summaryrefslogtreecommitdiff
blob: 40a5edf07d3372a33e02781092c51af7f2513427 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/lcd4linux/lcd4linux-0.10.0.ebuild,v 1.2 2006/10/24 07:20:46 jokey Exp $

#inherit eutils

DESCRIPTION="system and ISDN information is shown on an external display or in a X11 window"
HOMEPAGE="http://ssl.bulix.org/projects/lcd4linux/"
SRC_URI="mirror://sourceforge/lcd4linux/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
# contains x86 asm, upstream is working on a portable version
KEYWORDS="~x86"
IUSE="kde png X usb mysql python"

DEPEND="png? ( media-libs/libpng
			   media-libs/gd )
		X? ( x11-libs/libX11 )
		usb? ( dev-libs/libusb )
		mysql? ( dev-db/mysql )"
#		python? ( dev-lang/python )
# mpd is needed soon
# python is broken

pkg_preinst() {
	einfo "If you wish to compile only specific drivers or plugins, please use"
	einfo "the LCD4LINUX_PLUGINS and LCD4LINUX_DRIVERS environment variables."
}

src_compile() {
	local myconf myp myd

	# need to grab upstream's *.m4 and fix python building
	# they didn't have python properly set up originally.
	#myconf="${myconf} $(use_with python)"
	myconf="${myconf} --without-python"

	# plugins
	if [ -n "$LCD4LINUX_PLUGINS" ]; then
		myp="$LCD4LINUX_PLUGINS"
		einfo "Active plugins (overridden): ${myp}"
	else
		myp="all"
		use mysql || myp="${myp},!mysql"
		#use python || myp="${myp},!python"
		myp="${myp},!python"
		einfo "Active plugins: ${myp}"
	fi

	# drivers
	if [ -n "$LCD4LINUX_DRIVERS" ]; then
		myd="$LCD4LINUX_DRIVERS"
		einfo "Active drivers (overridden): ${myd}"
	else
		myd="all"
		use usb || myd="${myd},!USBLCD"
		use png || myd="${myd},!PNG"
		use X || myd="${myd},!X11"
		einfo "Active drivers: ${myd}"
	fi

	# avoid package brokenness
	use X && myconf="${myconf} --x-libraries=/usr/lib --x-include=/usr/include"
	use X || myconf="${myconf} --without-x"

	econf \
		--sysconfdir=/etc/lcd4linux \
		--with-drivers="${myd}" \
		--with-plugins="${myp}" \
		${myconf} \
		|| die "econf failed"

	sed -i.orig -e 's,-L -lX11, -lX11 ,g' Makefile || die "sed fixup failed"

	emake || die
}

src_install() {
	# upstream's makefile acts weird, and tries to recompile stuff
	into /usr
	dobin lcd4linux

	dodoc README* NEWS TODO CREDITS FAQ AUTHORS ChangeLog

	#newconfd ${FILESDIR}/${PN}.confd ${PN}
	#newinitd ${FILESDIR}/${PN}.initd ${PN}

	dodir /etc/lcd4linux

	if use X || use kde; then
	  insinto /usr/share/pixmaps
	  doins lcd4linux.xpm
	fi
	use X && touch ${D}/etc/lcd4linux/lcd4X11.conf

	if use kde ; then
		insinto /usr/share/applnk/apps/System
		doins lcd4linux.kdelnk
		insinto /etc/lcd4linux
		insopts -o root -g root -m 0600
		doins lcd4kde.conf
	fi

	insinto /etc/lcd4linux
	insopts -o root -g root -m 0600
	newins lcd4linux.conf.sample lcd4linux.conf
}