File jarjar.spec of Package jarjar

#
# spec file for package jarjar
#
# Copyright (c) 2017 SUSE LINUX 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:  fdupes
BuildRequires:  gnu-regexp
BuildRequires:  java-devel
BuildRequires:  javapackages-local
BuildRequires:  javapackages-tools
BuildRequires:  junit
BuildRequires:  unzip
Requires:       asm2
Requires:       gnu-regexp
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
BuildArch:      noarch
%if 0
BuildRequires:  maven2
%endif

%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}
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
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
# 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
ln -sf $(build-classpath ant) ant.jar
%if 0
ln -sf $(build-classpath maven2/plugin-api) maven-plugin-api.jar
%endif
popd
export OPT_JAR_LIST="ant/ant-junit junit"
ant \
    -Dcompile.source=1.6 -Dcompile.target=1.6 \
    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}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}

%files
%doc COPYING
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-util.jar
%{_mavenpomdir}/*
%{_datadir}/maven-metadata/%{name}.xml*

%if 0
%files maven2-plugin
%{_javadir}/%{name}-maven2-plugin-%{version}.jar
%{_javadir}/%{name}-maven2-plugin.jar
%endif

%files javadoc
%{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by