summaryrefslogtreecommitdiff
path: root/java-commons-math.spec
blob: 11c46d1a5952d75fe7e0f3ab1ec5068b1296d7f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# TODO
# - tests fail. a lot
# - junit needed for compile target
#
# Conditional build:
%bcond_without	javadoc		# don't build javadoc
%bcond_with	tests		# don't build and run tests

%define		srcname		commons-math
Summary:	Java library of lightweight mathematics and statistics components
Name:		java-%{srcname}
Version:	2.2
Release:	1
License:	ASL 1.1 and ASL 2.0 and BSD
Group:		Development/Libraries
URL:		http://commons.apache.org/math/
Source0:	http://www.apache.org/dist/commons/math/source/%{srcname}-%{version}-src.tar.gz
# Source0-md5:	6261d7991154c992477b32b8f3bea18b
Patch0:		notest.patch
BuildRequires:	java-junit >= 4.3
BuildRequires:	jdk >= 1.6
BuildRequires:	jpackage-utils
BuildRequires:	rpm-javaprov
BuildRequires:	rpmbuild(macros) >= 1.555
%if %(locale -a | grep -q '^en_US$'; echo $?)
BuildRequires:	glibc-localedb-all
%endif
Requires:	jpackage-utils
BuildArch:	noarch
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description
Commons Math is a library of lightweight, self-contained mathematics
and statistics components addressing the most common problems not
available in the Java programming language or Commons Lang.

%package javadoc
Summary:	Javadoc for commons-math
Group:		Documentation
Requires:	jpackage-utils

%description javadoc
This package contains the API documentation for commons-math.

%prep
%setup -q -n commons-math-%{version}-src
%patch0 -p1

%build
# source code not US-ASCII
export LC_ALL=en_US

%ant \
	-Dskip.download=1 \
	jar %{?with_javadoc:javadoc}

%if %{with tests}
junit=$(find-jar junit)
%ant \
	-Djunit.jar=$junit
%endif

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_javadir}

# jars
cp -p target/%{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}-%{version}.jar
ln -s %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}.jar

# javadoc
%if %{with javadoc}
install -d $RPM_BUILD_ROOT%{_javadocdir}/%{srcname}-%{version}
cp -a target/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{srcname}-%{version}
ln -s %{srcname}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{srcname} # ghost symlink
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post javadoc
ln -nfs %{srcname}-%{version} %{_javadocdir}/%{srcname}

%files
%defattr(644,root,root,755)
%doc LICENSE.txt NOTICE.txt RELEASE-NOTES.txt
%{_javadir}/%{srcname}.jar
%{_javadir}/%{srcname}-%{version}.jar

%if %{with javadoc}
%files javadoc
%defattr(644,root,root,755)
%{_javadocdir}/%{srcname}-%{version}
%ghost %{_javadocdir}/%{srcname}
%endif