##
##  commons.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_beanutils     1.11.0
%define       V_cli           1.10.0
%define       V_collections   3.2.2
%define       V_configuration 1.6
%define       V_httpclient    3.1
%define       V_io            2.20.0
%define       V_lang          2.6
%define       V_launcher      1.1
%define       V_logging       1.3.5
%define       V_net           3.1

#   package information
Name:         commons
Summary:      Apache Java Commons Libraries
URL:          http://commons.apache.org/
Vendor:       Apache Software Foundation
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Libraries
License:      Apache
Version:      0
Release:      20250803

#   list of sources
Source0:      http://www.apache.org/dist/commons/beanutils/binaries/commons-beanutils-%{V_beanutils}-bin.tar.gz
Source1:      http://www.apache.org/dist/commons/cli/binaries/commons-cli-%{V_cli}-bin.tar.gz
Source2:      http://www.apache.org/dist/commons/collections/binaries/commons-collections-%{V_collections}-bin.tar.gz
Source3:      http://www.apache.org/dist/commons/configuration/binaries/commons-configuration-%{V_configuration}.tar.gz
Source4:      http://www.apache.org/dist/httpcomponents/commons-httpclient/binary/commons-httpclient-%{V_httpclient}.tar.gz
Source5:      http://www.apache.org/dist/commons/io/binaries/commons-io-%{V_io}-bin.tar.gz
Source6:      http://www.apache.org/dist/commons/lang/binaries/commons-lang-%{V_lang}-bin.tar.gz
Source7:      http://www.apache.org/dist/commons/launcher/binaries/commons-launcher-%{V_launcher}.tar.gz
Source8:      http://www.apache.org/dist/commons/logging/binaries/commons-logging-%{V_logging}-bin.tar.gz
Source9:      http://www.apache.org/dist/commons/net/binaries/commons-net-%{V_net}-bin.tar.gz

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

%description
    Apache Commons is a set of Java utility libraries.

%track
    prog commons:beanutils = {
        version   = %{V_beanutils}
        url       = http://www.apache.org/dist/commons/beanutils/binaries/
        regex     = commons-beanutils-(\d+\.\d+\.\d+)-bin\.tar\.gz
    }
    prog commons:cli = {
        version   = %{V_cli}
        url       = http://www.apache.org/dist/commons/cli/binaries/
        regex     = commons-cli-(__VER__)-bin\.tar\.gz
    }
    prog commons:collections = {
        version   = %{V_collections}
        url       = http://www.apache.org/dist/commons/collections/binaries/
        regex     = commons-collections-(__VER__)-bin\.tar\.gz
    }
    prog commons:configuration = {
        version   = %{V_configuration}
        url       = http://www.apache.org/dist/commons/configuration/binaries/
        regex     = commons-configuration-(__VER__)\.tar\.gz
    }
    prog commons:httpclient = {
        version   = %{V_httpclient}
        url       = http://www.apache.org/dist/httpcomponents/commons-httpclient/binary/
        regex     = commons-httpclient-(__VER__)\.tar\.gz
    }
    prog commons:io = {
        version   = %{V_io}
        url       = http://www.apache.org/dist/commons/io/binaries/
        regex     = commons-io-(__VER__)-bin\.tar\.gz
    }
    prog commons:lang = {
        version   = %{V_lang}
        url       = http://www.apache.org/dist/commons/lang/binaries/
        regex     = commons-lang-(__VER__)-bin\.tar\.gz
    }
    prog commons:launcher = {
        version   = %{V_launcher}
        url       = http://www.apache.org/dist/commons/launcher/binaries/
        regex     = commons-launcher-(__VER__)\.tar\.gz
    }
    prog commons:logging = {
        version   = %{V_logging}
        url       = http://www.apache.org/dist/commons/logging/binaries/
        regex     = commons-logging-(__VER__)-bin\.tar\.gz
    }
    prog commons:net = {
        version   = %{V_net}
        url       = http://www.apache.org/dist/commons/net/binaries/
        regex     = commons-net-(__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_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/lib/commons
    %{l_shtool} install -c -m 644 \
        commons-*/commons-*.jar \
        commons-*/*/commons-*.jar \
        $RPM_BUILD_ROOT%{l_prefix}/lib/commons/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

