File jarjar.spec of Package jarjar
#
# spec file for package jarjar (Version 0.9)
#
# 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 section free
Name: jarjar
Version: 0.9
Release: 2
Summary: Repackage Java libraries
License: GPL v2 or later
Url: http://tonicsystems.com/products/jarjar/
Group: Development/Libraries/Java
Source0: http://downloads.sourceforge.net/jarjar/jarjar-src-0.9.zip
Source1: jarjar-0.9.pom
BuildRequires: ant >= 1.6
BuildRequires: ant-junit >= 1.6
BuildRequires: jpackage-utils >= 1.7.2
BuildRequires: junit
BuildRequires: asm2
BuildRequires: gnu-regexp
%if 0
BuildRequires: maven2
%endif
BuildRequires: unzip
BuildRequires: java-devel
Requires: asm2
Requires: gnu-regexp
Requires(post): jpackage-utils >= 1.7.2
Requires(postun): jpackage-utils >= 1.7.2
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Jar Jar Links is a utility that makes it easy to repackage Java
libraries and embed them into your own distribution. This is useful for
two reasons: You can easily ship a single jar file with no external
dependencies. You can avoid problems where your library depends on a
specific version of a library, which may conflict with the dependencies
of another library.
%if 0
%package maven2-plugin
Summary: Maven2 plugin for %{name}
Group: Utilities
Requires: maven2
Requires: %{name} = %{version}-%{release}
%description maven2-plugin
%{summary}.
%endif
%package javadoc
License: GPL v2 or later
Summary: Repackage Java libraries
Group: Development/Libraries/Java
%description javadoc
Jar Jar Links is a utility that makes it easy to repackage Java
libraries and embed them into your own distribution. This is useful for
two reasons: You can easily ship a single jar file with no external
dependencies. You can avoid problems where your library depends on a
specific version of a library, which may conflict with the dependencies
of another library.
%prep
%setup -q -n %{name}-%{version}
# remove all binary libs
find . -name "*.jar" | xargs -t rm
# maven plugin
find . -name JarJarMojo.java | xargs rm -rf
%build
pushd lib
ln -sf $(build-classpath gnu.regexp) gnu-regexp.jar
ln -sf $(build-classpath asm2/asm) asm.jar
ln -sf $(build-classpath asm2/asm-commons) asm-commons.jar
ln -sf $(build-classpath asm2/asm-util) asm-util.jar
%if 0
ln -sf $(build-classpath maven2/plugin-api) maven-plugin-api.jar
%endif
popd
export OPT_JAR_LIST="ant/ant-junit junit"
export CLASSPATH=$(build-classpath ant)
ant jar jar-util javadoc mojo test
%install
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/%{name}-%{version}.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 dist/%{name}-util-%{version}.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-util-%{version}.jar
%if 0
install -m 644 dist/%{name}-plugin-%{version}.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-maven2-plugin-%{version}.jar
%endif
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
%add_to_maven_depmap tonic jarjar %{version} JPP %{name}
%add_to_maven_depmap com.tonicsystems jarjar %{version} JPP %{name}
%add_to_maven_depmap tonic jarjar-util %{version} JPP %{name}-util
%add_to_maven_depmap com.tonicsystems jarjar-util %{version} JPP %{name}-util
%add_to_maven_depmap tonic jarjar-plugin %{version} JPP %{name}-plugin
%add_to_maven_depmap com.tonicsystems jarjar-plugin %{version} JPP %{name}-plugin
# poms
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE1} \
$RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}.pom
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%defattr(0644,root,root,0755)
%doc COPYING
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}-util-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-util.jar
%{_datadir}/maven2/poms/*
%{_mavendepmapfragdir}/*
%if 0
%files maven2-plugin
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-maven2-plugin-%{version}.jar
%{_javadir}/%{name}-maven2-plugin.jar
%endif
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
%changelog
* Thu Apr 23 2009 mvyskocil@suse.cz
- Initial packaging for SUSE. Version 0.9 (jpp5)