aboutsummaryrefslogtreecommitdiffstats
path: root/dev-util/amd-app-sdk/amd-app-sdk-2.4.ebuild
blob: e25af82f88e8ed5fd20fedd684154d05ece7f462 (plain) (blame)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"
inherit eutils flag-o-matic

DESCRIPTION="Enable compiling code and loading it on ATI/AMD GPU"
HOMEPAGE="http://developer.amd.com/GPU/ATISTREAMSDK/Pages/default.aspx"
SRC_URI="http://developer.amd.com/Downloads/AMD-APP-SDK-v${PV}-lnx64.tgz"

LICENSE="AMD GPL-1 as-is"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="examples doc"
RESTRICT="strip fetch"
RDEPEND="examples? ( media-libs/glew )"

MY_PN="AMD-APP-SDK"
MY_PV="${PV}"
MY_P="${MY_PN}-v${MY_PV}-lnx64"

QA_EXECSTACK="
	usr/lib32/libatiocl32.so
	usr/lib64/libatiocl64.so
	usr/lib/libatiocl32.so
	usr/lib/libatiocl64.so
"

src_compile() {
    if use examples; then
        cd ${MY_P} || die
        MAKEOPTS="${MAKEOPTS} -j1" emake || die "emake failed"
    fi
}

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

	cd ${MY_P} || die

	# install libraries and executables into standart tree
	dodir ${DEST}/bin
	if use multilib; then
		# executables (32 and 64 bit versions)
		newbin bin/x86_64/clinfo clinfo64
		newbin bin/x86/clinfo clinfo32
		dosym cinfo64 /usr/bin/clinfo
		dodir ${DEST}/bin/x86
		dosym /usr/bin/clinfo32 ${DEST}/bin/x86/clinfo
		dodir ${DEST}/bin/x86_64
		dosym /usr/bin/clinfo64 ${DEST}/bin/x86_64/clinfo
		# libraries
		dolib.so lib/x86_64/libOpenCL.so lib/x86_64/libOpenCL.so.1 lib/x86_64/libatiocl64.so
		insinto /usr/lib32
		insopts -m0755
		doins lib/x86/libOpenCL.so lib/x86/libOpenCL.so.1 lib/x86/libatiocl32.so
		dosym /usr/lib32/libOpenCL.so ${DEST}/lib/x86/libOpenCL.so
		dosym /usr/lib32/libOpenCL.so.1 ${DEST}/lib/x86/libOpenCL.so.1
		dosym /usr/lib32/libamdocl32.so ${DEST}/lib/x86/libamdocl32.so
		dosym /usr/lib64/libOpenCL.so ${DEST}/lib/x86_64/libOpenCL.so
		dosym /usr/lib64/libOpenCL.so.1 ${DEST}/lib/x86_64/libOpenCL.so.1
		dosym /usr/lib64/libamdocl64.so ${DEST}/lib/x86_64/libamdocl64.so
	else
		# 32 bit or 64 bit versions are installed only
		if use amd64; then
			dobin bin/x86_64/clinfo
			dolib.so lib/x86_64/libOpenCL.so lib/x86_64/libOpenCL.so.1 lib/x86_64/libamdocl64.so
			dodir ${DEST}/bin/x86_64
			dosym /usr/bin/clinfo ${DEST}/bin/x86_64/clinfo
			dosym /usr/lib/libOpenCL.so ${DEST}/lib/x86_64/libOpenCL.so
			dosym /usr/lib/libOpenCL.so.1 ${DEST}/lib/x86_64/libOpenCL.so.1
			dosym /usr/lib/libamdocl64.so ${DEST}/lib/x86_64/libamdocl64.so
		else
			dobin bin/x86/clinfo
			dolib.so lib/x86/libOpenCL.so lib/x86/libOpenCL.so.1 lib/x86/libamdocl32.so
			dodir ${DEST}/bin/x86
			dosym /usr/bin/clinfo ${DEST}/bin/x86/clinfo
			dosym /usr/lib/libOpenCL.so ${DEST}/lib/x86/libOpenCL.so
			dosym /usr/lib/libOpenCL.so.1 ${DEST}/lib/x86/libOpenCL.so.1
			dosym /usr/lib/libamdocl32.so ${DEST}/lib/x86/libamdocl32.so
		fi
	fi

	# Install libraries
	insinto ${DEST}/lib
	insopts -m0755

	if ! use amd64 || use multilib; then
		insinto ${DEST}/lib/x86
		doins lib/x86/libGLEW.so
		doins lib/x86/libglut.so
	fi
	if use amd64; then
	insinto ${DEST}/lib/x86_64
		doins lib/x86_64/libGLEW.so
		doins lib/x86_64/libglut.so
	fi

	# Install includes
	# only selected header; not  glew
	insinto /usr/include
	insopts -m0644
	doins -r include/CAL
	doins -r include/CL
	insinto ${DEST}/include
	dosym /usr/include/CL ${DEST}/include/CL
	doins -r include/GL

	# Install examples & docs
	if use examples; then
		insinto "/usr/share/doc/${PF}/examples"
		doins -r samples
		doins -r make
		dosym ${DEST}/include /usr/share/doc/${PF}/examples/include
		dosym ${DEST}/lib /usr/share/doc/${PF}/examples/lib
	fi

	if use doc; then
		dodoc docs/opencl/*.pdf
		dodoc docs/opencl/LICENSES
		dodoc docs/opencl/StreamDoc.url
	fi

	# Create icd files; we COULD use the tar file from
	# ATI's homepage, yet this seems so unnessecary as
	# those files are VERY simple.
	insinto /etc/OpenCL/vendors
	echo "libamdocl64.so" > amdocl64.icd
	echo "libamdocl32.so" > amdocl32.icd

	if use amd64; then
		doins amdocl64.icd
	fi
	doins amdocl32.icd

	# Create env file
	echo "AMDAPPSDKROOT=${DEST}" > 99${PN}
	doenvd 99${PN}

	# issue info about gpu computing
	elog "REMEMBER: You need to install a recent version of ati-drivers to use your GPU for calculations."
}