File jarjar.spec of Package jarjar

#
# spec file for package jarjar
#
# 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 section free

Name:           jarjar
Version:        0.9
Release:        0
Summary:        Repackage Java libraries
License:        GPL-2.0+
Group:          Development/Libraries/Java
Url:            http://tonicsystems.com/products/jarjar/
Source0:        http://downloads.sourceforge.net/jarjar/jarjar-src-0.9.zip
Source1:        jarjar-0.9.pom
Source2:        jarjar-util.pom

BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit >= 1.6
BuildRequires:  asm2
BuildRequires:  gnu-regexp
BuildRequires:  javapackages-tools
BuildRequires:  junit
%if 0
BuildRequires:  maven2
%endif
BuildRequires:  java-devel
BuildRequires:  unzip
Requires:       asm2
Requires:       gnu-regexp
Requires(post):    javapackages-tools
Requires(postun):  javapackages-tools
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:       %{name} = %{version}-%{release}
Requires:       maven2

%description maven2-plugin

%{summary}.
%endif

%package javadoc
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 %{buildroot}%{_javadir}
install -m 644 dist/%{name}-%{version}.jar \
  %{buildroot}%{_javadir}/%{name}.jar
install -m 644 dist/%{name}-util-%{version}.jar \
  %{buildroot}%{_javadir}/%{name}-util.jar
%if 0
install -m 644 dist/%{name}-plugin-%{version}.jar \
  %{buildroot}%{_javadir}/%{name}-maven2-plugin.jar
%endif

# poms
mkdir -p %{buildroot}/%{_mavenpomdir}
install -pD -T -m 644 %{SOURCE1} \
  %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
install -pD -T -m 644 %{SOURCE2} \
  %{buildroot}%{_mavenpomdir}/JPP-%{name}-util.pom

# depmaps
%add_maven_depmap JPP-%{name}.pom %{name}.jar -a "jarjar:%{name},com.tonicsystems:%{name}"
%add_maven_depmap JPP-%{name}-util.pom %{name}-util.jar -a "jarjar:%{name}-util,com.tonicsystems:%{name}-util"
#% add_maven_depmap JPP-%{name}-plugin.pom %{name}-plugin.jar -a "jarjar:%{name}-plugin,tonic:%{name}-plugin,com.tonicsystems:%{name}-plugin" -f "plugin"

# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr dist/javadoc/* %{buildroot}%{_javadocdir}/%{name}

%files
%defattr(0644,root,root,0755)
%doc COPYING
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-util.jar
%{_mavenpomdir}/*
%{_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}

%changelog
openSUSE Build Service is sponsored by