blob: af50987968c4b56da2138e853fa0d9d790aa608f [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# The DTDs of the various versions have to be installed in parallel and
2# should not replace each other. The installation step is common for
3# all versions and just differs in ${DTD_VERSION} which is set in each
4# version recipe.
5#
6# The DTDs do have some quirks (see LFS documentation).
7SUMMARY = "Document type definitions for verification of SGML data files"
8DESCRIPTION = "Document type definitions for verification of SGML data \
9files against the DocBook rule set"
10HOMEPAGE = "http://www.docbook.org/sgml/"
11
12DEPENDS = "sgml-common-native"
13
14# Note: the upstream sources are not distributed with a license file.
15# LICENSE-OASIS is included as a "patch" to workaround this. When
16# upgrading this recipe, please verify whether this is still needed.
17SRC_URI = "http://www.docbook.org/sgml/${DTD_VERSION}/docbook-${DTD_VERSION}.zip \
18 file://LICENSE-OASIS"
19
20# The .zip file extracts to the current dir
21S = "${WORKDIR}"
22
23INC_PR = "r3"
24
25SSTATEPOSTINSTFUNCS += "docbook_sgml_dtd_sstate_postinst"
26SYSROOT_PREPROCESS_FUNCS += "docbook_sgml_dtd_sysroot_preprocess"
27
28inherit native
29
30do_install () {
31 # Refer to http://www.linuxfromscratch.org/blfs/view/stable/pst/sgml-dtd.html
32 # for details.
33 install -d -m 755 ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}
34 install docbook.cat ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}/catalog
35 cp -PpRr *.dtd *.mod *.dcl ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}
36
37 install -d ${D}${sysconfdir}/sgml
38 echo "CATALOG ${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}/catalog" > \
39 ${D}${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat
40}
41
42docbook_sgml_dtd_sstate_postinst () {
43 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
44 then
45 # Ensure that the catalog file sgml-docbook.cat is properly
46 # updated when the package is installed from sstate cache.
47 ${SYSROOT_DESTDIR}${bindir_crossscripts}/install-catalog-docbook-sgml-dtd-${DTD_VERSION} \
48 --add ${sysconfdir}/sgml/sgml-docbook.bak \
49 ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat
50 ${SYSROOT_DESTDIR}${bindir_crossscripts}/install-catalog-docbook-sgml-dtd-${DTD_VERSION} \
51 --add ${sysconfdir}/sgml/sgml-docbook.cat \
52 ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat
53 fi
54}
55
56docbook_sgml_dtd_sysroot_preprocess () {
57 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
58 install -m 755 ${STAGING_BINDIR_NATIVE}/install-catalog ${SYSROOT_DESTDIR}${bindir_crossscripts}/install-catalog-docbook-sgml-dtd-${DTD_VERSION}
59}
60
61CLEANFUNCS += "docbook_sgml_dtd_sstate_clean"
62
63docbook_sgml_dtd_sstate_clean () {
64 # Ensure that the catalog file sgml-docbook.cat is properly
65 # updated when the package is removed from sstate cache.
66 files="${sysconfdir}/sgml/sgml-docbook.bak ${sysconfdir}/sgml/sgml-docbook.cat"
67 for f in $files; do
68 [ ! -f $f ] || sed -i '/\/sgml\/sgml-docbook-dtd-${DTD_VERSION}.cat/d' $f
69 done
70}