File castor.spec of Package castor

#
# spec file for package castor
#
# 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/
#



Name:           castor
BuildRequires:  adaptx ant java-1_5_0-gcj-compat-devel jta junit ldapjdk regexp servletapi3 xml-commons-apis
#!BuildIgnore:  java-1_6_0-openjdk java-1_6_0-openjdk-devel
BuildRequires:  fdupes
%define name            castor
%define version         0.9.5
%define release         1jpp
%define section         free
Summary:        An Open Source Data Binding Framework for Java
Version:        0.9.5
Release:        308
Group:          Development/Libraries/Java
License:        BSD3c
Url:            http://www.castor.org/
Source0:        ftp://ftp.exolab.org/pub/castor/castor_0.9.5/castor-0.9.5-src.tar.bz2
Patch0:         castor-unicode-document-fix.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       adaptx
Requires:       jdbc-stdext
Requires:       jndi
Requires:       jta
Requires:       ldapjdk
Requires:       oro
Requires:       regexp
Requires:       xerces-j2

%description
Castor is an open source data binding framework for Java. It is
basically the shortest path between Java objects, XML documents, and
SQL tables. Castor provides Java to XML binding, Java to SQL
persistence, and more.



%package demo
License:        BSD3c
Group:          Development/Libraries/Java
Summary:        Demonstration and sample file for castor
Requires:       %{name} = %{version}-%{release}
Requires:       servletapi3

%description demo
Castor is an open source data binding framework for Java. It's
basically the shortest path between Java objects, XML documents and SQL
tables. Castor provides Java to XML binding, Java to SQL persistence,
and then some more.

This package contains demonstration and sample files for Castor.



%package test
License:        BSD3c
Group:          Development/Libraries/Java
Summary:        Tests for castor
Requires:       %{name} = %{version}-%{release}
Requires:       junit

%description test
Castor is an open source data binding framework for Java. It's
basically the shortest path between Java objects, XML documents and SQL
tables. Castor provides Java to XML binding, Java to SQL persistence,
and then some more.

This package contains tests for Castor.



%package xml
License:        BSD3c
Group:          Development/Libraries/Java
Summary:        XML support for castor
Requires:       %{name} = %{version}-%{release}

%description xml
Castor is an open source data binding framework for Java. It's
basically the shortest path between Java objects, XML documents and SQL
tables. Castor provides Java to XML binding, Java to SQL persistence,
and then some more.

This package contains XML support for Castor.



%package javadoc
License:        BSD3c
Group:          Development/Libraries/Java
Summary:        Javadoc for castor
PreReq:         coreutils

%description javadoc
Castor is an open source data binding framework for Java. It's
basically the shortest path between Java objects, XML documents and SQL
tables. Castor provides Java to XML binding, Java to SQL persistence,
and then some more.

This package contains the javadoc documentation for Castor.



%package doc
License:        BSD3c
Summary:        Documentation for castor
Group:          Development/Libraries/Java

%description doc
Castor is an open source data binding framework for Java. It's
basically the shortest path between Java objects, XML documents and SQL
tables. Castor provides Java to XML binding, Java to SQL persistence,
and then some more.

This package contains the documentation for Castor.



%prep
%setup -q
%patch0 -b .sav
find . -name "*.jar" -exec rm -f {} \;
perl -p -i -e 's|org.apache.xerces.utils.regex|org.apache.xerces.impl.xpath.regex|g;' \
src/main/org/exolab/castor/util/XercesRegExpEvaluator.java
find . -name "*.java" -exec perl -p -i -e 's|assert\(|assertTrue\(|g;' {} \;
find . -name "*.java" -exec perl -p -i -e 's|_test.name\(\)|_test.getName\(\)|g;' {} \;

%build
if ! grep -q "javac.*source=" src/build.xml ; then
  perl -p -i -e 's|<javac |<javac source=\"1.4\" |' src/build.xml
  perl -p -i -e 's|<javadoc |<javadoc source=\"1.4\" |' src/build.xml
fi
export GC_MAXIMUM_HEAP_SIZE="134217728"
export CLASSPATH=%(build-classpath adaptx jta junit ldapjdk oro regexp servletapi3 xerces)
export LC_ALL="en_US.UTF-8" # necessary for javadoc
ant -buildfile src/build.xml jar
ant -buildfile src/build.xml examples
ant -buildfile src/build.xml CTFjar
ant -buildfile src/build.xml javadoc

%install
#export ANT_OPTS="--param max-fields-for-field-sensitive=1 -O1"
export GC_MAXIMUM_HEAP_SIZE="134217728"
# jar
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 dist/%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
install -m 644 dist/%{name}-%{version}-xml.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-xml-%{version}.jar
install -m 644 dist/CTF-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-tests-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
# examples (demo)
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/examples
cp -pr build/examples/* $RPM_BUILD_ROOT%{_datadir}/%{name}/examples
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr build/doc/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
# do this last, since it will delete all build directories
export CLASSPATH=%(build-classpath adaptx log4j)
ant -buildfile src/build.xml doc
# like magic
%jpackage_script org.exolab.castor.builder.SourceGenerator %{nil} %{nil} xerces-j2:%{name} %{name}
%fdupes -s %{buildroot}

%files
%defattr(0644,root,root,0755)
%doc src/etc/{CHANGELOG,LICENSE,README}
%attr(0755,root,root) %{_bindir}/%{name}
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%dir %{_datadir}/%{name}

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

%files test
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-tests-%{version}.jar
%{_javadir}/%{name}-tests.jar

%files xml
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-xml-%{version}.jar
%{_javadir}/%{name}-xml.jar

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

%files doc
%defattr(0644,root,root,0755)
%doc build/doc/*

%changelog
openSUSE Build Service is sponsored by