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

#
# spec file for package d-haven-event (Version 1.1.0)
#
# 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}}
%bcond_with             maven
%define section free

Name:           d-haven-event
Version:        1.1.0
Release:        2
Summary:        D-Haven Event based processing
License:        The Apache Software License
Url:            http://d-haven.org/
Group:          Development/Libraries/Java
Source0:        http://dist.d-haven.org/d-haven-event/src/d-haven-event-1.1.0-src.tar.gz
Source1:        pom-maven2jpp-depcat.xsl
Source2:        pom-maven2jpp-newdepmap.xsl
Source3:        pom-maven2jpp-mapdeps.xsl
Source4:        d-haven-event-1.1.0-jpp-depmap.xml
Source5:        d-haven-event-1.1.0-navigation.xml
Source6:        d-haven-event-1.1.0.pom
Patch0:         d-haven-event-1.1.0-build_xml.patch
Requires:       concurrent
BuildRequires:  jpackage-utils >= 1.7.2
BuildRequires:  ant >= 1.6.5
BuildRequires:  junit
BuildRequires:  ant-junit
%if %with maven
BuildRequires:  maven >= 1.1
BuildRequires:  saxon
BuildRequires:  saxon-scripts
%endif
BuildRequires:  concurrent
PreReq:         jpackage-utils >= 1.7.2
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
D-Haven Event is a library designed to make it easier to develop event
based processing systems.  It also includes a CommandManager to handle
certain activities behind the scenes in a controlled number of
background threads.  The library has been fully tested, and all
dependencies have been brought to a minimum.



%package javadoc
License:        The Apache Software License
Summary:        D-Haven Event based processing
Group:          Development/Libraries/Java

%description javadoc
D-Haven Event is a library designed to make it easier to develop event
based processing systems.  It also includes a CommandManager to handle
certain activities behind the scenes in a controlled number of
background threads.  The library has been fully tested, and all
dependencies have been brought to a minimum.



%prep
%setup -q -n %{name}-%{version}
# Already clean
#find . -name "*.jar" | xargs rm
%patch0 -p0
mkdir -p xdocs
cp -p %{SOURCE5} xdocs/navigation.xml

%build
%if %with maven
export DEPCAT=$(pwd)/d-haven-event-1.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)
    /usr/bin/saxon project.xml %{SOURCE1} >> $DEPCAT
    popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon $DEPCAT %{SOURCE2} > d-haven-event-1.1.0-depmap.new.xml
for p in $(find . -name project.xml); do
    pushd $(dirname $p)
    cp project.xml project.xml.orig
    /usr/bin/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 junit)
CLASSPATH=${CLASSPATH}:target/classes:target/test-classes
export OPT_JAR_LIST="junit ant/ant-junit"
ant \
    -Dsource=1.4 \
    -Dbuild.sysclasspath=only \
    jar javadoc
%endif

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/d-haven-event-1.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)
%add_to_maven_depmap %{name} %{name} %{version} JPP %{name}
# poms
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE6} \
    $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
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%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
* Fri May 15 2009 mvyskocil@suse.cz
- 'Initial SUSE packaging of d-haven-event (from japckage.org)'
openSUSE Build Service is sponsored by