1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit prefix sgml-catalog-r1
8 DESCRIPTION="Base ISO character entities and utilities for SGML"
9 HOMEPAGE="https://www.iso.org/standard/16387.html"
10 SRC_URI="https://dev.gentoo.org/~floppym/dist/${PN}/${P}-gentoo.tar.gz"
12 # install-catalog is GPL
13 LICENSE="FDL-1.1+ GPL-2"
15 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
21 PATCHES=( "${FILESDIR}"/${P}-prefix.patch )
24 # We use a hacked version of install-catalog that supports the ROOT
25 # variable, puts quotes around the CATALOG files, and can be prefixed.
26 cp "${FILESDIR}/${P}-install-catalog.in" "${S}/bin/install-catalog.in" \
27 || die "Copy of install-catalog.in failed"
30 eprefixify bin/install-catalog.in bin/sgmlwhich config/sgml.conf
36 # own /etc/sgml/catalog
38 newins - catalog <<<''
39 newins - sgml-ent.cat <<-EOF
40 CATALOG "${EPREFIX}/usr/share/sgml/sgml-iso-entities-8879.1986/catalog"
42 newins - sgml-docbook.cat <<-EOF
43 CATALOG "${EPREFIX}/etc/sgml/sgml-ent.cat"
50 for f in /etc/sgml/{catalog,sgml-docbook.cat}; do
51 if [[ -s ${EROOT}${f} ]]; then
52 cp "${EROOT}${f}" "${ED}${f}" || die
56 # and back them up in case postrm killed them
57 for f in sgml-ent.cat sgml-docbook.cat; do
58 cp "${ED}/etc/sgml/${f}" "${T}" || die
63 # restore backed up files if necessary
64 for f in sgml-ent.cat sgml-docbook.cat; do
65 if ! cmp -s "${T}/${f}" "${EROOT}/etc/sgml/${f}"; then
66 cp "${T}/${f}" "${EROOT}"/etc/sgml/ || die
70 # re-append sgml-ent.cat if necessary
71 if ! grep -q -s sgml-ent.cat "${EROOT}/etc/sgml/sgml-docbook.cat"; then
72 ebegin "Adding sgml-ent.cat to /etc/sgml/sgml-docbook.cat"
73 cat >> "${EROOT}/etc/sgml/sgml-docbook.cat" <<-EOF
74 CATALOG "${EPREFIX}/etc/sgml/sgml-ent.cat"
79 sgml-catalog-r1_pkg_postinst
83 if [[ -z ${REPLACED_BY_VERSION} ]]; then
84 ebegin "Removing sgml-ent.cat from /etc/sgml/sgml-docbook.cat"
85 sed -i -e '/sgml-ent\.cat/d' \
86 "${EROOT}"/etc/sgml/sgml-docbook.cat
88 if [[ ! -s ${EROOT}/etc/sgml/sgml-docbook.cat ]]; then
89 rm -f "${EROOT}"/etc/sgml/sgml-docbook.cat
93 sgml-catalog-r1_pkg_postrm