File jgroups.spec of Package jgroups

#
# spec file for package jgroups (Version 2.6.10)
#
# 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/
#

# norootforbuild

%define _with_repolib 1
%define with_repolib %{?_with_repolib:1}%{!?_with_repolib:0}
%define without_repolib %{!?_with_repolib:1}%{?_with_repolib:0}
%define repodir %{_javadir}/repository.jboss.com/jgroups/2.4.1.SP4-brew
%define repodirlib %{repodir}/lib
%define repodirsrc %{repodir}/src
# If you don't want to run the unit tests
# give rpmbuild option '--without tests'
%define with_tests %{!?_without_tests:1}%{?_without_tests:0}
%define without_tests %{?_without_tests:1}%{!?_without_tests:0}
%define section free

Name:           jgroups
Version:        2.6.10
Release:        2
%define dirname JGroups-%{version}.merge.src
Summary:        Toolkit for reliable multicast communication
License:        LGPL-2.0+
Url:            http://www.jgroups.org/
Group:          Development/Libraries/Java
# get source zip from sf.net
# unzip -q JGroups-2.6.10.merge.src.zip
# find JGroups-2.6.10.merge.src/ -iname *.jar | xargs rm -rf
# ## bnc#509439
# cd JGroups-2.6.10.merge.src
# rm -rf doc/
# cvs -d:pserver:anonymous@javagroups.cvs.sourceforge.net:/cvsroot/javagroups login 
# cvs -z3 -d:pserver:anonymous@javagroups.cvs.sourceforge.net:/cvsroot/javagroups co -P JGroups/doc
# mv JGroups/doc doc/
# rm -rf JGroups
# cd ..
# tar --exclude-vcs -cjf JGroups-2.6.10.merge.src.tar.bz2 JGroups-2.6.10.merge.src/
Source0:        %{dirname}.tar.bz2
Source1:        jgroups-component-info.xml
# To use JGroups one needs:
Requires:       jakarta-commons-logging
# 2.5+ uses java.util.concurrent
#Requires:       concurrent
Requires:       log4j
Requires:       jaxp_parser_impl
Requires:       geronimo-jms-1_1-api
Requires:       bsh
#Optional:       mx4j
Provides:       javagroups = %{version}
Obsoletes:      javagroups < %{version}
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  java-devel >= 1.5.0
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit
BuildRequires:  ant-trax
BuildRequires:  bsh
# 2.5+ uses java.util.concurrent
#BuildRequires:  concurrent
BuildRequires:  jakarta-commons-logging
BuildRequires:  jaxp_parser_impl
BuildRequires:  geronimo-jms-1_1-api
BuildRequires:  junit
BuildRequires:  log4j
BuildRequires:  mx4j
BuildRequires:  xalan-j2
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
JGroups is a toolkit for reliable multicast communication. (Note that
this doesn't necessarily mean IP Multicast, JGroups can also use
transports such as TCP). It can be used to create groups of processes
whose members can send messages to each other. The main features include

    * Group creation and deletion. Group members can be spread across
      LANs or WANs
    * Joining and leaving of groups
    * Membership detection and notification about joined/left/crashed members
    * Detection and removal of crashed members
    * Sending and receiving of member-to-group messages (point-to-multipoint)
    * Sending and receiving of member-to-member messages (point-to-point)

To use JGroups one needs:
 commons-logging.jar
 log4j.jar

To run JGroups you need to have an XML parser installed on your system.
If you use JDK 1.4 or higher, you can use the parser that is shipped with it.

If you want to use the JGroups JMS protocol ( org.jgroups.protocols.JMS ),
then you will also need to place jms.jar somewhere in your CLASSPATH. 

Place the JAR files somewhere in your CLASSPATH , and you're ready to start
using JGroups.

%if %{with_repolib}

%package repolib
License:        LGPL-2.0+
Summary:        Artifacts to be uploaded to a repository library
Group:          Development/Libraries/Java

%description repolib
Artifacts to be uploaded to a repository library.
This package is not meant to be installed but so its contents
can be extracted through rpm2cpio
%endif

%package javadoc
License:        LGPL-2.0+
PreReq:         coreutils
Group:          Development/Libraries/Java
Summary:        Javadoc for jgroups

%description javadoc
JGroups is a toolkit for reliable multicast communication. (Note that
this doesn't necessarily mean IP Multicast, JGroups can also use
transports such as TCP). It can be used to create groups of processes
whose members can send messages to each other. The main features include

    * Group creation and deletion. Group members can be spread across
      LANs or WANs
    * Joining and leaving of groups
    * Membership detection and notification about joined/left/crashed members
    * Detection and removal of crashed members
    * Sending and receiving of member-to-group messages (point-to-multipoint)
    * Sending and receiving of member-to-member messages (point-to-point)

%package manual
License:        LGPL-2.0+
Group:          Development/Libraries/Java
Summary:        Manual for jgroups
Requires:       %{name} = %{version}

%description manual
JGroups is a toolkit for reliable multicast communication. (Note that
this doesn't necessarily mean IP Multicast, JGroups can also use
transports such as TCP). It can be used to create groups of processes
whose members can send messages to each other. The main features include

    * Group creation and deletion. Group members can be spread across
      LANs or WANs
    * Joining and leaving of groups
    * Membership detection and notification about joined/left/crashed members
    * Detection and removal of crashed members
    * Sending and receiving of member-to-group messages (point-to-multipoint)
    * Sending and receiving of member-to-member messages (point-to-point)

%prep
%setup -q -n %{dirname}
find . -type f -name '*.jar' | xargs rm -f
# this test requires bouncycastle
rm tests/junit/org/jgroups/protocols/ENCRYPTAsymmetricTest.java
%if %{with_repolib}
tag=`echo %{name}-%{version}-%{release} | sed 's|\.|_|g'`
sed -i "s/tag=\".*\">/tag=\"$tag\">/g" %{SOURCE1}
%endif

%build
export CLASSPATH=
export OPT_JAR_LIST="ant-launcher ant/ant-junit ant/ant-trax junit xalan-j2 xalan-j2-serializer"
pushd lib
ln -sf $(build-classpath ant) .
ln -sf $(build-classpath ant-launcher) .
ln -sf $(build-classpath ant/ant-junit) .
#BUILD/JGroups-2.4.1.src/lib/bcprov-jdk14-117.jar.no
ln -sf $(build-classpath bsh) .
ln -sf $(build-classpath commons-logging) .
# 2.5+ uses java.util.concurrent from JDK 5
#ln -sf $(build-classpath concurrent) .
ln -sf $(build-classpath jms) .
ln -sf $(build-classpath junit) .
ln -sf $(build-classpath log4j) .
ln -sf $(build-classpath mx4j/mx4j-jmx) .
ln -sf $(build-classpath xalan-j2) .
ln -sf $(build-classpath xalan-j2-serializer) .
popd
%if %{without_tests}
ant jar javadoc gossip-service jgroups-service
%else
#export ANT_OPTS="-Djava.net.preferIPv4Stack=true"
ant jar javadoc gossip-service jgroups-service unittests-xml testreport
%endif

%install
# jar
install -d $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/%{name}-all.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 dist/%{name}-core.jar \
        $RPM_BUILD_ROOT%{_javadir}/%{name}-core-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
# javadoc
install -d $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/
(cd $RPM_BUILD_ROOT%{_javadocdir} && ln -sf %{name}-%{version} %{name})
# services
install -p -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
install -m 644 dist/%{name}*.sar \
        $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
# docs
install -p -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr doc/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%if %{with_repolib}
	install -d -m 755 $RPM_BUILD_ROOT%{repodir}
	install -d -m 755 $RPM_BUILD_ROOT%{repodirlib}
	install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{repodir}/component-info.xml
	install -d -m 755 $RPM_BUILD_ROOT%{repodirsrc}
	install -m 755 %{SOURCE0} $RPM_BUILD_ROOT%{repodirsrc}
	cp -p $RPM_BUILD_ROOT%{_javadir}/jgroups.jar $RPM_BUILD_ROOT%{repodirlib}
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(0644,root,root,0755)
%doc CREDITS INSTALL.html README LICENSE
%{_javadir}/%{name}*jar
%{_datadir}/%{name}-%{version}

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

%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}
%if %{with_repolib}

%files repolib
%defattr(0644,root,root,0755)
%{repodir}
%dir %{_javadir}/repository.jboss.com
%dir %{_javadir}/repository.jboss.com/%{name}
%endif

%changelog