Package xmldb-api: Specfile

BuildRequires: /proc
BuildRequires: jpackage-1.4-compat
# Copyright (c) 2000-2005, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%define gcj_support 0

%define bname		xmldb
%define cvs_version	20041010


Name:		xmldb-api
Version:	0.1
Release:	alt2_0.%{cvs_version}.3jpp1.7
Epoch:		1
Summary:	XML:DB API for Java
License:	BSD style
Group:		Development/Java
Source:		xmldb-xapi-%{cvs_version}-src.tar.gz
# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xmldb-org login
# cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/xmldb-org export -D 2004-10-10 xapi
Url:		http://xmldb-org.sourceforge.net
Requires: xalan-j2
BuildRequires: ant >= 0:1.6
BuildRequires: jpackage-utils >= 0:1.6
BuildRequires: junit
BuildRequires: xalan-j2
%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
Requires(post): java-gcj-compat
Requires(postun): java-gcj-compat
%endif
%if ! %{gcj_support}
BuildArch:      noarch
%endif

%description
The API interfaces are what driver developers must implement when creating a
new driver and are the interfaces that applications are developed against. 
Along with the interfaces a concrete DriverManager implementation is also
provides.

%package sdk
Summary:	SDK for %{name}
Group:		Development/Java
Requires: %{name} = %{version}-%{release}

%description sdk
The reference implementation provides a very simple file system based
implementation of the XML:DB API. This provides what is basically a very
simple native XML database that uses directories to represent collections and
just stores the XML in files.

The driver development kit provides a set of base classes that can be 
extended to simplify and speed the development of XML:DB API drivers. These
classes are used to provide the basis for the reference implementation and
therefore a simple example of how a driver can be implemented. Using the SDK
classes significantly reduces the amount of code that must be written to
create a new driver.

Along with the SDK base classes the SDK also contains a set of jUnit test
cases that can be used to help validate the driver while it is being
developed. The test cases are still in development but there are enough tests
currently to be useful.

%package -n %{bname}-common
Summary:	Common package for %{name}
Group:		Development/Java
Requires:	%{name} = %{version}-%{release}

%description -n %{bname}-common
XMLDB common Package, originally Infozone Tools

%package javadoc
Summary:	Javadoc for %{name}
Group:		Development/Java

%description javadoc
Javadoc for %{name}.

%prep
%setup -q -n xapi
# remove all binary libs
for j in $(find . -name "*.jar"); do
	mv $j $j.no
done

find . -name "*.java" -exec perl -p -i -e 's|assert\(|assertTrue\(|' {} \;
perl -p -i -e 's|return result;;|return result;|' \
api/org/xmldb/api/reference/modules/XPathQueryServiceImpl.java

%build
export CLASSPATH=$(build-classpath junit xalan-j2)
usejikes=false ant -Djarname=%{name} -Dsdk.jarname=%{name}-sdk dist

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/xmldb/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 dist/xmldb/%{name}-sdk.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-sdk-%{version}.jar
install -m 644 dist/xmldb/%{bname}-common.jar $RPM_BUILD_ROOT%{_javadir}/%{bname}-common-%{version}.jar
(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}
cp -pr src/build/javadoc/full/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink

%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

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

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

%if %{gcj_support}
%post
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%if %{gcj_support}
%postun
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%files
%doc src/{AUTHORS,LICENSE,README,config.xml}
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%{_libdir}/gcj/%{name}/%{name}-%{version}.jar.*
%endif

%files sdk
%{_javadir}/%{name}-sdk-%{version}.jar
%{_javadir}/%{name}-sdk.jar
%if %{gcj_support}
%{_libdir}/gcj/%{name}/%{name}-sdk-%{version}.jar.*
%endif

%files -n %{bname}-common
%{_javadir}/%{bname}-common-%{version}.jar
%{_javadir}/%{bname}-common.jar
%if %{gcj_support}
%{_libdir}/gcj/%{name}/%{bname}-common-%{version}.jar.*
%endif

%files javadoc
%{_javadocdir}/%{name}-%{version}
%ghost %{_javadocdir}/%{name}

%changelog
* Sat Apr 21 2007 Igor Vlasenko <viy@altlinux.ru> 1:0.1-alt2_0.20041010.3jpp1.7
- converted from JPackage by jppimport script

* Thu Mar 23 2006 Vladimir Lettiev <crux@altlinux.ru> 20011111-alt2
- Fix build with j2se-1.5

* Sat Apr 23 2005 Vladimir Lettiev <crux@altlinux.ru> 20011111-alt1
- Rebuild for ALT Linux Sisyphus
- spec cleanup
- URL changed

* Thu Aug 26 2004 Ralph Apel <r.apel at r-apel.de> 0:20011111-3jpp
- Build with ant-1.6.2

* Mon May 05 2003 David Walluck <david@anti-microsoft.org> 0:20011111-2jpp
- update for JPackage 1.5
- fix sdk package summary
- fix for newer javac's

* Thu Mar 28 2002 Guillaume Rousse <guillomovitch@users.sourceforge.net> 20011111-1jpp
- first JPackage release