archrelease: copy trunk to testing-any
[arch-packages.git] / docbook5-xml / trunk / PKGBUILD
blob5a52fc7e79d035ea05a26a79a59fe4affcbcd004
1 # Maintainer: Andreas Radke <andyrtr@archlinux.org>
2 # Contributor: Andy Weidenbaum <archbaum@gmail.com>
3 # Contributor: Holger Rauch < holger dot rauch at posteo dot de >
4 # based on CentOS 7 rpm
5 # http://pkgs.org/centos-7/centos-x86_64/docbook5-schemas-5.0-10.el7.noarch.rpm.html
7 pkgname=docbook5-xml
8 pkgver=5.1
9 pkgrel=3
10 pkgdesc="a complete rewrite of the well-known DocBook 4 XML schema (DTD, Relax NG, W3C schema) for Docbook 5.X"
11 arch=('any')
12 depends=('libxml2')
13 makedepends=('unzip')
14 optdepends=('perl: for docbook v4 upgrade tools')
15 url="https://docbook.org/schemas/5x"
16 license=('MIT')
17 source=(https://docbook.org/xml/5.0/docbook-5.0.zip
18         https://docbook.org/xml/5.1/docbook-v5.1-os.zip)
19 sha512sums=('a245796881762cf001f0d32b7c87315cba0454750d6b4178e4546357e320e2ab602d84c08a7e44329f406a8d32340605671c351e87c0b9097582ebf6d10fede4'
20             'b55f8eda4dcff9d4ebd31876bc33c244ef3884afc167da1425531266963ba64000fbe619ec7c049ae65c0aab864a5a7228caef08b53f546e2686296d97190873')
21 install=$pkgname.install
22 provides=('docbook5-schemas' 'docbook-xml-5.0' 'docbook-xml-5.1')
23 replaces=('docbook5-schemas')
24 conflicts=('docbook5-schemas')
26 _datadir=/usr/share
27 _catalog50=docbook-5.0.xml
28 _catalog51=docbook-5.1.xml
29   
30 build() {
32   # docbook-5.0
33   pushd "$srcdir/docbook-5.0"
34   xmlcatalog --create --noout ${_catalog50}
36   for v in 5.0; do
37     # DTD
38     xmlcatalog --noout --add "public" \
39       "-//OASIS//DTD DocBook XML ${v}//EN" \
40       "file://${_datadir}/xml/docbook/schema/dtd/${v}/docbook.dtd" ${_catalog50}
41     xmlcatalog --noout --add "system" \
42       "http://www.oasis-open.org/docbook/xml/${v}/dtd/docbook.dtd" \
43       "file://${_datadir}/xml/docbook/schema/dtd/${v}/docbook.dtd" ${_catalog50}
44     xmlcatalog --noout --add "system" \
45       "http://docbook.org/xml/${v}/dtd/docbook.dtd" \
46       "file://${_datadir}/xml/docbook/schema/dtd/${v}/docbook.dtd" ${_catalog50}
47     # RNG
48     xmlcatalog --noout --add "uri" \
49       "http://www.oasis-open.org/docbook/xml/${v}/rng/docbook.rng" \
50       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rng" ${_catalog50}
51     xmlcatalog --noout --add "uri" \
52       "http://docbook.org/xml/${v}/rng/docbook.rng" \
53       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rng" ${_catalog50}
54     # RNG+XInclude
55     xmlcatalog --noout --add "uri" \
56       "http://www.oasis-open.org/docbook/xml/${v}/rng/docbookxi.rng" \
57       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rng" ${_catalog50}
58     xmlcatalog --noout --add "uri" \
59       "http://docbook.org/xml/${v}/rng/docbookxi.rng" \
60       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rng" ${_catalog50}
61     # RNC
62     xmlcatalog --noout --add "uri" \
63       "http://www.oasis-open.org/docbook/xml/${v}/rnc/docbook.rnc" \
64       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rnc" ${_catalog50}
65     xmlcatalog --noout --add "uri" \
66       "http://docbook.org/xml/${v}/rng/docbook.rnc" \
67       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rnc" ${_catalog50}
68     # RNC+XInclude
69     xmlcatalog --noout --add "uri" \
70       "http://www.oasis-open.org/docbook/xml/${v}/rnc/docbookxi.rnc" \
71       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rnc" ${_catalog50}
72     xmlcatalog --noout --add "uri" \
73       "http://docbook.org/xml/${v}/rng/docbookxi.rnc" \
74       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rnc" ${_catalog50}
75     # XSD
76     xmlcatalog --noout --add "uri" \
77       "http://www.oasis-open.org/docbook/xml/${v}/xsd/docbook.xsd" \
78       "file://${_datadir}/xml/docbook/schema/xsd/${v}/docbook.xsd" ${_catalog50}
79     xmlcatalog --noout --add "uri" \
80       "http://docbook.org/xml/${v}/xsd/docbook.xsd" \
81       "file://${_datadir}/xml/docbook/schema/xsd/${v}/docbook.xsd" ${_catalog50}
82     # XSD + XInclude
83     xmlcatalog --noout --add "uri" \
84       "http://www.oasis-open.org/docbook/xml/${v}/xsd/docbookxi.xsd" \
85       "file://${_datadir}/xml/docbook/schema/xsd/${v}/docbookxi.xsd" ${_catalog50}
86     xmlcatalog --noout --add "uri" \
87       "http://docbook.org/xml/${v}/xsd/docbookxi.xsd" \
88       "file://${_datadir}/xml/docbook/schema/xsd/${v}/docbookxi.xsd" ${_catalog50}
89     xmlcatalog --noout --add "uri" \
90       "http://www.oasis-open.org/docbook/xml/${v}/xsd/xi.xsd" \
91       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xi.xsd" ${_catalog50}
92     xmlcatalog --noout --add "uri" \
93       "http://docbook.org/xml/${v}/xsd/xi.xsd" \
94       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xi.xsd" ${_catalog50}
95     # XLink + XML
96     xmlcatalog --noout --add "uri" \
97       "http://www.oasis-open.org/docbook/xml/${v}/xsd/xlink.xsd" \
98       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xlink.xsd" ${_catalog50}
99     xmlcatalog --noout --add "uri" \
100       "http://docbook.org/xml/${v}/xsd/xlink.xsd" \
101       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xlink.xsd" ${_catalog50}
102     xmlcatalog --noout --add "uri" \
103       "http://www.oasis-open.org/docbook/xml/${v}/xsd/xml.xsd" \
104       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xml.xsd" ${_catalog50}
105     xmlcatalog --noout --add "uri" \
106       "http://docbook.org/xml/${v}/xsd/xml.xsd" \
107       "file://${_datadir}/xml/docbook/schema/xsd/${v}/xml.xsd" ${_catalog50}
108     # Schematron
109     xmlcatalog --noout --add "uri" \
110       "http://www.oasis-open.org/docbook/xml/${v}/sch/docbook.sch" \
111       "file://${_datadir}/xml/docbook/schema/sch/${v}/docbook.sch" ${_catalog50}
112     xmlcatalog --noout --add "uri" \
113       "http://docbook.org/xml/${v}/sch/docbook.sch" \
114       "file://${_datadir}/xml/docbook/schema/sch/${v}/docbook.sch" ${_catalog50}
116     # ---------------------
117     # Build XML catalog files for each Schema
118     for s in dtd rng sch xsd; do
119       _schema_catalog=${s}/catalog.xml
120       xmlcatalog --noout --create ${_schema_catalog}
121       case $s in
122         dtd)
123           xmlcatalog --noout --add "public" \
124             "-//OASIS//DTD DocBook XML ${v}//EN" \
125             "docbook.dtd" ${_schema_catalog}
126           xmlcatalog --noout --add "system" \
127             "http://www.oasis-open.org/docbook/xml/${v}/dtd/docbook.dtd" \
128             "docbook.dtd" ${_schema_catalog}
129           ;;
130         sch)
131           xmlcatalog --noout --add "uri" \
132             "http://docbook.org/xml/${v}/${s}/docbook.${s}" \
133             "docbook.${s}" ${_schema_catalog}
134           xmlcatalog --noout --add "uri" \
135             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.${s}" \
136             "docbook.${s}" ${_schema_catalog}
137           ;;
138         rng)
139           xmlcatalog --noout --add "uri" \
140             "http://docbook.org/xml/${v}/${s}/docbook.${s}" \
141             "docbook.${s}" ${_schema_catalog}
142           xmlcatalog --noout --add "uri" \
143             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.${s}" \
144             "docbook.${s}" ${_schema_catalog}
145           xmlcatalog --noout --add "uri" \
146             "http://docbook.org/xml/${v}/${s}/docbookxi.${s}" \
147             "docbookxi.${s}" ${_schema_catalog}
148           xmlcatalog --noout --add "uri" \
149             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbookxi.${s}" \
150             "docbookxi.${s}" ${_schema_catalog}
151           xmlcatalog --noout --add "uri" \
152             "http://docbook.org/xml/${v}/${s}/docbook.rnc" \
153             "docbook.rnc" ${_schema_catalog}
154           xmlcatalog --noout --add "uri" \
155             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.rnc" \
156             "docbook.rnc" ${_schema_catalog}
157           xmlcatalog --noout --add "uri" \
158             "http://docbook.org/xml/${v}/${s}/docbookxi.rnc" \
159             "docbookxi.rnc" ${_schema_catalog}
160           xmlcatalog --noout --add "uri" \
161             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbookxi.rnc" \
162             "docbookxi.rnc" ${_schema_catalog}
163           ;;
164         xsd)
165           # https://docbook.org/xml/5.0/xsd/docbook.xsd
166           # https://docbook.org/xml/5.0/xsd/xml.xsd
167           # https://docbook.org/xml/5.0/xsd/xlink.xsd
168           xmlcatalog --noout --add "uri" \
169             "http://docbook.org/xml/${v}/${s}/docbook.${s}" \
170             "docbook.${s}" ${_schema_catalog}
171           xmlcatalog --noout --add "uri" \
172             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.${s}" \
173             "docbook.${s}" ${_schema_catalog}
174           xmlcatalog --noout --add "uri" \
175             "http://docbook.org/xml/${v}/${s}/docbookxi.${s}" \
176             "docbookxi.${s}" ${_schema_catalog}
177           xmlcatalog --noout --add "uri" \
178             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbookxi.${s}" \
179             "docbookxi.${s}" ${_schema_catalog}
180           # XLink + XML:
181           xmlcatalog --noout --add "uri" \
182             "http://docbook.org/xml/${v}/${s}/xlink.xsd" \
183             "xlink.xsd" ${_schema_catalog}
184           xmlcatalog --noout --add "uri" \
185             "http://www.oasis-open.org/docbook/xml/${v}/${s}/xlink.xsd" \
186             "xlink.xsd" ${_schema_catalog}
187           xmlcatalog --noout --add "uri" \
188             "http://docbook.org/xml/${v}/${s}/xml.xsd" \
189             "xml.xsd" ${_schema_catalog}
190           xmlcatalog --noout --add "uri" \
191             "http://www.oasis-open.org/docbook/xml/${v}/${s}/xml.xsd" \
192             "xml.xsd" ${_schema_catalog}
193           ;;
194       esac
195     done
196   done
197   popd
198   
199   # docbook-5.1
200   xmlcatalog --create --noout ${_catalog51}
202   for v in 5.1; do
203     # RNG
204     xmlcatalog --noout --add "uri" \
205       "http://www.oasis-open.org/docbook/xml/${v}/rng/docbook.rng" \
206       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rng" ${_catalog51}
207     xmlcatalog --noout --add "uri" \
208       "http://docbook.org/xml/${v}/rng/docbook.rng" \
209       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rng" ${_catalog51}
210     # RNG+XInclude
211     xmlcatalog --noout --add "uri" \
212       "http://www.oasis-open.org/docbook/xml/${v}/rng/docbookxi.rng" \
213       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rng" ${_catalog51}
214     xmlcatalog --noout --add "uri" \
215       "http://docbook.org/xml/${v}/rng/docbookxi.rng" \
216       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rng" ${_catalog51}
217     # RNC
218     xmlcatalog --noout --add "uri" \
219       "http://www.oasis-open.org/docbook/xml/${v}/rnc/docbook.rnc" \
220       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rnc" ${_catalog51}
221     xmlcatalog --noout --add "uri" \
222       "http://docbook.org/xml/${v}/rng/docbook.rnc" \
223       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbook.rnc" ${_catalog51}
224     # RNC+XInclude
225     xmlcatalog --noout --add "uri" \
226       "http://www.oasis-open.org/docbook/xml/${v}/rnc/docbookxi.rnc" \
227       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rnc" ${_catalog51}
228     xmlcatalog --noout --add "uri" \
229       "http://docbook.org/xml/${v}/rng/docbookxi.rnc" \
230       "file://${_datadir}/xml/docbook/schema/rng/${v}/docbookxi.rnc" ${_catalog51}
231     # Schematron
232     xmlcatalog --noout --add "uri" \
233       "http://www.oasis-open.org/docbook/xml/${v}/sch/docbook.sch" \
234       "file://${_datadir}/xml/docbook/schema/sch/${v}/docbook.sch" ${_catalog51}
235     xmlcatalog --noout --add "uri" \
236       "http://docbook.org/xml/${v}/sch/docbook.sch" \
237       "file://${_datadir}/xml/docbook/schema/sch/${v}/docbook.sch" ${_catalog51}
239     # ---------------------
240     # Build XML catalog files for each Schema
241     for s in schemas/rng schemas/sch; do
242       _schema_catalog=${s}/catalog.xml
243       xmlcatalog --noout --create ${_schema_catalog}
244       case $s in
245         sch)
246           xmlcatalog --noout --add "uri" \
247             "http://docbook.org/xml/${v}/${s}/docbook.${s}" \
248             "docbook.${s}" ${_schema_catalog}
249           xmlcatalog --noout --add "uri" \
250             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.${s}" \
251             "docbook.${s}" ${_schema_catalog}
252           ;;
253         rng)
254           xmlcatalog --noout --add "uri" \
255             "http://docbook.org/xml/${v}/${s}/docbook.${s}" \
256             "docbook.${s}" ${_schema_catalog}
257           xmlcatalog --noout --add "uri" \
258             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.${s}" \
259             "docbook.${s}" ${_schema_catalog}
260           xmlcatalog --noout --add "uri" \
261             "http://docbook.org/xml/${v}/${s}/docbookxi.${s}" \
262             "docbookxi.${s}" ${_schema_catalog}
263           xmlcatalog --noout --add "uri" \
264             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbookxi.${s}" \
265             "docbookxi.${s}" ${_schema_catalog}
266           xmlcatalog --noout --add "uri" \
267             "http://docbook.org/xml/${v}/${s}/docbook.rnc" \
268             "docbook.rnc" ${_schema_catalog}
269           xmlcatalog --noout --add "uri" \
270             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbook.rnc" \
271             "docbook.rnc" ${_schema_catalog}
272           xmlcatalog --noout --add "uri" \
273             "http://docbook.org/xml/${v}/${s}/docbookxi.rnc" \
274             "docbookxi.rnc" ${_schema_catalog}
275           xmlcatalog --noout --add "uri" \
276             "http://www.oasis-open.org/docbook/xml/${v}/${s}/docbookxi.rnc" \
277             "docbookxi.rnc" ${_schema_catalog}
278           ;;
279       esac
280     done
281   done
284 package() {
286   _docbook5dir="${pkgdir}${_datadir}/xml/docbook"
287         
288   # docbook-5.0
289   pushd "$srcdir/docbook-5.0"
290   for v in 5.0; do
291     for type in dtd rng sch xsd; do
292       mkdir -p ${_docbook5dir}/schema/${type}/${v}
293       install -m644 ${type}/* ${_docbook5dir}/schema/${type}/${v}
294     done
295   done
296   popd
298   # docbook-5.1
299   pushd "$srcdir/schemas"
300   for v in 5.1; do
301     for type in rng sch; do
302       mkdir -p ${_docbook5dir}/schema/${type}/${v}
303       install -m644 ${type}/* ${_docbook5dir}/schema/${type}/${v}
304     done
305   done
306   popd
308   mkdir -p "$pkgdir/usr/bin"
309   install -m755 tools/db4-entities.pl "$pkgdir/usr/bin"
310   mkdir -p "${_docbook5dir}/stylesheet/docbook5"
311   install -m644 tools/db4-upgrade.xsl "${_docbook5dir}/stylesheet/docbook5/"
313   # catalog configuration
314   mkdir -p "$pkgdir/etc/xml"
315   install -m644 docbook-5.0/${_catalog50} "$pkgdir/etc/xml/${_catalog50}"
316   install -m644 ${_catalog51} "$pkgdir/etc/xml/${_catalog51}"