summaryrefslogtreecommitdiff
blob: 746e34668b6615405f3349dcef84f3d7e9d3fd50 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/lirc-0.8.0-r2.ebuild,v 1.2 2006/06/26 20:28:52 corsair Exp $

inherit eutils linux-mod flag-o-matic autotools

DESCRIPTION="LIRC is a package that allows you to decode and send infra-red \
	signals of many (but not all) commonly used remote controls."
HOMEPAGE="http://www.lirc.org"

SLOT="0"
LICENSE="GPL-2"
IUSE="alsa debug doc X usb hardware-carrier transmitter"
KEYWORDS="~ppc64 ~x86"
SRC_URI="mirror://sourceforge/lirc/${P/_pre/pre}.tar.bz2"

S=${WORKDIR}/${P/_pre/pre}


IUSE_LIRC_DEVICES_DIRECT="
	all userspace act200l act220l
	adaptec alsa_usb animax atilibusb
	atiusb audio audio_alsa avermedia avermedia_vdomate
	avermedia98 bestbuy bestbuy2 breakoutbox
	bte bw6130 caraca chronos cmdir com1 com2 com3 com4
	cph06x creative creative_infracd
	devinput digimatrix dsp dvico ea65
	exaudio flyvideo gvbctv5pci hauppauge
	hauppauge_dvb hercules_smarttv_stereo
	igorplugusb imon imon_pad imon_rsc
	irdeo irdeo_remote irman irreal it87
	knc_one kworld leadtek_0007 leadtek_0010
	leadtek_pvr2000 livedrive_midi
	livedrive_seq logitech lpt1 lpt2 mceusb
	mceusb2 mediafocusI mouseremote
	mouseremote_ps2 mp3anywhere nslu2
	packard_bell parallel pcmak pcmak_usb
	pctv pixelview_bt878 pixelview_pak
	pixelview_pro provideo realmagic
	remotemaster sa1100 sasem serial
	silitek sir slinke streamzap tekram
	tekram_bt829 tira tvbox udp uirt2
	uirt2_raw"

IUSE_LIRC_DEVICES_SPECIAL="imon_pad2keys serial_igor_cesko xboxusb usbirboy"
IUSE_LIRC_DEVICES="${IUSE_LIRC_DEVICES_DIRECT} ${IUSE_LIRC_DEVICES_SPECIAL}"



RDEPEND="virtual/libc
	sys-apps/coreutils
	X? ( || ( (	x11-libs/libX11
			x11-libs/libSM
			x11-libs/libICE )
	virtual/x11 ) )
	lirc_devices_alsa_usb? ( media-libs/alsa-lib )
	lirc_devices_audio? ( media-libs/portaudio )
	lirc_devices_irman? ( media-libs/libirman )"


#device-driver which use libusb
LIBUSB_USED_BY_DEV="
	all atiusb sasem igorplugusb imon imon_pad imon_pad2keys
	imon_rsc streamzap mceusb mceusb2 xboxusb"

for dev in ${LIBUSB_USED_BY_DEV}; do
	RDEPEND="${RDEPEND} lirc_devices_${dev}? ( dev-libs/libusb )"
done

# adding only compile-time depends
DEPEND="${RDEPEND}
	virtual/linux-sources
	sys-devel/autoconf
	sys-devel/libtool"


# adding only run-time depends
RDEPEND="${RDEPEND}
	lirc_devices_usbirboy? ( app-misc/usbirboy )"



# add all devices to IUSE
for dev in ${IUSE_LIRC_DEVICES}; do
	IUSE="${IUSE} lirc_devices_${dev}"
done


add_device() {
	: $(( lirc_device_count++ ))

	if [[ ${lirc_device_count} -eq 2 ]]; then
		ewarn
		#ewarn "When selecting multiple devices for lirc to be supported,"
		#ewarn "it can not be garanteed that the drivers play nice together."
		ewarn "lirc does at the moment support only one driver be compiled at a time."
		ewarn "Please reduce LIRC_DEVICES to one item."
		die "Multiple drivers selected for lirc."
	fi


	local dev="${1}"
	local desc="device ${dev}"
	if [[ -n "${2}" ]]; then
		desc="${2}"
	fi

	einfo "Compiling support for ${desc}"
	MY_OPTS="${MY_OPTS} --with-driver=${dev}"
}

pkg_setup() {
	linux-mod_pkg_setup

	# set default configure options
	MY_OPTS=""
	lirc_driver_count=0

	local dev

	if use lirc_devices_all; then
		# compile in drivers for a lot of devices
		add_device all "a lot of devices"
	else
		# compile in only requested drivers
		for dev in ${IUSE_LIRC_DEVICES_DIRECT}; do
			if use lirc_devices_${dev}; then
				add_device ${dev}
			fi
		done

		if use lirc_devices_serial_igor_cesko; then
			add_device serial "serial with Igor Cesko design"
			MY_OPTS="${MY_OPTS} --with-igor"
		fi

		if use lirc_devices_imon_pad2keys; then
			add_device imon_pad "device imon_pad (with converting pad input to keyspresses)"
		fi

		if use lirc_devices_xboxusb; then
			add_device atiusb "device xboxusb"
		fi

		if use lirc_devices_usbirboy; then
			add_device userspace "device usbirboy"
		fi

		if [[ "${MY_OPTS}" == "" ]]; then
			if [[ "${PROFILE_ARCH}" == "xbox" ]]; then
				# on xbox: use special driver
				add_device atiusb "device xboxusb"
			else
				# no driver requested
				einfo
				einfo "Compiling only the lirc-applications, but no drivers."
				einfo "Enable drivers with LIRC_DEVICES if you need them."
				MY_OPTS="--with-driver=none"
			fi
		fi
	fi

	use hardware-carrier && MY_OPTS="${MY_OPTS} --without-soft-carrier"
	use transmitter && MY_OPTS="${MY_OPTS} --with-transmitter"


	if [[ -n "${LIRC_OPTS}" ]] ; then
		ewarn
		ewarn "LIRC_OPTS is deprecated from lirc-0.8.0-r1 on."
		ewarn
		ewarn "Please use LIRC_DEVICES from now on."
		ewarn "e.g. LIRC_DEVICES=\"serial sir\""
		ewarn
		ewarn "Flags are now set per use-flags."
		ewarn "e.g. transmitter, hardware-carrier"

		local opt
		local unsupported_opts=""

		# test for allowed options for LIRC_OPTS
		for opt in ${LIRC_OPTS}; do
			case ${opt} in
				--with-port=*|--with-irq=*|--with-timer=*|--with-tty=*)
					MY_OPTS="${MY_OPTS} ${opt}"
					;;
				*)
					unsupported_opts="${unsupported_opts} ${opt}"
					;;
			esac
		done
		if [[ -n ${unsupported_opts} ]]; then
			ewarn "These options are no longer allowed to be set"
			ewarn "with LIRC_OPTS: ${unsupported_opts}"
			die "LIRC_OPTS is no longer recommended."
		fi
	fi

	MODULE_NAMES="lirc(misc:${S})"
	BUILD_TARGETS="all"

	ECONF_PARAMS="	--localstatedir=/var
			        --with-syslog=LOG_DAEMON
			        --enable-sandboxed
	    		    --with-kerneldir=${KV_DIR}
			        --with-moduledir=/lib/modules/${KV_FULL}/misc
	    		    $(use_enable debug)
					$(use_with X)
					${MY_OPTS}
					CPPFLAGS=-DLIRC_HAVE_DEVFS"

	einfo
	einfo "lirc-configure-opts: ${MY_OPTS}"

	export WANT_AUTOCONF=2.5
	filter-flags -Wl,-O1
}

src_unpack() {
	unpack ${A}
	cd ${S}

	epatch ${FILESDIR}/${P}-kernel-2.6.16.diff
	epatch ${FILESDIR}/${P}-kernel-2.6.17.diff

	use lirc_devices_xboxusb && epatch ${FILESDIR}/lirc-0.8.0pre4-xbox-remote.diff
	use lirc_devices_imon_pad2keys && epatch ${FILESDIR}/${P}-imon-pad2keys.patch

	# remove parallel driver on SMP systems
	if linux_chkconfig_present SMP ; then
		sed -i -e "s:lirc_parallel::" drivers/Makefile.in
	fi

	sed -i -e 's:CFLAGS="-O2:CFLAGS=""\n#CFLAGS="-O2:' configure.in

	eautoreconf || "autoreconf failed"
}


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

	newinitd ${FILESDIR}/lircd lircd
	newinitd ${FILESDIR}/lircmd lircmd
	newconfd ${FILESDIR}/lircd.conf lircd

	has_version sys-fs/udev && (
		insinto /etc/udev/rules.d/;
		newins ${S}/contrib/lirc.rules 10-lirc.rules )

	if use doc ; then
		dohtml doc/html/*.html
		insinto /usr/share/doc/${PF}/images
		doins doc/images/*
	fi
}

pkg_preinst() {
	linux-mod_pkg_preinst
	[[ -f "${ROOT}/etc/lircd.conf" ]] && cp ${ROOT}/etc/lircd.conf ${IMAGE}/etc
}

pkg_postinst() {
	linux-mod_pkg_postinst
	echo
	einfo "The lirc Linux Infrared Remote Control Package has been"
	einfo "merged, please read the documentation at http://www.lirc.org"
	echo
}