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

#
# spec file for package jakarta-commons-compress (Version 1.0)
#
# Copyright (c) 2009 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 with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%define _without_maven 1
%bcond_with             maven
%define section   free
%define base_name commons-compress
%define svnrev 701433

Name:           jakarta-commons-compress
Version:        1.0
Release:        2
Summary:        Commons Compress
License:        The Apache Software License
Group:          Development/Libraries/Java
Url:            http://jakarta.apache.org/commons/sandbox/compress/
# svn export http://svn.apache.org/repos/asf/commons/sandbox/compress/trunk commons-compress-1.0-701433
# tar cjf commons-compress-1.0-701433.tar.bz2 commons-compress-1.0-701433
Source0:        commons-compress-1.0-%{svnrev}.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        commons-compress-0.1-jpp-depmap.xml
Source5:        commons-sandbox-build-project.xml
Source6:        commons-compress-0.1-build.xml
Patch0:         commons-compress-0.1-project_xml.patch
BuildRequires:  ant >= 1.6
BuildRequires:  jakarta-commons-io
BuildRequires:  junit
%if %with maven
BuildRequires:  maven2
BuildRequires:  maven2-plugin-compiler
BuildRequires:  maven2-plugin-install
BuildRequires:  maven2-plugin-jar
BuildRequires:  maven2-plugin-javadoc
BuildRequires:  maven2-plugin-resources
BuildRequires:  maven2-plugin-site
BuildRequires:  maven-surefire-plugin
%endif
BuildRequires:  saxon
BuildRequires:  saxon-scripts
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Commons Compress is a component that contains Tar, Zip and BZip2
packages.



%package javadoc
License:        The Apache Software License
Summary:        Commons Compress
Group:          Development/Libraries/Java

%description javadoc
Commons Compress is a component that contains Tar, Zip and BZip2
packages.



%prep
%setup -q -n %{base_name}-%{version}-%{svnrev}
cp -p %{SOURCE5} .
cp -p %{SOURCE6} build.xml
%if %with maven
export DEPCAT=$(pwd)/commons-compress-0.1-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    %{_bindir}/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
%{_bindir}/saxon $DEPCAT %{SOURCE2} > commons-compress-0.1-depmap.new.xml
%endif
%patch0 -p0

%build
%if %with maven
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    %{_bindir}/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done
maven -e \
        -Dmaven.repo.remote=file:/usr/share/maven/repository \
        -Dmaven.javadoc.source=1.4 \
        -Dmaven.test.failure.ignore=true \
        -Dmaven.home.local=$(pwd)/.maven \
        jar javadoc 
%else
export CLASSPATH=$(build-classpath commons-io):`pwd`/target/classes:`pwd`/target/test-classes
export OPT_JAR_LIST=:
ant \
    -Djunit.jar=file://$(build-classpath junit) \
    -Dbuild.sysclasspath=only \
    -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5  \
    jar javadoc
%endif

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/commons-compress-0.1-dev.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in jakarta-*; do ln -sf ${jar} ${jar/jakarta-/}; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{base_name}-%{version}
ln -s %{name} $RPM_BUILD_ROOT%{_javadocdir}/%{base_name}
# FIXME: (dwalluck): breaks --short-circuit
rm -rf target/docs/apidocs

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/%{base_name}-%{version}.jar
%{_javadir}/%{base_name}.jar

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

%changelog
* Thu May 14 2009 mvyskocil@suse.cz
- 'Initial SUSE packaging from jpackage.org 5.0'
openSUSE Build Service is sponsored by