File mx4j.spec of Package mx4j

#
# spec file for package mx4j (Version 3.0.2)
#
# Copyright (c) 2009 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 compile_and_run_tests false
%define section     free

Name:           mx4j
Version:        3.0.2
Release:        1
Summary:        Open Source Implementation of JMX Java API
License:        Apache Software License ..
Group:          Development/Libraries/Java
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
Patch6:         mx4j-3.0.2-use-external-rmic.patch
Patch7:         mx4j-3.0.2-docbook-stylesheet-location.patch
Url:            http://mx4j.sourceforge.net/
BuildRequires:  java-1_5_0-gcj-compat-devel
BuildRequires:  ant
BuildRequires:  ant-junit
BuildRequires:  ant-nodeps
BuildRequires:  ant-trax antlr
BuildRequires:  axis
BuildRequires:  bcel
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_3
BuildRequires:  jaf
BuildRequires:  jakarta-commons-logging
BuildRequires:  javamail
BuildRequires:  jpackage-utils
BuildRequires:  junit
BuildRequires:  libtool
BuildRequires:  log4j-mini
BuildRequires:  perl
BuildRequires:  servletapi5
BuildRequires:  unzip
BuildRequires:  update-alternatives
BuildRequires:  xalan-j2
BuildRequires:  xerces-j2
#BuildRequires:  burlap
#BuildRequires:  hessian
BuildArch:      noarch
PreReq:         /usr/sbin/update-alternatives
Requires:       jaf
Requires:       javamail >= 1.2-5jpp
Requires:       log4j >= 1.2.7
Requires:       jakarta-commons-logging >= 1.0.1
Requires:       xml-commons-apis
Requires:       bcel >= 5.0
Requires:       jce >= 1.2.2
Requires:       axis >= 1.1
Requires:       xml-commons-resolver
Requires:       xml-commons
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Obsoletes:      openjmx
Provides:       jmxri
Provides:       jmx

%description
OpenJMX is an open source implementation of the Java(TM) Management
Extensions (JMX).



%package javadoc
License:        Apache Software License ..
Group:          Development/Libraries/Java
Summary:        Javadoc for mx4j
Obsoletes:      openjmx-javadoc

%description javadoc
OpenJMX is an open source implementation of the Java(TM) Management
Extensions (JMX).

This package contains the javadoc documentation for OpenJMX.



%package manual
License:        Apache Software License ..
Group:          Development/Libraries/Java
Summary:        Manual for mx4j

%description    manual
OpenJMX is an open source implementation of the Java(TM) Management
Extensions (JMX).

This package contains the manual for OpenJMX.



%prep
%setup -q
%patch0 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
cp %{SOURCE1} build
#cp %{SOURCE2} build
cp %{_sourcedir}/CatalogManager.properties %{_builddir}/%{name}-%{version}/build/
pushd lib
   ln -sf $(build-classpath junit) .
if [ "%compile_and_run_tests" = "true" ]
then
   ln -sf $(build-classpath xmlunit) .
fi
   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 burlap)                                      || :
#   ln -sf $(build-classpath hessian)                                     || :
   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 jetty4) org.mortbay.jetty.jar                || :
   ln -sf $(build-classpath servletapi5) servlet.jar                      || :
   ln -sf $(build-classpath jython)                                       || :
   ln -sf $(build-classpath jaas)                                         || :
   #ln -sf $(build-classpath jmxremoteri) jmxremote.jar                   || :
   #ln -sf $(build-classpath jmxremoteri-optional) jmxremote_optional.jar || :
   #ln -sf $(build-classpath jmxri)                                       || :
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"
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
if [ "%compile_and_run_tests" = "true" ]
then
  ant release -Dbuild.sysclasspath=first tests-report javadocs docs
else
  ant  compile.jmx compile.rjmx compile.tools compile.examples javadocs 
fi

%install
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 dist/lib/%{name}-impl.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-impl-%{version}.jar
install -m 644 dist/lib/%{name}-jmx.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-jmx-%{version}.jar
install -m 644 dist/lib/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-%{version}.jar
install -m 644 dist/lib/%{name}-tools.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-tools-%{version}.jar
install -m 644 dist/lib/%{name}-rjmx.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-rjmx-%{version}.jar
install -m 644 dist/lib/%{name}-rimpl.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-rimpl-%{version}.jar
install -m 644 dist/lib/%{name}-remote.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-remote-%{version}.jar
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}/boa
install -m 644 dist/lib/boa/%{name}-rjmx-boa.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/boa/%{name}-rjmx-boa-%{version}.jar
install -m 644 dist/lib/boa/%{name}-rimpl-boa.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/boa/%{name}-rimpl-boa-%{version}.jar
install -m 644 dist/lib/boa/%{name}-remote-boa.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/boa/%{name}-remote-boa-%{version}.jar
pushd $RPM_BUILD_ROOT%{_javadir}/%{name}
   for jar in *-%{version}.jar ; do
      ln -fs ${jar} $(echo $jar | sed "s|-%{version}.jar|.jar|g")
   done
popd
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -r dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}

%clean
rm -rf $RPM_BUILD_ROOT

%pre
rm -f %{_javadir}/%{name}.jar

%post
/usr/sbin/update-alternatives --install %{_javadir}/jmxri.jar jmxri %{_javadir}/%{name}/%{name}-jmx.jar 0

%postun
if [ "$1" = "0" ]; then
	/usr/sbin/update-alternatives --remove jmxri %{_javadir}/%{name}/%{name}-jmx.jar
fi

%files
%defattr(-,root,root)
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/*.jar
%dir %{_javadir}/%{name}/boa
%{_javadir}/%{name}/boa/*.jar

%files javadoc
%defattr(-,root,root)
%{_javadocdir}/%{name}-%{version}

%files manual
%defattr(0644,root,root,0755)
%doc dist/docs/*

%changelog
openSUSE Build Service is sponsored by