apache-commons-cli/apache-commons-cli.spec

105 lines
3.5 KiB
RPMSpec
Raw Normal View History

#
# spec file for package apache-commons-cli
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global base_name cli
%global short_name commons-%{base_name}
Name: apache-commons-cli
Version: 1.2
Release: 0
Summary: Command Line Interface Library for Java
License: Apache-2.0
Group: Development/Libraries/Java
Url: http://commons.apache.org/%{base_name}/
Source0: http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz
Source1: build.xml.tar.bz2
Patch0: commons-cli-1.2-jdk9.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
Requires: java >= 1.8
Provides: jakarta-%{short_name} = %{version}-%{release}
Obsoletes: jakarta-%{short_name} < %{version}
Provides: apache-cli = %{version}
Provides: java(commons-cli:commons-cli) = %{version}
Obsoletes: apache-cli < 1.2
%description
The CLI library provides a simple and easy to use API for working with the
command line arguments and options.
%package javadoc
Summary: Javadoc for %{name}
Group: Development/Libraries/Java
Provides: jakarta-%{short_name}-javadoc = %{version}
Obsoletes: jakarta-%{short_name}-javadoc < %{version}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{short_name}-%{version}-src -a1
%patch0 -p1
%build
export CLASSPATH=$(build-classpath \
plexus/ \
maven/ \
):target/classes:target/test-classes
ant -Dmaven.mode.offline=true package javadoc \
-Dmaven.test.skip=true \
-lib /usr/share/java
%install
# jars
install -Dpm 644 target/%{short_name}-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|apache-||g"`; done)
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{short_name}.pom
%add_maven_depmap JPP-%{short_name}.pom %{short_name}.jar
# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version}
cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{version}/
%fdupes -s %{buildroot}%{_javadocdir}/%{name}-%{version}/
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
%files
%defattr(-,root,root)
%doc LICENSE.txt NOTICE.txt README.txt RELEASE-NOTES.txt
%{_javadir}/*
%{_mavenpomdir}/*
%if %{defined _maven_repository}
%config(noreplace) %{_mavendepmapfragdir}/%{name}
%else
%{_datadir}/maven-metadata/%{name}.xml
%endif
%files javadoc
%defattr(-,root,root)
%doc LICENSE.txt
%{_javadocdir}/*
%changelog