summaryrefslogtreecommitdiff
blob: 50b66365f2fce7ea01a0e05699df7395da4309bc (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
# 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.ebuild,v 1.7 2006/05/29 10:45:07 zzam 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"
KEYWORDS="~alpha ~amd64 ~ia64 ppc ppc64 x86"

RDEPEND="virtual/libc
	sys-apps/coreutils
	alsa? ( media-libs/alsa-lib )
	usb? ( dev-libs/libusb )
	X? ( || ( (	x11-libs/libX11
			x11-libs/libSM
			x11-libs/libICE )
	virtual/x11 ) )"

DEPEND="${RDEPEND}
	virtual/linux-sources
	sys-devel/autoconf
	sys-devel/libtool"

SRC_URI="mirror://sourceforge/lirc/${P/_pre/pre}.tar.bz2"

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

pkg_setup() {
	linux-mod_pkg_setup

	if [ "x${LIRC_OPTS}" = x ] ; then
		echo
		ewarn "By default this package will not compile a driver for your hardware"
		ewarn "unless you specify LIRC_OPTS. The best place to save this is in"
		ewarn "/etc/make.conf"
		ewarn "For example, PVR-x50 users should add the following to /etc/make.conf"
		ewarn "LIRC_OPTS=\"--with-driver=hauppauge\""
		echo
		ewarn "Possible options are listed below:"
		echo
		cat <<-EOF
# You have to know, which driver you want;
# --with-driver=X

# where X is one of:
# none, all, act200l, animax, atilibusb, atiusb, audio, avermedia, avermedia_vdomate,
# avermedia98, bestbuy, bestbuy2, breakoutbox, bte, caraca, chronos, comX,
# creative_infracd, dsp, cph03x, cph06x, creative, devinput, exaudio, flyvideo,
# gvbctv5pci, hauppauge, hauppauge_dvb, hercules_smarttv_stereo, igorplugusb, irdeo,
# irdeo_remote, irman, irreal, it87, knc_one, kworld, leadtek_0007, leadtek_0010,
# livedrive_midi, livedrive_seq, logitech, lptX, mceusb, mediafocusI, mp3anywhere,
# packard_bell, parallel, pcmak, pcmak_usb, pctv, pixelview_bt878, pixelview_pak,
# pixelview_pro, provideo, realmagic, remotemaster, sa1100, sasem, serial,
# silitek, sir, slinke, tekram, tekram_bt829, tira, tvbox, udp, uirt2, uirt2_raw
# winfast_tv2000 is now leadtek_0010, streamzap

# This could be useful too

# --with-port=port      # port number for the lirc device.
# --with-irq=irq        # irq line for the lirc device.
# --with-timer=value    # timer value for the parallel driver
# --with-tty=file       # tty to use (Irman, RemoteMaster, etc.)
# --without-soft-carrier        # if your serial hw generates carrier

# --with-port=port      # port number for the lirc device.
# --with-irq=irq        # irq line for the lirc device.
# --with-timer=value    # timer value for the parallel driver
# --with-tty=file       # tty to use (Irman, RemoteMaster, etc.)
# --without-soft-carrier        # if your serial hw generates carrier
# --with-transmitter    # if you use a transmitter diode
		EOF
		sleep 5
	fi

	export WANT_AUTOCONF=2.5
}

src_unpack() {
	unpack ${A}
	cd ${S}
	#epatch ${FILESDIR}/lirc-0.7.0-xbox.patch.bz2
	epatch ${FILESDIR}/${P}-kernel-2.6.16.diff

	filter-flags -Wl,-O1
	sed -i -e 's:CFLAGS="-O2:CFLAGS=""\n#CFLAGS="-O2:' configure.in

	eautoreconf || "autoreconf failed"
}


src_compile() {
	get_version

	# set default configure options
	[ "x${LIRC_OPTS}" = x ] && [ "${PROFILE_ARCH}" == "xbox" ] && \
		LIRC_OPTS="--with-driver=xboxusb"
	[ "x${LIRC_OPTS}" = x ] && LIRC_OPTS="--with-driver=none"

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

	unset ARCH

	econf \
		--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` \
		${LIRC_OPTS} || die "./configure failed"

	emake || die "compile 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() {
	[ -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
}