File mx4j.spec of Package mx4j
#
# spec file for package mx4j
#
# 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/
#
Name: mx4j
Version: 3.0.2
Release: 0
Summary: Open Source Implementation of JMX Java API
License: Apache-2.0
Group: Development/Libraries/Java
Url: http://mx4j.sourceforge.net/
Source0: mx4j-%{version}-src.tar.bz2
Source1: mx4j-build.policy
Source2: CatalogManager.properties
Patch0: mx4j-javaxssl.patch
Patch2: mx4j-build.patch
Patch3: mx4j-docbook.patch
Patch5: mx4j-caucho-build.patch
Patch7: mx4j-3.0.2-docbook-stylesheet-location.patch
Patch8: mx4j-3.0.2-sourcetarget.patch
BuildRequires: ant
BuildRequires: ant-junit
BuildRequires: antlr
BuildRequires: apache-commons-logging
BuildRequires: axis
BuildRequires: bcel
BuildRequires: docbook-xsl-stylesheets
BuildRequires: docbook_3
BuildRequires: jaf
BuildRequires: java-devel >= 1.6.0
BuildRequires: javamail
BuildRequires: javapackages-tools
BuildRequires: junit
BuildRequires: libtool
BuildRequires: log4j-mini
BuildRequires: perl
BuildRequires: servletapi5
BuildRequires: unzip
BuildRequires: update-alternatives
BuildRequires: xalan-j2
BuildRequires: xerces-j2
Requires: apache-commons-logging >= 1.0.1
Requires: axis >= 1.1
Requires: bcel >= 5.0
Requires: jaf
Requires: javamail >= 1.2-5jpp
Requires: jce >= 1.2.2
Requires: log4j >= 1.2.7
Requires: xml-commons
Requires: xml-commons-apis
Requires: xml-commons-resolver
Requires(post): update-alternatives
Requires(postun): update-alternatives
Obsoletes: openjmx < %{version}
Provides: jmx
Provides: jmxri
Provides: openjmx = %{version}
BuildArch: noarch
%description
OpenJMX is an open source implementation of the Java(TM) Management
Extensions (JMX).
%prep
%setup -q
%patch0 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch7 -p1
%patch8 -p1
cp %{SOURCE1} build
cp %{SOURCE2} build
pushd lib
ln -sf $(build-classpath junit) .
ln -sf $(build-classpath xml-commons-apis) xml-apis.jar || :
ln -sf $(build-classpath xerces-j2) xercesImpl.jar || :
ln -sf $(build-classpath xalan-j2) xalan.jar || :
ln -sf $(build-classpath xalan-j2-serializer) || :
ln -sf $(build-classpath commons-logging) || :
ln -sf $(build-classpath log4j) || :
ln -sf $(build-classpath bcel) || :
ln -sf $(build-classpath axis/axis) || :
ln -sf $(build-classpath axis/jaxrpc) || :
ln -sf $(build-classpath axis/saaj) || :
ln -sf $(build-classpath wsdl4j) || :
ln -sf $(build-classpath commons-discovery) || :
ln -sf $(build-classpath servletapi5) servlet.jar || :
ln -sf $(build-classpath jython) || :
ln -sf $(build-classpath jaas) || :
popd
%build
export GC_MAXIMUM_HEAP_SIZE="134217728" #128M
ln -sf $(build-classpath gnumail) lib/mail.jar
ln -sf $(build-classpath activation) lib/
export ANT_OPTS="-Djava.security.manager \
-Djava.security.policy=$(pwd)/build/mx4j-build.policy \
-Dant.build.javac.source=1.6 \
-Dant.build.javac.target=1.6"
export OPT_JAR_LIST="ant/ant-junit junit ant/ant-trax jaxp_transform_impl"
export CLASSPATH=$(build-classpath glibj-tools activation javamail/mailapi javamail/smtp \
jetty4 jython jakarta-commons-logging xml-commons-apis bcel jaas jce \
log4j jaxp_transform_impl axis/axis axis/jaxrpc axis/saaj \
xml-commons-resolver xdoclet/xdoclet xdoclet/xdoclet-jmx-module \
xdoclet/xdoclet-mx4j-module xalan-j2-serializer)
export CLASSPATH=${CLASSPATH}:%{_builddir}/%{name}-%{version}/classes/core:%{_builddir}/%{name}-%{version}/build
cd build
ant compile.jmx compile.rjmx compile.tools compile.examples
%install
install -d -m 755 %{buildroot}%{_javadir}/%{name}
install -d -m 755 %{buildroot}%{_datadir}/%{name}
install -m 644 dist/lib/%{name}-impl.jar %{buildroot}%{_javadir}/%{name}/%{name}-impl-%{version}.jar
install -m 644 dist/lib/%{name}-jmx.jar %{buildroot}%{_javadir}/%{name}/%{name}-jmx-%{version}.jar
install -m 644 dist/lib/%{name}.jar %{buildroot}%{_javadir}/%{name}/%{name}-%{version}.jar
install -m 644 dist/lib/%{name}-tools.jar %{buildroot}%{_javadir}/%{name}/%{name}-tools-%{version}.jar
install -m 644 dist/lib/%{name}-rjmx.jar %{buildroot}%{_javadir}/%{name}/%{name}-rjmx-%{version}.jar
install -m 644 dist/lib/%{name}-rimpl.jar %{buildroot}%{_javadir}/%{name}/%{name}-rimpl-%{version}.jar
install -m 644 dist/lib/%{name}-remote.jar %{buildroot}%{_javadir}/%{name}/%{name}-remote-%{version}.jar
install -d -m 755 %{buildroot}%{_javadir}/%{name}/boa
install -m 644 dist/lib/boa/%{name}-rjmx-boa.jar %{buildroot}%{_javadir}/%{name}/boa/%{name}-rjmx-boa-%{version}.jar
install -m 644 dist/lib/boa/%{name}-rimpl-boa.jar %{buildroot}%{_javadir}/%{name}/boa/%{name}-rimpl-boa-%{version}.jar
install -m 644 dist/lib/boa/%{name}-remote-boa.jar %{buildroot}%{_javadir}/%{name}/boa/%{name}-remote-boa-%{version}.jar
pushd %{buildroot}%{_javadir}/%{name}
for jar in *-%{version}.jar ; do
ln -fs ${jar} $(echo $jar | sed "s|-%{version}.jar|.jar|g")
done
popd
# alternatives
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
ln -sf %{_sysconfdir}/alternatives/jmxri.jar %{buildroot}%{_javadir}/jmxri.jar
%post
%{_sbindir}/update-alternatives --install %{_javadir}/jmxri.jar jmxri %{_javadir}/%{name}/%{name}-jmx.jar 0
%postun
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove jmxri %{_javadir}/%{name}/%{name}-jmx.jar
fi
%files
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/*.jar
%dir %{_javadir}/%{name}/boa
%{_javadir}/%{name}/boa/*.jar
%{_javadir}/jmxri.jar
%ghost %{_sysconfdir}/alternatives/jmxri.jar
%changelog