packaging: Bump to 1.78.1
[platform/upstream/docbook-xsl-stylesheets.git] / packaging / docbook-xsl-stylesheets.spec
1 %define regcat /usr/bin/sgml-register-catalog
2
3 Name:           docbook-xsl-stylesheets
4 Version:        1.78.1
5 Release:        0
6 License:        MPL-1.1 and MIT
7 Summary:        XSL Stylesheets for DocBook 4
8 Url:            http://sourceforge.net/projects/docbook/
9 Group:          Base/Utilities
10 Source0:        http://switch.dl.sourceforge.net/sourceforge/docbook/docbook-xsl-%{version}.tar.bz2
11 Source1001:     docbook-xsl-stylesheets.manifest
12 BuildRequires:  fdupes
13 BuildRequires:  sgml-skel
14 BuildRequires:  unzip
15 Requires(pre):  %{regcat}
16 Requires(pre):  /usr/bin/xmlcatalog
17 Requires(pre):  sgml-skel
18 Requires:       docbook_4
19 Requires:       xmlcharent
20 BuildArch:      noarch
21
22 %description
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.
26
27 The stylesheets transform DocBook documents into HTML, XHTML, Manpages,
28 XSL-FO (for PDF), and a few other formats.
29
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/
33
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
54
55 %prep
56 %setup -q -n docbook-xsl-%{version} 
57 cp %{SOURCE1001} .
58
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
61
62 # We don't need these scripts:
63 rm -rf install.sh tools/bin/docbook-xsl-update
64
65 find -type f  -exec 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
74 ## rm $x;
75 #  for i in $x; do
76 #     if [ -f $i ]; then
77 #        rm $i
78 #     fi
79 #  done
80 #fi
81
82 %build
83 xmlcatbin=/usr/bin/xmlcatalog
84 CATALOG=%{name}.xml
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" \
108 #   "-//OASIS//xxx" \
109 #   "file:///$CATALOG" %%{FOR_ROOT_CAT}.tmp
110 # Create tag
111 sed '/<catalog/a\
112   <group id="%{name}-%{version}">
113 /<\/catalog/i\
114   </group>' \
115   %{FOR_ROOT_CAT}.tmp > %{FOR_ROOT_CAT}
116
117 %install
118 # FIXME: Danger!?
119 # export NO_BRP_CHECK_BYTECODE_VERSION=true
120
121 # Install scripts
122 %{INSTALL_DIR} %{buildroot}%{_bindir}
123 %{INSTALL_SCRIPT} fo/pdf2index       %{buildroot}%{_bindir}
124 %{INSTALL_SCRIPT} epub/bin/dbtoepub  %{buildroot}%{_bindir}
125 rm fo/pdf2index
126
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' -exec rm -f {} \;
132 rm -f %{buildroot}%{xml_mod_style_prod_dir}/%{version}/for-catalog*
133 : >%{name}_list
134 {
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
140 #  fi
141   popd >/dev/null
142 } >%{name}_list
143 %{INSTALL_DIR} $doc_dir
144 # documentation
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
148 done
149 # cp -p README.SuSE $doc_dir/README.SuSE
150 #
151 {
152   LANG=C \
153     find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
154     -type d \
155     -not -path '%{buildroot}%{xml_mod_style_prod_dir}/%{version}/latex*' \
156     | sed 's|%{buildroot}|%dir |'
157   LANG=C \
158     find %{buildroot}%{xml_mod_style_prod_dir}/%{version} \
159     -type f \
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}
164 #   rm -f docbook-xsl
165 #   ln -sf docbook-xsl-stylesheets-%%{version} docbook-xsl
166 #   rm -f xsl-stylesheets
167 #   ln -sf docbook-xsl-stylesheets-%%{version} xsl-stylesheets
168 #   rm -f %%{name}
169 #   ln -sf docbook-xsl-stylesheets-%%{version} %%{name}
170 # popd
171 cat_dir=%{buildroot}%{_sysconfdir}/xml
172 %{INSTALL_DIR} $cat_dir
173 %{INSTALL_DATA} %{FOR_ROOT_CAT} %{name}.xml $cat_dir
174 # cleanup
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
178 chmod +x \
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
183
184 %fdupes -s %{buildroot}
185
186
187 %post
188 # remove empty dir if present (from ghost)
189 # also remove dangling symlink
190 D=usr/share/sgml
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}
196 fi
197
198 %postun
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}
203 fi
204
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
215 %{_bindir}/*