##
##  perl-regex.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_re_engine_plugin         0.05
%define       V_re_engine_posix          0.05
%define       V_re_engine_pcre           0.17
%define       V_re_engine_tre            0.04
%define       V_re_engine_plan9          0.16
%define       V_re_engine_lua            0.19
%define       V_re_engine_onig           0.04
%define       V_re_engine_re2            0.18
%define       V_regexp_bind              0.05
%define       V_regexp_common            2024080801
%define       V_regexp_copy              0.06
%define       V_regexp_extended          0.01
%define       V_regexp_keep              0.02
%define       V_regexp_parser            0.20
%define       V_regexp_shellish          0.93
%define       V_regexp_assemble          0.35
%define       V_regexp_wildcards         1.05
%define       V_regexp_compare           0.35
%define       V_regexp_english           1.01
%define       V_regexp_grammars          1.058

#   package information
Name:         perl-regex
Summary:      Perl Modules for Regular Expression Management
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:      20250106

#   package options
%option       with_posix  no
%option       with_pcre   no
%option       with_tre    no
%option       with_plan9  no
%option       with_lua    no
%option       with_onig   no
%option       with_re2    no

#   list of sources
Source0:      http://www.cpan.org/authors/id/A/AV/AVAR/re-engine-POSIX-%{V_re_engine_posix}.tar.gz
Source1:      http://www.cpan.org/authors/id/A/AV/AVAR/re-engine-PCRE-%{V_re_engine_pcre}.tar.gz
Source2:      http://www.cpan.org/authors/id/A/AV/AVAR/re-engine-TRE-%{V_re_engine_tre}.tar.gz
Source3:      http://www.cpan.org/authors/id/A/AV/AVAR/re-engine-Plan9-%{V_re_engine_plan9}.tar.gz
Source4:      http://www.cpan.org/authors/id/P/PE/PERRAD/re-engine-Lua-%{V_re_engine_lua}.tar.gz
Source5:      http://www.cpan.org/authors/id/A/AN/ANDYA/re-engine-Oniguruma-%{V_re_engine_onig}.tar.gz
Source6:      http://www.cpan.org/authors/id/D/DG/DGL/re-engine-RE2-%{V_re_engine_re2}.tar.gz
Source7:      http://www.cpan.org/authors/id/X/XE/XERN/Regexp-Bind-%{V_regexp_bind}.tar.gz
Source8:      http://www.cpan.org/authors/id/A/AB/ABIGAIL/Regexp-Common-%{V_regexp_common}.tar.gz
Source9:      http://www.cpan.org/authors/id/J/JD/JDUNCAN/Regexp-Copy-%{V_regexp_copy}.tar.gz
Source10:     http://www.cpan.org/authors/id/C/CR/CRUNCHIE/Regexp-Extended-%{V_regexp_extended}.tar.gz
Source11:     http://www.cpan.org/authors/id/P/PI/PINYAN/Regexp-Keep-%{V_regexp_keep}.tar.gz
Source12:     http://www.cpan.org/authors/id/P/PI/PINYAN/Regexp-Parser-%{V_regexp_parser}.tar.gz
Source13:     http://www.cpan.org/authors/id/R/RB/RBS/Regexp-Shellish-%{V_regexp_shellish}.tar.gz
Source14:     http://www.cpan.org/authors/id/D/DL/DLAND/Regexp-Assemble-%{V_regexp_assemble}.tar.gz
Source15:     http://www.cpan.org/authors/id/V/VP/VPIT/Regexp-Wildcards-%{V_regexp_wildcards}.tar.gz
Source16:     http://www.cpan.org/authors/id/V/VB/VBAR/Regexp-Compare-%{V_regexp_compare}.tar.gz
Source17:     http://www.cpan.org/authors/id/C/CH/CHROMATIC/Regexp-English-%{V_regexp_english}.tar.gz
Source18:     http://www.cpan.org/authors/id/D/DC/DCONWAY/Regexp-Grammars-%{V_regexp_grammars}.tar.gz
Patch0:       perl-regex.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
PreReq:       OpenPKG, openpkg >= 20160101, perl >= %{V_perl}
BuildPreReq:  perl-module
PreReq:       perl-module
%if "%{with_pcre}" == "yes"
BuildPreReq:  pcre
PreReq:       pcre
%endif
%if "%{with_tre}" == "yes"
BuildPreReq:  tre, pkgconfig
PreReq:       tre, pkgconfig
%endif

%description
    Perl modules for regular expression management:
    - re::engine::POSIX (%{V_re_engine_posix}) [with_posix=yes]
    - re::engine::PCRE (%{V_re_engine_pcre}) [with_pcre=yes]
    - re::engine::TRE (%{V_re_engine_tre}) [with_tre=yes]
    - re::engine::Plan9 (%{V_re_engine_plan9}) [with_plan9=yes]
    - re::engine::Lua (%{V_re_engine_lua}) [with_lua=yes]
    - re::engine::Oniguruma (%{V_re_engine_onig}) [with_onig=yes]
    - re::engine::RE2 (%{V_re_engine_re2}) [with_re2=yes]
    - Regexp::Bind (%{V_regexp_bind})
    - Regexp::Common (%{V_regexp_common})
    - Regexp::Copy (%{V_regexp_copy})
    - Regexp::Extended (%{V_regexp_extended})
    - Regexp::Keep (%{V_regexp_keep})
    - Regexp::Parser (%{V_regexp_parser})
    - Regexp::Shellish (%{V_regexp_shellish})
    - Regexp::Assemble (%{V_regexp_assemble})
    - Regexp::Wildcards (%{V_regexp_wildcards})
    - Regexp::Compare (%{V_regexp_compare})
    - Regexp::English (%{V_regexp_english})
    - Regexp::Grammars (%{V_regexp_grammars})

%track
    prog perl-regex:re-engine-POSIX = {
        version   = %{V_re_engine_posix}
        url       = http://www.cpan.org/authors/id/A/AV/AVAR/
        regex     = re-engine-POSIX-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-PCRE = {
        version   = %{V_re_engine_pcre}
        url       = http://www.cpan.org/authors/id/A/AV/AVAR/
        regex     = re-engine-PCRE-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-TRE = {
        version   = %{V_re_engine_tre}
        url       = http://www.cpan.org/authors/id/A/AV/AVAR/
        regex     = re-engine-TRE-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-Plan9 = {
        version   = %{V_re_engine_plan9}
        url       = http://www.cpan.org/authors/id/A/AV/AVAR/
        regex     = re-engine-Plan9-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-Lua = {
        version   = %{V_re_engine_lua}
        url       = http://www.cpan.org/authors/id/P/PE/PERRAD/
        regex     = re-engine-Lua-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-Oniguruma = {
        version   = %{V_re_engine_onig}
        url       = http://www.cpan.org/authors/id/A/AN/ANDYA/
        regex     = re-engine-Oniguruma-(__VER__)\.tar\.gz
    }
    prog perl-regex:re-engine-RE2 = {
        version   = %{V_re_engine_re2}
        url       = http://www.cpan.org/authors/id/D/DG/DGL/
        regex     = re-engine-RE2-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Bind = {
        version   = %{V_regexp_bind}
        url       = http://www.cpan.org/authors/id/X/XE/XERN/
        regex     = Regexp-Bind-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Common = {
        version   = %{V_regexp_common}
        url       = http://www.cpan.org/authors/id/A/AB/ABIGAIL/
        regex     = Regexp-Common-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Copy = {
        version   = %{V_regexp_copy}
        url       = http://www.cpan.org/authors/id/J/JD/JDUNCAN/
        regex     = Regexp-Copy-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Extended = {
        version   = %{V_regexp_extended}
        url       = http://www.cpan.org/authors/id/C/CR/CRUNCHIE/
        regex     = Regexp-Extended-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Keep = {
        version   = %{V_regexp_keep}
        url       = http://www.cpan.org/authors/id/P/PI/PINYAN/
        regex     = Regexp-Keep-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Parser = {
        version   = %{V_regexp_parser}
        url       = http://www.cpan.org/authors/id/P/PI/PINYAN/
        regex     = Regexp-Parser-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Shellish = {
        version   = %{V_regexp_shellish}
        url       = http://www.cpan.org/authors/id/R/RB/RBS/
        regex     = Regexp-Shellish-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Assemble = {
        version   = %{V_regexp_assemble}
        url       = http://www.cpan.org/authors/id/D/DL/DLAND/
        regex     = Regexp-Assemble-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Wildcards = {
        version   = %{V_regexp_wildcards}
        url       = http://www.cpan.org/authors/id/V/VP/VPIT/
        regex     = Regexp-Wildcards-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Compare = {
        version   = %{V_regexp_compare}
        url       = http://www.cpan.org/authors/id/V/VB/VBAR/
        regex     = Regexp-Compare-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-English = {
        version   = %{V_regexp_english}
        url       = http://www.cpan.org/authors/id/C/CH/CHROMATIC/
        regex     = Regexp-English-(__VER__)\.tar\.gz
    }
    prog perl-regex:Regexp-Grammars = {
        version   = %{V_regexp_grammars}
        url       = http://www.cpan.org/authors/id/D/DC/DCONWAY/
        regex     = Regexp-Grammars-(__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
    %setup -q -T -D -a 10
    %setup -q -T -D -a 11
    %setup -q -T -D -a 12
    %setup -q -T -D -a 13
    %setup -q -T -D -a 14
    %setup -q -T -D -a 15
    %setup -q -T -D -a 16
    %setup -q -T -D -a 17
    %patch -p0

%build

%install
    %{l_prefix}/bin/perl-openpkg prepare
%if "%{with_posix}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE0}  configure build install
%endif
%if "%{with_pcre}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE1}  configure build install
%endif
%if "%{with_tre}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE2}  configure build install
%endif
%if "%{with_plan9}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE3}  configure build install
%endif
%if "%{with_lua}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE4}  configure build install
%endif
%if "%{with_onig}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE5}  configure build install
%endif
%if "%{with_re2}" == "yes"
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE6}  configure build install
%endif
    %{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 -d %{SOURCE10} configure build install
    #   %{l_prefix}/bin/perl-openpkg -d %{SOURCE11} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE12} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE13} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE14} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE15} configure build install
    #   %{l_prefix}/bin/perl-openpkg -d %{SOURCE16} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE17} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE18} 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

