blob: 7e9676a7132ec7ed57b3b5878b4e541f54282aa3 (
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
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
|
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/nvidia-cuda-sdk/nvidia-cuda-sdk-4.2.9-r2.ebuild,v 1.1 2013/01/23 09:24:30 jlec Exp $
EAPI=4
inherit cuda eutils toolchain-funcs unpacker versionator
MYD=$(get_version_component_range 1)_$(get_version_component_range 2)
DESCRIPTION="NVIDIA CUDA Software Development Kit"
HOMEPAGE="http://developer.nvidia.com/cuda"
SRC_URI="http://developer.download.nvidia.com/compute/cuda/${MYD}/rel/sdk/gpucomputingsdk_${PV}_linux.run"
LICENSE="CUDPP"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="debug +doc +examples opencl +cuda"
RDEPEND="
>=dev-util/nvidia-cuda-toolkit-${PV}
media-libs/freeglut
examples? (
>=x11-drivers/nvidia-drivers-296
media-libs/glew
)"
DEPEND="${RDEPEND}"
S=${WORKDIR}
pkg_setup() {
if use cuda || use opencl; then
cuda_pkg_setup
fi
}
src_prepare() {
epatch "${FILESDIR}"/${P}-asneeded.patch
sed \
-e 's:-O2::g' \
-e 's:-O3::g' \
-e "/LINK/s:gcc:$(tc-getCC) ${LDFLAGS}:g" \
-e "/LINK/s:g++:$(tc-getCXX) ${LDFLAGS}:g" \
-e "/LINKFLAGS/s:=:= ${LDFLAGS} :g" \
-e "/CC/s:gcc:$(tc-getCC):g" \
-e "/CXX/s:g++:$(tc-getCXX):g" \
-e "/NVCCFLAGS/s|\(:=\)|\1 ${NVCCFLAGS} |g" \
-e "/ CFLAGS/s|\(:=\)|\1 ${CFLAGS}|g" \
-e "/ CXXFLAGS/s|\(:=\)|\1 ${CXXFLAGS}|g" \
-e 's:-Wimplicit::g' \
-e 's:GLEW_x86_64:GLEW:g' \
-i $(find sdk -type f -name "*.mk") || die
sed \
-e "s:/usr/local/cuda:${EPREFIX}/opt/cuda:g" \
-i sdk/shared/common.mk sdk/C/common/common.mk || die
find sdk/shared/inc/GL -delete || die
find sdk -type f -name "*\.a" -delete || die
}
src_compile() {
use examples || return
local myopts verbose="verbose=1"
use debug && myopts+=" dbg=1"
cd sdk
use cuda && emake -C C cuda-install="${EPREFIX}/opt/cuda" ${myopts} ${verbose}
use opencl && emake -C OpenCL ${verbose}
}
src_install() {
local i j f t crap=""
cd sdk
if use doc; then
ebegin "Installing docs ..."
for i in *; do
if [[ -d ${i} ]]; then
for j in doc releaseNotesData; do
docinto ${i}
[[ -d ${i}/${j} ]] && dodoc -r ${i}/${j}
done
fi
done
dodoc -r doc
dohtml {.,*}/*htm*
eend
fi
crap+=" *.txt doc */doc */Samples.htm* */releaseNotesData"
if ! use examples; then
crap+=" */bin */tools"
fi
ebegin "Cleaning before installation..."
find ${crap} -delete || die
find . \( -name Makefile -o -name "*.mk" \) -delete || die
eend
ebegin "Moving files..."
for f in $(find .); do
local t="$(dirname ${f})"
if [[ ${t/obj\/} != ${t} || ${t##*.} == a ]]; then
continue
fi
if [[ ! -d ${f} ]]; then
if [[ -x ${f} ]]; then
exeinto /opt/cuda/sdk/${t}
doexe ${f}
else
insinto /opt/cuda/sdk/${t}
doins ${f}
fi
fi
done
eend
}
|