# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=2 inherit cmake-utils linux-mod eutils DESCRIPTION="Driver and tools for controlling a Telldus Technologies TellStick." HOMEPAGE="http://www.telldus.se/" SRC_URI="http://download.telldus.se/TellStick/Software/${PN}/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="amd64" IUSE="udev" DEPEND="dev-libs/confuse >=dev-util/cmake-2.6.0 dev-embedded/libftdi" RDEPEND=">=dev-libs/confuse-2.6-r2 udev? ( sys-fs/udev )" pkg_postinst() { elog "You will need to set up your /etc/tellstick.conf file before running" elog "tdtool. For details, please see url:" elog "http://developer.telldus.se/wiki/TellStick_conf" } pkg_setup() { CONFIG_CHECK="USB_SERIAL_FTDI_SIO" linux-mod_pkg_setup enewgroup tellstick enewuser tellstick -1 -1 -1 "tellstick,usb" # Fails to find its libraries with '--as-needed'; causes the linking error # 'undefined reference' to sem_close, sem_open, sem_post, sem_unlink # and sem_wait. append-ldflags $(no-as-needed) } src_compile() { # Build system is broken, force -j1 cmake-utils_src_compile -j1 } src_configure() { mycmakeargs=( "-DGENERATE_MAN=TRUE" ) cmake-utils_src_configure } src_install() { cmake-utils_src_install fowners tellstick:tellstick /var/state/telldus-core.conf fperms 644 /var/state/telldus-core.conf dodoc AUTHORS ChangeLog README newinitd "${FILESDIR}/telldusd.initd" telldusd } src_prepare() { # Clear the state file, because the default contents have caused warnings # when running tdtool. echo -n > driver/libtelldus-core/telldus-core.conf || ( \ ewarn "Failed to clear the contents of telldus-core.conf; when running tdtool, it" && ewarn "might generate warnings unless telldus-core.conf is cleared." ) # Fix user/group in default config and udev rules sed -i -e "s/plugdev/usb/" tdadmin/05-tellstick.rules sed -i -e "s/plugdev/usb/" -e "s/nobody/tellstick/" -i service/tellstick.conf if ! use udev; then sed -i \ -e "/SET(UDEV_RULES_DIR/d" \ -e "/INSTALL(FILES 05-tellstick.rules/,/)/d" \ driver/libtelldus-core/CMakeLists.txt \ || die "failed to patch driver/libtelldus-core/CMakeLists.txt" fi }