summaryrefslogtreecommitdiff
blob: 4983192c78b096137817aee16dbd6fbc7ae0e42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-text/scrollkeeper/scrollkeeper-0.3.14-r2.ebuild,v 1.14 2007/01/28 06:03:51 genone Exp $

inherit libtool eutils

DESCRIPTION="cataloging system for documentation on open systems"
HOMEPAGE="http://scrollkeeper.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="FDL-1.1 LGPL-2.1"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
IUSE="nls"

RDEPEND=">=dev-libs/libxml2-2.4.19
	>=dev-libs/libxslt-1.0.14
	>=sys-libs/zlib-1.1.3
	~app-text/docbook-xml-dtd-4.1.2
	app-text/docbook-xsl-stylesheets"
DEPEND="${RDEPEND}
	>=dev-util/intltool-0.29
	nls? ( sys-devel/gettext )"

src_unpack() {
	unpack ${A}

	cd "${S}"
	epatch "${FILESDIR}"/${P}-gentoo.patch
	epatch "${FILESDIR}"/${P}-gcc2_fix.patch
	epatch "${FILESDIR}"/${P}-nls.patch

	elibtoolize
}

src_compile() {
	econf \
		--localstatedir=/var \
		$(use_enable nls) \
		|| die
	emake || die
}

src_install() {
	make DESTDIR="${D}" install || die

	insinto /etc/logrotate.d
	newins "${FILESDIR}"/scrollkeeper-logrotate scrollkeeper

	dodoc AUTHORS ChangeLog NEWS README TODO scrollkeeper-spec.txt
}

pkg_preinst() {
	if [[ -d ${ROOT}/usr/share/scrollkeeper/Templates ]] ; then
		rm -rf "${ROOT}"/usr/share/scrollkeeper/Templates
	fi
}

pkg_postinst() {
	einfo "Installing catalog..."
	"${ROOT}"/usr/bin/xmlcatalog --noout --add "public" \
		"-//OMF//DTD Scrollkeeper OMF Variant V1.0//EN" \
		"`echo "${ROOT}/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd" | sed -e "s://:/:g"`" \
		"${ROOT}"/etc/xml/catalog
	einfo "Rebuilding Scrollkeeper database..."
	scrollkeeper-rebuilddb -q -p "${ROOT}"/var/lib/scrollkeeper
	einfo "Updating Scrollkeeper database..."
	scrollkeeper-update -v &> "${T}"/foo
}

pkg_postrm() {
	if [[ ! -x ${ROOT}/usr/bin/scrollkeeper-config ]] ; then
		# SK is being removed, not upgraded.
		# Remove all generated files
		einfo "Cleaning up ${ROOT}/var/lib/scrollkeeper..."
		rm -rf "${ROOT}"/var/lib/scrollkeeper
		rm -rf "${ROOT}"/var/log/scrollkeeper.log
		rm -rf "${ROOT}"/var/log/scrollkeeper.log.1
		"${ROOT}"/usr/bin/xmlcatalog --noout --del \
			"${ROOT}/usr/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd" \
			"${ROOT}"/etc/xml/catalog

		elog "Scrollkeeper ${PV} unmerged, if you removed the package"
		elog "you might want to clean up /var/lib/scrollkeeper."
	fi
}