##
##  fonts-core.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         fonts-core
Summary:      Microsoft Core Fonts for the Web
URL:          http://corefonts.sourceforge.net/
Vendor:       Microsoft
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Graphics
License:      Freely Available
Version:      20020815
Release:      20150525

#   list of sources
Source0:      fonts-core.conf
Source1:      fonts-core.txt
Source2:      http://downloads.sourceforge.net/corefonts/andale32.exe
Source3:      http://downloads.sourceforge.net/corefonts/arial32.exe
Source4:      http://downloads.sourceforge.net/corefonts/arialb32.exe
Source5:      http://downloads.sourceforge.net/corefonts/comic32.exe
Source6:      http://downloads.sourceforge.net/corefonts/courie32.exe
Source7:      http://downloads.sourceforge.net/corefonts/georgi32.exe
Source8:      http://downloads.sourceforge.net/corefonts/impact32.exe
Source9:      http://downloads.sourceforge.net/corefonts/times32.exe
Source10:     http://downloads.sourceforge.net/corefonts/trebuc32.exe
Source11:     http://downloads.sourceforge.net/corefonts/verdan32.exe
Source12:     http://downloads.sourceforge.net/corefonts/webdin32.exe
%NoSource     2
%NoSource     3
%NoSource     4
%NoSource     5
%NoSource     6
%NoSource     7
%NoSource     8
%NoSource     9
%NoSource     10
%NoSource     11
%NoSource     12

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, cabextract
PreReq:       OpenPKG, openpkg >= 20160101

%description
    This is Microsoft Core Fonts, a collection of TrueType
    core fonts for the web that was once freely available from
    http://www.microsoft.com/typography/fontpack/. They are now just
    shown under https://www.microsoft.com/typography/fonts/web.aspx

%track

%prep
    %setup -q -c -T

%build
    cabextract \
        %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} \
        %{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12}
    OIFS="$IFS"; IFS="
"
    for map in `cat %{SOURCE fonts-core.txt}`; do
        eval "mv $map"
    done
    IFS="$OIFS"

%install
    #   install fonts
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/share/fonts-core
    %{l_shtool} install -c -m 644 \
        *.ttf $RPM_BUILD_ROOT%{l_prefix}/share/fonts-core/

    #   provide license and manifest information
    %{l_shtool} install -c -m 644 \
        %{SOURCE fonts-core.txt} $RPM_BUILD_ROOT%{l_prefix}/share/fonts-core/MANIFEST.txt

    #   hook into fontconfig(1)
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/etc/fontconfig/conf.avail \
        $RPM_BUILD_ROOT%{l_prefix}/etc/fontconfig/conf.d
    %{l_shtool} install -c -m 644 %{l_value -s -a} \
        %{SOURCE fonts-core.conf} \
        $RPM_BUILD_ROOT%{l_prefix}/etc/fontconfig/conf.avail/
    ln -s ../conf.avail/fonts-core.conf \
        $RPM_BUILD_ROOT%{l_prefix}/etc/fontconfig/conf.d/99-fonts-core.conf

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

%post
    #   update fontconfig cache
    $RPM_INSTALL_PREFIX/bin/fc-cache -f 2>/dev/null || true
    exit 0

