summaryrefslogtreecommitdiff
blob: e0528e6c26d72ed35e0a0835b7e6a8fc65f23423 (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
73
74
75
76
77
78
79
80
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"
inherit eutils multilib

MY_P="${PN}-v${PV}"

DESCRIPTION="Enable compiling code and loading it on ATI/AMD GPU"
HOMEPAGE="http://developer.amd.com/GPU/ATISTREAMSDK/Pages/default.aspx"
SRC_URI=" \
	amd64? ( http://download2-developer.amd.com/amd/Stream20GA/${MY_P}-lnx64.tgz ) \
	x86? ( http://download2-developer.amd.com/amd/Stream20GA/${MY_P}-lnx32.tgz )"

LICENSE="AMD GPL-1 as-is"
SLOT="0"
KEYWORDS=""
IUSE="examples doc multilib"
RESTRICT="strip fetch"
RDEPEND="media-libs/freeglut
	x11-drivers/ati-drivers
	examples? ( media-libs/glew )"

QA_EXECSTACK="opt/${PN}/lib*/libatiocl??.so"

S="${WORKDIR}/${MY_P}"

pkg_nofetch() {
	ewarn "Proprietary software. Download at"
	ewarn "http://developer.amd.com/gpu/AMDAPPSDK/downloads/Pages/default.aspx"
	ewarn "and move it to distfiles"
}

src_unpack() {
	default_src_unpack

	mv ${MY_P}-lnx* ${MY_P} || die
	cp "${FILESDIR}"/Makefile ${MY_P}/ || die
}

src_prepare(){
	if use examples; then
		sed -i -e 's/samples/examples/g'  make/openclsdkrules.mk make/openclsdkdefs.mk\
			|| die "Sed failed"
	fi
}

src_compile() { true; }

src_install() {
	local DEST=/opt/${PN}

	rm include/GL/{glext.h,glut.h} || die

	if use amd64; then
		emake DESTDIR="${D}" ARCH="amd64" install || die "Install failed";
	else
		emake DESTDIR="${D}" ARCH="x86" install || die "Install failed";
	fi

	cat > "${T}/99${PN}" << EOF
PATH=${DEST}/bin
ROOTPATH=${DEST}/bin
LDPATH=${DEST}/$(get_libdir)
LD_LIBRARY_PATH="${DEST}/$(get_libdir)
EOF
	doenvd "${T}/99${PN}"

	if use examples; then
		insinto ${DEST}/examples
		doins -r samples/* || die
		insinto ${DEST}
		doins -r make || die
	fi

	if use doc; then
		dodoc docs/opencl/*
	fi
}