File dita-ot.spec of Package dita-ot
#
# spec file for package dita-ot
#
# 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: dita-ot
BuildRequires: ant-apache-regexp ant-trax dita fop java2-devel-packages xalan-j2 xml-commons-apis xml-commons-resolver xorg-x11-libs
BuildRequires: fdupes
Url: http://dita-ot.sourceforge.net/
Group: Productivity/Publishing/XML
License: Other uncritical OpenSource License
Summary: DITA Open Toolkit
Version: 1.5.1
Release: 1
Source0: http://mesh.dl.sourceforge.net/sourceforge/dita-ot/DITA-OT%{version}_M7_src.tar.bz2
#PATCH-FIX_OPENSUSE: the update-doc task ends up on java.lang.NullPointerException for unknow reason
# so as a workaround, let skip it
Patch0: dita-ot-disable-doc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Requires: jpackage-utils >= 1.5
Requires: fop ant dita
%description
Stylesheets for processing DITA documents.
%define xml_dir %{_datadir}/xml
%define xml_pack_dir %{xml_dir}/dita
%prep
%setup -q -n DITA-OT%{version}-src
%patch0 -p1 -b .update-doc
%build
export ANT_OPTS="-Xmx256M"
#export ANT_OPTS="${ANT_OPTS} -Djavax.xml.transform.TransformerFactory=org.apache.xalan.transformer.TransformerImpl"
#export CLASSPATH=/usr/share/fop-0.20.5/build/fop.jar:/usr/share/fop/lib/batik.jar:/usr/share/fop/lib/avalon-framework-cvs-20020806.jar:$(build-classpath xalan-j2 xalan-j2-serializer)
CLASSPATH="$CLASSPATH:$(build-classpath xerces-j2 xalan-j2 xalan-j2-serializer xml-commons-resolver ant/ant-apache-regexp)"
ant -v -d -buildfile buildPackage.xml
ant all
tar -xf build/DITA-OT%{version}_standard_bin.tar.gz
%install
# prevent suse-filelist-forbiden
find DITA-OT%{version}/ -name '*.orig' | xargs rm -rf
install -d $RPM_BUILD_ROOT/usr/share/dita-ot
cp -a DITA-OT%{version}/* $RPM_BUILD_ROOT/usr/share/dita-ot
pushd $RPM_BUILD_ROOT/usr/share/dita-ot
for f in $(find . -name '*.xml' -o -name '*.xsl'); do
tr -d '\15' <$f >$f.tmp && mv $f.tmp $f
done
# rm -fr dtd
# ln -s /usr/share/xml/dita/schema/dtd/1.0 dtd
install -d $RPM_BUILD_ROOT/usr/share/xml/dita/stylesheet/sf.net
mv xsl $RPM_BUILD_ROOT/usr/share/xml/dita/stylesheet/sf.net/%{version}
ln -s /usr/share/xml/dita/stylesheet/sf.net/%{version} xsl
popd
%fdupes -s %{buildroot}
# %post
# if [ -x %{regcat} ]; then
# for c in %{all_cat}; do
# %{regcat} -a %{sgml_dir}/$c >/dev/null 2>&1
# done
# fi
# edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
# --add /etc/xml/%{FOR_ROOT_CAT}
# exit 0
#
# %postun
# if [ "$1" = "0" -a -x %{regcat} ]; then
# for c in %{all_cat}; do
# %{regcat} -r %{sgml_dir}/$c >/dev/null 2>&1
# done
# fi
# #now XML catalog
# edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
# --del %{name}-%{version}-%{release}
# exit 0
%files
%defattr(-, root, root)
# %doc README
/usr/share/dita-ot
%{xml_dir}/dita/stylesheet
%changelog