summaryrefslogtreecommitdiff
blob: fd76e3d9fae130eaabc135c29ccd5a75a3657731 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/rrdtool/rrdtool-1.2.10.ebuild,v 1.1 2005/06/19 00:38:09 vanquirius Exp $

inherit perl-module flag-o-matic gnuconfig eutils

DESCRIPTION="A system to store and display time-series data"
HOMEPAGE="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/"
SRC_URI="http://people.ee.ethz.ch/~oetiker/webtools/${PN}/pub/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~alpha ~amd64 ~hppa ~ia64 ~ppc ~sparc"
IUSE="doc perl python tcltk"

DEPEND="perl? ( dev-lang/perl )
	python? ( dev-lang/python )
	sys-apps/gawk
	>=sys-libs/zlib-1.2.1
	>=media-libs/freetype-2.1.5
	>=media-libs/libart_lgpl-2.3.16
	>=media-libs/libpng-1.2.5
	>=media-libs/gd-1.8.3
	>=dev-libs/cgilib-0.5"
RDEPEND="tcltk? ( dev-lang/tcl )"

TCLVER=""

src_unpack() {
	unpack ${A}
	cd ${S}
	sed -i -e 's:<rrd_\(.*\)>:"../../src/rrd_\1":g' \
		bindings/tcl/tclrrd.c || die "sed failed"
	sed -i -e 's:-lrrd_private:-ltcl -lrrd:' \
		bindings/tcl/Makefile.* || die "sed failed"
}

pkg_setup() {
	use perl && perl-module_pkg_setup
}

src_compile() {
	filter-mfpmath sse
	filter-flags -ffast-math

	local myconf
	myconf="--datadir=/usr/share --enable-shared"

	use tcltk \
		&& myconf="${myconf} --with-tcllib=/usr/lib" \
		|| myconf="${myconf} --without-tcllib"

	use python || myconf="${myconf} --disable-python"

	if use perl ; then
		econf ${myconf} --with-perl-options='PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D}' || \
			die "econf failed"
	else
		econf ${myconf} --disable-perl || die "econf failed"
	fi

	make || die "make failed"
}

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

	rm -fr ${D}/usr/examples
	rm -fr ${D}/usr/shared

	if use doc ; then
		dohtml doc/*.html
		dodoc doc/*.pod
		dodoc doc/*.txt
		insinto /usr/share/doc/${PF}/examples
		doins examples/*
		insinto /usr/share/doc/${PF}/contrib
		doins contrib/*
	fi

	if use perl ; then
		perlinfo
		mytargets="site-perl-install"
		perl-module_src_install || die

		# remove duplicate installation into /usr/lib/perl
		rm -Rf ${D}/usr/lib/perl
	fi

	if use tcltk ; then
		mv ${S}/bindings/tcl/tclrrd.so ${S}/bindings/tcl/tclrrd${PV}.so
		insinto /usr/lib/tcl${TCL_VER}/tclrrd${PV}
		doins ${S}/bindings/tcl/tclrrd${PV}.so
		echo "package ifneeded Rrd ${PV} [list load [file join \$$dir .. tclrrd${PV}.so]]" \
			>> ${D}/usr/lib/tcl${TCL_VER}/tclrrd${PV}/pkgIndex.tcl
	fi

	dodoc COPY* CONTR* README TODO
}

pkg_preinst() {
	use perl && perl-module_pkg_preinst
}

pkg_postinst() {
	use perl && perl-module_pkg_postinst
}

pkg_prerm() {
	use perl && perl-module_pkg_prerm
}

pkg_postrm() {
	use perl && perl-module_pkg_postrm
}