1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: sgml-catalog.eclass
7 # SGML Herd <sgml@gentoo.org>
9 # Author Matthew Turk <satai@gentoo.org>
10 # @BLURB: Functions for installing SGML catalogs
14 DEPEND=">=app-text/sgml-common-0.6.3-r2"
16 # @ECLASS-VARIABLE: SGML_TOINSTALL
18 # An array of catalogs, arranged in pairs.
19 # Each pair consists of a centralized catalog followed by an ordinary catalog.
22 # @FUNCTION: sgml-catalog_cat_include
23 # @USAGE: <centralized catalog> <ordinary catalog>
25 # Appends a catalog pair to the SGML_TOINSTALL array.
26 sgml-catalog_cat_include() {
27 debug-print function $FUNCNAME $*
28 SGML_TOINSTALL+=("$1" "$2")
31 # @FUNCTION: sgml-catalog_cat_doinstall
32 # @USAGE: <centralized catalog> <ordinary catalog>
34 # Adds an ordinary catalog to a centralized catalog.
35 sgml-catalog_cat_doinstall() {
36 debug-print function $FUNCNAME $*
37 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
38 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
41 # @FUNCTION: sgml-catalog_cat_doremove
42 # @USAGE: <centralized catalog> <ordinary catalog>
44 # Removes an ordinary catalog from a centralized catalog.
45 sgml-catalog_cat_doremove() {
46 debug-print function $FUNCNAME $*
47 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
48 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
51 sgml-catalog_pkg_postinst() {
52 debug-print function $FUNCNAME $*
53 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
55 set -- "${SGML_TOINSTALL[@]}"
58 if [[ ! -e "${EPREFIX}$2" ]]; then
59 ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
63 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
64 sgml-catalog_cat_doinstall "$1" "$2"
70 sgml-catalog_pkg_prerm() {
74 sgml-catalog_pkg_postrm() {
75 debug-print function $FUNCNAME $*
76 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
78 set -- "${SGML_TOINSTALL[@]}"
81 einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
82 sgml-catalog_cat_doremove "$1" "$2"
87 sgml-catalog_cleanup() {
88 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
89 if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
91 einfo Regenerating SGML environment variables ...
93 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
97 sgml-catalog_src_compile() {
101 EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm