app-text/libmwaw: arm64 stable wrt bug #716822
[gentoo.git] / app-text / docbook-dsssl-stylesheets / docbook-dsssl-stylesheets-1.79-r4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit sgml-catalog-r1
7
8 MY_P=${P/-stylesheets/}
9 DESCRIPTION="DSSSL Stylesheets for DocBook"
10 HOMEPAGE="https://github.com/docbook/wiki/wiki"
11 SRC_URI="https://downloads.sourceforge.net/project/docbook/docbook-dsssl/${PV}/${MY_P}.tar.bz2"
12
13 LICENSE="MIT"
14 SLOT="0"
15 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x64-solaris"
16 IUSE=""
17
18 RDEPEND="
19         app-text/docbook-sgml-dtd:3.0
20 "
21
22 DOCS=( BUGS ChangeLog README RELEASE-NOTES.txt WhatsNew )
23
24 S="${WORKDIR}/${MY_P}"
25
26 src_install() {
27         local d catdir=/usr/share/sgml/docbook/dsssl-stylesheets-${PV}
28
29         dobin bin/collateindex.pl
30
31         insinto "${catdir}"
32         doins catalog VERSION
33
34         insinto "${catdir}"/common
35         doins common/*.{dsl,ent}
36
37         insinto "${catdir}"/images
38         doins images/*.gif
39
40         for d in html lib olink print; do
41                 insinto "${catdir}/${d}"
42                 doins "${d}"/*.dsl
43         done
44
45         for d in dbdsssl html imagelib olink; do
46                 insinto "${catdir}/dtds/${d}"
47                 doins "dtds/${d}"/*.dtd
48         done
49
50         insinto "${catdir}/dtds/html"
51         doins dtds/html/*.{dcl,gml}
52
53         insinto /etc/sgml
54         newins - dsssl-docbook-stylesheets.cat <<-EOF
55                 CATALOG "${EPREFIX}/usr/share/sgml/docbook/dsssl-stylesheets-${PV}/catalog"
56         EOF
57
58         dodoc "${DOCS[@]}"
59 }
60
61 pkg_preinst() {
62         # work-around old revision removing it
63         cp "${ED}"/etc/sgml/dsssl-docbook-stylesheets.cat "${T}" || die
64 }
65
66 pkg_postinst() {
67         local backup=${T}/dsssl-docbook-stylesheets.cat
68         local real=${EROOT}/etc/sgml/dsssl-docbook-stylesheets.cat
69         if ! cmp -s "${backup}" "${real}"; then
70                 cp "${backup}" "${real}" || die
71         fi
72         # this one's shared with openjade, so we need to do it in postinst
73         if ! grep -q -s dsssl-docbook-stylesheets.cat \
74                         "${EROOT}"/etc/sgml/sgml-docbook.cat; then
75                 ebegin "Adding dsssl-docbook-stylesheets.cat to /etc/sgml/sgml-docbook.cat"
76                 cat >> "${EROOT}"/etc/sgml/sgml-docbook.cat <<-EOF
77                         CATALOG "${EPREFIX}/etc/sgml/dsssl-docbook-stylesheets.cat"
78                 EOF
79                 eend ${?}
80         fi
81         sgml-catalog-r1_pkg_postinst
82 }
83
84 pkg_postrm() {
85         if [[ -z ${REPLACED_BY_VERSION} ]]; then
86                 ebegin "Removing dsssl-docbook-stylesheets.cat from /etc/sgml/sgml-docbook.cat"
87                 sed -i -e '/dsssl-docbook-stylesheets/d' \
88                         "${EROOT}"/etc/sgml/sgml-docbook.cat
89                 eend ${?}
90                 if [[ ! -s ${EROOT}/etc/sgml/sgml-docbook.cat ]]; then
91                         rm -f "${EROOT}"/etc/sgml/sgml-docbook.cat
92                 fi
93         fi
94         sgml-catalog-r1_pkg_postrm
95 }