1 # Copyright 1999-2009 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://heyu.tanj.com"
11 SRC_URI="http://heyu.tanj.com/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"
24 mv x10config.sample x10.conf.sample
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"
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"
47 sed -i -r 's%(LOG_DIR.*?)NONE%\1/var/log/heyu%' x10.conf.sample || die "changing LOG_DIR failed"
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"
56 doins x10.*.sample || die "installing config samples failed"
58 diropts -m 0750 -o heyu
59 dodir /var/log/heyu || die "creating log directory failed"
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"
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:"
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"
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)."
79 elog "Execute the following command if you wish to start the HEYU daemon"
82 elog "rc-update add heyu default"