# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=2 ESVN_REPO_URI="http://crystalhd-for-osx.googlecode.com/svn/trunk/" [[ ${PV} = *9999* ]] && SVN_ECLASS="subversion" || SVN_ECLASS="" inherit autotools eutils flag-o-matic linux-mod $SVN_ECLASS DESCRIPTION="Kernel module supporting the Broadcom Crystal HD" HOMEPAGE="http://www.broadcom.com/support/crystal_hd/" #SRC_URI="http://www.broadcom.com/docs/support/crystalhd/crystalhd_linux_${PV}.zip" #SRC_URI="mirror://gentoo/${P}.xz" 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 "svn 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}/crystalhd/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 subversion_src_unpack else unpack ${A} fi if use modules; then cd ${S}/crystalhd/driver/linux eautoconf fi } #src_prepare() { # if use appletv; then # # Better support AppleTV and their limited memory. # # reference http://forum.xbmc.org/showthread.php?t=81715 # epatch "${FILESDIR}"/crystalhd-appletv.patch || die "Failed AppleTV patch." # fi # # # Removes an annoying printk that is probably useful for someone. # epatch "${FILESDIR}"/remove-annoying-printk.patch || die "You're stuck with the annoying messages." #} #src_configure() { # if use modules; then # cd ${S}/driver/linux # eautoconf # fi #} src_compile() { cd ${S}/crystalhd/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}/crystalhd/driver/linux/20-crystalhd.rules || die fi cd ${S}/crystalhd/linux_lib/libcrystalhd emake DESTDIR=${D} install || die "Failed to install library" if use examples; then insinto /usr/share/${PN} doins -r ${S}/crystalhd/examples fi } pkg_postinst() { if use modules; then cd ${S}/crystalhd/driver/linux linux-mod_pkg_postinst fi }