File susedoc.spec of Package susedoc
#
# spec file for package susedoc (Version 4.2_20090924)
#
# Copyright (c) 2009 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.2
%define dtdname novdoc
%define docbuilddir /usr/share/susedoc
%define _version 20090924
%define _name susedoc
%define regcat /usr/bin/sgml-register-catalog
Name: susedoc
Version: %{packageversion}_%{_version}
Release: 1
Summary: XML Build Mechanics for Novell, SUSE, and openSUSE Documentation
Requires: libxml2 libxslt inkscape transfig ImageMagick java xml-commons-resolver svg-dtd freefont xalan-j2 dia fop >= 0.94 make
Requires: docbook-xsl-stylesheets >= 1.75
Requires: docbook_4 xmlformat optipng
Requires: dejavu LinuxLibertine mplus-fonts liberation-fonts
#
#%if 0%{?opensuse_bs}
#%else
#Requires: agfa-fonts
#%endif
#
%if %suse_version >= 1100
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
%endif
BuildRequires: sgml-skel unzip
%if 0%{?suse_version} > 1020
BuildRequires: fdupes
%endif
License: GPL
Group: Productivity/Publishing/XML
AutoReqProv: on
# Needs to be fixed to openSUSE build server:
Url: http://www.opensuse.org/Documentation_Team
Source0: %{_name}-%{packageversion}_%{_version}.tar.bz2
Source1: susedoc-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
PreReq: libxml2 sgml-skel
%if %suse_version <= 1100
Obsoletes: novdoc-schema
Provides: novdoc-schema
#Recommends: agfa-fonts ttf-founder unfonts sazanami-fonts
%endif
%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://developer.novell.com/wiki/index.php/Lessons_for_Lizards
* 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>
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
#----------------------
%build
%define FOR_ROOT_CAT for-catalog-%{dtdname}-%{version}-%{release}.xml
%define FOR_XSLT_CAT for-catalog-%{dtdname}xslt-%{version}-%{release}.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}-%{release}">
/<\/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: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}-%{release}">
/<\/catalog/i\
</group>' \
%{FOR_XSLT_CAT}.tmp > %{FOR_XSLT_CAT}
#----------------------
%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] \
&& %{__rm} -rf $RPM_BUILD_ROOT
%{__mkdir} %buildroot
%{__mkdir_p} $RPM_BUILD_ROOT/usr/share \
$RPM_BUILD_ROOT/%{_bindir} \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/{dtd,rng}/%{dtdversion}
tar xjf %{SOURCE0} -C $RPM_BUILD_ROOT/usr/share
%{__mv} $RPM_BUILD_ROOT/usr/share/%{name}/schema/{*.dtd,catalog.xml,CATALOG} \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/dtd/%{dtdversion}
%{__mv} $RPM_BUILD_ROOT/usr/share/%{name}/schema/*.rng \
$RPM_BUILD_ROOT/%{xml_dir}/%{dtdname}/schema/rng/%{dtdversion}
# 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}
%{__mv} $RPM_BUILD_ROOT/%{docbuilddir}/bin/susedoc-new.py $RPM_BUILD_ROOT/%{_bindir}
# create symlinks:
%if 0%{?suse_version} > 1020
%fdupes -s $RPM_BUILD_ROOT/%{docbuilddir}/etc/XEP
%fdupes -s $RPM_BUILD_ROOT/%{docbuilddir}/xslt
%endif
#----------------------
%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}
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--add /etc/xml/%{FOR_XSLT_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 %{dtdname}-%{version}-%{release}
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
--del %{dtdname}xslt-%{version}-%{release}
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}/susedoc-new.py
%{sgml_dir}/CATALOG.%{dtdname}-%{dtdversion}
%{xml_dir}/%{dtdname}/
%{docbuilddir}
#
%changelog