File xpp2.spec of Package xpp2

#
# spec file for package xpp2 (Version 2.1.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/
#


%define section free
%define originalname PullParser
Summary:        XML Pull Parser

Name:           xpp2
Version:        2.1.10
Release:        3
License:        Apache 1.1 (Indiana University)
Url:            http://www.extreme.indiana.edu/xgws/xsoap/xpp/
Group:          Development/Libraries/Java
Source0:        http://www.extreme.indiana.edu/xgws/xsoap/xpp/download/PullParser2/PullParser2.1.10.tar.bz2
Patch0:         xpp2-build_xml.patch
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit >= 1.6
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  junit
BuildRequires:  xml-commons-apis
BuildRequires:  fdupes
Requires:       xml-commons-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
XML Pull Parser 2 (XPP2) is a simple and fast incremental XML parser.
NOTE: XPP2 is no longer developed and is on maintenance mode. All
active development concentrates on its successor XPP3/MXP1



%package javadoc
License:        Apache 1.1 (Indiana University)
Summary:        XML Pull Parser
Group:          Development/Libraries/Java

%description javadoc
XML Pull Parser 2 (XPP2) is a simple and fast incremental XML parser.
NOTE: XPP2 is no longer developed and is on maintenance mode. All
active development concentrates on its successor XPP3/MXP1



%package manual
License:        Apache 1.1 (Indiana University)
Summary:        XML Pull Parser
Group:          Development/Libraries/Java

%description manual
XML Pull Parser 2 (XPP2) is a simple and fast incremental XML parser.
NOTE: XPP2 is no longer developed and is on maintenance mode. All
active development concentrates on its successor XPP3/MXP1



%package demo
License:        Apache 1.1 (Indiana University)
Summary:        XML Pull Parser
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description demo
XML Pull Parser 2 (XPP2) is a simple and fast incremental XML parser.
NOTE: XPP2 is no longer developed and is on maintenance mode. All
active development concentrates on its successor XPP3/MXP1



%prep
%setup -q -n %{originalname}%{version}
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%patch0 -b .sav

%build
export OPT_JAR_LIST="ant/ant-junit junit"
export CLASSPATH=$(build-classpath xml-commons-apis)
ant all api api.impl
CLASSPATH=$CLASSPATH:$(build-classpath junit):build/tests:build/lib/PullParser-2.1.10.jar
java AllTests

%install
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p build/lib/%{originalname}-intf-%{version}.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-intf-%{version}.jar
cp -p build/lib/%{originalname}-standard-%{version}.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-standard-%{version}.jar
cp -p build/lib/%{originalname}-%{version}.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
cp -p build/lib/%{originalname}-x2-%{version}.jar \
  $RPM_BUILD_ROOT%{_javadir}/%{name}-x2-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/api
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/api_impl
cp -pr doc/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/api
cp -pr doc/api_impl/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/api_impl
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
rm -rf doc/{build.txt,api,api_impl}
# manual
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
cp -pr doc/* $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
cp -p README.html $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
cp -p LICENSE.txt $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_datadir}/doc/%{name}
# demo
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
cp -pr src/java/samples/* $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_datadir}/%{name}
%fdupes -s %{buildroot}/%{_javadocdir}/%{name}-%{version}

%clean
rm -rf $RPM_BUILD_ROOT

%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
  rm -f %{_javadocdir}/%{name}
fi

%post manual
rm -f %{_datadir}/doc/%{name}
ln -s %{name}-%{version} %{_datadir}/doc/%{name}

%postun manual
if [ "$1" = "0" ]; then
  rm -f %{_datadir}/doc/%{name}
fi

%post demo
rm -f %{_datadir}/%{name}
ln -s %{name}-%{version} %{_datadir}/%{name}

%postun demo
if [ "$1" = "0" ]; then
  rm -f %{_datadir}/%{name}
fi

%files
%defattr(0644,root,root,0755)
%{_datadir}/doc/%{name}-%{version}/README.html
%{_datadir}/doc/%{name}-%{version}/LICENSE.txt
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}-intf.jar
%{_javadir}/%{name}-intf-%{version}.jar
%{_javadir}/%{name}-standard.jar
%{_javadir}/%{name}-standard-%{version}.jar
%{_javadir}/%{name}-x2.jar
%{_javadir}/%{name}-x2-%{version}.jar

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

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

%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}-%{version}
%{_datadir}/%{name}

%changelog
* Tue May 12 2009 mvyskocil@suse.cz
- Initial packaging of xpp2 2.1.10 (from jpackage.org)
openSUSE Build Service is sponsored by