beust-jcommander/beust-jcommander.spec

105 lines
3.4 KiB
RPMSpec

#
# spec file for package beust-jcommander
#
# 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 https://bugs.opensuse.org/
#
%global short_name jcommander
Name: beust-%{short_name}
Version: 1.71
Release: 0
Summary: Java framework for parsing command line parameters
License: Apache-2.0
Group: Development/Libraries/Java
URL: http://jcommander.org/
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
# Adapted from earlier version that still shipped poms. It uses kobalt for building now
Source1: %{name}.pom
# Cleaned up bundled jars hose licensing cannot be easily verified
Source2: generate-tarball.sh
Patch0: 0001-ParseValues-NullPointerException-patch.patch
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
Requires: java >= 1.8
Obsoletes: %{short_name} < %{version}-%{release}
Provides: %{short_name} = %{version}-%{release}
BuildArch: noarch
%description
JCommander is a very small Java framework that makes it trivial to
parse command line parameters (with annotations).
%package javadoc
Summary: API documentation for %{name}
Group: Development/Libraries/Java
%description javadoc
This package contains the %{summary}.
%prep
%setup -q -n %{short_name}-%{version}
%patch0 -p1
chmod -x license.txt
cp -p %{SOURCE1} pom.xml
sed -i 's/@VERSION@/%{version}/g' pom.xml
%build
mkdir -p build/classes
mkdir -p build/javadoc
javac -d build/classes -source 8 -target 8 `find src/main/java -name *.java | xargs`
javadoc -d build/javadoc -source 8 --source-path src/main/java/ `find src/main/java -name *.java | xargs`
(cd build/classes && jar cf ../%{name}-%{version}.jar `find . -name *.class | xargs`)
%install
# jars
install -d -m 0755 %{buildroot}%{_javadir}
install -m 644 build/%{name}-%{version}.jar \
%{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{name}.jar)
(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{short_name}-%{version}.jar)
(cd %{buildroot}%{_javadir} && ln -s %{short_name}-%{version}.jar %{short_name}.jar)
# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}-%{version}.pom
%add_maven_depmap %{name}-%{version}.pom %{name}-%{version}.jar
# javadoc
install -dm 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr build/javadoc/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}/%{name}/
%files
%license license.txt
%doc notice.md README.markdown
%{_javadir}/*
%{_mavenpomdir}/*
%if %{defined _maven_repository}
%{_mavendepmapfragdir}/%{name}
%else
%{_datadir}/maven-metadata/%{name}.xml*
%endif
%files javadoc
%license license.txt
%doc notice.md
%{_javadocdir}/%{name}
%changelog