File docbook-xsl-stylesheets.spec of Package docbook-xsl-stylesheets

# spec file for package docbook-xsl-stylesheets
# Copyright (c) 2015 SUSE LINUX 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

%define realversion            1.78.1

%define dbstyle_dir            %{_datadir}/xml/docbook/stylesheet/nwalsh
%define dbstyle_catalog        %{name}.xml
%define suse_catalog           %{_sysconfdir}/xml/suse-catalog.xml
%define xmlcatalog             %{_bindir}/xmlcatalog
%define dbstyle_catalog_entry  for-catalog-%{name}-%{realversion}.xml

Name:           docbook-xsl-stylesheets
Summary:        XSL Stylesheets for DocBook 4
License:        MPL-1.1 and MIT
Group:          Productivity/Publishing/DocBook
BuildRequires:  fdupes
BuildRequires:  sgml-skel
BuildRequires:  unzip
# BuildRequires:  dos2unix
BuildArch:      noarch
Requires:       docbook_4
Requires:       xmlcharent
PreReq:         sgml-skel %{_bindir}/xmlcatalog
Version:        1.78.1+svn9743
Release:        0

## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-dbtoepub.patch Fixed dirname
Patch0:         %{name}-dbtoepub.patch

## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-epub3-base.dir-r9742.patch Fix for base.dir parameter
Patch10:        %{name}-epub3-base.dir.patch

## PATCH-FIX-OPENSUSE docbook-xsl-stylesheets-manpages-other-r9847.patch Fixed upstream bug #1313
Patch11:        %{name}-manpages-other-r9847.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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:

# 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.

%setup -q -n docbook-xsl-%{realversion} -b1
%patch0 -p1
%patch10 -p0
%patch11 -p0

cp %{S:10} .

find slides -regex ".*\.\(xml\|htc\|\|hu\|js\|svg\|css\|html\.*\|txt\|rnc\|xhtml\)" \
   -exec sed -i 's/\r//' {} \;

# Fix wrong end-of-line encoding
sed -i 's/\r//' params/*

find -type f -exec chmod 644 {} \;
find -type d -exec chmod 755 {} \;
chmod 755 extensions/


sh ./ --package-version="%{realversion}" --buildroot=%{buildroot}

# fixing permission errors from sources

# create current link
# but not for snapshots
if ! echo %{S:0} | grep -q snapshot; then
   pushd %{buildroot}%{dbstyle_dir} >/dev/null
    ln -sf %{realversion} current
   popd >/dev/null

# the docs come last
%__tar c -C doc . | (cd %{buildroot}%{_defaultdocdir}/%{name}/html; %__tar xp);

%fdupes -s %{buildroot}

# XML Catalog entries
# remove existing entries first (if existing) - needed for
# zypper in, since it does not call postun
# in case of an update, remove old
if [ "2" = "$1" ]; then
  %{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{name}
# ... and (re)add it again
%{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} \
  --add %{_sysconfdir}/xml/%{dbstyle_catalog_entry}

exit 0

# delete catalog entry
# only run if package is really uninstalled ($1 = 0) and not
# in case of an update
if [ "0" = "$1" ]; then
   %{_bindir}/edit-xml-catalog --group --catalog %{suse_catalog} --del %{name}

exit 0

%defattr(-, root, root)
%config %{_sysconfdir}/xml/*.xml
%dir %{_datadir}/xml/docbook/stylesheet
%dir %{_datadir}/xml/docbook/stylesheet/nwalsh
%dir %{dbstyle_dir}/%{realversion}

%exclude %{dbstyle_dir}/%{realversion}/slides/slidy/.htaccess
%exclude %{dbstyle_dir}/%{realversion}/slides/slidy/*/.htaccess
# %%exclude %%{dbstyle_dir}/svn-commit.tmp
# %%exclude %%{dbstyle_dir}/%%{realversion}/*/*.xsl.orig


%files scripts
%defattr(-, root, root)