summaryrefslogtreecommitdiff
blob: f20fffc9e5e995a44b2bd0e301f4a0e9e18c96c6 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-laptop/ibam/ibam-0.5.2-r2.ebuild,v 1.1 2011/03/20 15:34:24 aidecoe Exp $

EAPI=2

inherit base toolchain-funcs

DESCRIPTION="Intelligent Battery Monitor"
HOMEPAGE="http://ibam.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="gkrellm"

DEPEND="gkrellm? ( app-admin/gkrellm )"
RDEPEND="${DEPEND}"
PATCHES=( "${FILESDIR}/${P}-ldflags.patch"
	"${FILESDIR}/${P}-acpi.patch"
	)

src_prepare() {
	base_src_prepare
	sed -i \
		-e "s:^CFLAGS=-O3:CFLAGS=${CFLAGS}:" \
		-e "s:^CC=g++:CC=$(tc-getCXX):" \
		"${S}"/Makefile \
		|| die "Failed to set CFLAGS/compiler"
}

src_compile() {
	emake || die "Making ibam failed"
	if use gkrellm; then
		emake krell || die "Making krell failed"
	fi
}

src_install() {
	dobin ibam || die "dobin failed"
	dodoc CHANGES README REPORT || die "dodoc failed"

	if use gkrellm; then
		insinto /usr/$(get_libdir)/gkrellm2/plugins
		doins ibam-krell.so || die "doins gkrellm plugin failed"
	fi
}

pkg_postinst() {
	elog
	elog "You will need to install sci-visualization/gnuplot if you wish to use"
	elog "the --plot argument to ibam."
	elog
}