File docbook-xml-website.spec of Package docbook-xml-website

#
# spec file for package docbook-xml-website (Version 2.6.0)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           docbook-xml-website
BuildRequires:  sgml-skel unzip
Summary:        DTD and Stylesheets for Web Site Development
Version:        2.6.0
Release:        1
Group:          Productivity/Publishing/DocBook
Requires:       docbook-xsl-stylesheets xmlcharent docbook_4 sgml-skel
%define regcat /usr/bin/sgml-register-catalog
PreReq:         %{regcat} /usr/bin/xmlcatalog /usr/bin/edit-xml-catalog
PreReq:         sed grep awk
License:        X11/MIT
Url:            http://sourceforge.net/projects/docbook/
Source0:        docbook-website-%{version}.tar.bz2
Source1:        CATALOG.docbook-xml-website
Patch:          docbook-xml-website/website-catalog.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
A DTD in XML as an extension to DocBook XML and XSL stylesheets to
process it.



Authors:
--------
    Norman Walsh <ndw@nwalsh.com>

%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}/docbook
%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}/docbook/custom/website/%{version}
%define xml_mod_dtd_dir %{xml_mod_dir}/schema/dtd
%define xml_mod_custom_dir %{xml_mod_dir}/custom
%define xml_mod_style_dir %{xml_mod_dir}/stylesheet
%define xml_mod_style_prod_dir %{xml_mod_style_dir}
%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 docbook-website-%{version}
# %patch -p 1 -P 0
# /usr/share/xml/docbook/custom/website/2.6.0/catalog
sed 's|@VERSION@|%{version}|
s|@DIR@|%{xml_mod_dir}|' %{S:1} > CATALOG.%{name}
mv .CatalogManager.properties.example dot.CatalogManager.properties.example
find . -type f -name '\.*' | xargs rm

%build
xmlcatbin=/usr/bin/xmlcatalog
%define FOR_ROOT_CAT for-catalog-%{name}-%{version}-%{release}.xml
CATALOG=%{xml_mod_dir}/catalog.xml
rm -f %{FOR_ROOT_CAT}.tmp
$xmlcatbin --noout --create %{FOR_ROOT_CAT}.tmp
$xmlcatbin --noout --add "delegateSystem" \
  "http://docbook.sourceforge.net/release/website/" \
  "file://$CATALOG" %{FOR_ROOT_CAT}.tmp
$xmlcatbin --noout --add "delegatePublic" \
  "-//Norman Walsh//DTD Website" \
  "file://$CATALOG" %{FOR_ROOT_CAT}.tmp
# Create tag
sed '/<catalog/a\
  <group id="%{name}-%{version}-%{release}">
/<\/catalog/i\
  </group>' \
  %{FOR_ROOT_CAT}.tmp > %{FOR_ROOT_CAT}

%install
%{INSTALL_DIR} $RPM_BUILD_ROOT%{xml_mod_dir}
find . -type d -name '.xvpics' | xargs rm -fr
cp -a . $RPM_BUILD_ROOT%{xml_mod_dir}
rm -f $RPM_BUILD_ROOT%{xml_mod_dir}/for-catalog*
# install-dtd.sh -p %{name}-%{version}/schema/dtd \
#   -s $RPM_BUILD_ROOT%{sgml_dir} \
#   -f website.dtd \
#   -i '-//Norman Walsh//DTD Website V%{version}//EN'
# {
#   echo "DTDDECL \"-//Norman Walsh//DTD Website V%{version}//EN\" \"/usr/share/sgml/opensp/xml.dcl\""
#   echo "CATALOG %{sgml_dir}/CATALOG.db41xml"
#   echo "PUBLIC \"-//Norman Walsh//DTD Website V%{version}//EN\" \
# %{sgml_dir}/%{name}-%{version}/schema/dtd/website.dtd"
# } > CATALOG.%{name}
%{INSTALL_DIR} $RPM_BUILD_ROOT%{sgml_config_dir} $RPM_BUILD_ROOT%{sgml_dir}
%{INSTALL_DATA} CATALOG.%{name} $RPM_BUILD_ROOT%{sgml_config_dir}
pushd $RPM_BUILD_ROOT%{sgml_dir}
ln -sf ../../..%{sgml_config_dir}/CATALOG.%{name} CATALOG.%{name}
popd
cat_dir=%{buildroot}/etc/xml
%{INSTALL_DIR} $cat_dir
# %{INSTALL_DATA} %{name}.xml $RPM_BUILD_ROOT/etc/xml/%{name}.xml
%{INSTALL_DATA} %{FOR_ROOT_CAT} $cat_dir
# %define all_cat %{name}-%{version}

%post
if [ -x %{regcat} ]; then
  for c in docbook-xml-website; do
    %{regcat} -a  %{sgml_dir}/CATALOG.$c >/dev/null 2>&1 || true
  done
fi
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
  --add /etc/xml/%{FOR_ROOT_CAT}

%postun
if [ "$1" = "0" -a -x %{regcat} ]; then
  for c in docbook-xml-website; do
    %{regcat} -r %{sgml_dir}/CATALOG.$c >/dev/null 2>&1 || true
  done
fi
edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
  --del %{name}-%{version}-%{release}

%clean
rm -fr $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
#%doc README.SuSE
%{xml_dir}/docbook/custom
# %{sgml_dir}
# %{sgml_dir}/Norman_Walsh
%{sgml_dir}/CATALOG.*
%config %{sgml_config_dir}/CATALOG.*
%config %{_sysconfdir}/xml/%{FOR_ROOT_CAT}

%changelog
* Tue Dec 11 2007 - ke@suse.de
- 2.6.0 (from the announcement):
  * Significant schema changes.
  * Minor Website XSL stylesheets changes.
  * Bug fixes.
- Start with spec file cleanup.
* Thu May 10 2007 - ro@suse.de
- added unzip to buildrequires
* Fri Jan 12 2007 - ke@suse.de
- Remove /usr/share/xml from the files list.
* Tue Aug 15 2006 - ke@suse.de
- Remove SuSEconfig call.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Mar 09 2005 - ke@suse.de
- Add sgml-skel to the "Requires:" line to make sure edit-xml-catalog is
  available at deinstallation time; reported by Thomas Schmidt [# 71811].
* Thu Mar 18 2004 - ke@suse.de
- Remove unwanted directory '.xvpics'.
* Fri Feb 06 2004 - ke@suse.de
- Update to version 2.5.0.
- Adjust directories according to FHS 2.3:
  * Move stylesheets to /usr/share/xml/docbook/custom/website.
  * Provide compatibility links for SL =< 9.0 (log this info in
  /var/adm/SuSEconfig/run-sgmldir-links for later processing).
* Wed Jun 18 2003 - ke@suse.de
- Add missing directory to the %%files list.
- Use edit-xml-catalog for catalog registration.
* Mon Jan 27 2003 - ke@suse.de
- Update to version 2.0a2; cf. [# 22861].
- Install and register catalog files,
* Mon Aug 27 2001 - ke@suse.de
- Update to version 2.0a2.
- Fix broken link.
* Fri Mar 23 2001 - ke@suse.de
- Update to version 1.10.
- Requires 'docbook-xsl-stylesheets'; needeforbuild sgml-skel.
* Fri Mar 09 2001 - ke@suse.de
- Version 1.9 (an earlier version was part of docbk30).