File mingw64-docbook-xsl-stylesheets.spec of Package mingw64-docbook-xsl-stylesheets
#
# spec file for package mingw64-docbook-xsl-stylesheets
#
# Copyright (c) 2015 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/
#
%define dbstyle_dir %{_mingw64_datadir}/xml/docbook/stylesheet/nwalsh
%define dbstyle_catalog %{_name}.xml
%define suse_catalog %{_mingw64_sysconfdir}/xml/suse-catalog.xml
%define xmlcatalog %{_bindir}/xmlcatalog
%define dbstyle_catalog_entry for-catalog-%{_name}-%{version}.xml
%define _name docbook-xsl-stylesheets
Name: mingw64-%{_name}
Summary: XSL Stylesheets for DocBook 4
License: MPL-1.1 and MIT
Group: Productivity/Publishing/DocBook
BuildRequires: fdupes
BuildRequires: libxml2-tools
BuildRequires: mingw64-filesystem
BuildRequires: mingw64-sgml-skel
#BuildRequires: sgml-skel
BuildRequires: unzip
BuildArch: noarch
Requires: mingw64-docbook_4
Requires: mingw64-filesystem
Requires: mingw64-xmlcharent
PreReq: sgml-skel %{_bindir}/xmlcatalog %{_bindir}/edit-xml-catalog
Version: 1.78.1
Release: 0
Source0: http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-%{version}.tar.bz2
Source1: http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-doc-%{version}.tar.bz2
Patch0: docbook-xsl-stylesheets-dbtoepub.patch
%if 0%{suse_version} >= 1600
Patch1: docbook-xsl-stylesheets-fix-python3.patch
%endif
%_mingw64_package_header
Url: http://sourceforge.net/projects/docbook/
#--------------------------------------------------------------------------
%description
These are the XSL stylesheets for DocBook XML and "Simplified" DocBook
DTDs. Use these stylesheets for documents based on DocBook 4 and
earlier; they are not aware of the namespace feature.
The stylesheets transform DocBook documents into HTML, XHTML, Manpages,
XSL-FO (for PDF), and a few other formats.
XSL is a standard W3C stylesheet language for both print and online
rendering. For more information about XSL, see the XSL page at the W3C:
http://www.w3.org/Style/XSL/
%if %{with scripts}
# Package
%package scripts
# License: MPL-1.1 and MIT
Summary: Script to create Indices for FOP
Group: Productivity/Publishing/XML
Requires: ImageMagick
Requires: perl
Requires: ruby
%description scripts
Contains several scripts:
* pdf2index: Create indices for FOP
* db2epub: Create EPUB2 output
* callout-gen: Create callout icons using ImageMagick
This package may be obsolete in the future.
%endif
#--------------------------------------------------------------------------
%prep
%autosetup -p1 -n docbook-xsl-%{version} -b1
#--------------------------------------------------------------------------
%build
#
# Creating catalog entries
#
rel_dbstyle_dir=$(echo %{dbstyle_dir} | sed 's,%{_mingw64_datadir},../../share,g')
#
# /etc/xml/docbook-xsl-stylesheets.xml
#
%{xmlcatalog} --noout --create %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteSystem" \
"http://docbook.sourceforge.net/release/xsl/%{version}" \
"$rel_dbstyle_dir/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteURI" \
"http://docbook.sourceforge.net/release/xsl/%{version}" \
"$rel_dbstyle_dir/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteSystem" \
"http://docbook.sourceforge.net/release/xsl/current" \
"$rel_dbstyle_dir/%{version}" %{dbstyle_catalog}
%{xmlcatalog} --noout --add "rewriteURI" \
"http://docbook.sourceforge.net/release/xsl/current" \
"$rel_dbstyle_dir/%{version}" %{dbstyle_catalog}
#
# temporary file that is added to /etc/xml/suse-catalog.xml
# during post
#
%{xmlcatalog} --noout --create %{dbstyle_catalog_entry}
%{xmlcatalog} --noout --add "delegateSystem" \
"http://docbook.sourceforge.net/release/xsl/" \
"%{dbstyle_catalog}" %{dbstyle_catalog_entry}
%__sed -i -e '/<catalog/a\ <group id="%{_name}">' \
-e '/<\/catalog/i\ </group>' %{dbstyle_catalog_entry}
#--------------------------------------------------------------------------
%install
# Create directories
%__mkdir_p -m755 %{buildroot}%{_mingw64_bindir}
%__mkdir_p -m755 %{buildroot}%{dbstyle_dir}/%{version}
%__mkdir_p -m755 %{buildroot}%{_mingw64_docdir}/%{_name}/html
%__mkdir_p -m755 %{buildroot}%{_mingw64_sysconfdir}/xml
%if %{with scripts}
# Install scripts
%__install -m755 fo/pdf2index %{buildroot}%{_mingw64_bindir}
%__install -m755 epub/bin/dbtoepub %{buildroot}%{_mingw64_bindir}
%__install -m755 slides/images/callouts/gen.sh %{buildroot}%{_mingw64_bindir}/callout-gen
%else
rm fo/pdf2index epub/bin/dbtoepub slides/images/callouts/gen.sh
%endif
# VERSION.xsl
%__install -m644 VERSION.xsl %{buildroot}%{dbstyle_dir}/%{version}
# all the rest is located in subdirectories, exclude some subdirectories with
# stuff not needed
for DIR in $(find -maxdepth 1 -mindepth 1 -type d \( -name "tools" -o -name "doc" -o -name "docsrc" -o -name "tests" \) -prune -o -type d -print ); do
%__tar c $DIR | (cd %{buildroot}%{dbstyle_dir}/%{version}; %__tar xp);
done
# fixing permission errors from sources
find %{buildroot}%{dbstyle_dir}/%{version} -type f -exec %__chmod 644 {} \;
find %{buildroot}%{dbstyle_dir}/%{version} -type d -exec %__chmod 755 {} \;
%__chmod 755 %{buildroot}%{dbstyle_dir}/%{version}/extensions/xslt.py
# create current link
# but not for snapshots
#
if ! echo %{S:0} | grep -q snapshot; then
pushd %{buildroot}%{dbstyle_dir} >/dev/null
ln -sf %{version} current
popd >/dev/null
fi
# install the catalog files
#
%__install -m644 %{dbstyle_catalog} %{buildroot}%{_mingw64_sysconfdir}/xml
%__install -m644 %{dbstyle_catalog_entry} %{buildroot}%{_mingw64_sysconfdir}/xml
# the docs come last
#
%__tar c -C doc . | (cd %{buildroot}%{_mingw64_docdir}/%{_name}/html; %__tar xp);
%fdupes -s %{buildroot}
#--------------------------------------------------------------------------
%post
#
# XML Catalog entries for daps profiling
#
# remove existing entries first (if existing) - needed for
# zypper in, since it does not call postun
#
# delete ...
%{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{_name}
# ... and add it again
%{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} \
--add %{_mingw64_sysconfdir}/xml/%{dbstyle_catalog_entry}
exit 0
#--------------------------------------------------------------------------
%postun
#
# delete catalog entry for daps profiling
# only run if package is really uninstalled ($1 = 0) and not
# in case of an update
#
if [ 0 = $1 ]; then
if [ -x %{_mingw64_bindir}/edit-xml-catalog ] ; then
%{_mingw64_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{_name}
fi
fi
exit 0
#--------------------------------------------------------------------------
%files
%defattr(-, root, root)
%dir %{_mingw64_datadir}/xml/
%dir %{_mingw64_datadir}/xml/docbook
%dir %{_mingw64_datadir}/xml/docbook/stylesheet
%dir %{_mingw64_datadir}/xml/docbook/stylesheet/nwalsh
%dir %{dbstyle_dir}/%{version}
%exclude %{dbstyle_dir}/%{version}/slides/slidy/.htaccess
%exclude %{dbstyle_dir}/%{version}/slides/slidy/*/.htaccess
%config %{_mingw64_sysconfdir}/xml/*.xml
%doc BUGS NEWS README RELEASE-NOTES.txt TODO
%{dbstyle_dir}/current
%{dbstyle_dir}/%{version}/*
%{_mingw64_docdir}/%{_name}
%if %{with scripts}
%files scripts
%defattr(-, root, root)
%{_mingw64_bindir}/*
%endif
%changelog