SHA256
1
0
forked from pool/docbook_5
docbook_5/docbook_5.spec
2016-06-21 13:51:11 +00:00

235 lines
7.1 KiB
RPMSpec

#
# spec file for package docbook_5
#
# Copyright (c) 2016 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 http://bugs.opensuse.org/
#
Name: docbook_5
Summary: DocBook Schemas (DTD, RELAX NG, W3C Schema) for Version 5.x
License: SUSE-Oasis-Specification-Notice
Group: Productivity/Publishing/DocBook
Version: 5.1CR3
Release: 0
BuildRequires: fdupes
BuildRequires: sgml-skel
Requires: sgml-skel >= 0.7
Requires(post): sgml-skel >= 0.7
Requires(postun): sgml-skel >= 0.7
# XML Catalog Entry
Source1: docbook_5.xml
Source2: docbook_5-README.SUSE
# DocBook Specifications:
Source3: docbook-5.0-spec-cd-01.pdf
Source4: docbook-5.0-spec-cd-01.html
Source5: docbook-5.0-spec-cd-01.xml
# DB 5.0
Source500: docbook-5.0.tar.bz2
# DB 5.1CR3
Source510: docbook-5.1CR3.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Url: http://www.oasis-open.org/docbook/
%define schemaversions 5.0 5.1
%define lastschemaversion 5.1
%description
The version 5.0 release is a complete rewrite of DocBook in RELAX NG.
The intent of this rewrite is to produce a schema that is true to the
spirit of DocBook while simultaneously removing inconsistencies that
have arisen as a natural consequence of DocBook's long, slow evolution.
%package doc
Summary: Documentation for %{name}
Group: Documentation/HTML
BuildArch: noarch
%description doc
The documentation for the DocBook 5.x specification (%schemaversions)
%define INSTALL install -m755 -s
%define INSTALL_DIR install -d -m755
%define INSTALL_DATA install -m644
%define INSTALL_SCRIPT install -m755
%define xml_dir %{_datadir}/xml
%define xml_docbook_dir %{xml_dir}/docbook
%define xml_schema_dir %{xml_dir}/docbook/schema
%define xml_docbook_dtd_dir %{xml_schema_dir}/dtd
%define xml_docbook_rng_dir %{xml_schema_dir}/rng
%define xml_docbook_sch_dir %{xml_schema_dir}/sch
%define xml_docbook_xsd_dir %{xml_schema_dir}/xsd
%define xml_docbook_custom_dir %{xml_docbook_dir}/custom
%define xml_docbook_style_dir %{xml_docbook_dir}/stylesheet
%define xml_config_dir /var/lib/xml
%define xml_sysconf_dir %{_sysconfdir}/xml
%prep
%setup -n %{name} -c -T
# Copy catalog
cp -p %{S:1} .
# Copy README
cp -p %{S:2} .
# Copy the DocBook Specifications:
cp %{S:3} %{S:4} %{S:5} .
tar -xjf %{S:500}
tar -xjf %{S:510}
mv docbook-%{version} docbook-%{lastschemaversion}
chmod -R a+rX,g-w,o-w .
find . -type f | xargs chmod a-x
%build
xmlcatbin=/usr/bin/xmlcatalog
# ---------------------
# Build XML catalog files for each Schema
for v in %{schemaversions}; do
for s in dtd rng sch xsd; do
cat=docbook-${v}/${s}/catalog.xml
$xmlcatbin --noout --create ${cat}
$xmlcatbin --noout --add "public" \
"-//OASIS//DTD DocBook XML ${v}//EN" \
"docbook.dtd" ${cat}
for http in "http://www.oasis-open.org/docbook/xml" \
"http://www.docbook.org/xml" \
"http://docbook.org/xml" ; do
case ${s} in
dtd)
$xmlcatbin --noout --add "system" \
"${http}/${v}/dtd/docbook.dtd" \
"docbook.dtd" ${cat}
;;
rng)
for ff in docbook.rng docbook.rnc \
"docbookxi.${s}" docbookxi.rnc \
assembly.rng assembly.rnc \
dbits.rng dbits.rnc; do
$xmlcatbin --noout --add "system" \
"${http}/${v}/${s}/${ff}" \
"${ff}" ${cat}
$xmlcatbin --noout --add "uri" \
"${http}/${v}/${s}/${ff}" \
"${ff}" ${cat}
done
;;
sch)
$xmlcatbin --noout --add "system" \
"${http}/${v}/${s}/docbook.${s}" \
"docbook.${s}" ${cat}
$xmlcatbin --noout --add "uri" \
"${http}/${v}/${s}/docbook.${s}" \
"docbook.${s}" ${cat}
;;
xsd)
for ff in "docbook.${s}" "docbookxi.${s}" xlink.xsd xml.xsd; do
$xmlcatbin --noout --add "system" \
"${http}/${v}/${s}/${ff}" \
"${ff}" ${cat}
$xmlcatbin --noout --add "uri" \
"${http}/${v}/${s}/${ff}" \
"${ff}" ${cat}
done
;;
esac
done
done
done
%install
# Create installation structure
%{INSTALL_DIR} $RPM_BUILD_ROOT%{xml_config_dir} \
$RPM_BUILD_ROOT%{_bindir} \
$RPM_BUILD_ROOT%{xml_docbook_style_dir}/upgrade
cat_dir=%{buildroot}/etc/xml/catalog.d
%{INSTALL_DIR} $cat_dir
%{INSTALL_DATA} %{name}.xml $cat_dir
for v in %{schemaversions}; do
# Create directories
mkdir -p $RPM_BUILD_ROOT%{xml_docbook_dtd_dir}/$v \
$RPM_BUILD_ROOT%{xml_docbook_rng_dir}/$v \
$RPM_BUILD_ROOT%{xml_docbook_sch_dir}/$v \
$RPM_BUILD_ROOT%{xml_docbook_xsd_dir}/$v
#
%{INSTALL_DATA} docbook-$v/dtd/* $RPM_BUILD_ROOT%{xml_docbook_dtd_dir}/$v
%{INSTALL_DATA} docbook-$v/rng/* $RPM_BUILD_ROOT%{xml_docbook_rng_dir}/$v
%{INSTALL_DATA} docbook-$v/sch/* $RPM_BUILD_ROOT%{xml_docbook_sch_dir}/$v
%{INSTALL_DATA} docbook-$v/xsd/* $RPM_BUILD_ROOT%{xml_docbook_xsd_dir}/$v
done
# Use the latest version. If not found, fall back to 5.0
if [ ! -e docbook-$v/tools/db4-entities.pl ] ; then
v=5.0
fi
%{INSTALL_SCRIPT} docbook-$v/tools/db4-entities.pl $RPM_BUILD_ROOT%{_bindir}
%{INSTALL_DATA} docbook-$v/tools/db4-upgrade.xsl \
$RPM_BUILD_ROOT%{xml_docbook_style_dir}/upgrade
# Install NDVL file(s)
#for v in %%{version}; do
# %%{INSTALL_DATA} docbook-$v/docbook.nvdl $RPM_BUILD_ROOT%%{xml_docbook_rng_dir}/$v
#done
# cleanup
%fdupes $RPM_BUILD_ROOT
%post
update-xml-catalog
%postun
update-xml-catalog
%files
%defattr(-, root, root)
%config %{xml_sysconf_dir}/catalog.d/docbook_5.xml
%doc *README*
# Use the last version of DocBook:
%doc docbook-%{lastschemaversion}/docbook.nvdl
%dir %{xml_docbook_dir}/schema
%dir %{xml_docbook_dtd_dir}
%dir %{xml_docbook_rng_dir}
%dir %{xml_docbook_sch_dir}
%dir %{xml_docbook_xsd_dir}
%dir %{xml_docbook_style_dir}
# 5.0
%{xml_docbook_dtd_dir}/5.0
%{xml_docbook_rng_dir}/5.0
%{xml_docbook_sch_dir}/5.0
%{xml_docbook_xsd_dir}/5.0
%{xml_docbook_style_dir}/upgrade
# 5.1CR3
%{xml_docbook_dtd_dir}/%{lastschemaversion}
%{xml_docbook_rng_dir}/%{lastschemaversion}
%{xml_docbook_sch_dir}/%{lastschemaversion}
%{xml_docbook_xsd_dir}/%{lastschemaversion}
%{_bindir}/db4-entities.pl
%files doc
%defattr(-, root, root)
%doc docbook-5.0/docs/* docbook-5.0-spec-cd-01.{pdf,html,xml}
%changelog