summaryrefslogtreecommitdiff
blob: dfd0833fa701a99fedef1b6b529879aac576cf2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit autotools eutils linux-info linux-mod

DESCRIPTION="A general USB device sharing system over IP networks"
HOMEPAGE="http://usbip.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug"

RDEPEND=">=sys-fs/sysfsutils-2
	sys-apps/tcp-wrappers
	dev-libs/glib"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	>=sys-devel/automake-1.9
	sys-devel/libtool"

MODULE_NAMES="usbip(usbip:${S}/drivers/head:${S}/drivers/head) usbip_common_mod(usbip:${S}/drivers/head:${S}/drivers/head) vhci-hcd(usbip:${S}/drivers/head:${S}/drivers/head)"
BUILD_PARAMS=""

pkg_setup() {
	linux-mod_pkg_setup
	if kernel_is lt 2 6 24
	then
		eerror "You need at least kernel 2.6.24"
		die "Kernel too old"
	fi

	ebegin "Checking for CONFIG_USB enabled"
	linux_chkconfig_present USB
	eend $?
	[[ $? -ne 0 ]] && die "USB is not enabled in the kernel."

	if use debug
	then
		ebegin "Checking for CONFIG_USB_DEBUG enabled"
	        linux_chkconfig_present USB_DEBUG
		eend $?
		[[ $? -ne 0 ]] && die "USE=debug requires that USB debugging is enabled in the kernel."
		BUILD_PARAMS+="DEBUG=y"
	fi
}

src_unpack() {
	unpack ${A}
	cd "${S}"/src
	eautoreconf
}

src_compile() {
	# compiling kernel modules
	cd "${S}"/drivers/head
	emake ARCH="$(tc-arch-kernel)" ${BUILD_PARAMS} || die "Compiling kernel modules failed"

	# compiling userspace tools
	cd "${S}"/src
	econf
	emake KSOURCE="${KV_DIR}" || die "Compiling userspace tools failed"
}

src_install() {
	linux-mod_src_install

	cd "${S}"/src
	emake DESTDIR="${D}" install || die "Installing userspace tools failed"
	dodoc README* || die
}