File jakarta-commons-cli.spec of Package jakarta-commons-cli

#
# spec file for package jakarta-commons-cli
#
# Copyright (c) 2013 SUSE LINUX Products 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/
#


%define base_name       cli
%define short_name      commons-%{base_name}
%define section         devel

Name:           jakarta-commons-cli
Version:        1.0
Release:        0
Summary:        Jakarta Commons CLI, a Command Line Interface for Java
License:        Apache-2.0
Group:          Development/Languages/Java
Url:            http://commons.apache.org/cli/
Source:         http://archive.apache.org/dist/jakarta/commons/cli/source/cli-1.0-src.tar.bz2
Patch0:         %{name}-crosslink.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit >= 1.6
BuildRequires:  jakarta-commons-lang
BuildRequires:  jakarta-commons-logging
BuildRequires:  java-devel
BuildRequires:  javapackages-tools
BuildRequires:  junit
Requires:       jakarta-commons-lang
Requires:       jakarta-commons-logging

%description
The CLI library provides a simple and easy to use API for working with
the command line arguments and options.



%package        javadoc
Summary:        Jakarta Commons CLI, a Command Line Interface for Java
Group:          Development/Languages/Java

%description    javadoc
The CLI library provides a simple and easy to use API for working with
the command line arguments and options.



%prep
%setup -q -n %{short_name}-%{version}
%patch0 -p0

%build
export OPT_JAR_LIST="ant/ant-junit junit"
export CLASSPATH=%(build-classpath commons-logging commons-lang )
export CLASSPATH="$CLASSPATH:target/%{short_name}.jar:target/test-classes"
 # for tests
mkdir lib
ant \
  -Dbuild.sysclasspath=only \
  -Dfinal.name=%{short_name} \
  -Dj2se.javadoc=%{_javadocdir}/java \
  -Dant.build.javac.target=1.4 \
  -Dant.build.javac.sourc=1.4 \
  jar test dist

%install
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p dist/%{short_name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|jakarta-||g"`; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt README.txt
%{_javadir}/*

%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}-%{version}
%doc %{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by