# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils linux-mod IUSE="" DESCRIPTION="ALSA bluetooth headset driver [snd-bt-sco.ko]." HOMEPAGE="http://bluetooth-alsa.sourceforge.net" SRC_URI="mirror://gentoo/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" DEPEND="virtual/alsa virtual/linux-sources" general_info(){ echo ewarn "The kernel source needs to be configured and installed with BT_SCO and SND_HWDEP enabled." echo einfo "BT_SCO can be found under:" einfo "Device drivers -> Net. support -> Bluetooth subs. support -> SCO links support" echo einfo "If you have a usb bluetooth dongle you must also enable BT_HCIUSB_SCO:" einfo "Device drivers -> Net. support -> Bluetooth subs. support -> HCI USB driver -> SCO support" echo einfo "SND_HWDEP depends on special ALSA sound drivers" einfo "You can either choose the Tascam usb sound driver 'SND_USB_USX2Y'" einfo "or the soundblaster live driver 'SND_EMU10K1'." echo [ $DIE = true ] && die exit 1 } choose_kernel(){ echo echo "Proceed with enter to compile against running kernel." echo -n "You may also enter a different kernel version or type 'info' to get general information: " read KVERSION echo DIE="false" if [ -z $KVERSION ]; then if kernel_is 2 4; then eerror "You need a 2.6.x series kernel" && DIE="true" else MODDIR="/lib/modules/$(uname -r)" fi else if [ $KVERSION = info ]; then general_info elif echo $KVERSION | grep ^2.6.* >/dev/null; then MODDIR="/lib/modules/${KVERSION}" elif echo $KVERSION | grep ^2.4.* >/dev/null; then eerror "You need a 2.6.x series kernel" && DIE="true" else eerror "$KVERSION is not a valid kernel version." && DIE="true" fi fi [ $DIE = true ] && general_info DIE="false" KSYMDIR="${MODDIR}/source" NEEDED_OPTIONS="BT_SCO SND_HWDEP" if [ ! -e ${MODDIR}/source/.config ]; then eerror "Either ${MODDIR} does not exist" eerror "or the symlink ${KSYMDIR} does not point to the kernel source" eerror "or the kernel souce is not properly configured" einfo "Check this and if needed recompile your kernel with $NEEDED_OPTIONS enabled" DIE="true" fi [ $DIE = true ] && general_info DIE="false" for OPTION in $NEEDED_OPTIONS do if ! cat ${KSYMDIR}/.config | grep $OPTION | egrep -v ^# >/dev/null; then eerror "CONFIG_${OPTION} is not enabled." && DIE="true" fi done [ $DIE = true ] && general_info } pkg_setup() { choose_kernel } src_compile() { set_arch_to_kernel make -C ${KSYMDIR} M=$(pwd) modules } src_install() { insinto ${MODDIR}/extra doins snd-bt-sco.ko } pkg_postinst() { echo einfo "Running modules-update" /usr/sbin/update-modules }