##
##  perl-font.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.
##

#   versions of individual parts
%define       V_perl                    5.22
%define       V_font_ttf                1.05
%define       V_font_ttf_scripts        1.05
%define       V_font_afm                1.20
%define       V_font_tfm                1.01
%define       V_font_freetype           0.010_1
%define       V_font_glyphnames         1.00000

#   package information
Name:         perl-font
Summary:      Perl Modules for use with Fonts
URL:          http://www.cpan.org/
Vendor:       Perl Community
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        BASE
Group:        Perl
License:      GPL/Artistic
Version:      %{V_perl}
Release:      20180317

#   list of sources
Source0:      http://www.cpan.org/authors/id/M/MH/MHOSKEN/Font-TTF-%{V_font_ttf}.tar.gz
Source1:      http://www.cpan.org/authors/id/M/MH/MHOSKEN/Font-TTF-Scripts-%{V_font_ttf_scripts}.tar.gz
Source2:      http://www.cpan.org/authors/id/G/GA/GAAS/Font-AFM-%{V_font_afm}.tar.gz
Source3:      http://www.cpan.org/authors/id/J/JA/JANPAZ/Font-TFM-%{V_font_tfm}.tar.gz
Source4:      http://www.cpan.org/authors/id/D/DM/DMOL/Font-FreeType-%{V_font_freetype}.tar.gz
Source5:      http://www.cpan.org/authors/id/S/SP/SPROUT/Font-GlyphNames-%{V_font_glyphnames}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
PreReq:       OpenPKG, openpkg >= 20160101, perl >= %{V_perl}
BuildPreReq:  perl-module, perl-sys, freetype
PreReq:       perl-module, perl-sys, freetype

%description
    Perl modules for use with Fonts:
    - Font::TTF (%{V_font_ttf})
    - Font::TTF::Scripts (%{V_font_ttf_scripts})
    - Font::AFM (%{V_font_afm})
    - Font::TFM (%{V_font_tfm})
    - Font::FreeType (%{V_font_freetype})
    - Font::Glyphnames (%{V_font_glyphnames})

%track
    prog perl-font:Font-TTF = {
        version   = %{V_font_ttf}
        url       = http://www.cpan.org/authors/id/M/MH/MHOSKEN/
        regex     = Font-TTF-(__VER__)\.tar\.gz
    }
    prog perl-font:Font-TTF-Scripts = {
        version   = %{V_font_ttf_scripts}
        url       = http://www.cpan.org/authors/id/M/MH/MHOSKEN/
        regex     = Font-TTF-scripts-(__VER__)\.tar\.gz
    }
    prog perl-font:Font-AFM = {
        version   = %{V_font_afm}
        url       = http://www.cpan.org/authors/id/G/GA/GAAS/
        regex     = Font-AFM-(__VER__)\.tar\.gz
    }
    prog perl-font:Font-TFM = {
        version   = %{V_font_tfm}
        url       = http://www.cpan.org/authors/id/J/JA/JANPAZ/
        regex     = Font-TFM-(__VER__)\.tar\.gz
    }
    prog perl-font:Font-FreeType = {
        version   = %{V_font_freetype}
        url       = http://www.cpan.org/authors/id/D/DM/DMOL/
        regex     = Font-FreeType-(__VER__)\.tar\.gz
    }
    prog perl-font:Font-Glyphnames = {
        version   = %{V_font_glyphnames}
        url       = http://www.cpan.org/modules/by-module/Font/
        regex     = Font-Glyphnames-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1
    %setup -q -T -D -a 2
    %setup -q -T -D -a 3
    %setup -q -T -D -a 4
    %setup -q -T -D -a 5
    %{l_shtool} subst \
        -e 's;\(-lfreetype\);%{l_ldflags} \1;' \
        -e 's;-I/usr/include/freetype2;%{l_cppflags freetype .};' \
        Font-FreeType-%{V_font_freetype}/Makefile.PL
    %{l_shtool} subst \
        -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
        Font-TTF-scripts/scripts/*

%build

%install
    %{l_prefix}/bin/perl-openpkg prepare
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE0} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE1} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE2} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE3} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE4} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE5} configure build install
    %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
    mv  $RPM_BUILD_ROOT%{l_prefix}/bin/ttf2woff \
        $RPM_BUILD_ROOT%{l_prefix}/bin/ttf-to-woff
    mv  $RPM_BUILD_ROOT%{l_prefix}/man/man1/ttf2woff.1 \
        $RPM_BUILD_ROOT%{l_prefix}/man/man1/ttf-to-woff.1
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`

%files -f files

%clean

