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

#
# spec file for package jakarta-commons-collections (Version 3.2)
#
# Copyright (c) 2008 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/
#

# norootforbuild
# icecream 0

%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}
# If you don't want to build with maven, and use straight ant instead,
# give rpmbuild option '--without maven'
%define with_maven %{!?_without_maven:1}%{?_without_maven:0}
%define without_maven %{?_without_maven:1}%{!?_without_maven:0}
%if %defined suse_version
# there's currently no maven in Suse
%define with_maven 0
%endif
%define base_name       collections
%define short_name      commons-%{base_name}
%define section         free

Name:           jakarta-commons-collections
Version:        3.2
Release:        88
Summary:        Jakarta Commons Collections Package
License:        The Apache Software License
Group:          Development/Libraries/Java
Source0:        http://www.apache.org/dist/jakarta/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        commons-collections-3.2-jpp-depmap.xml
Source5:        %{short_name}-%{version}.pom
Source6:        collections-tomcat5-build.xml
Patch0:         %{name}-javadoc-nonet.patch
Patch1:         %{name}-navigation.patch
Patch2:         %{name}-target15.patch
Url:            http://jakarta.apache.org/commons/collections/
BuildRequires:  ant
BuildRequires:  ant-junit
BuildRequires:  jpackage-utils >= 1.7.2
#BuildRequires:  xml-commons-jaxp-1.3-apis
%if %{with_maven}
BuildRequires:  maven >= 1.1
BuildRequires:  maven-plugins-base
BuildRequires:  maven-plugin-test
BuildRequires:  maven-plugin-xdoc
BuildRequires:  maven-plugin-license
BuildRequires:  maven-plugin-changes
BuildRequires:  maven-plugin-jdepend
BuildRequires:  maven-plugin-jdiff
BuildRequires:  maven-plugin-jxr
BuildRequires:  maven-plugin-tasklist
BuildRequires:  maven-plugin-developer-activity
BuildRequires:  maven-plugin-file-activity
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%endif
%if %defined suse_version
BuildRequires:  java-devel
%endif
%if ! %{gcj_support}
BuildArch:      noarch
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       %{short_name} = %{version}-%{release}
Obsoletes:      %{short_name} < {version}-%{release}
PreReq:         coreutils
Requires(post):    jpackage-utils >= 1.7.2
Requires(postun):  jpackage-utils >= 1.7.2
%if %{gcj_support}
BuildRequires:  gnu-crypto
BuildRequires:  java-gcj-compat-devel
Requires(post):         java-gcj-compat
Requires(postun):       java-gcj-compat
%endif

%description
The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections

- methods to test or create typical set theory properties of
collections such as union, intersection, and closure



%package testframework
License:        The Apache Software License
Summary:        Jakarta Commons Collections Package
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}
%if %{gcj_support}
Requires(post):         java-gcj-compat
Requires(postun):       java-gcj-compat
%endif

%description testframework
The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections

- methods to test or create typical set theory properties of
collections such as union, intersection, and closure



%{summary}.

%package javadoc
License:        The Apache Software License
Summary:        Javadoc for jakarta-commons-collections
Group:          Development/Libraries/Java
Requires(post): %{__rm}
Requires(post): /bin/ln
Requires(postun): %{__rm}

%description javadoc
This package contains the javadoc documentation for the Jakarta Commons
Collections package.

The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections.

- methods to test or create typical set-theory properties of
collections such as union, intersection, and closure.



%{summary}.

%package tomcat5
License:        The Apache Software License
Summary:        Jakarta Commons Collections Package
Group:          Development/Libraries/Java
%if %{gcj_support}
Requires(post):         java-gcj-compat
Requires(postun):       java-gcj-compat
%endif

%description tomcat5
The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections

- methods to test or create typical set theory properties of
collections such as union, intersection, and closure



%package testframework-javadoc
License:        The Apache Software License
Summary:        Jakarta Commons Collections Package
Group:          Development/Libraries/Java
Requires(post): %{__rm}
Requires(post): /bin/ln
Requires(postun): %{__rm}

%description testframework-javadoc
The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections

- methods to test or create typical set theory properties of
collections such as union, intersection, and closure



%{summary}.
%if %{with_maven}

%package manual
License:        The Apache Software License
Summary:        Jakarta Commons Collections Package
Group:          Development/Libraries/Java

%description manual
The introduction of the Collections API by Sun in JDK 1.2 has been a
   boon to quick and effective Java programming. Ready access to
   powerful data structures has accelerated development by reducing
   the need for custom container classes around each core object.
   Most Java2 APIs are significantly easier to use because of the
   Collections API. However, there are certain holes left unfilled
   by Sun's implementations, and the Jakarta-Commons Collections
   Component strives to fulfill them. Among the features of this
   package are: - special-purpose implementations of Lists and Maps
   for fast access

- adapter classes from Java1-style containers (arrays, enumerations)
   to Java2-style collections

- methods to test or create typical set theory properties of
collections such as union, intersection, and closure



%{summary}.
%endif

%prep
%setup -q -n %{short_name}-%{version}-src
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%patch0 -p1 -b .sav0
%patch1 -b .sav1
%patch2 -b .target15
# Avoid fail on error for GCJ. See FIXME below.
%if %{gcj_support}
# still needed ?
#%patch4 -b .sav
%endif
cp %{SOURCE6} .
if [ ! -f %{SOURCE4} ]; then
export DEPCAT=$(pwd)/%{short_name}-%{version}-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)
    /usr/bin/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon $DEPCAT %{SOURCE2} > %{short_name}-%{version}-depmap.new.xml
fi

%build
%if %{with_maven}
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    /usr/bin/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done
export MAVEN_HOME_LOCAL=$(pwd)/.maven
maven -e \
        -Dmaven.repo.remote=file:/usr/share/maven/repository \
        -Dmaven.home.local=${MAVEN_HOME_LOCAL} \
        jar:jar javadoc:generate xdoc:transform
ant tf.javadoc
%else
#FIXME Enabling tests with gcj causes memory leaks!
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423
%if %{gcj_support}
ant -Djava.io.tmpdir=. jar javadoc tf.validate tf.jar dist.bin dist.src tf.javadoc
%else
#FIXME: the test fails on x390!
#java: pthread_mutex_lock.c:71: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
#ant -Djava.io.tmpdir=. test dist tf.javadoc
#FIXME: the test fails on ppc with openjdk b11
# See bnc#441085
#ant -Djava.io.tmpdir=. dist tf.javadoc
ant -Djava.io.tmpdir=. jar javadoc tf.validate tf.jar dist.bin dist.src tf.javadoc
%endif
%endif
# commons-collections-tomcat5
ant -f collections-tomcat5-build.xml

%install
rm -rf $RPM_BUILD_ROOT
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
%if %{with_maven}
install -m 644 target/%{short_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 target/%{short_name}-testframework-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-testframework-%{version}.jar
%else
install -m 644 build/%{short_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 build/%{short_name}-testframework-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-testframework-%{version}.jar
%endif
#tomcat5
install -m 644 collections-tomcat5/%{short_name}-tomcat5.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-tomcat5-%{version}.jar
%add_to_maven_depmap %{short_name} %{short_name} %{version} JPP %{short_name}
(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)
# pom
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -m 644 %{SOURCE5} \
    $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-%{short_name}.pom
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%if %{with_maven}
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%else
cp -pr build/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%endif
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink
rm -rf target/docs/apidocs
# testframework-javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-testframework-%{version}
cp -pr build/docs/testframework/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-testframework-%{version}
ln -s %{name}-testframework-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}-testframework # ghost symlink
# manual
%if %{with_maven}
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%endif
%if %{gcj_support}
export CLASSPATH=$(build-classpath gnu-crypto)
%{_bindir}/aot-compile-rpm
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
    rm -f %{_javadocdir}/%{name}
fi

%post testframework-javadoc
rm -f %{_javadocdir}/%{name}-testframework
ln -s %{name}-testframework-%{version} %{_javadocdir}/%{name}-testframework

%postun testframework-javadoc
if [ "$1" = "0" ]; then
    rm -f %{_javadocdir}/%{name}-testframework
fi

%post
%update_maven_depmap
%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%postun
%update_maven_depmap
%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif
%if %{gcj_support}

%post testframework
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif
%if %{gcj_support}

%postun testframework
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif
%if %{gcj_support}

%post tomcat5
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif
%if %{gcj_support}

%postun tomcat5 
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%files
%defattr(0644,root,root,0755)
%doc PROPOSAL.html README.txt STATUS.html LICENSE.txt RELEASE-NOTES.html
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/%{short_name}-%{version}.jar
%{_javadir}/%{short_name}.jar
%dir %{_datadir}/maven2
%dir %{_datadir}/maven2/poms
%{_datadir}/maven2/poms/*
%{_mavendepmapfragdir}
%if %{gcj_support}
%dir %attr(-,root,root) %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-*%{version}.jar.*
%endif

%files testframework
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-testframework-%{version}.jar
%{_javadir}/%{name}-testframework.jar
%{_javadir}/%{short_name}-testframework-%{version}.jar
%{_javadir}/%{short_name}-testframework.jar
%if %{gcj_support}
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-testframework-%{version}.jar.*
%endif

%files tomcat5
%defattr(0644,root,root,0755)
%{_javadir}/*-tomcat5*.jar
%if %{gcj_support}
%attr(-,root,root) %{_libdir}/gcj/%{name}/*-tomcat5*
%endif

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

%files testframework-javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-testframework-%{version}
%ghost %{_javadocdir}/%{name}-testframework
%if %{with_maven}

%files manual
%defattr(0644,root,root,0755)
%{_docdir}/%{name}-%{version}
%endif

%changelog
* Tue Nov 11 2008 mvyskocil@suse.cz
- fix of bnc#441085: yast2-schema is missing on media (openSUSE-11. 1-DVD-ppc-Build0113)
  - unittest disabled as it fails on ppc with openjdk b11
* Mon Aug 25 2008 mvyskocil@suse.cz
- target=1.5 source=1.5
* Thu Mar 13 2008 mvyskocil@suse.cz
- merged with jpackage-1.7
- update to 3.2
- changes in BuildRequires:
  - java2-devel-packages was substituded by java-devel
  - added ant-junit
  - maven build support and a maven specific BuildRequires
- added maven pom files
- provides and obsoletes contains a version
- the gcj build support
- new subpackages:
  - jakarta-commons-collections-testframework
  - jakarta-commons-collections-testframework-javadoc
  - jakarta-commons-collections-tomcat5
* Mon Sep 25 2006 skh@suse.de
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jul 27 2005 jsmeix@suse.de
- Adjustments in the spec file.
* Mon Jul 18 2005 jsmeix@suse.de
- Current version 3.1 from JPackage.org
* Mon Feb 21 2005 skh@suse.de
- update to version 3.1
- don't use icecream
* Thu Sep 16 2004 skh@suse.de
- Fix prerequires of javadoc subpackage
* Thu Sep 02 2004 skh@suse.de
- Initial package created with version 2.1.1 (JPackage 1.5)