recipe 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. # Build recipe for docbook-xml.
  2. #
  3. # Copyright (c) 2019, 2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. # Exit immediately on any error
  17. set -e
  18. program=docbook-xml
  19. version=4.5
  20. release=2
  21. # Define a category for the output of the package name
  22. pkgcategory=docbook
  23. tarname=${program}-${version}.zip
  24. # Remote source(s)
  25. fetch="
  26. https://docbook.org/xml/${version}/$tarname
  27. https://docbook.org/xml/4.4/${program}-4.4.zip
  28. https://docbook.org/xml/4.3/${program}-4.3.zip
  29. https://docbook.org/xml/4.2/${program}-4.2.zip
  30. https://docbook.org/xml/4.1.2/docbkx412.zip
  31. "
  32. description="
  33. The DocBook XML DTD.
  34. The DocBook XML DTD package contains document type definitions
  35. for verification of XML data files against the DocBook rule set.
  36. These are useful for structuring books and software documentation
  37. to a standard allowing you to utilize transformations already
  38. written for that standard.
  39. "
  40. homepage=https://www.docbook.org
  41. license=Custom
  42. # Source documentation
  43. docs="ChangeLog README"
  44. docsdir="${docdir}/${program}-${version}"
  45. build()
  46. {
  47. # Unzip the sources in an own directory
  48. for _version in $version 4.4 4.3 4.2 4.1.2
  49. do
  50. mkdir -p "${srcdir}/${_version}" \
  51. "${destdir}/usr/share/xml/docbook/xml-dtd-${_version}"
  52. if test $_version = 4.1.2
  53. then
  54. cd "${srcdir}/${_version}"
  55. unpack "${tardir}/docbkx412.zip"
  56. else
  57. cd "${srcdir}/${_version}"
  58. unpack "${tardir}/docbook-xml-${_version}.zip"
  59. fi
  60. # Set sane permissions
  61. chmod -R u+w,go-w,a+rX-s .
  62. # Populate package
  63. cp -R -p -f docbook.cat *.dtd ent/ *.mod \
  64. "${destdir}/usr/share/xml/docbook/xml-dtd-${_version}"
  65. done
  66. unset -v _version
  67. # Switch back to the current 'version'
  68. cd "${srcdir}/${version}"
  69. # Copy documentation
  70. mkdir -p "${destdir}/$docsdir"
  71. cp -p $docs "${destdir}/$docsdir"
  72. # Create config directory
  73. mkdir -p "${destdir}/etc/xml"
  74. # Insert post-install script manually
  75. mkdir -p "${destdir}/var/lib/qi"
  76. cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
  77. # XML docbook
  78. if test ! -e etc/xml/docbook
  79. then
  80. echo "Creating etc/xml/docbook (version: $version) ..."
  81. xmlcatalog --noout --create etc/xml/docbook
  82. fi
  83. echo ""
  84. echo "Updating etc/xml/docbook ..."
  85. xmlcatalog --noout --add "public" \\
  86. "-//OASIS//DTD DocBook XML V4.5//EN" \\
  87. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \\
  88. etc/xml/docbook
  89. xmlcatalog --noout --add "public" \\
  90. "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \\
  91. "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \\
  92. etc/xml/docbook
  93. xmlcatalog --noout --add "public" \\
  94. "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \\
  95. "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \\
  96. etc/xml/docbook
  97. xmlcatalog --noout --add "public" \\
  98. "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \\
  99. "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \\
  100. etc/xml/docbook
  101. xmlcatalog --noout --add "public" \\
  102. "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \\
  103. "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \\
  104. etc/xml/docbook
  105. xmlcatalog --noout --add "public" \\
  106. "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \\
  107. "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \\
  108. etc/xml/docbook
  109. xmlcatalog --noout --add "public" \\
  110. "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \\
  111. "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \\
  112. etc/xml/docbook
  113. xmlcatalog --noout --add "public" \\
  114. "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \\
  115. "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \\
  116. etc/xml/docbook
  117. xmlcatalog --noout --add "public" \\
  118. "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \\
  119. "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \\
  120. etc/xml/docbook
  121. xmlcatalog --noout --add "rewriteSystem" \\
  122. "http://www.oasis-open.org/docbook/xml/4.5" \\
  123. "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
  124. etc/xml/docbook
  125. xmlcatalog --noout --add "rewriteURI" \\
  126. "http://www.oasis-open.org/docbook/xml/4.5" \\
  127. "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
  128. etc/xml/docbook
  129. # XML catalog
  130. if test ! -e etc/xml/catalog
  131. then
  132. echo "Creating etc/xml/catalog (version: $version) ..."
  133. xmlcatalog --noout --create etc/xml/catalog
  134. fi
  135. echo ""
  136. echo "Updating etc/xml/catalog ..."
  137. xmlcatalog --noout --add "delegatePublic" \\
  138. "-//OASIS//ENTITIES DocBook XML" \\
  139. "file:///etc/xml/docbook" \\
  140. etc/xml/catalog
  141. xmlcatalog --noout --add "delegatePublic" \\
  142. "-//OASIS//DTD DocBook XML" \\
  143. "file:///etc/xml/docbook" \\
  144. etc/xml/catalog
  145. xmlcatalog --noout --add "delegateSystem" \\
  146. "http://www.oasis-open.org/docbook/" \\
  147. "file:///etc/xml/docbook" \\
  148. etc/xml/catalog
  149. xmlcatalog --noout --add "delegateURI" \\
  150. "http://www.oasis-open.org/docbook/" \\
  151. "file:///etc/xml/docbook" \\
  152. etc/xml/catalog
  153. echo ""
  154. printf "%s" "Adding identifiers from previous version:"
  155. for DTDVERSION in 4.4 4.3 4.2 4.1.2
  156. do
  157. printf "%s" " v\${DTDVERSION}"
  158. # etc/xml/docbook
  159. xmlcatalog --noout --add "public" \\
  160. "-//OASIS//DTD DocBook XML V\${DTDVERSION}//EN" \\
  161. "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/docbookx.dtd" \\
  162. etc/xml/docbook
  163. xmlcatalog --noout --add "rewriteSystem" \\
  164. "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}" \\
  165. "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
  166. etc/xml/docbook
  167. xmlcatalog --noout --add "rewriteURI" \\
  168. "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}" \\
  169. "file:///usr/share/xml/docbook/xml-dtd-4.5" \\
  170. etc/xml/docbook
  171. # etc/xml/catalog
  172. xmlcatalog --noout --add "delegateSystem" \\
  173. "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/" \\
  174. "file:///etc/xml/docbook" \\
  175. etc/xml/catalog
  176. xmlcatalog --noout --add "delegateURI" \\
  177. "http://www.oasis-open.org/docbook/xml/\${DTDVERSION}/" \\
  178. "file:///etc/xml/docbook" \\
  179. etc/xml/catalog
  180. done
  181. EOF
  182. }