File castor.spec of Package castor

#
# spec file for package castor
#
# Copyright (c) 2014 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
Version:        0.9.5
Release:        0
Summary:        An Open Source Data Binding Framework for Java
License:        BSD-3-Clause
Group:          Development/Libraries/Java
Url:            http://castor.codehaus.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
Patch1:         castor-0.9.5-CVE-2014-3004.patch
BuildRequires:  adaptx
BuildRequires:  ant
#!BuildIgnore:  java-1_6_0-openjdk java-1_6_0-openjdk-devel
#!BuildIgnore:  java-1_7_0-openjdk java-1_7_0-openjdk-devel
BuildRequires:  fdupes
BuildRequires:  java-1_5_0-gcj-compat-devel
BuildRequires:  jta
BuildRequires:  junit
BuildRequires:  ldapjdk
BuildRequires:  regexp
BuildRequires:  servletapi3
BuildRequires:  xerces-j2-xml-apis
Requires:       adaptx
Requires:       jdbc-stdext
Requires:       jndi
Requires:       jta
Requires:       ldapjdk
Requires:       oro
Requires:       regexp
Requires:       xerces-j2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%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
Summary:        Demonstration and sample file for castor
Group:          Development/Libraries/Java
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
Summary:        Tests for castor
Group:          Development/Libraries/Java
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
Summary:        XML support for castor
Group:          Development/Libraries/Java
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 doc
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
%patch1 -p1
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;' {} \;

# junit.swingui is missing in junit 4
rm -rf src/tests/org/exolab/castor/tests/framework/CastorTestSuiteRunner.java

%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 xerces-j2-xml-apis)
ant -buildfile src/build.xml jar
ant -buildfile src/build.xml examples
ant -buildfile src/build.xml CTFjar

%install
#export ANT_OPTS="--param max-fields-for-field-sensitive=1 -O1"
export GC_MAXIMUM_HEAP_SIZE="134217728"
# jar
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 dist/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
install -m 644 dist/%{name}-%{version}-xml.jar %{buildroot}%{_javadir}/%{name}-xml-%{version}.jar
install -m 644 dist/CTF-%{version}.jar %{buildroot}%{_javadir}/%{name}-tests-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
# examples (demo)
install -d -m 755 %{buildroot}%{_datadir}/%{name}/examples
cp -pr build/examples/* %{buildroot}%{_datadir}/%{name}/examples

# do this last, since it will delete all build directories
export CLASSPATH=%(build-classpath adaptx log4j xerces-j2-xml-apis)
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%{_sysconfdir}/{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 doc
%defattr(0644,root,root,0755)
%doc build/doc/*

%changelog
openSUSE Build Service is sponsored by