summaryrefslogtreecommitdiff
blob: 47fa3ba8dd2f6d10224a69daac0c82b1ca52eab3 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/libspe2/libspe2-2.3.0_p135.ebuild,v 1.1 2008/12/26 14:58:21 josejx Exp $
inherit eutils

MY_P=${P/_p/.}

DESCRIPTION="A wrapper library to adapt the JSRE SPU usage model to SPUFS"
HOMEPAGE="http://sourceforge/projects/libspe"
SRC_URI="mirror://sourceforge/libspe/${MY_P}.tar.gz"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="~ppc ~ppc64"
IUSE="debug"

S="${WORKDIR}/${P/_p*//}"

DEPEND=""
# This packages also provides libspe1
RDEPEND="!sys-libs/libspe"

export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}

if [[ ${CTARGET} == ${CHOST} ]] ; then
	if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
		export CTARGET=${CATEGORY/cross-}
	fi
fi

if [[ ${CTARGET} == ${CHOST} ]] ; then
	SYSROOT=""
else
	SYSROOT="/usr/${CTARGET}"
fi

src_unpack () {
	unpack ${A}
	#just in case something is missing
	cd "${S}"
	echo "${S}"
}

src_compile() {
	myconf=""
	use debug && myconf="${myconf} DEBUG=1"
	make all elfspe-all CROSS="${CTARGET}-" \
		prefix=/usr SYSROOT="$SYSROOT" ${myconf} \
		speinclude=/usr/spu-elf/include || die
}

src_install() {
	make CROSS="${CTARGET}-" prefix=/usr \
		 speinclude=/usr/spu-elf/include \
		 SYSROOT="$SYSROOT" \
		 DESTDIR="$D" install elfspe-install || die
	newinitd "${FILESDIR}/spe.rc6" elfspe
}

pkg_postinst() {
	einfo "You may want to register elfspe to binfmt using the"
	einfo "provided initscript"
	einfo "# rc-update add elfspe boot"
	ewarn "make sure your fstab contains the following line"
	ewarn "none                    /spu            spufs           defaults
	0 0"
	ewarn "and that you have spufs support enabled in the kernel"
}