File xmlbeans-mini.spec of Package xmlbeans

#
# spec file for package xmlbeans-mini (Version 2.1.0)
#
# Copyright (c) 2010 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/
#

# norootforbuild

%define bootstrap 1
%define with_maven 0
%define section         free
%define source_top      %{name}-%{cvs_version}
%define real xmlbeans

Name:           xmlbeans-mini
# This line is not a comment, please do not remove it!
#%(sh %{_sourcedir}/jpackage-mini-prepare.sh %{_sourcedir} %{name})
Version:        2.1.0
Release:        7
Summary:        XML-Java binding tool
Url:            http://xmlbeans.apache.org 
# Removal of .xsd files with problematic license
# find xmlbeans-2.1.0/test/cases/xbean/compile/scomp -iname '*.xsd' | xargs rm -rf
Source0:        %{real}-%{version}-src-free.tar.bz2
Source1000:     jpackage-mini-prepare.sh
# svn export http://svn.apache.org/repos/asf/xmlbeans/tags/2.1.0
Patch0:         xmlbeans-2.1.0-maven-plugin-project_xml.patch
Patch1:         xmlbeans-2.1.0-SchemaTypesTests.patch
Patch2:         xmlbeans-2.1.0-build_xml.patch
Patch3:         xmlbeans-2.1.0-XBeansXPath.patch
Patch4:         xmlbeans-2.1.0-XBeansXQuery.patch
Patch5:         xmlbeans-2.1.0-alltests.patch
Patch6:         xmlbeans-2.1.0-scripts.patch
Patch7:         xmlbeans-2.1.0-remove-svn.patch
License:        Apache-2.0
Group:          Development/Libraries/Java
BuildRequires:  jpackage-utils >= 1.5
BuildRequires:  ant >= 1.6
%if ! %{bootstrap}
BuildRequires:  ant-junit
BuildRequires:  ant-contrib
BuildRequires:  junit
BuildRequires:  ant-nodeps
BuildRequires:  xml-commons-resolver >= 1.1
BuildRequires:  bea-stax-api
BuildRequires:  saxon8 saxon8-xpath
BuildRequires:  dom2-core-tests
BuildRequires:  java-devel
%if %{with_maven}
BuildRequires:  maven >= 1.1
%endif
BuildRequires:  ant-trax
%else
BuildRequires:  java-1_5_0-gcj-compat-devel
BuildRequires:  xerces-j2-bootstrap
BuildRequires:  xml-commons-apis-bootstrap
BuildRequires:  xml-commons-resolver-bootstrap
#!BuildIgnore:  xerces-j2 xml-commons xml-commons-apis xml-commons-resolver
%endif
BuildRequires:  unzip
#!BuildIgnore:  antlr antlr-java
#!BuildIgnore:  xml-commons-jaxp-1.3-apis xml-commons-resolver12
Requires:       jpackage-utils >= 1.6
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       %{real} = %{version}-%{release}

%description
XMLBeans is a tool that allows you to access the full power of XML in a
Java friendly way. It is an XML-Java binding tool. The idea is that you
can take advantage the richness and features of XML and XML Schema and
have these features mapped as naturally as possible to the equivalent
Java language and typing constructs. XMLBeans uses XML Schema to
compile Java interfaces and classes that you can then use to access and
modify XML instance data. Using XMLBeans is similar to using any other
Java interface/class, you will see things like getFoo or setFoo just as
you would expect when working with Java. While a major use of XMLBeans
is to access your XML instance data with strongly typed Java classes
there are also API's that allow you access to the full XML infoset
(XMLBeans keeps full XML Infoset fidelity) as well as to allow you to
reflect into the XML schema itself through an XML Schema Object model.



%package javadoc
License:        Apache-2.0
Summary:        XML-Java binding tool
Group:          Development/Libraries/Java

%description javadoc
XMLBeans is a tool that allows you to access the full power of XML in a
Java friendly way. It is an XML-Java binding tool. The idea is that you
can take advantage the richness and features of XML and XML Schema and
have these features mapped as naturally as possible to the equivalent
Java language and typing constructs. XMLBeans uses XML Schema to
compile Java interfaces and classes that you can then use to access and
modify XML instance data. Using XMLBeans is similar to using any other
Java interface/class, you will see things like getFoo or setFoo just as
you would expect when working with Java. While a major use of XMLBeans
is to access your XML instance data with strongly typed Java classes
there are also API's that allow you access to the full XML infoset
(XMLBeans keeps full XML Infoset fidelity) as well as to allow you to
reflect into the XML schema itself through an XML Schema Object model.



%{summary}.

%package manual
License:        Apache-2.0
Summary:        XML-Java binding tool
Group:          Development/Libraries/Java

%description manual
XMLBeans is a tool that allows you to access the full power of XML in a
Java friendly way. It is an XML-Java binding tool. The idea is that you
can take advantage the richness and features of XML and XML Schema and
have these features mapped as naturally as possible to the equivalent
Java language and typing constructs. XMLBeans uses XML Schema to
compile Java interfaces and classes that you can then use to access and
modify XML instance data. Using XMLBeans is similar to using any other
Java interface/class, you will see things like getFoo or setFoo just as
you would expect when working with Java. While a major use of XMLBeans
is to access your XML instance data with strongly typed Java classes
there are also API's that allow you access to the full XML infoset
(XMLBeans keeps full XML Infoset fidelity) as well as to allow you to
reflect into the XML schema itself through an XML Schema Object model.



%{summary}.
%if %{with_maven}

%package maven-plugin


Summary:        Maven plugin for %{name}
Group:          Development/Libraries/Java
Requires:       %{name} >= 2.0
Requires:       maven >= 1.1
Requires:       bea-stax-api
Requires:       xml-commons-resolver

%description maven-plugin

%{summary}.
%endif

%package scripts
License:        Apache-2.0
Summary:        XML-Java binding tool
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description scripts
XMLBeans is a tool that allows you to access the full power of XML in a
Java friendly way. It is an XML-Java binding tool. The idea is that you
can take advantage the richness and features of XML and XML Schema and
have these features mapped as naturally as possible to the equivalent
Java language and typing constructs. XMLBeans uses XML Schema to
compile Java interfaces and classes that you can then use to access and
modify XML instance data. Using XMLBeans is similar to using any other
Java interface/class, you will see things like getFoo or setFoo just as
you would expect when working with Java. While a major use of XMLBeans
is to access your XML instance data with strongly typed Java classes
there are also API's that allow you access to the full XML infoset
(XMLBeans keeps full XML Infoset fidelity) as well as to allow you to
reflect into the XML schema itself through an XML Schema Object model.



%{summary}.

%prep
%setup -q -n %{real}-%{version}
chmod -R go=u-w *
chmod a-x LICENSE.txt
for j in $(find . -name "*.jar"); do
    jj=$(basename $j)
    m=$(expr $jj : '\(piccolo_apache_dist\).*') || :
    n=$(expr $jj : '\(jam-\).*') || :
    if [ "$m" != "piccolo_apache_dist" -a "$n" != "jam-" ]; then
       mv $j $j.no
    fi
done
mkdir -p build/lib
pushd build/lib
ln -sf $(build-classpath xml-commons-resolver) resolver.jar
ln -sf $(build-classpath bea-stax-api) jsr173_1.0_api.jar
popd
pushd external/lib
mv oldxbean.jar.no oldxbean.jar
popd
pushd test/lib
ln -sf $(build-classpath dom2-core-tests) w3c_domts.jar
popd
pushd test/tools/lib
ln -sf $(build-classpath ant) .
%if ! %{bootstrap}
ln -sf $(build-classpath junit) .
ln -sf $(build-classpath ant/ant-junit) .
%endif
pushd ant-ext
%if ! %{bootstrap}
ln -sf $(build-classpath ant-contrib) ant-contrib-0.6.jar
%endif
mkdir tmp
cd tmp
jar xf ../antexts.jar.no
rm -rf antexts* META-INF
cd src
JAVAC_ARGS=""
if [[ $(readlink -f /etc/alternatives/java_sdk | grep gcj) ]]; then
JAVAC_ARGS=" -C "
fi
javac ${JAVAC_ARGS} -classpath $(build-classpath ant) $(find . -name "*.java")
jar cf ../../antexts.jar $(find . -name "*.class") antexts.properties
popd
popd
%patch0 -b .orig
%patch1 -b .orig
%patch2 -b .orig
%patch3 -b .orig
%patch4 -b .orig
%patch5 -b .orig
%patch6 -b .orig
%patch7 -b .sav7

%build
export XMLBEANS_EXTERNALS=/usr/share/java
export XMLBEANS_HOME=`pwd`
%if %{bootstrap}
ant xmlpublic.jar
%else
ant default docs 
%if %{with_maven}
pushd maven-plugin
    maven -Dmaven.repo.remote=file:/usr/share/maven/repository jar:jar
popd
%endif
ant checkintest
%endif

%install
# jar
install -d -m 0755 $RPM_BUILD_ROOT%{_javadir}/%{real}
install -p -m 0644 build/lib/xmlpublic.jar $RPM_BUILD_ROOT%{_javadir}/%{real}/xmlpublic-%{version}.jar
ln -s xmlpublic-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{real}/xmlpublic.jar
%if ! %{bootstrap}
install -p -m 0644 build/lib/xbean_xpath.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/xbean_xpath-%{version}.jar
install -p -m 0644 build/lib/xbean.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/xbean-%{version}.jar
ln -s xbean_xpath-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/xbean_xpath.jar
ln -s xbean-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/xbean.jar
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
cp -pr xkit $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}
# bin
install -d -m 0755 $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/dumpxsb   $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/inst2xsd  $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/scomp     $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/sdownload $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/sfactor   $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/svalidate $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/validate  $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/xpretty   $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/xsd2inst  $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/xsdtree   $RPM_BUILD_ROOT%{_bindir}
install -p -m 0755 bin/xstc      $RPM_BUILD_ROOT%{_bindir}
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr build/docs/reference/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
rm -rf build/docs/reference
# manual
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr build/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp LICENSE.txt $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%if %{with_maven}
# maven-plugin
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven/repository/JPP/plugins
cp -p maven-plugin/target/xmlbeans-maven-plugin-2.0.0-beta1.jar \
 $RPM_BUILD_ROOT%{_datadir}/maven/repository/JPP/plugins/maven-%{name}-plugin-%{version}.jar
ln -s maven-%{name}-plugin-%{version}.jar $RPM_BUILD_ROOT%{_datadir}/maven/repository/JPP/plugins/maven-%{name}-plugin.jar
%endif
%endif #if ! %{bootstrap}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc LICENSE.txt
%{_javadir}/*
%if ! %{bootstrap}
%{_datadir}/%{name}-%{version}

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

%files manual
%defattr(0644,root,root,0755)
%{_docdir}/%{name}-%{version}
%if %{with_maven}

%files maven-plugin
%defattr(0644,root,root,0755)
%{_datadir}/maven/repository/JPP/plugins/maven-%{name}-plugin-%{version}.jar
%{_datadir}/maven/repository/JPP/plugins/maven-%{name}-plugin.jar
%endif

%files scripts
%defattr(0644,root,root,0755)
%attr(0755,root,root) %{_bindir}/*
%endif #if ! %{bootstrap}

%changelog