File jakarta-commons-transaction.spec of Package jakarta-commons-transaction

#
# spec file for package jakarta-commons-transaction (Version 1.1)
#
# 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 with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%define _without_maven 1
%bcond_with maven
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}
%define section   free
%define base_name commons-transaction

Name:           jakarta-commons-transaction
Version:        1.1
Release:        2
Summary:        Commons Transaction
License:        Apache-2.0
Url:            http://jakarta.apache.org/commons/transaction/
Group:          Development/Libraries/Java
Source0:        commons-transaction-1.1-src.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        commons-transaction-1.1-jpp-depmap.xml
Patch0:         commons-transaction-1.1-project_xml.patch
Requires:       jakarta-commons-codec
Requires:       log4j
#Requires:       jta
Requires:       geronimo-jta-1_1-api
Requires:       xerces-j2
Requires:       xml-commons-apis
BuildRequires:  jpackage-utils >= 1.7
BuildRequires:  ant >= 1.6
%if %with maven
BuildRequires:  maven >= 1.0.2
BuildRequires:  maven-plugins-base
BuildRequires:  maven-plugin-test
BuildRequires:  maven-plugin-xdoc
BuildRequires:  maven-plugin-license
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%endif
#BuildRequires:  jta
BuildRequires:  geronimo-jta-1_1-api
BuildRequires:  junit
BuildRequires:  jakarta-commons-beanutils
BuildRequires:  jakarta-commons-codec
BuildRequires:  log4j
BuildRequires:  xerces-j2
BuildRequires:  xml-commons-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Commons Transaction aims at providing lightweight, standardized, well
tested and efficient implementations of utility classes commonly used
in transactional Java programming. Initially there are implementations
for multi level locks, transactional collections and transactional file
access. There may be additional implementations when the common need
for them becomes obvious. However, the complete component shall remain
compatible to JDK1.2 and should have minimal dependencies.



%package javadoc
License:        Apache-2.0
Summary:        Commons Transaction
Group:          Development/Libraries/Java

%description javadoc
Commons Transaction aims at providing lightweight, standardized, well
tested and efficient implementations of utility classes commonly used
in transactional Java programming. Initially there are implementations
for multi level locks, transactional collections and transactional file
access. There may be additional implementations when the common need
for them becomes obvious. However, the complete component shall remain
compatible to JDK1.2 and should have minimal dependencies.



%prep
%setup -q -c -n %{base_name}
find . -name "*.jar" | xargs rm
%if %with maven
export DEPCAT=$(pwd)/commons-transaction-1.1-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    %{_bindir}/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
%{_bindir}/saxon $DEPCAT %{SOURCE2} > commons-transaction-1.1-depmap.new.xml
%endif
%patch0 -b .sav

%build
%if %with maven
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    %{_bindir}/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
    popd
done
maven -Dmaven.repo.remote=file:/usr/share/maven/repository \
      -Dmaven.javadoc.source=1.4 \
      -Dmaven.home.local=$(pwd)/.maven \
      jar javadoc 
%else
export CLASSPATH=$(build-classpath commons-codec jta log4j):`pwd`/build/classes
export OPT_JAR_LIST=:
ant -Dbuild.sysclasspath=only jar javadocs
%endif

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
%if %with maven
install -m 644 target/commons-transaction-1.1.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
%else
install -m 644 build/lib/commons-transaction-1.1.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
%endif
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in jakarta-*; do \
ln -sf ${jar} ${jar/jakarta-/}; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do \
ln -sf ${jar} ${jar/-%{version}/}; done)
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%if %with maven
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%else
cp -pr build/doc/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%endif
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# FIXME: (dwalluck): this breaks -bi --short-circuit
rm -rf target/docs/apidocs

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/*

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

%changelog
* Fri May 15 2009 mvyskocil@suse.cz
- 'Initial SUSE packaging'