##
##  perl-gd.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_gd             2.53
%define       V_gdtextutil     0.86
%define       V_gdbarcode      1.15
%define       V_gdgraph        1.44
%define       V_gdgraph3d      0.56
%define       V_gdgraphmap     1.05
%define       V_chart          2.4.10
%define       V_chartthreed    0.01
%define       V_chartplot      0.11
%define       V_imagetimeline  0.11

#   package information
Name:         perl-gd
Summary:      Perl Modules for use with GD
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:      20150603

#   list of sources
Source0:      http://www.cpan.org/authors/id/L/LD/LDS/GD-%{V_gd}.tar.gz
Source1:      http://www.cpan.org/authors/id/M/MV/MVERB/GDTextUtil-%{V_gdtextutil}.tar.gz
Source2:      http://www.cpan.org/authors/id/K/KW/KWITKNR/GD-Barcode-%{V_gdbarcode}.tar.gz
Source3:      http://www.cpan.org/authors/id/B/BW/BWARFIELD/GDGraph-%{V_gdgraph}.tar.gz
Source4:      http://www.cpan.org/modules/by-module/GD/GDGraph3d-%{V_gdgraph3d}.tar.gz
Source5:      http://www.cpan.org/modules/by-module/GD/GDGraph-Map-%{V_gdgraphmap}.tgz
Source6:      http://www.cpan.org/authors/id/C/CH/CHARTGRP/Chart-%{V_chart}.tar.gz
Source7:      http://www.cpan.org/authors/id/F/FT/FTASSIN/Chart-ThreeD-%{V_chartthreed}.tar.gz
Source8:      http://www.cpan.org/authors/id/S/SM/SMORTON/Chart-Plot-%{V_chartplot}.tar.gz
Source9:      http://www.cpan.org/authors/id/K/KW/KWILLIAMS/Image-Timeline-%{V_imagetimeline}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
PreReq:       OpenPKG, openpkg >= 20160101, perl >= %{V_perl}
BuildPreReq:  gd >= 2.0.33
PreReq:       gd >= 2.0.33

%description
    Various modules for using the GD library from within the Perl
    language plus additional functionality for drawing various types of
    charts and graphs.
    - GD (%{V_gd})
    - GD::TextUtil (%{V_gdtextutil})
    - GD::Barcode (%{V_gdbarcode})
    - GD::Graph (%{V_gdgraph})
    - GD::Graph::3d (%{V_gdgraph3d})
    - GD::Graph::Map (%{V_gdgraphmap})
    - Chart (%{V_chart})
    - Chart::ThreeD (%{V_chartthreed})
    - Chart::Plot (%{V_chartplot})
    - Image::Timeline (%{V_imagetimeline})

%track
    prog perl-gd:Chart = {
        version   = %{V_chart}
        url       = http://www.cpan.org/authors/id/C/CH/CHARTGRP/
        regex     = Chart-(__VER__)\.tar\.gz
    }
    prog perl-gd:Chart-Plot = {
        version   = %{V_chartplot}
        url       = http://www.cpan.org/authors/id/S/SM/SMORTON/
        regex     = Chart-Plot-(__VER__)\.tar\.gz
    }
    prog perl-gd:Chart-ThreeD = {
        version   = %{V_chartthreed}
        url       = http://www.cpan.org/authors/id/F/FT/FTASSIN/
        regex     = Chart-ThreeD-(__VER__)\.tar\.gz
    }
    prog perl-gd:GD = {
        version   = %{V_gd}
        url       = http://www.cpan.org/authors/id/L/LD/LDS/
        regex     = GD-(__VER__)\.tar\.gz
    }
    prog perl-gd:GD-Barcode = {
        version   = %{V_gdbarcode}
        url       = http://www.cpan.org/authors/id/K/KW/KWITKNR/
        regex     = GD-Barcode-(__VER__)\.tar\.gz
    }
    prog perl-gd:GDGraph = {
        version   = %{V_gdgraph}
        url       = http://www.cpan.org/authors/id/B/BW/BWARFIELD/
        regex     = GDGraph-(__VER__)\.tar\.gz
    }
    prog perl-gd:GDGraph-Map = {
        version   = %{V_gdgraphmap}
        url       = http://www.cpan.org/modules/by-module/GD/
        regex     = GDGraph-Map-(__VER__)\.tgz
    }
    prog perl-gd:GDGraph3d = {
        version   = %{V_gdgraph3d}
        url       = http://www.cpan.org/modules/by-module/GD/
        regex     = GDGraph3d-(__VER__)\.tar\.gz
    }
    prog perl-gd:GDTextUtil = {
        version   = %{V_gdtextutil}
        url       = http://www.cpan.org/authors/id/M/MV/MVERB/
        regex     = GDTextUtil-(__VER__)\.tar\.gz
    }
    prog perl-gd:Image-Timeline = {
        version   = %{V_imagetimeline}
        url       = http://www.cpan.org/authors/id/K/KW/KWILLIAMS/
        regex     = Image-Timeline-(__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
    %setup -q -T -D -a 6
    %setup -q -T -D -a 7
    %setup -q -T -D -a 8
    %setup -q -T -D -a 9

%build

%install
    %{l_prefix}/bin/perl-openpkg prepare
    ( cd GD-%{V_gd}
      %{l_shtool} subst \
          -e 's/\(@INC     = qw(\).*\();\)/\1\2/' \
          -e 's/\(@LIBPATH = qw(\).*\();\)/\1\2/' \
          Makefile.PL
      %{l_prefix}/bin/perl-openpkg \
          -A '-options       GIF,ANIMGIF,PNG,JPEG,FT' \
          -A '-lib_gd_path   %{l_prefix}' \
          -A '-lib_png_path  %{l_prefix}' \
          -A '-lib_zlib_path %{l_prefix}' \
          -A '-lib_jpeg_path %{l_prefix}' \
          -A '-lib_ft_path   %{l_prefix}' \
          configure build install
    ) || exit $?
    %{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 -d %{SOURCE6}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE7}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE8}  configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE9}  configure build install
    %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`

%files -f files

%clean

