blob: d3ef7ff43c234f2b4b0845b1c65fc8b93ff1452e [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
Patrick Williams705982a2024-01-12 09:51:57 -06007# 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 Williams92b42cb2022-09-03 06:53:57 -050010
11# A whitespace-separated list of XML catalogs to be registered, for example
12# "${sysconfdir}/xml/docbook-xml.xml".
13XMLCATALOGS ?= ""
14
Patrick Williams705982a2024-01-12 09:51:57 -060015DEPENDS:append = " libxml2-native"
16
17SYSROOT_PREPROCESS_FUNCS:append:class-native = " xmlcatalog_sstate_postinst"
Patrick Williams92b42cb2022-09-03 06:53:57 -050018
19xmlcatalog_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
30xmlcatalog_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}