1 %define regcat /usr/bin/sgml-register-catalog
3 Name: docbook-xsl-stylesheets
6 License: MPL-1.1 and MIT
7 Summary: XSL Stylesheets for DocBook 4
8 Url: http://sourceforge.net/projects/docbook/
10 Source0: http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-%{version}.tar.bz2
11 Source1001: docbook-xsl-stylesheets.manifest
13 BuildRequires: sgml-skel
15 Requires(pre): %{regcat}
16 Requires(pre): /usr/bin/xmlcatalog
17 Requires(pre): sgml-skel
23 These are the XSL stylesheets for DocBook XML and "Simplified" DocBook
24 DTDs. Use these stylesheets for documents based on DocBook 4 and
25 earlier; they are not aware of the namespace feature.
27 The stylesheets transform DocBook documents into HTML, XHTML, Manpages,
28 XSL-FO (for PDF), and a few other formats.
30 XSL is a standard W3C stylesheet language for both print and online
31 rendering. For more information about XSL, see the XSL page at the W3C:
32 http://www.w3.org/Style/XSL/
34 %define INSTALL install -m755 -s
35 %define INSTALL_DIR install -d -m755
36 %define INSTALL_DATA install -m644
37 %define INSTALL_SCRIPT install -m755
38 %define sgml_dir %{_datadir}/sgml
39 %define sgml_var_dir /var/lib/sgml
40 %define sgml_mod_dir %{sgml_dir}/docbook
41 %define sgml_mod_dtd_dir %{sgml_mod_dir}/dtd
42 %define sgml_mod_custom_dir %{sgml_mod_dir}/custom
43 %define sgml_mod_style_dir %{sgml_mod_dir}/stylesheet
44 %define xml_dir %{_datadir}/xml
45 %define xml_mod_dir %{xml_dir}/docbook
46 %define xml_mod_dtd_dir %{xml_mod_dir}/dtd
47 %define xml_mod_custom_dir %{xml_mod_dir}/custom
48 %define xml_mod_style_dir %{xml_mod_dir}/stylesheet
49 %define xml_mod_style_prod_dir %{xml_mod_style_dir}/nwalsh
50 %define sgml_config_dir /var/lib/sgml
51 %define sgml_sysconf_dir %{_sysconfdir}/sgml
52 %define xml_config_dir /var/lib/xml
53 %define xml_sysconf_dir %{_sysconfdir}/xml
56 %setup -q -n docbook-xsl-%{version}
59 # mv epub/bin/dbtoepub epub/bin/dbtoepub.tmp
60 sed -i 's=@@EPUBDIR@@=%{xml_mod_style_prod_dir}/current//epub/bin=' epub/bin/dbtoepub
62 # We don't need these scripts:
63 rm -rf install.sh tools/bin/docbook-xsl-update
65 find -type f -print0 |xargs -0 chmod -x
66 chmod -R a+rX,g-w,o-w .
67 chmod -x images/*.{svg,png,gif,tif} images/callouts/*.{svg,png,gif} extensions/docbook.py
68 # Start cleanup (to avoid warnings for rpmlint
69 [ -f ./extensions/saxon65/dist/saxon65.jar ] && rm -rf ./extensions/saxon65/dist/saxon65.jar
70 [ -f ./extensions/xalan27/dist/xalan27.jar ] && rm -rf ./extensions/xalan27/dist/xalan27.jar
71 find . -name '.gitignore' | xargs rm -fr
72 #x=$(find {lib,html,fo,lib,website,slides/fo,slides/html,roundtrip,manpages}/.[a-zA-Z0-9]* -maxdepth 1 -type f )
73 #if [ "$x" != '' ]; then
83 xmlcatbin=/usr/bin/xmlcatalog
85 # file:///usr/share/sgml/docbook/ = %%{sgml_mod_dir} map it to
86 # %%{xml_mod_style_prod_dir}/%%{version}
87 $xmlcatbin --noout --create $CATALOG
88 /usr/bin/xmlcatalog --noout --add "rewriteSystem" \
89 "http://docbook.sourceforge.net/release/xsl/%{version}" \
90 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
91 /usr/bin/xmlcatalog --noout --add "rewriteURI" \
92 "http://docbook.sourceforge.net/release/xsl/%{version}" \
93 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
94 /usr/bin/xmlcatalog --noout --add "rewriteSystem" \
95 "http://docbook.sourceforge.net/release/xsl/current" \
96 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
97 /usr/bin/xmlcatalog --noout --add "rewriteURI" \
98 "http://docbook.sourceforge.net/release/xsl/current" \
99 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
100 %define FOR_ROOT_CAT for-catalog-%{name}-%{version}.xml
101 CATALOG=etc/xml/$CATALOG
102 rm -f %{FOR_ROOT_CAT}.tmp
103 $xmlcatbin --noout --create %{FOR_ROOT_CAT}.tmp
104 $xmlcatbin --noout --add "delegateSystem" \
105 "http://docbook.sourceforge.net/release/xsl/" \
106 "file:///$CATALOG" %{FOR_ROOT_CAT}.tmp
107 # $xmlcatbin --noout --add "delegatePublic" \
109 # "file:///$CATALOG" %%{FOR_ROOT_CAT}.tmp
112 <group id="%{name}-%{version}">
115 %{FOR_ROOT_CAT}.tmp > %{FOR_ROOT_CAT}
119 # export NO_BRP_CHECK_BYTECODE_VERSION=true
122 %{INSTALL_DIR} %{buildroot}%{_bindir}
123 %{INSTALL_SCRIPT} fo/pdf2index %{buildroot}%{_bindir}
124 %{INSTALL_SCRIPT} epub/bin/dbtoepub %{buildroot}%{_bindir}
127 doc_dir=%{buildroot}%{_defaultdocdir}/%{name}
128 %{INSTALL_DIR} %{buildroot}%{xml_mod_style_prod_dir}/%{version}
129 cp -a [[:lower:]]* %{buildroot}%{xml_mod_style_prod_dir}/%{version}
130 cp -a VERSION.xsl %{buildroot}%{xml_mod_style_prod_dir}/%{version}
131 find %{buildroot}%{xml_mod_style_prod_dir} -type f -name '*.orig' -print0 |xargs -0 rm -f
132 rm -f %{buildroot}%{xml_mod_style_prod_dir}/%{version}/for-catalog*
135 pushd %{buildroot}%{xml_mod_style_prod_dir} >/dev/null
136 # do not create the current link for snapshots
137 # if ! echo %%{SOURCE0} | grep -q snapshot; then
138 ln -sf %{version} current
139 echo %{xml_mod_style_prod_dir}/current
143 %{INSTALL_DIR} $doc_dir
145 for f in README BUGS TODO WhatsNew RELEASE-NOTES.html; do
146 # On snapshots, WhatsNew is missing
147 [ -f $f ] && %{INSTALL_DATA} $f $doc_dir/$f
149 # cp -p README.SuSE $doc_dir/README.SuSE
153 find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
155 -not -path '%{buildroot}%{xml_mod_style_prod_dir}/%{version}/latex*' \
156 | sed 's|%{buildroot}|%dir |'
158 find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
160 -not -path '%{buildroot}%{xml_mod_style_prod_dir}/%{version}/latex*' \
161 | sed 's|%{buildroot}||'
162 } >> %{_builddir}/%{buildsubdir}/%{name}_list
163 # pushd %%{buildroot}%%{xml_mod_style_prod_dir}
165 # ln -sf docbook-xsl-stylesheets-%%{version} docbook-xsl
166 # rm -f xsl-stylesheets
167 # ln -sf docbook-xsl-stylesheets-%%{version} xsl-stylesheets
169 # ln -sf docbook-xsl-stylesheets-%%{version} %%{name}
171 cat_dir=%{buildroot}%{_sysconfdir}/xml
172 %{INSTALL_DIR} $cat_dir
173 %{INSTALL_DATA} %{FOR_ROOT_CAT} %{name}.xml $cat_dir
175 rm -f %{buildroot}%{xml_mod_style_prod_dir}/%{version}/%{name}.xml
176 cp $cat_dir/%{FOR_ROOT_CAT} \
177 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/%{name}.xml
179 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/extensions/docbook.py \
180 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/extensions/xslt.py
181 # %%{buildroot}%%{xml_mod_style_prod_dir}/%%{version}/epub/bin/lib/docbook.rb
182 # %%{buildroot}%%{xml_mod_style_prod_dir}/%%{version}/epub/bin/spec/spec_helper.rb
184 %fdupes -s %{buildroot}
188 # remove empty dir if present (from ghost)
189 # also remove dangling symlink
191 rmdir $D/docbkxsl >/dev/null 2>&1 || :
192 test -L $D/docbkxsl -a ! -e $D/docbkxsl && rm -f $D/docbkxsl
193 if [ -x /usr/bin/edit-xml-catalog ]; then
194 edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
195 --add /etc/xml/%{FOR_ROOT_CAT}
199 # remove entries only on removal of file
200 if [ ! -f %{xml_sysconf_dir}/%{FOR_ROOT_CAT} -a -x /usr/bin/edit-xml-catalog ] ; then
201 edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
202 --del %{name}-%{version}
205 %files -f %{name}_list
206 %manifest %{name}.manifest
207 %defattr(-, root, root)
208 %config %{_sysconfdir}/xml/%{name}.xml
209 %config %{_sysconfdir}/xml/%{FOR_ROOT_CAT}
210 %{_defaultdocdir}/%{name}
211 %dir %{xml_mod_style_dir}
212 %dir %{xml_mod_style_prod_dir}
213 # it is now in the list:
214 # %%{xml_mod_style_prod_dir}/current