Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 7 | # Note that this recipe only handles XML catalogues in the native sysroot, and doesn't |
| 8 | # yet support catalogue management in the target sysroot or on the target itself. |
| 9 | # (https://bugzilla.yoctoproject.org/13271) |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 10 | |
| 11 | # A whitespace-separated list of XML catalogs to be registered, for example |
| 12 | # "${sysconfdir}/xml/docbook-xml.xml". |
| 13 | XMLCATALOGS ?= "" |
| 14 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 15 | DEPENDS:append = " libxml2-native" |
| 16 | |
| 17 | SYSROOT_PREPROCESS_FUNCS:append:class-native = " xmlcatalog_sstate_postinst" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 18 | |
| 19 | xmlcatalog_complete() { |
| 20 | ROOTCATALOG="${STAGING_ETCDIR_NATIVE}/xml/catalog" |
| 21 | if [ ! -f $ROOTCATALOG ]; then |
| 22 | mkdir --parents $(dirname $ROOTCATALOG) |
| 23 | xmlcatalog --noout --create $ROOTCATALOG |
| 24 | fi |
| 25 | for CATALOG in ${XMLCATALOGS}; do |
| 26 | xmlcatalog --noout --add nextCatalog unused file://$CATALOG $ROOTCATALOG |
| 27 | done |
| 28 | } |
| 29 | |
| 30 | xmlcatalog_sstate_postinst() { |
| 31 | mkdir -p ${SYSROOT_DESTDIR}${bindir} |
| 32 | dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}-xmlcatalog |
| 33 | echo '#!/bin/sh' > $dest |
| 34 | echo '${xmlcatalog_complete}' >> $dest |
| 35 | chmod 0755 $dest |
| 36 | } |