File susedoc.spec of Package susedoc
#
# spec file for package susedoc
#
# 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/
#
# norootforbuild
%define dtdversion 1.0
%define packageversion 4.3
%define dtdname novdoc
%define docbuilddir /usr/share/susedoc
%define regcat /usr/bin/sgml-register-catalog
%define fontdir /usr/share/fonts/truetype
Name: susedoc
Version: 4.3.32
Release: 1
Summary: XML Build Mechanics for Novell, SUSE, and openSUSE Documentation
BuildRequires: sgml-skel
BuildRequires: trang
Requires: libxslt inkscape transfig ImageMagick java xml-commons-resolver
Requires: svg-dtd freefont xalan-j2 dia fop >= 0.94 make
Requires: docbook-xsl-stylesheets >= 1.75
Requires: docbook_4 opensp sgml-skel
Requires: xmlformat optipng
Requires: python-optcomplete xmlstarlet
Requires: subversion unzip zip exiftool
Requires: dejavu LinuxLibertine mplus-fonts liberation-fonts
Requires: python-xml
#
#%%if 0%%{?opensuse_bs}
#%%else
#Requires: agfa-fonts
#%%endif
#
Recommends: agfa-fonts fifth-leg-font
# Korean Fonts:
Recommends: unfonts
# Japanese Fonts:
Recommends: sazanami-fonts
# Chinese
Recommends: ttf-arphic
# Split of ttf-founder-simplified and ttf-founder-traditional
Recommends: FZSongTi FZHeiTi FZFangSong
# Internal XEP package:
Recommends: xep
BuildRequires: xorg-x11-devel
BuildRequires: sgml-skel unzip
BuildRequires: fdupes
License: GPL
Group: Productivity/Publishing/XML
Url: http://svn.berlios.de/viewvc/opensuse-doc/trunk/tools/docmaker/
Source0: %{name}-%{version}.tar.bz2
Source1: %{name}-rpmlintrc
Patch1: %{name}-prefer-xmlformat-t.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
PreReq: libxml2 sgml-skel
%description
This RPM consists of a set of stylesheets, scripts and makefiles that
are used to create HTML, PDF and Wiki documents from Novdoc/DocBook XML.
See also:
* http://en.opensuse.org/Documentation_Team
Authors:
--------
Karl Eichwalder <ke AT suse DOT de>
Berthold Gunreben <bg AT suse DOT de>
Thomas Schraitle <thomas DOT schraitle AT suse DOT de>
Frank Sundermeyer <fs AT suse DOT de>
Curtis Graham
%define INSTALL install -m755 -s
%define INSTALL_DIR install -d -m755
%define INSTALL_DATA install -m644
%define INSTALL_SCRIPT install -m755 -o root -g root
%define sgml_dir %{_datadir}/sgml
%define sgml_var_dir /var/lib/sgml
%define sgml_mod_dir %{sgml_dir}/novdoc
%define sgml_mod_dtd_dir %{sgml_mod_dir}/dtd
%define sgml_mod_custom_dir %{sgml_mod_dir}/custom
%define sgml_mod_style_dir %{sgml_mod_dir}/stylesheet
%define xml_dir %{_datadir}/xml
%define xml_mod_dir %{xml_dir}/novdoc/
%define xml_mod_dtd_dir %{xml_mod_dir}/schema/dtd/%{dtdversion}
%define xml_mod_custom_dir %{xml_mod_dir}/custom
%define xml_mod_style_dir %{xml_mod_dir}/stylesheet
%define sgml_config_dir /var/lib/sgml
%define sgml_sysconf_dir %{_sysconfdir}/sgml
%define xml_config_dir /var/lib/xml
%define xml_sysconf_dir %{_sysconfdir}/xml
#----------------------
%prep
%setup -q -n %{name}
# susedoc-prefer-xmlformat-t.diff
%patch1 -p1
# susedoc-titlepage-fop-mm.patch
# %%patch2 -p0
#----------------------
%build
%define FOR_ROOT_CAT for-catalog-%{dtdname}-%{version}.xml
%define FOR_XSLT_CAT for-catalog-%{dtdname}xslt-%{version}.xml
xmlcatbin=/usr/bin/xmlcatalog
# build root catalog fragment
%{__rm} -f %{FOR_ROOT_CAT}.tmp %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --create %{FOR_ROOT_CAT}.tmp
#CATALOG=%%{xml_mod_dtd_dir}/catalog.xml
NOVCAT=%{xml_mod_dtd_dir}/catalog.xml
$xmlcatbin --noout --add "delegatePublic" "-//Novell//DTD NovDoc XML" \
"file://$NOVCAT" %{FOR_ROOT_CAT}.tmp
$xmlcatbin --noout --add "delegateSystem" "novdocx.dtd" \
"file://$NOVCAT" %{FOR_ROOT_CAT}.tmp
# Create tag
sed '/<catalog/a\
<group id="%{dtdname}-%{version}">
/<\/catalog/i\
</group>' \
%{FOR_ROOT_CAT}.tmp > %{FOR_ROOT_CAT}
# Register different URNs:
$xmlcatbin --noout --create %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:docbook41-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/docbook41-profile.xsl" %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:docbook42-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/docbook42-profile.xsl" %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:docbook43-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/docbook43-profile.xsl" %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:docbook44-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/docbook44-profile.xsl" %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:docbook45-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/docbook45-profile.xsl" %{FOR_XSLT_CAT}.tmp
$xmlcatbin --noout --add "system" "urn:x-suse:xslt:profiling:novdoc-profile.xsl" \
"file://%{docbuilddir}/xslt/profiling/novdoc-profile.xsl" %{FOR_XSLT_CAT}.tmp
#$xmlcatbin --noout --add "rewriteSystem" "urn:x-suse:common:" \
# "file://$NOVCAT" %%{FOR_ROOT_CAT}.tmp
sed '/<catalog/a\
<group id="%{dtdname}xslt-%{version}">
/<\/catalog/i\
</group>' \
%{FOR_XSLT_CAT}.tmp > %{FOR_XSLT_CAT}
## moved to libsusedoc
rm -f bin/project_files.p* bin/dmstat.pl
#----------------------
%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] \
&& %{__rm} -rf $RPM_BUILD_ROOT
%{__mkdir} %buildroot
%{__mkdir_p} $RPM_BUILD_ROOT/usr/share/%{name} \
$RPM_BUILD_ROOT/%{fontdir} \
$RPM_BUILD_ROOT/%{_bindir} \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/{dtd,rng}/%{dtdversion}
# Copy the NimbusMono fonts (the TrueType version!)
%{__rm} etc/fonts/Dingbats.ttf
%{__mv} etc/fonts/*.ttf $RPM_BUILD_ROOT/%{fontdir}
# Remove any remaining fonts:
%{__rm} -rf etc/fonts/
# %%{__tar} xjf %%{SOURCE0} -C $RPM_BUILD_ROOT/usr/share
%{__cp} -a * $RPM_BUILD_ROOT/usr/share/%{name}/
%{__rm} -f $RPM_BUILD_ROOT/usr/share/%{name}/for-catalog-novdoc*
# FIXME: should bin really end up in /usr/share/susedoc/bin ???
# I'll make at least some of the tools appear in /usr/bin
for i in $(echo bin/suse* bin/svn* bin/grepimage.sh ); do
mv -v $RPM_BUILD_ROOT/usr/share/%{name}/$i $RPM_BUILD_ROOT/usr/bin/
done
%{__mv} $RPM_BUILD_ROOT/usr/share/%{name}/schema/{*.dtd,catalog.xml,CATALOG} \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/dtd/%{dtdversion}/
#
# To avoid unknown host errors, we have to switch off the external
# entities from DocBook. As this is not used in RELAX NG anyway, this
# is uncritical.
sed 's:\(%[ \t]*ISO[^\.]*\.module[ \t]*\)"INCLUDE":\1"IGNORE":g' < $RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/dtd/%{dtdversion}/novdocx.dtd > novdocx2.dtd
# Build RNC and RNG files with trang:
trang novdocx2.dtd \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/rng/%{dtdversion}/novdocx.rnc
trang novdocx2.dtd \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/rng/%{dtdversion}/novdocx.rng
rm novdocx2.dtd
#%%{__mv} $RPM_BUILD_ROOT/usr/share/%%{name}/schema/*.rn{g,c} \
# $RPM_BUILD_ROOT/%%{xml_dir}/%%{dtdname}/schema/rng/%%{dtdversion}/
# Install any fonts
if [ -e fontforge ]; then
%{__mv} $RPM_BUILD_ROOT/usr/share/%{name}/fontforge/*.ttf \
$RPM_BUILD_ROOT/%{fontdir}
%{__rm} -rf $RPM_BUILD_ROOT/usr/share/%{name}/fontforge/
else
rm -rf $RPM_BUILD_ROOT/%{fontdir}
fi
# Catalog
%{INSTALL_DIR} $RPM_BUILD_ROOT%{sgml_var_dir}
%{INSTALL_DIR} $RPM_BUILD_ROOT%{sgml_dir}
echo "CATALOG \"%{xml_mod_dtd_dir}/CATALOG\"" \
>$RPM_BUILD_ROOT%{sgml_var_dir}/CATALOG.%{dtdname}-%{dtdversion}
%{__ln_s} %{sgml_var_dir}/CATALOG.%{dtdname}-%{dtdversion} \
$RPM_BUILD_ROOT%{sgml_dir}/CATALOG.%{dtdname}-%{dtdversion}
cat_dir=%{buildroot}/etc/xml
%{INSTALL_DIR} $cat_dir
%{INSTALL_DATA} %{FOR_ROOT_CAT} $cat_dir
%{INSTALL_DATA} %{FOR_XSLT_CAT} $cat_dir
%define all_cat CATALOG.%{dtdname}-%{dtdversion}
[ -e $RPM_BUILD_ROOT/%{docbuilddir}/bin/susedoc-new.py ] &&
%{__mv} -v $RPM_BUILD_ROOT/%{docbuilddir}/bin/susedoc-new.py $RPM_BUILD_ROOT/%{_bindir}
# Fix non-executable-script warning
[ -e $RPM_BUILD_ROOT/usr/share/%{name}/bin/dm ] &&
%{__chmod} -x $RPM_BUILD_ROOT/usr/share/%{name}/bin/dm/*.py
# create symlinks:
%if 0%{?suse_version} > 1020
%fdupes -s $RPM_BUILD_ROOT/%{docbuilddir}/etc/
%fdupes -s $RPM_BUILD_ROOT/%{docbuilddir}/xslt/
%fdupes -s $RPM_BUILD_ROOT/%{_bindir}/
%fdupes -s $RPM_BUILD_ROOT/%{docbuilddir}/bin/
%endif
#----------------------
%post
if [ -x %{regcat} ]; then
for c in %{all_cat}; do
%{regcat} -a %{sgml_dir}/$c >/dev/null 2>&1 || true
done
fi
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--add /etc/xml/%{FOR_ROOT_CAT}
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--add /etc/xml/%{FOR_XSLT_CAT}
%run_suseconfig_fonts
exit 0
#----------------------
%postun
if [ ! -f %{xml_sysconf_dir}/%{FOR_ROOT_CAT} -a -x /usr/bin/edit-xml-catalog ] ; then
for c in %{all_cat}; do
%{regcat} -r %{sgml_dir}/$c >/dev/null 2>&1
done
#now XML catalog
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--del %{dtdname}-%{version}
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--del %{dtdname}xslt-%{version}
fi
%run_suseconfig_fonts
exit 0
#----------------------
%clean
%{__rm} -rf $RPM_BUILD_ROOT
#----------------------
%files
%defattr(-,root,root)
# %%dir %%{sgml_dir}
%config %{sgml_var_dir}/*
%config %{xml_sysconf_dir}/%{FOR_ROOT_CAT}
%config %{xml_sysconf_dir}/%{FOR_XSLT_CAT}
%{_bindir}/*
%{sgml_dir}/CATALOG.%{dtdname}-%{dtdversion}
%{xml_dir}/%{dtdname}/
%{docbuilddir}
# %%{py_libdir}/optcomplete.*
%dir %{fontdir}
%{fontdir}/*
%changelog