]> Pileus Git - ~andy/sunrise/blob - app-misc/heyu/heyu-2.6.0.ebuild
Use EPI 2. Use src_configure instead of src_compile. sed and domanimproved, readability.
[~andy/sunrise] / app-misc / heyu / heyu-2.6.0.ebuild
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="2"
6
7 inherit eutils toolchain-funcs
8
9 DESCRIPTION="Utility to control and program CM11A, CM17A and CM12U X10 interfaces"
10 HOMEPAGE="http://heyu.tanj.com"
11 SRC_URI="http://heyu.tanj.com/download/${P}.tgz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~ppc ~x86"
16 IUSE="kernel_Darwin kernel_FreeBSD kernel_linux cm17a dmx210 ext0 ore rfxm rfxs"
17
18 pkg_setup() {
19         enewgroup ${PN}
20         enewuser ${PN} -1 -1 /var/lib/${PN} "${PN},uucp"
21 }
22
23 src_configure() {
24         mv x10config.sample x10.conf.sample
25         ./Configure \
26                 $(use kernel_FreeBSD && echo "freebsd") \
27                 $(use kernel_Darwin && echo "darwin") \
28                 $(use kernel_linux && echo "linux") \
29                 $(use cm17a || echo "-nocm17a") \
30                 $(use dmx210 || echo "-nodmx") \
31                 $(use ext0 || echo "-noext0") \
32                 $(use ore || echo "-noore") \
33                 $(use rfxm || echo "-norfxm") \
34                 $(use rfxs || echo "-norfxs") \
35                 || die "configure failed"
36
37         sed -i -r -e "s/CC\s*=.*/CC = $(tc-getCC)/" \
38                 -e "s/CFLAGS\s*=.*/CFLAGS = ${CFLAGS} \$(DFLAGS)/" \
39                 -e 's%^(DFLAGS.+)-DSYSBASEDIR=\\"[^\]+\\"%\1%' \
40                 -e 's%^(DFLAGS\s*=\s*)%\1-DSYSBASEDIR=\\"/var/lib/heyu\\" %' \
41                 -e 's%^(DFLAGS.+)-DSPOOLDIR=\\"[^\]+\\"%\1%' \
42                 -e 's%^(DFLAGS\s*=\s*)%\1-DSPOOLDIR=\\"/var/lib/heyu\\" %' \
43                 -e 's%^(DFLAGS.+)-DLOCKDIR=\\"[^\]+\\"%\1%' \
44                 -e 's%^(DFLAGS\s*=\s*)%\1-DLOCKDIR=\\"/var/lock\\" %' Makefile \
45                 || die "adjusting Makefile failed"
46
47         sed -i -r 's%(LOG_DIR.*?)NONE%\1/var/log/heyu%' x10.conf.sample || die "changing LOG_DIR failed"
48 }
49
50 src_install() {
51         dobin heyu || die "installing binary failed"
52         doman heyu.1 x10{config,scripts,sched}.5 || die "installing man pages failed"
53         newinitd "${FILESDIR}"/heyu.init heyu || die "newinitd failed"
54
55         insinto /etc/heyu
56         doins x10.*.sample || die "installing config samples failed"
57
58         diropts -m 0750 -o heyu
59         dodir /var/log/heyu  || die "creating log directory failed"
60
61         dosym /etc/heyu/x10.conf /var/lib/heyu/x10.conf || die "dosym failed"
62         dosym /etc/heyu/x10.sched /var/lib/heyu/x10.sched || die "dosym failed"
63 }
64
65 pkg_postinst() {
66         elog "Don't forget to tell heyu where to find your CM11 or CM17. Therefore"
67         elog "the file /etc/heyu/x10.conf must contain a line starting with 'TTY'"
68         elog "followed by the corresponding device such as:"
69         elog
70         elog "TTY /dev/ttyS0     <-- on first serial port"
71         elog "TTY /dev/ttyS1     <-- on second serial port"
72         elog "TTY /dev/ttyUSB0   <-- on USB port"
73         elog
74         elog "To use your device on a USB port, the corresponding USB serial converter"
75         elog "kernel module must be loaded. Older CM11 are usually delivered with a"
76         elog "a Prolific 2303 cable (kernel module: pl2303) while newer come with a"
77         elog "FTDI cable (kernel module: ftdi_sio)."
78         elog
79         elog "Execute the following command if you wish to start the HEYU daemon"
80         elog "at boot time:"
81         elog
82         elog "rc-update add heyu default"
83 }