recipes: docbook: Switch back to http:// for DTD references
[dragora.git] / recipes / docbook / docbook-xml / recipe
blob82588dc4b4d4f6119baeed66f767b8e0e916b7e5
1 # Build recipe for docbook-xml.
3 # Copyright (c) 2019 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=docbook-xml
21 version=4.5
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=docbook
27 tarname=${program}-${version}.zip
29 # Remote source(s)
30 fetch="
31   https://docbook.org/xml/${version}/$tarname
32   https://docbook.org/xml/4.4/${program}-4.4.zip
33   https://docbook.org/xml/4.3/${program}-4.3.zip
34   https://docbook.org/xml/4.2/${program}-4.2.zip
35   https://docbook.org/xml/4.1.2/docbkx412.zip
38 description="
39 The DocBook XML DTD.
41 The DocBook XML DTD package contains document type definitions
42 for verification of XML data files against the DocBook rule set.
44 These are useful for structuring books and software documentation
45 to a standard allowing you to utilize transformations already
46 written for that standard.
49 homepage=https://www.docbook.org
50 license=Custom
52 # Source documentation
53 docs="ChangeLog README"
54 docsdir="${docdir}/${program}-${version}"
56 build()
58     # Unzip the sources in an own directory
59     for _version in $version 4.4 4.3 4.2 4.1.2
60     do
61         mkdir -p "${srcdir}/${_version}" \
62                  "${destdir}/usr/share/xml/docbook/xml-dtd-${_version}"
64         if test $_version = 4.1.2
65         then
66             cd "${srcdir}/${_version}"
67             unpack "${tardir}/docbkx412.zip"
68         else
69             cd "${srcdir}/${_version}"
70             unpack "${tardir}/docbook-xml-${_version}.zip"
71         fi
73         # Set sane permissions
74         chmod -R u+w,go-w,a+rX-s .
76         # Populate package
77         cp -R -p -f docbook.cat *.dtd ent/ *.mod \
78          "${destdir}/usr/share/xml/docbook/xml-dtd-${_version}"
79     done
80     unset -v _version
82     # Switch back to the current 'version'
83     cd "${TMPDIR}/${srcdir}/${version}"
85     # Copy documentation
86     mkdir -p "${destdir}${docsdir}"
87     cp -p $docs "${destdir}${docsdir}"/
89     # Create config directory
90     mkdir -p "${destdir}/etc/xml"
92     # Insert post-install script manually
94     mkdir -p "${destdir}/var/lib/qi"
95     cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
97 # XML docbook
98 if test ! -e etc/xml/docbook
99 then
100     echo "Creating etc/xml/docbook (version: $version) ..."
101     xmlcatalog --noout --create etc/xml/docbook
104 echo ""
105 echo "Updating etc/xml/docbook ..."
107 xmlcatalog --noout --add "public" \\
108  "-//OASIS//DTD DocBook XML V4.5//EN" \\
109  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \\
110  etc/xml/docbook
112 xmlcatalog --noout --add "public" \\
113  "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \\
114  "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \\
115  etc/xml/docbook
117 xmlcatalog --noout --add "public" \\
118  "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \\
119  "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \\
120  etc/xml/docbook
122 xmlcatalog --noout --add "public" \\
123  "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \\
124  "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \\
125  etc/xml/docbook
127 xmlcatalog --noout --add "public" \\
128  "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \\
129  "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \\
130  etc/xml/docbook
132 xmlcatalog --noout --add "public" \\
133  "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \\
134  "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \\
135  etc/xml/docbook
137 xmlcatalog --noout --add "public" \\
138  "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \\
139  "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \\
140  etc/xml/docbook
142 xmlcatalog --noout --add "public" \\
143  "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \\
144  "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \\
145  etc/xml/docbook
147 xmlcatalog --noout --add "public" \\
148  "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \\
149  "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \\
150  etc/xml/docbook
152 xmlcatalog --noout --add "rewriteSystem" \\
153  "http://www.oasis-open.org/docbook/xml/4.5" \\
154  "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
155  etc/xml/docbook
157 xmlcatalog --noout --add "rewriteURI" \\
158  "http://www.oasis-open.org/docbook/xml/4.5" \\
159  "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
160  etc/xml/docbook
162 # XML catalog
163 if test ! -e etc/xml/catalog
164 then
165     echo "Creating etc/xml/catalog (version: $version) ..."
166     xmlcatalog --noout --create etc/xml/catalog
169 echo ""
170 echo "Updating etc/xml/catalog ..."
172 xmlcatalog --noout --add "delegatePublic" \\
173  "-//OASIS//ENTITIES DocBook XML" \\
174  "file:///etc/xml/docbook" \\
175  etc/xml/catalog
177 xmlcatalog --noout --add "delegatePublic" \\
178  "-//OASIS//DTD DocBook XML" \\
179  "file:///etc/xml/docbook" \\
180  etc/xml/catalog
182 xmlcatalog --noout --add "delegateSystem" \\
183  "http://www.oasis-open.org/docbook/" \\
184  "file:///etc/xml/docbook" \\
185  etc/xml/catalog
187 xmlcatalog --noout --add "delegateURI" \\
188  "http://www.oasis-open.org/docbook/" \\
189  "file:///etc/xml/docbook" \\
190  etc/xml/catalog
192 echo ""
193 printf "%s" "Adding identifiers from previous version:"
195 for DTDVERSION in 4.4 4.3 4.2 4.1.2
197     printf "%s" " v\${DTDVERSION}"
199     # etc/xml/docbook
201     xmlcatalog --noout --add "public" \\
202      "-//OASIS//DTD DocBook XML V\${DTDVERSION}//EN" \\
203      "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/docbookx.dtd" \\
204      etc/xml/docbook
206     xmlcatalog --noout --add "rewriteSystem" \\
207      "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}" \\
208      "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
209      etc/xml/docbook
211     xmlcatalog --noout --add "rewriteURI" \\
212      "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}" \\
213      "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
214      etc/xml/docbook
216     # etc/xml/catalog
218     xmlcatalog --noout --add "delegateSystem" \\
219      "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/" \\
220      "file:///etc/xml/docbook" \\
221      etc/xml/catalog
223     xmlcatalog --noout --add "delegateURI" \\
224      "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/" \\
225      "file:///etc/xml/docbook" \\
226      etc/xml/catalog
227 done