| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-wireless/ubertooth/ubertooth-2012.10.1.ebuild,v 1.2 2012/10/08 21:05:43 zerochaos Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
PYTHON_DEPEND="python? 2"
|
| 8 |
SUPPORT_PYTHON_ABIS="1"
|
| 9 |
RESTRICT_PYTHON_ABIS="3.*"
|
| 10 |
|
| 11 |
inherit multilib distutils
|
| 12 |
|
| 13 |
HOMEPAGE="http://ubertooth.sourceforge.net/"
|
| 14 |
|
| 15 |
LICENSE="GPL-2"
|
| 16 |
SLOT="0"
|
| 17 |
IUSE="+dfu clock_debug +specan +python ubertooth0-firmware +ubertooth1-firmware"
|
| 18 |
REQUIRED_USE="dfu? ( python )
|
| 19 |
specan? ( python )
|
| 20 |
ubertooth0-firmware? ( dfu )
|
| 21 |
ubertooth1-firmware? ( dfu )
|
| 22 |
python? ( || ( dfu specan ) )"
|
| 23 |
DEPEND="clock_debug? ( net-wireless/bluez )"
|
| 24 |
RDEPEND="${DEPEND}
|
| 25 |
specan? ( virtual/libusb:1
|
| 26 |
>=x11-libs/qt-gui-4.7.2:4
|
| 27 |
>=dev-python/pyside-1.0.2
|
| 28 |
>=dev-python/numpy-1.3
|
| 29 |
>=dev-python/pyusb-1.0.0_alpha1 )
|
| 30 |
dfu? ( virtual/libusb:1
|
| 31 |
>=dev-python/pyusb-1.0.0_alpha1 )"
|
| 32 |
|
| 33 |
if [[ ${PV} == "9999" ]] ; then
|
| 34 |
EGIT_REPO_URI="git://ubertooth.git.sourceforge.net/gitroot/ubertooth/ubertooth"
|
| 35 |
SRC_URI=""
|
| 36 |
inherit git-2
|
| 37 |
KEYWORDS=""
|
| 38 |
DEPEND="=net-libs/libbtbb-9999"
|
| 39 |
RDEPEND="${RDEPEND}
|
| 40 |
=net-libs/libbtbb-9999"
|
| 41 |
DEPEND="ubertooth0-firmware? ( sys-devel/crossdev )
|
| 42 |
ubertooth1-firmware? ( sys-devel/crossdev )"
|
| 43 |
else
|
| 44 |
MY_P=${P/\./-}
|
| 45 |
MY_P=${MY_P/./-R}
|
| 46 |
S=${WORKDIR}/${MY_P}
|
| 47 |
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.xz"
|
| 48 |
#re-add arm keyword after making a lib-only target
|
| 49 |
KEYWORDS="~amd64 ~arm ~x86"
|
| 50 |
DEPEND=">=net-libs/libbtbb-${PV}"
|
| 51 |
RDEPEND="${RDEPEND}
|
| 52 |
>=net-libs/libbtbb-${PV}"
|
| 53 |
fi
|
| 54 |
DESCRIPTION="An open source wireless development platform suitable for Bluetooth experimentation"
|
| 55 |
|
| 56 |
have_clock_debug() {
|
| 57 |
use clock_debug && echo "true" || echo "false"
|
| 58 |
}
|
| 59 |
|
| 60 |
pkg_setup() {
|
| 61 |
if [[ ${PV} == "9999" ]] ; then
|
| 62 |
#ebegin "arm-none-eabi-gcc"
|
| 63 |
#if type -p arm-none-eabi-gcc > /dev/null ; then
|
| 64 |
# eend 0
|
| 65 |
#else
|
| 66 |
# eend 1
|
| 67 |
# eerror "Failed to locate 'arm-none-eabi-gcc' in \$PATH. You can install the needed toolchain using:"
|
| 68 |
# eerror " $ crossdev --genv 'USE=\"-openmp -fortran\"' -s4 -t arm-none-eabi"
|
| 69 |
# die "arm-none-eabi toolchain not found"
|
| 70 |
#fi
|
| 71 |
ewarn "bypassing live pkg_setup because firmware building doesn't work"
|
| 72 |
fi
|
| 73 |
if use python; then
|
| 74 |
#I would prefer like this but we can't multiconditional PYTHON_DEPEND in EAPI4
|
| 75 |
#if use dfu || use specan; then
|
| 76 |
python_pkg_setup;
|
| 77 |
DISTUTILS_SETUP_FILES=()
|
| 78 |
if use dfu; then
|
| 79 |
DISTUTILS_SETUP_FILES+=("${S}/host/usb_dfu|setup.py")
|
| 80 |
PYTHON_MODNAME="dfu"
|
| 81 |
fi
|
| 82 |
if use specan; then
|
| 83 |
DISTUTILS_SETUP_FILES+=("${S}/host/specan_ui|setup.py")
|
| 84 |
PYTHON_MODNAME+=" specan"
|
| 85 |
fi
|
| 86 |
fi
|
| 87 |
}
|
| 88 |
|
| 89 |
src_compile() {
|
| 90 |
cd "${S}/host/bluetooth_rxtx" || die
|
| 91 |
emake \
|
| 92 |
clock_debug="$(have_clock_debug)"
|
| 93 |
|
| 94 |
use python && distutils_src_compile
|
| 95 |
if [[ ${PV} == "9999" ]] ; then
|
| 96 |
#cd "${S}"/firmware/bluetooth_rxtx || die
|
| 97 |
#if use ubertooth0-firmware; then
|
| 98 |
# SVN_REV_NUM="-D'SVN_REV_NUM'=${ESVN_WC_REVISION}" BOARD=UBERTOOTH_ZERO emake -j1
|
| 99 |
# mv bluetooth_rxtx.bin bluetooth_rxtx_U0.bin || die
|
| 100 |
# emake clean
|
| 101 |
#fi
|
| 102 |
#if use ubertooth1-firmware; then
|
| 103 |
# SVN_REV_NUM="-D'SVN_REV_NUM'=${ESVN_WC_REVISION}" emake -j1
|
| 104 |
# mv bluetooth_rxtx.bin bluetooth_rxtx_U1.bin || die
|
| 105 |
#fi
|
| 106 |
ewarn "bypassing firmware build because the resulting firmware fails"
|
| 107 |
fi
|
| 108 |
}
|
| 109 |
|
| 110 |
src_install() {
|
| 111 |
cd host || die
|
| 112 |
dobin bluetooth_rxtx/ubertooth-dump bluetooth_rxtx/ubertooth-lap \
|
| 113 |
bluetooth_rxtx/ubertooth-btle bluetooth_rxtx/ubertooth-uap \
|
| 114 |
bluetooth_rxtx/ubertooth-hop bluetooth_rxtx/ubertooth-util
|
| 115 |
use clock_debug && dobin bluetooth_rxtx/ubertooth-follow
|
| 116 |
|
| 117 |
use python && distutils_src_install
|
| 118 |
use specan && dobin specan_ui/ubertooth-specan-ui
|
| 119 |
use dfu && dobin usb_dfu/ubertooth-dfu
|
| 120 |
|
| 121 |
dolib.so bluetooth_rxtx/libubertooth.so.0.1
|
| 122 |
dosym libubertooth.so.0.1 /usr/$(get_libdir)/libubertooth.so.0
|
| 123 |
dosym libubertooth.so.0.1 /usr/$(get_libdir)/libubertooth.so
|
| 124 |
|
| 125 |
insinto /lib/firmware
|
| 126 |
cd "${S}"
|
| 127 |
if [[ ${PV} == "9999" ]] ; then
|
| 128 |
#use ubertooth0-firmware && doins firmware/bluetooth_rxtx/bluetooth_rxtx_U0.bin
|
| 129 |
#use ubertooth1-firmware && doins firmware/bluetooth_rxtx/bluetooth_rxtx_U1.bin
|
| 130 |
ewarn "bypassing firmware install because the built firmware doesn't work"
|
| 131 |
else
|
| 132 |
use ubertooth0-firmware && newins ubertooth-zero-firmware-bin/bluetooth_rxtx.bin bluetooth_rxtx_U0.bin
|
| 133 |
use ubertooth1-firmware && newins ubertooth-one-firmware-bin/bluetooth_rxtx.bin bluetooth_rxtx_U1.bin
|
| 134 |
fi
|
| 135 |
|
| 136 |
insinto /lib/udev/rules.d/
|
| 137 |
doins "${S}"/host/bluetooth_rxtx/40-ubertooth.rules
|
| 138 |
|
| 139 |
elog "Everyone can read from the ubertooth, but to talk to it"
|
| 140 |
elog "your user needs to be in the usb group."
|
| 141 |
}
|
| 142 |
|
| 143 |
pkg_postinst() {
|
| 144 |
use python && distutils_pkg_postinst
|
| 145 |
|
| 146 |
#if use ubertooth0-firmware || use ubertooth1-firmware; then
|
| 147 |
# ewarn "currently the firmware builds using cross dev but is completely"
|
| 148 |
# ewarn "NON-FUNCTIONAL. This is supported for development only."
|
| 149 |
# ewarn "If you do not know what you are doing to NOT install this version"
|
| 150 |
# ewarn "of the firmware. If you ignore this warning and break your device"
|
| 151 |
# ewarn "you can find repair instructions at ${HOMEPAGE}"
|
| 152 |
# ewarn "You have been warned."
|
| 153 |
#fi
|
| 154 |
}
|
| 155 |
|
| 156 |
pkg_postrm() {
|
| 157 |
use python && distutils_pkg_postrm
|
| 158 |
}
|