blob: 53782c8b93a7396611b189e398824022b936a1bf (
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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit check-reqs toolchain-funcs unpacker
MYD=$(ver_cut 1-2 ${PV})
DRIVER_PV="440.33.01"
DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
SRC_URI="https://developer.download.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
LICENSE="NVIDIA-CUDA"
SLOT="0/${PV}"
KEYWORDS="-* ~amd64 ~amd64-linux"
IUSE="debugger doc eclipse profiler"
RESTRICT="bindist mirror"
BDEPEND=""
RDEPEND="
<sys-devel/gcc-9[cxx]
>=x11-drivers/nvidia-drivers-${DRIVER_PV}
debugger? (
dev-libs/openssl-compat:1.0.0
sys-libs/libtermcap-compat
sys-libs/ncurses-compat:5[tinfo]
)
eclipse? (
dev-libs/openssl-compat:1.0.0
>=virtual/jre-1.8:*
)
profiler? (
dev-libs/openssl-compat:1.0.0
>=virtual/jre-1.8:*
)"
S="${WORKDIR}"
QA_PREBUILT="opt/cuda/*"
CHECKREQS_DISK_BUILD="6800M"
pkg_setup() {
check-reqs_pkg_setup
}
src_prepare() {
local cuda_supported_gcc
# ATTENTION: change requires revbump
cuda_supported_gcc="4.7 4.8 4.9 5.3 5.4 6.3 6.4 7.2 7.3 8.2 8.3 8.4"
sed \
-e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
"${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die
default
}
src_install() {
local i remove=( doc )
local cudadir=/opt/cuda
local ecudadir="${EPREFIX}${cudadir}"
cd builds/cuda-toolkit
if use doc; then
DOCS+=( doc/pdf/. )
HTML_DOCS+=( doc/html/. )
fi
einstalldocs
mv doc/man/man3/{,cuda-}deprecated.3 || die
doman doc/man/man*/*
use debugger || remove+=( bin/cuda-gdb bin/cuda-gdbserver extras/Debugger share/gdb extras/cuda-gdb-${PV}.src.tar.gz )
if use profiler; then
# hack found in install-linux.pl
for i in nvvp nsight; do
cat > bin/${i} <<- EOF || die
#!/usr/bin/env sh
LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:${ecudadir}/lib:${ecudadir}/lib64 \
UBUNTU_MENUPROXY=0 LIBOVERLAY_SCROLLBAR=0 \
${ecudadir}/lib${i}/${i} -vm ${EPREFIX}/usr/bin/java
EOF
chmod a+x bin/${i} || die
done
else
use eclipse || remove+=( libnvvp libnsight nsightee_plugins nsight-compute-2019.5.0 nsight-systems-2019.5.2 bin/nsight bin/nsight_ee_plugins_manage.sh bin/nvvp bin/computeprof )
remove+=( extras/CUPTI bin/nvprof )
fi
for i in "${remove[@]}"; do
ebegin "Cleaning ${i}..."
rm -r "${i}" || die
eend $?
done
dodir ${cudadir}
into ${cudadir}
# Install binaries separately to make sure the X permission is set
local bindirs=( bin nvvm/bin extras/demo_suite $(usex profiler "libnsight/nsight") )
for i in $(find "${bindirs[@]}" -maxdepth 1 -type f); do
exeinto ${cudadir}/${i%/*}
doexe ${i}
rm ${i} || die
done
exeinto ${cudadir}/bin
doexe "${T}"/cuda-config
# Install the rest
insinto ${cudadir}
doins -r *
cat > "${T}"/99cuda <<- EOF || die
PATH=${ecudadir}/bin$(usex profiler ":${ecudadir}/libnvvp" "")
ROOTPATH=${ecudadir}/bin
LDPATH=${ecudadir}/lib64:${ecudadir}/lib:${ecudadir}/nvvm/lib64
EOF
doenvd "${T}"/99cuda
#Cuda prepackages libraries, don't revdep-build on them
echo "SEARCH_DIRS_MASK=\"${ecudadir}\"" > "${T}/80${PN}" || die
insinto "/etc/revdep-rebuild"
doins "${T}/80${PN}"
}
pkg_postinst_check() {
local a b
a="$(${EROOT}/opt/cuda/bin/cuda-config -s)"
b="0.0"
for v in $a; do
if ver_test "${v}" -gt "${b}"; then
b="${v}"
fi
done
# if gcc and if not gcc-version is at least greatest supported
if tc-is-gcc && \
ver_test $(gcc-version) -gt ${b}; then
ewarn ""
ewarn "gcc > ${b} will not work with CUDA"
ewarn "Make sure you set an earlier version of gcc with gcc-config"
ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
ewarn "to the nvcc compiler flags"
ewarn ""
fi
}
pkg_postinst() {
if [[ ${MERGE_TYPE} != binary ]]; then
pkg_postinst_check
fi
}
|