##
##  perl-xml.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
##
##  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_xml_parser           2.31
%define       V_xml_libxml_common    0.12_1
%define       V_xml_libxml           1.54_3
%define       V_xml_libxslt          1.52
%define       V_xml_regexp           0.03
%define       V_xml_dom              1.42
%define       V_xml_simple           2.02
%define       V_xml_namespacesupport 1.08
%define       V_xml_sax              0.12
%define       V_xml_sax_base         1.02
%define       V_xml_sax_expat        0.35
%define       V_xml_xslt             0.40
%define       V_xml_twig             3.09
%define       V_xml_xpath            1.12
%define       V_xml_xpath_simple     0.05
%define       V_xml_easyobj          1.12
%define       V_xml_rss              0.97
%define       V_xml_xupdate_libxml   0.3.0
%define       V_html_tagset          3.03
%define       V_html_parser          3.26
%define       V_html_tree            3.16
%define       V_rpc_xml              0.46
%define       V_soap_lite            0.55
%define       V_soap_lite_smartproxy 0.11
%define       V_soap_payload         1.02
%define       V_xml_xsh              1.6
%define       V_xml_gdome            0.82

#   package information
Name:         perl-xml
Summary:      Perl Modules for use with XML
URL:          http://www.cpan.org/
Vendor:       Perl Community
Packager:     The OpenPKG Project
Distribution: OpenPKG [BASE]
Group:        Language
License:      GPL/Artistic
Version:      20030103
Release:      20030103

#   package options
%option       with_libxml            %{l_test -p libxml}
%option       with_libxslt           %{l_test -p libxslt}
%option       with_libgdome          %{l_test -p libgdome}

#   package option dependencies
%if "%{with_libxslt}" == "yes"
%undefine     with_libxml
%define       with_libxml            yes
%endif
%if "%{with_libgdome}" == "yes"
%undefine     with_libxml
%define       with_libxml            yes
%endif

#   list of sources
Source0:      http://www.cpan.org/modules/by-module/XML/XML-Parser-%{V_xml_parser}.tar.gz
Source1:      http://www.cpan.org/modules/by-module/XML/XML-RegExp-%{V_xml_regexp}.tar.gz
Source2:      http://www.cpan.org/modules/by-module/XML/XML-DOM-%{V_xml_dom}.tar.gz
Source3:      http://www.cpan.org/modules/by-module/XML/XML-Simple-%{V_xml_simple}.tar.gz
Source4:      http://www.cpan.org/modules/by-module/XML/XML-NamespaceSupport-%{V_xml_namespacesupport}.tar.gz
Source5:      http://www.cpan.org/modules/by-module/XML/XML-SAX-%{V_xml_sax}.tar.gz
Source6:      http://www.cpan.org/modules/by-module/XML/XML-SAX-Base-%{V_xml_sax_base}.tar.gz
Source7:      http://www.cpan.org/modules/by-module/XML/XML-SAX-Expat-%{V_xml_sax_expat}.tar.gz
Source8:      http://www.cpan.org/modules/by-module/XML/XML-XSLT-%{V_xml_xslt}.tar.gz
Source9:      http://www.cpan.org/modules/by-module/XML/XML-Twig-%{V_xml_twig}.tar.gz
Source10:     http://www.cpan.org/modules/by-module/XML/XML-XPath-%{V_xml_xpath}.tar.gz
Source11:     http://www.cpan.org/modules/by-module/XML/XML-XPath-Simple-%{V_xml_xpath_simple}.tar.gz
Source12:     http://www.cpan.org/modules/by-module/XML/XML-EasyOBJ-%{V_xml_easyobj}.tar.gz
Source13:     http://www.cpan.org/modules/by-module/XML/XML-RSS-%{V_xml_rss}.tar.gz
Source14:     http://www.cpan.org/modules/by-module/XML/XML-XUpdate-LibXML-%{V_xml_xupdate_libxml}.tar.gz
Source15:     http://www.cpan.org/modules/by-module/HTML/HTML-Tagset-%{V_html_tagset}.tar.gz
Source16:     http://www.cpan.org/modules/by-module/HTML/HTML-Parser-%{V_html_parser}.tar.gz
Source17:     http://www.cpan.org/modules/by-module/HTML/HTML-Tree-%{V_html_tree}.tar.gz
Source18:     http://www.cpan.org/modules/by-module/SOAP/SOAP-Lite-%{V_soap_lite}.tar.gz
Source19:     http://www.cpan.org/modules/by-module/SOAP/SOAP-Lite-SmartProxy-%{V_soap_lite_smartproxy}.tar.gz
Source20:     http://www.cpan.org/modules/by-module/SOAP/SOAP-payload-%{V_soap_payload}.tar.gz
Source21:     http://www.cpan.org/modules/by-module/RPC/RPC-XML-%{V_rpc_xml}.tar.gz
Source22:     http://www.cpan.org/authors/id/P/PH/PHISH/XML-LibXML-Common-%{V_xml_libxml_common}.tar.gz
Source23:     http://www.cpan.org/authors/id/P/PH/PHISH/XML-LibXML-%{V_xml_libxml}.tar.gz
Source24:     http://osdn.dl.sourceforge.net/sourceforge/xsh/XML-XSH-%{V_xml_xsh}.tar.gz
Source25:     http://www.cpan.org/authors/id/M/MS/MSERGEANT/XML-LibXSLT-%{V_xml_libxslt}.tar.gz
Source26:     http://www.cpan.org/modules/by-module/XML/XML-GDOME-%{V_xml_gdome}.tar.gz

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20030103, perl >= 5.8.0, expat
PreReq:       OpenPKG, openpkg >= 20030103, perl >= 5.8.0
%if "%{with_libxml}" == "yes"
BuildPreReq:  libxml
%endif
%if "%{with_libxslt}" == "yes"
BuildPreReq:  libxslt
%endif
%if "%{with_libgdome}" == "yes"
BuildPreReq:  libgdome
%endif
AutoReq:      no
AutoReqProv:  no

%description
    Perl modules for use with XML:
    - XML::Parser (%{V_xml_parser})
%if "%{with_libxml}" == "yes"
    - XML::LibXML::Common (%{V_xml_libxml_common})
    - XML::LibXML (%{V_xml_libxml})
    - XML::XUpdate::LibXML (%{V_xml_xupdate_libxml})
    - XML::XSH (%{V_xml_xsh})
%endif
%if "%{with_libxslt}" == "yes"
    - XML::LibXSLT (%{V_xml_libxslt})
%endif
%if "%{with_libgdome}" == "yes"
    - XML::GDOME (%{V_xml_gdome})
%endif
    - XML::RegExp (%{V_xml_regexp})
    - XML::DOM (%{V_xml_dom})
    - XML::Simple (%{V_xml_simple})
    - XML::NamespaceSupport (%{V_xml_namespacesupport})
    - XML::SAX (%{V_xml_sax})
    - XML::SAX::Base (%{V_xml_sax_base})
    - XML::SAX::Expat (%{V_xml_sax_expat})
    - XML::XSLT (%{V_xml_xslt})
    - XML::Twig (%{V_xml_twig})
    - XML::XPath (%{V_xml_xpath})
    - XML::XPath::Simple (%{V_xml_xpath_simple})
    - XML::EasyOBJ (%{V_xml_easyobj})
    - XML::RSS (%{V_xml_rss})
    - HTML::Tagset (%{V_html_tagset})
    - HTML::Parser (%{V_html_parser})
    - HTML::Tree (%{V_html_tree})
    - RPC::XML (%{V_rpc_xml})
    - SOAP::Lite (%{V_soap_lite})
    - SOAP::Lite::SmartProxy (%{V_soap_lite_smartproxy})
    - SOAP::payload (%{V_soap_payload})

%prep
    %setup0  -q -c
    %setup1  -q -T -D -a 1
    %setup2  -q -T -D -a 2
    %setup3  -q -T -D -a 3
    %setup4  -q -T -D -a 4
    %setup5  -q -T -D -a 5
    %setup6  -q -T -D -a 6
    %setup7  -q -T -D -a 7
    %setup8  -q -T -D -a 8
    %setup9  -q -T -D -a 9
    %setup10 -q -T -D -a 10
    %setup11 -q -T -D -a 11
    %setup12 -q -T -D -a 12
    %setup13 -q -T -D -a 13
    %setup14 -q -T -D -a 14
    %setup15 -q -T -D -a 15
    %setup16 -q -T -D -a 16
    %setup17 -q -T -D -a 17
    %setup18 -q -T -D -a 18
    %setup19 -q -T -D -a 19
    %setup20 -q -T -D -a 20
    %setup21 -q -T -D -a 21
    %setup22 -q -T -D -a 22
    %setup23 -q -T -D -a 23
    %setup24 -q -T -D -a 24
    %setup25 -q -T -D -a 25
    %setup26 -q -T -D -a 26

%build

%install
    #   perform common prolog operations
    %{l_prefix}/bin/perl-openpkg prolog

    #   build and install individual modules
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE0} \
          EXPATLIBPATH=%{l_prefix}/lib EXPATINCPATH=%{l_prefix}/include
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE1}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE2}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE3}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE4}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE5}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE6}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE7}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE8}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE9}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE10}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE11}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE12}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE13}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE14}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE15}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE16}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE17}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE18}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE19}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE20}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE21}
%if "%{with_libxml}" == "yes"
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE22} XMLPREFIX=%{l_prefix}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE23} XMLPREFIX=%{l_prefix}
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE24}
%endif
%if "%{with_libxslt}" == "yes"
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE25} XMLPREFIX=%{l_prefix}
%endif
%if "%{with_libgdome}" == "yes"
    %{l_prefix}/bin/perl-openpkg install -d %{SOURCE26}
%endif

    #   pre-activate the XML::SAX parsers
    eval `%{l_prefix}/bin/perl -V:installsitelib`
    ( echo "[XML::SAX::PurePerl]"
      echo "http://xml.org/sax/features/namespaces = 1"
      echo "http://xml.org/sax/features/validation = 0"
      echo ""
      echo "[XML::SAX::Expat]"
      echo "http://xml.org/sax/features/namespaces = 1"
      echo "http://xml.org/sax/features/validation = 0"
    ) >$RPM_BUILD_ROOT$installsitelib/XML/SAX/ParserDetails.ini

    #   perform common epilog operations
    %{l_prefix}/bin/perl-openpkg epilog

%files -f files

%clean
    rm -rf $RPM_BUILD_ROOT

