%global with_ant 0
Name: uncommons-maths
Version: 1.2.3
Release: 1%{?dist}
Summary: Random number generators library for Java
License: ASL 2.0
Url: http://maths.uncommons.org/
Source0: https://github.com/dwdyer/uncommons-maths/archive/Release-%{version}.tar.gz
# fix project encoding
# add dependencies
# add maven plugins configuration
Patch0: uncommons-maths-1.2.3-pom.patch
BuildRequires: java-devel
BuildRequires: mvn(org.jfree:jcommon)
BuildRequires: mvn(org.jfree:jfreechart)
%if %with_ant
BuildRequires: ant
BuildRequires: aqute-bnd
BuildRequires: javapackages-tools
# https://bugzilla.redhat.com/show_bug.cgi?id=1069493
BuildRequires: uncommons-antlib
Requires: jcommon
Requires: jfreechart
Requires: java-headless
Requires: javapackages-tools
%else
BuildRequires: maven-local
%endif
%if 0
# Test deps
BuildRequires: mvn(org.testng:testng)
%endif
BuildArch: noarch
%description
The Uncommons Maths library provides five easy-to-use,
statistically sound, high-performance pseudo-random
number generators (RNGs).
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.
%prep
%setup -q -n %{name}-Release-%{version}
find . -name "*.jar" -print -delete
find . -name "*.class" -print -delete
rm -r lib/compiletime/diehard/diehard
%patch0 -p0
sed -i "s|@VERSION@|%{version}|" core/pom.xml
%if %with_ant
pushd lib
pushd compiletime
# unavailable ant task in aqute-bndlib pkg
ln -sf $(build-classpath aqute-bnd) bnd/bnd-1.50.0.jar
ln -sf $(build-classpath testng) testng/testng-5.13.1.jar
ln -sf $(build-classpath uncommons-antlib) uncommons-antlib-0.3.1.jar
popd
pushd runtime
ln -sf $(build-classpath jcommon) jcommon-1.0.12.jar
ln -sf $(build-classpath jfreechart/jfreechart) jfreechart-1.0.8.jar
popd
popd
sed -i 's|classpath="${artifact.identifier}.jar jfreechart-1.0.8.jar jcommon-1.0.12.jar"||' build.xml
sed -i 's|depends="core, demo"|depends="core"|' build.xml
%endif
%build
%if %with_ant
ant
ant docs
%else
cd core
%mvn_file : %{name}
# Test skipped unable to run test suite without uncommons-antlib support
%mvn_build -f
%endif
%install
%if %with_ant
mkdir -p %{buildroot}%{_javadir}
install -pm 644 core/build/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
mkdir -p %{buildroot}%{_mavenpomdir}
install -pm 644 core/pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr docs/api/* %{buildroot}%{_javadocdir}/%{name}
%else
cd core
%mvn_install
%endif
%if %with_ant
%files
%{_javadir}/%{name}.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%else
%files -f core/.mfiles
%endif
%doc CHANGELOG.txt LICENCE.txt NOTICE.txt
%if %with_ant
%files javadoc
%{_javadocdir}/%{name}
%else
%files javadoc -f core/.mfiles-javadoc
%endif
%doc LICENCE.txt NOTICE.txt
%changelog
* Fri Aug 23 2013 gil cattaneo 1.2.3-1
- initial rpm