# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=2 EGIT_REPO_URI="git://git.wilsonet.com/crystalhd.git" [[ ${PV} = *9999* ]] && GIT_ECLASS="git" || GIT_ECLASS="" inherit autotools eutils flag-o-matic linux-mod $GIT_ECLASS DESCRIPTION="Library and kernel module supporting the Broadcom CrystalHD" HOMEPAGE="http://www.broadcom.com/support/crystal_hd/" if [[ ${PV} == *9999* ]]; then RELEASE_URI="" else RELEASE_URI="mirror://gentoo/${P}.tbz2" fi SRC_URI="${RELEASE_URI}" LICENSE="LGPL-2.1" SLOT="0" if [[ ${PV} != *9999* ]]; then KEYWORDS="~amd64 ~x86" else KEYWORDS="" fi IUSE="examples modules" DEPEND="modules? ( virtual/linux-sources )" S=${WORKDIR} module_check() { if use modules; then if linux_chkconfig_present CRYSTALHD; then linux_chkconfig_present CRYSTALHD eerror "You have opted to build the external kernel module." eerror "Please disable CrystalHD support in your kernel config, found at:" eerror eerror " Device Drivers" eerror " [*] Staging drivers" eerror " [*] Exclude Staging drivers from being built" eerror " [ ] Broadcom Crystal HD video decoder support" eerror eerror "and recompile your kernel ..." die "In-kernel CrystalHD support detected!" fi fi } pkg_setup() { if [[ ${PV} == *9999* ]]; then elog elog "This is a live ebuild which installs the latest from upstream's" elog "git repository, and is unsupported by Gentoo." elog "Everything but bugs in the ebuild itself will be ignored." elog fi if use modules; then linux-mod_pkg_setup || die "Failed to configure kernel module" BUILD_TARGETS="all" MODULE_NAMES="crystalhd(staging:${S}/driver/linux/)" BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}" ECONF_PARAMS=--with-kernel-path=${KV_DIR} module_check fi } src_unpack() { if [[ ${PV} = *9999* ]]; then git_src_unpack else unpack ${A} fi if use modules; then cd ${S}/driver/linux eautoconf fi } src_compile() { cd ${S}/linux_lib/libcrystalhd emake || die "Failed to compile library" if use modules; then linux-mod_src_compile || die "Failed to compile kernel module" fi } src_install() { if use modules; then linux-mod_src_install insinto /etc/udev/rules.d/ doins ${S}/driver/linux/20-crystalhd.rules || die fi cd ${S}/linux_lib/libcrystalhd emake DESTDIR=${D} install || die "Failed to install library" if use examples; then insinto /usr/share/${PN} doins -r ${S}/examples fi } pkg_postinst() { if use modules; then cd ${S}/driver/linux linux-mod_pkg_postinst fi }