File d-haven-mpool.spec of Package d-haven-mpool

#
# spec file for package d-haven-mpool
#
# Copyright (c) 2011 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}}
%bcond_with             maven
%define section free

Name:           d-haven-mpool
Version:        1.0
Release:        3
Summary:        D-Haven Managed Pool async
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://d-haven.org/
# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/d-haven login
# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/d-haven co -P managed-pool
Source0:        d-haven-mpool-1.0-src.tar.bz2
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        d-haven-mpool-1.0-jpp-depmap.xml
Source5:        d-haven-mpool-1.0.pom
Patch0:         d-haven-mpool-1.0-build_xml.patch
Requires(post): jpackage-utils >= 1.7.2
Requires(postun): jpackage-utils >= 1.7.2
Requires:       concurrent
Requires:       d-haven-event
BuildRequires:  jpackage-utils >= 1.7.2
BuildRequires:  ant >= 1.6.5
BuildRequires:  junit
%if %with maven
BuildRequires:  maven >= 1.1
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%endif
BuildRequires:  concurrent
BuildRequires:  d-haven-event
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
D-Haven Managed Pool is a library designed to provide pools that are
asynchronously managed in a background thread.	The pool system is very
flexible and can accommodate just about every need.  It boasts the
ability to add pool listeners so that you can instrument and intercept
the pooled objects when they are created, destroyed, acquired, and
released.



%package javadoc
License:        Apache-2.0
Summary:        D-Haven Managed Pool async
Group:          Development/Libraries/Java

%description javadoc
D-Haven Managed Pool is a library designed to provide pools that are
asynchronously managed in a background thread.	The pool system is very
flexible and can accommodate just about every need.  It boasts the
ability to add pool listeners so that you can instrument and intercept
the pooled objects when they are created, destroyed, acquired, and
released.



%prep
%setup -q -n managed-pool
find . -name "*.jar" | xargs -t rm
%patch0 -p0

%build
%if %with maven
export DEPCAT=$(pwd)/d-haven-mpool-1.0-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} > d-haven-mpool-1.0-depmap.new.xml
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.javadoc.source=1.4 \
      -Dmaven.repo.remote=file:/usr/share/maven/repository \
      -Dmaven.home.local=$(pwd)/.maven \
      jar javadoc xdoc:transform
%else
export CLASSPATH=$(build-classpath concurrent d-haven-event junit)
CLASSPATH=${CLASSPATH}:target/classes:target/test-classes
export OPT_JAR_LIST=:
ant -Dbuild.sysclasspath=only jar javadoc
%endif

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/managed-pool-1.0.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
# poms
%add_to_maven_depmap %{name} managed-pool %{version} JPP %{name}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}.pom
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# FIXME: (dwalluck): breaks --short-circuit
rm -rf target/docs/apidocs
# manual
%if %with maven
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%endif

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/*
%{_datadir}/maven2/poms/*
%config %{_mavendepmapfragdir}/*

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
#% if %with maven
#% files manual
#% defattr(0644,root,root,0755)
#% {_docdir}/%{name}-%{version}
#% endif

%changelog
openSUSE Build Service is sponsored by