1 %define pack_vers 1.77.1
2 %define regcat /usr/bin/sgml-register-catalog
4 Name: docbook-xsl-stylesheets
7 License: MPL-1.1 and MIT
8 Summary: XSL Stylesheets for DocBook 4
9 Url: http://sourceforge.net/projects/docbook/
10 Group: Productivity/Publishing/DocBook
11 Source0: http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-%{pack_vers}.tar.bz2
12 Source1: http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-doc-%{version}.tar.bz2
14 BuildRequires: sgml-skel
16 Requires(pre): %{regcat}
17 Requires(pre): /usr/bin/xmlcatalog
18 Requires(pre): sgml-skel
24 These are the XSL stylesheets for DocBook XML and "Simplified" DocBook
25 DTDs. Use these stylesheets for documents based on DocBook 4 and
26 earlier; they are not aware of the namespace feature.
28 The stylesheets transform DocBook documents into HTML, XHTML, Manpages,
29 XSL-FO (for PDF), and a few other formats.
31 XSL is a standard W3C stylesheet language for both print and online
32 rendering. For more information about XSL, see the XSL page at the W3C:
33 http://www.w3.org/Style/XSL/
35 %define INSTALL install -m755 -s
36 %define INSTALL_DIR install -d -m755
37 %define INSTALL_DATA install -m644
38 %define INSTALL_SCRIPT install -m755
39 %define sgml_dir %{_datadir}/sgml
40 %define sgml_var_dir /var/lib/sgml
41 %define sgml_mod_dir %{sgml_dir}/docbook
42 %define sgml_mod_dtd_dir %{sgml_mod_dir}/dtd
43 %define sgml_mod_custom_dir %{sgml_mod_dir}/custom
44 %define sgml_mod_style_dir %{sgml_mod_dir}/stylesheet
45 %define xml_dir %{_datadir}/xml
46 %define xml_mod_dir %{xml_dir}/docbook
47 %define xml_mod_dtd_dir %{xml_mod_dir}/dtd
48 %define xml_mod_custom_dir %{xml_mod_dir}/custom
49 %define xml_mod_style_dir %{xml_mod_dir}/stylesheet
50 %define xml_mod_style_prod_dir %{xml_mod_style_dir}/nwalsh
51 %define sgml_config_dir /var/lib/sgml
52 %define sgml_sysconf_dir %{_sysconfdir}/sgml
53 %define xml_config_dir /var/lib/xml
54 %define xml_sysconf_dir %{_sysconfdir}/xml
57 # %%setup -q -n docbook-xsl-%%{pack_vers} -b 10
58 %setup -q -n docbook-xsl-%{pack_vers} -b 1
60 # mv epub/bin/dbtoepub epub/bin/dbtoepub.tmp
61 sed -i 's=@@EPUBDIR@@=%{xml_mod_style_prod_dir}/current//epub/bin=' epub/bin/dbtoepub
63 # We don't need these scripts:
64 rm -rf install.sh tools/bin/docbook-xsl-update
66 find -type f -exec chmod -x {} \;
67 chmod -R a+rX,g-w,o-w .
68 chmod -x images/*.{svg,png,gif,tif} images/callouts/*.{svg,png,gif} extensions/docbook.py
69 # Start cleanup (to avoid warnings for rpmlint
70 [ -f ./extensions/saxon65/dist/saxon65.jar ] && rm -rf ./extensions/saxon65/dist/saxon65.jar
71 [ -f ./extensions/xalan27/dist/xalan27.jar ] && rm -rf ./extensions/xalan27/dist/xalan27.jar
72 find . -name '.gitignore' | xargs rm -fr
73 #x=$(find {lib,html,fo,lib,website,slides/fo,slides/html,roundtrip,manpages}/.[a-zA-Z0-9]* -maxdepth 1 -type f )
74 #if [ "$x" != '' ]; then
84 xmlcatbin=/usr/bin/xmlcatalog
86 # file:///usr/share/sgml/docbook/ = %%{sgml_mod_dir} map it to
87 # %%{xml_mod_style_prod_dir}/%%{version}
88 $xmlcatbin --noout --create $CATALOG
89 /usr/bin/xmlcatalog --noout --add "rewriteSystem" \
90 "http://docbook.sourceforge.net/release/xsl/%{version}" \
91 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
92 /usr/bin/xmlcatalog --noout --add "rewriteURI" \
93 "http://docbook.sourceforge.net/release/xsl/%{version}" \
94 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
95 /usr/bin/xmlcatalog --noout --add "rewriteSystem" \
96 "http://docbook.sourceforge.net/release/xsl/current" \
97 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
98 /usr/bin/xmlcatalog --noout --add "rewriteURI" \
99 "http://docbook.sourceforge.net/release/xsl/current" \
100 "file://%{xml_mod_style_prod_dir}/%{version}" $CATALOG
101 %define FOR_ROOT_CAT for-catalog-%{name}-%{version}.xml
102 CATALOG=etc/xml/$CATALOG
103 rm -f %{FOR_ROOT_CAT}.tmp
104 $xmlcatbin --noout --create %{FOR_ROOT_CAT}.tmp
105 $xmlcatbin --noout --add "delegateSystem" \
106 "http://docbook.sourceforge.net/release/xsl/" \
107 "file:///$CATALOG" %{FOR_ROOT_CAT}.tmp
108 # $xmlcatbin --noout --add "delegatePublic" \
110 # "file:///$CATALOG" %%{FOR_ROOT_CAT}.tmp
113 <group id="%{name}-%{version}">
116 %{FOR_ROOT_CAT}.tmp > %{FOR_ROOT_CAT}
120 # export NO_BRP_CHECK_BYTECODE_VERSION=true
123 %{INSTALL_DIR} %{buildroot}%{_bindir}
124 %{INSTALL_SCRIPT} fo/pdf2index %{buildroot}%{_bindir}
125 %{INSTALL_SCRIPT} epub/bin/dbtoepub %{buildroot}%{_bindir}
128 doc_dir=%{buildroot}%{_defaultdocdir}/%{name}
129 %{INSTALL_DIR} %{buildroot}%{xml_mod_style_prod_dir}/%{version}
130 cp -a [[:lower:]]* %{buildroot}%{xml_mod_style_prod_dir}/%{version}
131 cp -a VERSION.xsl %{buildroot}%{xml_mod_style_prod_dir}/%{version}
132 find %{buildroot}%{xml_mod_style_prod_dir} -type f -name '*.orig' -exec rm -f {} \;
133 rm -f %{buildroot}%{xml_mod_style_prod_dir}/%{version}/for-catalog*
136 pushd %{buildroot}%{xml_mod_style_prod_dir} >/dev/null
137 # do not create the current link for snapshots
138 # if ! echo %%{SOURCE0} | grep -q snapshot; then
139 ln -sf %{version} current
140 echo %{xml_mod_style_prod_dir}/current
144 %{INSTALL_DIR} $doc_dir
146 for f in README BUGS TODO WhatsNew RELEASE-NOTES.html; do
147 # On snapshots, WhatsNew is missing
148 [ -f $f ] && %{INSTALL_DATA} $f $doc_dir/$f
150 # cp -p README.SuSE $doc_dir/README.SuSE
154 find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
156 -not -path '%{buildroot}%{xml_mod_style_prod_dir}/%{version}/latex*' \
157 | sed 's|%{buildroot}|%dir |'
159 find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
161 -not -path '%{buildroot}%{xml_mod_style_prod_dir}/%{version}/latex*' \
162 | sed 's|%{buildroot}||'
163 } >> %{_builddir}/%{buildsubdir}/%{name}_list
164 # pushd %%{buildroot}%%{xml_mod_style_prod_dir}
166 # ln -sf docbook-xsl-stylesheets-%%{version} docbook-xsl
167 # rm -f xsl-stylesheets
168 # ln -sf docbook-xsl-stylesheets-%%{version} xsl-stylesheets
170 # ln -sf docbook-xsl-stylesheets-%%{version} %%{name}
172 cat_dir=%{buildroot}%{_sysconfdir}/xml
173 %{INSTALL_DIR} $cat_dir
174 %{INSTALL_DATA} %{FOR_ROOT_CAT} %{name}.xml $cat_dir
176 rm -f %{buildroot}%{xml_mod_style_prod_dir}/%{version}/%{name}.xml
177 cp $cat_dir/%{FOR_ROOT_CAT} \
178 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/%{name}.xml
180 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/extensions/docbook.py \
181 %{buildroot}%{xml_mod_style_prod_dir}/%{version}/extensions/xslt.py
182 # %%{buildroot}%%{xml_mod_style_prod_dir}/%%{version}/epub/bin/lib/docbook.rb
183 # %%{buildroot}%%{xml_mod_style_prod_dir}/%%{version}/epub/bin/spec/spec_helper.rb
185 %fdupes -s %{buildroot}
189 # remove empty dir if present (from ghost)
190 # also remove dangling symlink
192 rmdir $D/docbkxsl >/dev/null 2>&1 || :
193 test -L $D/docbkxsl -a ! -e $D/docbkxsl && rm -f $D/docbkxsl
194 if [ -x /usr/bin/edit-xml-catalog ]; then
195 edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
196 --add /etc/xml/%{FOR_ROOT_CAT}
200 # remove entries only on removal of file
201 if [ ! -f %{xml_sysconf_dir}/%{FOR_ROOT_CAT} -a -x /usr/bin/edit-xml-catalog ] ; then
202 edit-xml-catalog --group --catalog /etc/xml/suse-catalog.xml \
203 --del %{name}-%{version}
206 %files -f %{name}_list
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