##
##  perl-mail.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_mail_box                3.011
%define       V_mail_imapclient         3.43
%define       V_mail_mbox_messageparser 1.5111
%define       V_mail_mboxparser         0.55
%define       V_mail_sender             0.8.23
%define       V_mail_sendmail           0.79_16
%define       V_mailtools               2.22
%define       V_mime_base64             3.15
%define       V_mime_explode            0.39
%define       V_mime_lite               3.033
%define       V_mime_tools              5.500
%define       V_mime_types              2.28
%define       V_user_identity           1.02
%define       V_email_address           1.912
%define       V_email_valid             1.204
%define       V_email_simple            2.218
%define       V_email_messageid         1.408
%define       V_email_mime_contenttype  1.028
%define       V_email_mime_encodings    1.317
%define       V_email_mime              1.954
%define       V_email_mime_modifier     1.444
%define       V_email_mime_creator      1.456
%define       V_email_find              0.10

#   package information
Name:         perl-mail
Summary:      Perl Modules for use with email
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:      20250420

#   list of sources
Source0:      http://www.cpan.org/authors/id/M/MA/MARKOV/MailTools-%{V_mailtools}.tar.gz
Source1:      http://www.cpan.org/authors/id/D/DO/DONEILL/MIME-tools-%{V_mime_tools}.tar.gz
Source2:      http://www.cpan.org/authors/id/R/RJ/RJBS/MIME-Lite-%{V_mime_lite}.tar.gz
Source3:      http://www.cpan.org/authors/id/G/GA/GAAS/MIME-Base64-%{V_mime_base64}.tar.gz
Source4:      http://www.cpan.org/authors/id/H/HD/HDIAS/MIME-Explode-%{V_mime_explode}.tar.gz
Source5:      http://www.cpan.org/authors/id/M/MA/MARKOV/MIME-Types-%{V_mime_types}.tar.gz
Source6:      http://www.cpan.org/authors/id/M/MA/MARKOV/User-Identity-%{V_user_identity}.tar.gz
Source7:      http://www.cpan.org/authors/id/P/PL/PLOBBES/Mail-IMAPClient-%{V_mail_imapclient}.tar.gz
Source8:      http://www.cpan.org/authors/id/M/MA/MARKOV/Mail-Box-%{V_mail_box}.tar.gz
Source9:      http://www.cpan.org/authors/id/V/VP/VPARSEVAL/Mail-MboxParser-%{V_mail_mboxparser}.tar.gz
Source10:     http://www.cpan.org/authors/id/D/DC/DCOPPIT/Mail-Mbox-MessageParser-%{V_mail_mbox_messageparser}.tar.gz
Source11:     http://www.cpan.org/authors/id/M/MI/MIVKOVIC/Mail-Sendmail-%{V_mail_sendmail}.tar.gz
Source12:     http://www.cpan.org/authors/id/J/JE/JENDA/Mail-Sender-%{V_mail_sender}.tar.gz
Source13:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-Address-%{V_email_address}.tar.gz
Source14:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-Valid-%{V_email_valid}.tar.gz
Source15:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-Simple-%{V_email_simple}.tar.gz
Source16:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-MessageID-%{V_email_messageid}.tar.gz
Source17:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-MIME-ContentType-%{V_email_mime_contenttype}.tar.gz
Source18:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-MIME-Encodings-%{V_email_mime_encodings}.tar.gz
Source19:     http://www.cpan.org/authors/id/R/RJ/RJBS/Email-MIME-%{V_email_mime}.tar.gz
Source20:     http://www.cpan.org/modules/by-module/Email/Email-MIME-Modifier-%{V_email_mime_modifier}.tar.gz
Source21:     http://www.cpan.org/modules/by-module/Email/Email-MIME-Creator-%{V_email_mime_creator}.tar.gz
Source22:     http://www.cpan.org/authors/id/M/MI/MIYAGAWA/Email-Find-%{V_email_find}.tar.gz
Patch0:       perl-mail.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
PreReq:       OpenPKG, openpkg >= 20160101, perl >= %{V_perl}
BuildPreReq:  perl-ds, perl-util, perl-sys, perl-time, grep, diffutils, gzip, bzip2
PreReq:       perl-ds, perl-util, perl-sys, perl-time, grep, diffutils, gzip, bzip2

%description
    Perl modules for use with email:
    - MIME::Base64 (%{V_mime_base64})
    - MIME::Explode (%{V_mime_explode})
    - MIME::Lite (%{V_mime_lite})
    - MIME::Tools (%{V_mime_tools})
    - MIME::Types (%{V_mime_types})
    - Mail::Box (%{V_mail_box})
    - Mail::IMAPClient (%{V_mail_imapclient})
    - Mail::Mbox::MessageParser (%{V_mail_mbox_messageparser})
    - Mail::Mbox::MboxParser (%{V_mail_mboxparser})
    - Mail::Sender (%{V_mail_sender})
    - Mail::Sendmail (%{V_mail_sendmail})
    - Mail::Tools (%{V_mailtools})
    - User::Identity (%{V_user_identity})
    - Email::Address (%{V_email_address})
    - Email::Valid (%{V_email_valid})
    - Email::Simple (%{V_email_simple})
    - Email::MessageID (%{V_email_messageid})
    - Email::MIME::ContentType (%{V_email_mime_contenttype})
    - Email::MIME::Encodings (%{V_email_mime_encodings})
    - Email::MIME (%{V_email_mime})
    - Email::MIME::Modifier (%{V_email_mime_modifier})
    - Email::MIME::Creator (%{V_email_mime_creator})
    - Email::Find (%{V_email_find})

%track
    prog perl-mail:Mail-Box = {
        version   = %{V_mail_box}
        url       = http://www.cpan.org/authors/id/M/MA/MARKOV/
        regex     = Mail-Box-(__VER__)\.tar\.gz
    }
    prog perl-mail:Mail-IMAPClient = {
        version   = %{V_mail_imapclient}
        url       = http://www.cpan.org/authors/id/P/PL/PLOBBES/
        regex     = Mail-IMAPClient-(__VER__)\.tar\.gz
    }
    prog perl-mail:Mail-Mbox-MessageParser = {
        version   = %{V_mail_mbox_messageparser}
        url       = http://www.cpan.org/authors/id/D/DC/DCOPPIT/
        regex     = Mail-Mbox-MessageParser-(__VER__)\.tar\.gz
    }
    prog perl-mail:Mail-MboxParser = {
        version   = %{V_mail_mboxparser}
        url       = http://www.cpan.org/authors/id/V/VP/VPARSEVAL/
        regex     = Mail-MboxParser-(__VER__)\.tar\.gz
    }
    prog perl-mail:Mail-Sender = {
        version   = %{V_mail_sender}
        url       = http://www.cpan.org/authors/id/J/JE/JENDA/
        regex     = Mail-Sender-(__VER__)\.tar\.gz
    }
    prog perl-mail:Mail-Sendmail = {
        version   = %{V_mail_sendmail}
        url       = http://www.cpan.org/authors/id/M/MI/MIVKOVIC/
        regex     = Mail-Sendmail-(__VER__)\.tar\.gz
    }
    prog perl-mail:MailTools = {
        version   = %{V_mailtools}
        url       = http://www.cpan.org/authors/id/M/MA/MARKOV/
        regex     = MailTools-(\d+\.\d\d)\.tar\.gz
    }
    prog perl-mail:MIME-Base64 = {
        version   = %{V_mime_base64}
        url       = http://www.cpan.org/authors/id/G/GA/GAAS/
        regex     = MIME-Base64-(__VER__)\.tar\.gz
    }
    prog perl-mail:MIME-Explode = {
        version   = %{V_mime_explode}
        url       = http://www.cpan.org/authors/id/H/HD/HDIAS/
        regex     = MIME-Explode-(__VER__)\.tar\.gz
    }
    prog perl-mail:MIME-Lite = {
        version   = %{V_mime_lite}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = MIME-Lite-(__VER__)\.tar\.gz
    }
    prog perl-mail:MIME-tools = {
        version   = %{V_mime_tools}
        url       = http://www.cpan.org/authors/id/D/DO/DONEILL/
        regex     = MIME-tools-(\d+\.\d+)\.tar\.gz
    }
    prog perl-mail:MIME-Types = {
        version   = %{V_mime_types}
        url       = http://www.cpan.org/authors/id/M/MA/MARKOV/
        regex     = MIME-Types-(__VER__)\.tar\.gz
    }
    prog perl-mail:User-Identity = {
        version   = %{V_user_identity}
        url       = http://www.cpan.org/authors/id/M/MA/MARKOV/
        regex     = User-Identity-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-Address = {
        version   = %{V_email_address}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-Address-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-Valid = {
        version   = %{V_email_valid}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-Valid-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-Simple = {
        version   = %{V_email_simple}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-Simple-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MessageID = {
        version   = %{V_email_messageid}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-MessageID-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MIME-ContentType = {
        version   = %{V_email_mime_contenttype}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-MIME-ContentType-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MIME-Encodings = {
        version   = %{V_email_mime_encodings}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-MIME-Encodings-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MIME = {
        version   = %{V_email_mime}
        url       = http://www.cpan.org/authors/id/R/RJ/RJBS/
        regex     = Email-MIME-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MIME-Modifier = {
        version   = %{V_email_mime_modifier}
        url       = http://www.cpan.org/modules/by-module/Email/
        regex     = Email-MIME-Modifier-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-MIME-Creator = {
        version   = %{V_email_mime_creator}
        url       = http://www.cpan.org/modules/by-module/Email/
        regex     = Email-MIME-Creator-(__VER__)\.tar\.gz
    }
    prog perl-mail:Email-Find = {
        version   = %{V_email_find}
        url       = http://www.cpan.org/authors/id/M/MI/MIYAGAWA/
        regex     = Email-Find-(__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
    %setup -q -T -D -a 18
    %setup -q -T -D -a 19
    %setup -q -T -D -a 20
    %setup -q -T -D -a 21
    %setup -q -T -D -a 22
    %patch -p0
    %{l_shtool} subst \
        -e 's;/usr/lib/sendmail;%{l_prefix}/sbin/sendmail;' \
        MIME-Lite-*/lib/MIME/Lite.pm

%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 -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 -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 </dev/null
    %{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 -d %{SOURCE19} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE20} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE21} configure build install
    %{l_prefix}/bin/perl-openpkg -d %{SOURCE22} 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

