7429a9f
# Copyright (c) 2000-2007, JPackage Project
7429a9f
# All rights reserved.
7429a9f
#
7429a9f
# Redistribution and use in source and binary forms, with or without
7429a9f
# modification, are permitted provided that the following conditions
7429a9f
# are met:
7429a9f
#
7429a9f
# 1. Redistributions of source code must retain the above copyright
7429a9f
#    notice, this list of conditions and the following disclaimer.
7429a9f
# 2. Redistributions in binary form must reproduce the above copyright
7429a9f
#    notice, this list of conditions and the following disclaimer in the
7429a9f
#    documentation and/or other materials provided with the
7429a9f
#    distribution.
7429a9f
# 3. Neither the name of the JPackage Project nor the names of its
7429a9f
#    contributors may be used to endorse or promote products derived
7429a9f
#    from this software without specific prior written permission.
7429a9f
#
7429a9f
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7429a9f
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7429a9f
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7429a9f
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7429a9f
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
7429a9f
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
7429a9f
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
7429a9f
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
7429a9f
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7429a9f
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7429a9f
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7429a9f
#
7429a9f
2b1ff42
%define _without_gcj_support 1
2b1ff42
7429a9f
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}
7429a9f
7429a9f
# If you don't want to build with maven, and use straight ant instead,
7429a9f
# give rpmbuild option '--without maven'
7429a9f
7429a9f
%define with_maven %{!?_without_maven:1}%{?_without_maven:0}
7429a9f
%define without_maven %{?_without_maven:1}%{!?_without_maven:0}
7429a9f
7429a9f
%define parent plexus
7429a9f
%define subname classworlds
7429a9f
%define namedversion 1.2-alpha-9
7429a9f
7429a9f
Name:           %{parent}-%{subname}
7429a9f
Version:        1.2
7429a9f
Release:        0.a9.2jpp.1%{?dist}
7429a9f
Epoch:          0
7429a9f
Summary:        Plexus Classworlds Classloader Framework
7429a9f
License:        Apache Software License 2.0
7429a9f
Group:          Development/Java
7429a9f
URL:            http://plexus.codehaus.org/
7429a9f
# svn export http://svn.codehaus.org/plexus/plexus-classworlds/tags/plexus-classworlds-1.2-alpha-9/ plexus-classworlds
7429a9f
# tar czf plexus-classworlds-1.0-alpha-9.tar.gz plexus-classworlds/
7429a9f
Source0:        %{name}-%{namedversion}-src.tar.gz
7429a9f
7429a9f
Source1:        plexus-classworlds-1.2-build.xml
7429a9f
Source3:        plexus-classworlds-settings.xml
7429a9f
Source4:        plexus-classworlds-1.2-jpp-depmap.xml
7429a9f
7429a9f
Patch0:         plexus-classworlds-1.2-pom_xml.patch
7429a9f
7429a9f
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
7429a9f
7429a9f
%if ! %{gcj_support}
7429a9f
BuildArch:      noarch
7429a9f
%endif
7429a9f
7429a9f
BuildRequires:  jpackage-utils >= 0:1.7.3
7429a9f
BuildRequires:  ant >= 0:1.6.5
7429a9f
BuildRequires:  jakarta-commons-logging
7429a9f
BuildRequires:  xml-commons-jaxp-1.3-apis
7429a9f
%if %{with_maven}
7429a9f
BuildRequires:  maven2 >= 2.0.4-10jpp
7429a9f
BuildRequires:  maven2-plugin-compiler
7429a9f
BuildRequires:  maven2-plugin-install
7429a9f
BuildRequires:  maven2-plugin-jar
7429a9f
BuildRequires:  maven2-plugin-javadoc
7429a9f
BuildRequires:  maven2-plugin-resources
7429a9f
BuildRequires:  maven2-plugin-surefire
858fe7d
#BuildRequires:	maven-release
7429a9f
%endif
7429a9f
BuildRequires:  plexus-utils 
7429a9f
%if %{gcj_support}
7429a9f
BuildRequires:    java-gcj-compat-devel
7429a9f
Requires(post):   java-gcj-compat
7429a9f
Requires(postun): java-gcj-compat
7429a9f
%endif
7429a9f
7429a9f
Requires(post):    jpackage-utils >= 0:1.7.2
7429a9f
Requires(postun):  jpackage-utils >= 0:1.7.2
7429a9f
7429a9f
%if %{gcj_support}
7429a9f
BuildRequires:		java-gcj-compat-devel
7429a9f
Requires(post):		java-gcj-compat
7429a9f
Requires(postun):	java-gcj-compat
7429a9f
%endif
7429a9f
7429a9f
%description
7429a9f
Classworlds is a framework for container developers
7429a9f
who require complex manipulation of Java's ClassLoaders.
7429a9f
Java's native ClassLoader mechanims and classes can cause
7429a9f
much headache and confusion for certain types of
7429a9f
application developers. Projects which involve dynamic
7429a9f
loading of components or otherwise represent a 'container'
7429a9f
can benefit from the classloading control provided by
7429a9f
classworlds.
7429a9f
7429a9f
%package javadoc
7429a9f
Summary:        Javadoc for %{name}
7429a9f
Group:          Development/Documentation
7429a9f
Requires(post):   /bin/rm,/bin/ln
7429a9f
Requires(postun): /bin/rm
7429a9f
7429a9f
%description javadoc
7429a9f
Javadoc for %{name}.
7429a9f
7429a9f
%prep
7429a9f
%setup -q -n %{name}-%{namedversion}
7429a9f
for j in $(find . -name "*.jar" | grep -v /test-data/ | grep -v /test-jars/); do
7429a9f
        mv $j $j.no
7429a9f
done
7429a9f
cp %{SOURCE1} build.xml
7429a9f
cp %{SOURCE3} settings.xml
7429a9f
%patch0 -b .sav
7429a9f
ln -sf $(build-classpath xml-commons-jaxp-1.3-apis) lib/xml-apis-1.3.02.jar
7429a9f
ln -sf $(build-classpath ant) lib/ant-1.6.5.jar
7429a9f
ln -sf $(build-classpath commons-logging) lib/commons-logging-1.0.3.jar
7429a9f
7429a9f
%build
7429a9f
7429a9f
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
7429a9f
mkdir -p $MAVEN_REPO_LOCAL
7429a9f
7429a9f
# org.codehaus.plexus.classworlds.strategy.StrategyTest fails 
7429a9f
# upstream, so ignore failures for now
7429a9f
7429a9f
%if %{with_maven}
7429a9f
mvn-jpp \
7429a9f
        -e \
7429a9f
        -Dmaven.test.failure.ignore=true \
7429a9f
		-Dmaven.repo.local=$MAVEN_REPO_LOCAL \
7429a9f
        install javadoc:javadoc
7429a9f
7429a9f
%else
7429a9f
export CLASSPATH=
7429a9f
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
7429a9f
7429a9f
ant -Dbuild.sysclasspath=only jar javadoc
7429a9f
%endif
7429a9f
7429a9f
%install
7429a9f
rm -rf $RPM_BUILD_ROOT
7429a9f
# jars
7429a9f
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/plexus
7429a9f
install -pm 644 target/%{name}-%{namedversion}.jar \
7429a9f
  $RPM_BUILD_ROOT%{_javadir}/plexus/%{subname}-%{version}.jar
7429a9f
%add_to_maven_depmap org.codehaus.plexus %{name} %{namedversion} JPP/%{parent} %{subname}
7429a9f
7429a9f
(cd $RPM_BUILD_ROOT%{_javadir}/%{parent} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
7429a9f
7429a9f
# pom
7429a9f
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
7429a9f
install -pm 644 pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{parent}-%{subname}.pom
7429a9f
7429a9f
# javadoc
7429a9f
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
7429a9f
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
7429a9f
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink
7429a9f
7429a9f
%if %{gcj_support}
7429a9f
%{_bindir}/aot-compile-rpm
7429a9f
%endif
7429a9f
7429a9f
%clean
7429a9f
rm -rf $RPM_BUILD_ROOT
7429a9f
7429a9f
%post
7429a9f
%update_maven_depmap
7429a9f
%if %{gcj_support}
7429a9f
if [ -x %{_bindir}/rebuild-gcj-db ]
7429a9f
then
7429a9f
  %{_bindir}/rebuild-gcj-db
7429a9f
fi
7429a9f
%endif
7429a9f
7429a9f
%postun
7429a9f
%update_maven_depmap
7429a9f
%if %{gcj_support}
7429a9f
if [ -x %{_bindir}/rebuild-gcj-db ]
7429a9f
then
7429a9f
  %{_bindir}/rebuild-gcj-db
7429a9f
fi
7429a9f
%endif
7429a9f
7429a9f
%files
7429a9f
%defattr(-,root,root,-)
7429a9f
%{_javadir}/%{parent}
7429a9f
%{_datadir}/maven2
7429a9f
%{_mavendepmapfragdir}
7429a9f
%if %{gcj_support}
7429a9f
%dir %attr(-,root,root) %{_libdir}/gcj/%{name}
7429a9f
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{subname}*-%{version}.jar.*
7429a9f
%endif
7429a9f
7429a9f
%files javadoc
7429a9f
%defattr(-,root,root,-)
7429a9f
%doc %{_javadocdir}/*
7429a9f
7429a9f
%changelog
7429a9f
* Tue Jan 13 2009 Yong Yang <yyang@redhat.com> 0:1.2-0.a9.3jpp.1
7429a9f
- re-build with maven 
7429a9f
7429a9f
* Tue Jan 06 2009 Yong Yang <yyang@redhat.com> 0:1.2-0.a9.2jpp.1
7429a9f
- Imported into devel from dbhole's maven 2.0.8 packages
7429a9f
7429a9f
* Wed Jan 30 2008 Deepak Bhole <dbhole@redhat.com> 0:1.2-0.a9.1jpp.1
7429a9f
- Initial build -- merged from JPackage