File saxon.spec of Package saxon
#
# spec file for package saxon
#
# Copyright (c) 2012 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/
#
Summary: The SAXON XSLT Processor from Michael Kay
License: MPL-1.0 and Apache-2.0
Group: Productivity/Publishing/XML
# net.sf.saxon.om.XMLChar is from ASL-licensed Xerces
Name: saxon
Version: 9.3.0.4
Release: 0
Url: http://saxon.sourceforge.net/
Source0: https://downloads.sourceforge.net/project/saxon/Saxon-HE/9.3/saxon9-3-0-4source.zip
Source1: %{name}.saxon.script
Source2: %{name}.saxonq.script
Source3: %{name}.build.script
Source4: %{name}.1
Source5: %{name}q.1
Source6: https://downloads.sourceforge.net/project/saxon/Saxon-HE/9.3/saxon-resources9-3.zip
Source7: http://irrational.googlecode.com/svn/trunk/maven-repo/net/sf/saxon/saxon-he/9.3.0.4/saxon-he-9.3.0.4.pom
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: ant
BuildRequires: bea-stax-api
BuildRequires: dom4j
BuildRequires: java-devel
BuildRequires: jdom
BuildRequires: unzip
BuildRequires: xml-commons-apis
BuildRequires: xom
BuildRequires: java-javadoc
#BuildRequires: jdom-javadoc >= 1.0
#BuildRequires: fop-javadoc
Requires: bea-stax
Requires: bea-stax-api
Provides: jaxp_transform_impl = %{version}-%{release}
# Older versions were split into multile packages
Obsoletes: %{name}-dom < %{version}-%{release}
Provides: %{name}-dom = %{version}-%{release}
Obsoletes: %{name}-jdom < %{version}-%{release}
Provides: %{name}-jdom = %{version}-%{release}
Obsoletes: %{name}-sql < %{version}-%{release}
Provides: %{name}-sql = %{version}-%{release}
Obsoletes: %{name}-xom < %{version}-%{release}
Provides: %{name}-xom = %{version}-%{release}
Obsoletes: %{name}-xpath < %{version}-%{release}
Provides: %{name}-xpath = %{version}-%{release}
%description
The SAXON package is a collection of tools for processing XML
documents. The main components are:
* An XSLT processor, which implements the Version 1.0 XSLT and XPath
Recommendations from the World Wide Web Consortium, found at
http://www.w3.org/TR/1999/REC-xslt-19991116 and
http://www.w3.org/TR/1999/REC-xpath-19991116 with a number of
powerful extensions. This version of Saxon also includes many of
the new features defined in the XSLT 1.1 working draft, but for
conformance and portability reasons these are not available if
the stylesheet header specifies version="1.0".
* A Java library, which supports a similar processing model to XSL,
but allows full programming capability, which you need if you
want to perform complex processing of the data or to access
external services such as a relational database
* A slightly improved version of the Aelfred parser from Microstar.
(But you can use SAXON with any SAX-compliant XML parser if you
prefer).
So you can use SAXON by writing XSLT stylesheets, by writing Java
applications, or by any combination of the two.
%package manual
Summary: Manual for saxon
Group: Productivity/Publishing/XML
%description manual
Manual for saxon.
%package javadoc
Summary: Javadoc for saxon
Group: Productivity/Publishing/XML
%description javadoc
Javadoc for saxon.
%package demo
Summary: Demos for saxon
Group: Productivity/Publishing/XML
Requires: %{name} = %{version}-%{release}
%description demo
Demonstrations and samples for saxon.
%package scripts
Summary: Utility scripts for saxon
Group: Productivity/Publishing/XML
Requires: %{name} = %{version}-%{release}
Requires: jpackage-utils >= 1.6
%description scripts
Utility scripts for saxon.
%prep
%setup -q -c
unzip -q %{SOURCE6}
cp -p %{SOURCE3} ./build.xml
# deadNET
rm -rf net/sf/saxon/dotnet
# Depends on XQJ (javax.xml.xquery)
rm -rf net/sf/saxon/xqj
# This requires a EE edition feature (com.saxonica.xsltextn)
rm -rf net/sf/saxon/option/sql/SQLElementFactory.java
# cleanup unnecessary stuff we'll build ourselves
rm -rf docs/api
find . \( -name "*.jar" -name "*.pyc" \) -delete
%build
mkdir -p build/classes
cat >build/classes/edition.properties <<EOF
config=net.sf.saxon.Configuration
platform=net.sf.saxon.java.JavaPlatform
EOF
export CLASSPATH=%(build-classpath xml-commons-apis jdom xom bea-stax-api dom4j)
ant \
-Dj2se.javadoc=%{_javadocdir}/java \
-Djdom.javadoc=%{_javadocdir}/jdom
%install
# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p build/lib/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr build/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# demo
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -pr samples/* $RPM_BUILD_ROOT%{_datadir}/%{name}
# scripts
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -p -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/%{name}
install -p -m755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/%{name}q
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
install -p -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
install -p -m644 %{SOURCE5} $RPM_BUILD_ROOT%{_mandir}/man1/%{name}q.1
# jaxp_transform_impl ghost symlink
ln -s %{_sysconfdir}/alternatives \
$RPM_BUILD_ROOT%{_javadir}/jaxp_transform_impl.jar
# a simple POM
install -dm 755 $RPM_BUILD_ROOT%{_mavenpomdir}
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
sed -i -e 's/saxon-he/saxon/' $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
#FIXME: some strange python exception even with javapackages-tools 0.3.1
# % add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_to_maven_depmap JPP-%{name}.pom %{name}.jar
%clean
rm -rf $RPM_BUILD_ROOT
%post
update-alternatives --install %{_javadir}/jaxp_transform_impl.jar \
jaxp_transform_impl %{_javadir}/%{name}.jar 25
%preun
{
[ $1 -eq 0 ] || exit 0
update-alternatives --remove jaxp_transform_impl %{_javadir}/%{name}.jar
} >/dev/null 2>&1 || :
%pre javadoc
# workaround for rpm bug
[ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \
rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || :
%files
%defattr(0644,root,root,0755)
%{_javadir}/%{name}.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%ghost %{_javadir}/jaxp_transform_impl.jar
%files manual
%defattr(0644,root,root,0755)
%doc doc/*.html
%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}
%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}
%files scripts
%defattr(0755,root,root,0755)
%{_bindir}/%{name}
%{_bindir}/%{name}q
%attr(0644,root,root) %{_mandir}/man1/%{name}.1*
%attr(0644,root,root) %{_mandir}/man1/%{name}q.1*
%changelog