##
##  soapjr.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.
##

#   package version
%define       V_javascript  1.3.0
%define       V_perl        1.1.4

#   package information
Name:         soapjr
Summary:      SOAP Junior
URL:          http://soapjr.org/
Vendor:       Rob Manson et al.
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Web
License:      GPL
Version:      %{V_javascript}
Release:      20090326

#   list of sources
Source0:      http://download.openpkg.org/components/versioned/soapjr/soapjr-%{V_javascript}.tar.gz
Source1:      http://www.cpan.org/authors/id/R/RO/ROBMAN/SOAPjr-%{V_perl}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, perl-openpkg
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  json, perl
PreReq:       json, perl

%description
    SOAPjr (SOAP Junior) gets the benefits of SOAP without the bloat and
    use JSON instead of XML.

%track
    prog soapjr:javascript = {
        version   = %{V_javascript}
        url       = http://download.openpkg.org/components/versioned/soapjr/
        regex     = soapjr-(__VER__)\.tar\.gz
    }
    prog soapjr:perl = {
        version   = %{V_perl}
        url       = http://www.cpan.org/authors/id/R/RO/ROBMAN/
        regex     = SOAPjr-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1

%build

%install

    #   install SOAPjr/JavaScript
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/share/soapjr
    %{l_shtool} install -c -m 644 \
        soapjr/jquery-*.min.js \
        $RPM_BUILD_ROOT%{l_prefix}/share/soapjr/jquery.js
    %{l_shtool} install -c -m 644 \
        soapjr/jquery.SOAPjr.*.txt \
        $RPM_BUILD_ROOT%{l_prefix}/share/soapjr/jquery.soapjr.js
    %{l_shtool} install -c -m 644 \
        soapjr/json2.js \
        $RPM_BUILD_ROOT%{l_prefix}/share/soapjr/json.js
    %{l_shtool} install -c -m 644 \
        soapjr/jsonschema-*.js \
        $RPM_BUILD_ROOT%{l_prefix}/share/soapjr/jsonschema.js

    #   install SOAPjr/Perl
    %{l_prefix}/bin/perl-openpkg prepare
    %{l_prefix}/bin/perl-openpkg -d SOAPjr-%{V_perl} configure build install
    %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`

%files -f files

%clean

