1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils toolchain-funcs
9 DESCRIPTION="Utility to control and program CM11A, CM17A and CM12U X10 interfaces"
10 HOMEPAGE="http://www.heyu.org"
11 SRC_URI="http://www.heyu.org/download/${P}.tgz"
15 KEYWORDS="~amd64 ~ppc ~x86"
16 IUSE="kernel_Darwin kernel_FreeBSD kernel_linux cm17a dmx210 ext0 ore rfxm rfxs"
20 enewuser ${PN} -1 -1 /var/lib/${PN} "${PN},uucp"
21 ewarn "Heyu must not be running when updating to a higher version as"
22 ewarn "stray lockfiles may prevent it from restarting - in which case"
23 ewarn "you should refer to the cleanup section of the Heyu man page."
28 mv x10config.sample x10.conf.sample
30 $(use kernel_FreeBSD && echo "freebsd") \
31 $(use kernel_Darwin && echo "darwin") \
32 $(use kernel_linux && echo "linux") \
33 $(use cm17a || echo "-nocm17a") \
34 $(use dmx210 || echo "-nodmx") \
35 $(use ext0 || echo "-noext0") \
36 $(use ore || echo "-noore") \
37 $(use rfxm || echo "-norfxm") \
38 $(use rfxs || echo "-norfxs") \
39 || die "configure failed"
40 sed -i -r -e "s/CC\s*=.*/CC = $(tc-getCC)/" \
41 -e "s/CFLAGS\s*=.*/CFLAGS = ${CFLAGS} \$(DFLAGS)/" \
42 -e 's%^(DFLAGS.+)-DSYSBASEDIR=\\"[^\]+\\"%\1%' \
43 -e 's%^(DFLAGS\s*=\s*)%\1-DSYSBASEDIR=\\"/var/lib/heyu\\" %' \
44 -e 's%^(DFLAGS.+)-DSPOOLDIR=\\"[^\]+\\"%\1%' \
45 -e 's%^(DFLAGS\s*=\s*)%\1-DSPOOLDIR=\\"/var/lib/heyu\\" %' \
46 -e 's%^(DFLAGS.+)-DLOCKDIR=\\"[^\]+\\"%\1%' \
47 -e 's%^(DFLAGS\s*=\s*)%\1-DLOCKDIR=\\"/var/lock\\" %' "${S}"/Makefile || die "adjusting Makefile failed"
48 sed -i -r 's%(LOG_DIR.*?)NONE%\1/var/log/heyu%' "${S}"/x10.conf.sample || die "changing LOG_DIR failed"
52 dobin heyu || die "installing binary failed"
53 doman heyu.1 x10{config,scripts,sched}.5 || die "installing man pages failed"
54 newinitd "${FILESDIR}"/heyu.init heyu
56 doins x10.*.sample || die "installing config samples failed"
57 diropts -m 0750 -o heyu
58 dodir /var/log/heyu || die "creating log directory failed"
59 dosym /etc/heyu/x10.conf /var/lib/heyu/x10.conf || die "dosym failed"
60 dosym /etc/heyu/x10.sched /var/lib/heyu/x10.sched || die "dosym failed"
64 elog "Don't forget to tell heyu where to find your CM11 or CM17. Therefore"
65 elog "the file /etc/heyu/x10.conf must contain a line starting with 'TTY'"
66 elog "followed by the corresponding device such as:"
68 elog "TTY /dev/ttyS0 <-- on first serial port"
69 elog "TTY /dev/ttyS1 <-- on second serial port"
70 elog "TTY /dev/ttyUSB0 <-- on USB port"
72 elog "To use your device on a USB port, the corresponding USB serial converter"
73 elog "kernel module must be loaded. Older CM11 are usually delivered with a"
74 elog "a Prolific 2303 cable (kernel module: pl2303) while newer come with a"
75 elog "FTDI cable (kernel module: ftdi_sio)."
77 elog "Execute the following command if you wish to start the HEYU daemon"
80 elog "rc-update add heyu default"