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
12 0|1|2|3|4|5) inherit base ;;
16 DEPEND=">=app-text/sgml-common-0.6.3-r2"
18 # @ECLASS-VARIABLE: SGML_TOINSTALL
20 # An array of catalogs, arranged in pairs.
21 # Each pair consists of a centralized catalog followed by an ordinary catalog.
24 # @FUNCTION: sgml-catalog_cat_include
25 # @USAGE: <centralized catalog> <ordinary catalog>
27 # Appends a catalog pair to the SGML_TOINSTALL array.
28 sgml-catalog_cat_include() {
29 debug-print function $FUNCNAME $*
30 SGML_TOINSTALL+=("$1" "$2")
33 # @FUNCTION: sgml-catalog_cat_doinstall
34 # @USAGE: <centralized catalog> <ordinary catalog>
36 # Adds an ordinary catalog to a centralized catalog.
37 sgml-catalog_cat_doinstall() {
38 debug-print function $FUNCNAME $*
39 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
40 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
43 # @FUNCTION: sgml-catalog_cat_doremove
44 # @USAGE: <centralized catalog> <ordinary catalog>
46 # Removes an ordinary catalog from a centralized catalog.
47 sgml-catalog_cat_doremove() {
48 debug-print function $FUNCNAME $*
49 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
50 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
53 sgml-catalog_pkg_postinst() {
54 debug-print function $FUNCNAME $*
55 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
57 set -- "${SGML_TOINSTALL[@]}"
60 if [[ ! -e "${EPREFIX}$2" ]]; then
61 ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
65 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
66 sgml-catalog_cat_doinstall "$1" "$2"
72 sgml-catalog_pkg_prerm() {
76 sgml-catalog_pkg_postrm() {
77 debug-print function $FUNCNAME $*
78 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
80 set -- "${SGML_TOINSTALL[@]}"
83 einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
84 sgml-catalog_cat_doremove "$1" "$2"
89 sgml-catalog_cleanup() {
90 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
91 if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
93 einfo Regenerating SGML environment variables ...
95 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
99 sgml-catalog_src_compile() {
103 EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm