Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # 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). |
| 7 | SUMMARY = "Document type definitions for verification of SGML data files" |
| 8 | DESCRIPTION = "Document type definitions for verification of SGML data \ |
| 9 | files against the DocBook rule set" |
| 10 | HOMEPAGE = "http://www.docbook.org/sgml/" |
| 11 | |
| 12 | DEPENDS = "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. |
| 17 | SRC_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 |
| 21 | S = "${WORKDIR}" |
| 22 | |
| 23 | INC_PR = "r3" |
| 24 | |
| 25 | SSTATEPOSTINSTFUNCS += "docbook_sgml_dtd_sstate_postinst" |
| 26 | SYSROOT_PREPROCESS_FUNCS += "docbook_sgml_dtd_sysroot_preprocess" |
| 27 | |
| 28 | inherit native |
| 29 | |
| 30 | do_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 | |
| 42 | docbook_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 | |
| 56 | docbook_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 | |
| 61 | CLEANFUNCS += "docbook_sgml_dtd_sstate_clean" |
| 62 | |
| 63 | docbook_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 | } |