summaryrefslogtreecommitdiff
blob: 166a03b1cf8e16bfffcad80a90a1924e214c46d4 (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit eutils multilib toolchain-funcs

MY_PV=${PV%_p*}
MY_P=${PN}_${MY_PV}
PATCHV=${PV#*_p}

DESCRIPTION="Advanced Power Management Daemon"
HOMEPAGE="https://packages.qa.debian.org/a/apmd.html"
SRC_URI="mirror://debian/pool/main/a/apmd/${MY_P}.orig.tar.gz
	mirror://debian/pool/main/a/apmd/${MY_P}-${PATCHV}.diff.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ppc ppc64 x86"
IUSE="nls X"

RDEPEND=">=sys-apps/debianutils-1.16
	>=sys-power/powermgmt-base-1.31
	X? ( x11-libs/libX11
		x11-libs/libXaw
		x11-libs/libXmu
		x11-libs/libSM
		x11-libs/libICE
		x11-libs/libXt
		x11-libs/libXext )"
DEPEND="${RDEPEND}
	sys-devel/libtool
	virtual/os-headers"

S=${WORKDIR}/${PN}-${MY_PV}.orig

src_prepare() {
	epatch "${WORKDIR}"/${MY_P}-${PATCHV}.diff

	if ! use X; then
		sed -i \
			-e 's:\(EXES=.*\)xapm:\1:' \
			-e 's:\(.*\)\$(LT_INSTALL).*xapm.*$:\1echo:' \
			Makefile || die
	fi

	# use system headers and skip on_ac_power
	rm -f on_ac_power*

	sed -i \
		-e '/on_ac_power/d' \
		-e 's:-I/usr/src/linux/include -I/usr/X11R6/include::' \
		-e 's:-L/usr/X11R6/lib::' \
		Makefile || die
}

src_compile() {
	emake CC=$(tc-getCC) CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
}

src_install() {
	dodir /usr/sbin
	emake DESTDIR="${D}" PREFIX=/usr LIBDIR=/usr/$(get_libdir) install

	keepdir /etc/apm/{event.d,suspend.d,resume.d,other.d,scripts.d}
	exeinto /etc/apm
	doexe debian/apmd_proxy
	dodoc AUTHORS {,apmsleep.}README debian/{changelog,README.Debian}

	doman *.{1,8}

	# note: apmd_proxy.conf is currently disabled and not used, thus
	# not installed - liquidx (01 Mar 2004)

	newconfd "${FILESDIR}"/apmd.confd apmd
	newinitd "${FILESDIR}"/apmd.rc6 apmd

	use nls || rm -rf "${D}"/usr/share/man/fr
}