1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: sgml-catalog.eclass
6 # No maintainer <maintainer-needed@gentoo.org>
8 # Author Matthew Turk <satai@gentoo.org>
9 # @BLURB: Functions for installing SGML catalogs
13 DEPEND=">=app-text/sgml-common-0.6.3-r2"
15 # @ECLASS-VARIABLE: SGML_TOINSTALL
17 # An array of catalogs, arranged in pairs.
18 # Each pair consists of a centralized catalog followed by an ordinary catalog.
21 # @FUNCTION: sgml-catalog_cat_include
22 # @USAGE: <centralized catalog> <ordinary catalog>
24 # Appends a catalog pair to the SGML_TOINSTALL array.
25 sgml-catalog_cat_include() {
26 debug-print function $FUNCNAME $*
27 SGML_TOINSTALL+=("$1" "$2")
30 # @FUNCTION: sgml-catalog_cat_doinstall
31 # @USAGE: <centralized catalog> <ordinary catalog>
33 # Adds an ordinary catalog to a centralized catalog.
34 sgml-catalog_cat_doinstall() {
35 debug-print function $FUNCNAME $*
36 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
37 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
40 # @FUNCTION: sgml-catalog_cat_doremove
41 # @USAGE: <centralized catalog> <ordinary catalog>
43 # Removes an ordinary catalog from a centralized catalog.
44 sgml-catalog_cat_doremove() {
45 debug-print function $FUNCNAME $*
46 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
47 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
50 sgml-catalog_pkg_postinst() {
51 debug-print function $FUNCNAME $*
52 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
54 set -- "${SGML_TOINSTALL[@]}"
57 if [[ ! -e "${EPREFIX}$2" ]]; then
58 ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
62 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
63 sgml-catalog_cat_doinstall "$1" "$2"
69 sgml-catalog_pkg_prerm() {
73 sgml-catalog_pkg_postrm() {
74 debug-print function $FUNCNAME $*
75 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
77 set -- "${SGML_TOINSTALL[@]}"
80 einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
81 sgml-catalog_cat_doremove "$1" "$2"
86 sgml-catalog_cleanup() {
87 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
88 if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
90 einfo Regenerating SGML environment variables ...
92 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
96 sgml-catalog_src_compile() {
100 EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm