Diff nvidia-cuda-toolkit-9.2.88-r1 with a nvidia-cuda-toolkit-10.2.89-r3

/usr/portage/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-10.2.89-r3.ebuild 2021-04-29 12:39:00.000000000 +0300
1 1
# Copyright 1999-2021 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=6
4
EAPI=7
5 5

  
6
inherit check-reqs cuda eutils toolchain-funcs unpacker versionator
6
inherit check-reqs cuda toolchain-funcs unpacker
7 7

  
8
MYD=$(get_version_component_range 1-2)
9
DRIVER_PV="396.26"
8
MYD=$(ver_cut 1-2 ${PV})
9
DRIVER_PV="440.33.01"
10 10

  
11 11
DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
12 12
HOMEPAGE="https://developer.nvidia.com/cuda-zone"
13
SRC_URI="https://developer.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux -> cuda_${PV}_${DRIVER_PV}_linux.run"
13
SRC_URI="https://developer.download.nvidia.com/compute/cuda/${MYD}/Prod/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
14 14

  
15 15
LICENSE="NVIDIA-CUDA"
16 16
SLOT="0/${PV}"
......
18 18
IUSE="debugger doc eclipse profiler"
19 19
RESTRICT="bindist mirror"
20 20

  
21
DEPEND=""
22
RDEPEND="${DEPEND}
23
	<sys-devel/gcc-8[cxx]
21
BDEPEND=""
22
RDEPEND="
23
	<sys-devel/gcc-9[cxx]
24 24
	>=x11-drivers/nvidia-drivers-${DRIVER_PV}
25 25
	debugger? (
26
		dev-libs/openssl-compat:1.0.0
26 27
		sys-libs/libtermcap-compat
27 28
		sys-libs/ncurses-compat:5[tinfo]
28
		)
29
	eclipse? ( >=virtual/jre-1.8:* )
30
	profiler? ( >=virtual/jre-1.8:* )"
29
	)
30
	eclipse? (
31
		dev-libs/openssl-compat:1.0.0
32
		>=virtual/jre-1.8:*
33
	)
34
	profiler? (
35
		dev-libs/openssl-compat:1.0.0
36
		>=virtual/jre-1.8:*
37
	)"
31 38

  
32 39
S="${WORKDIR}"
33 40

  
34 41
QA_PREBUILT="opt/cuda/*"
35 42

  
36
CHECKREQS_DISK_BUILD="3500M"
43
CHECKREQS_DISK_BUILD="6800M"
37 44

  
38 45
pkg_setup() {
39 46
	# We don't like to run cuda_pkg_setup as it depends on us
40 47
	check-reqs_pkg_setup
41 48
}
42 49

  
43
src_unpack() {
44
	unpacker
45
	unpacker run_files/cuda-linux*.run
46
}
47

  
48 50
src_prepare() {
49 51
	local cuda_supported_gcc
50 52

  
51 53
	# ATTENTION: change requires revbump
52
	cuda_supported_gcc="4.7 4.8 4.9 5.3 5.4 6.3 6.4 7.2 7.3"
54
	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"
53 55

  
54 56
	sed \
55 57
		-e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
......
59 61
}
60 62

  
61 63
src_install() {
62
	local i remove=( doc jre run_files install-linux.pl cuda-installer.pl )
64
	local i remove=( doc )
63 65
	local cudadir=/opt/cuda
64 66
	local ecudadir="${EPREFIX}${cudadir}"
65 67

  
68
	cd builds/cuda-toolkit
66 69
	if use doc; then
67 70
		DOCS+=( doc/pdf/. )
68 71
		HTML_DOCS+=( doc/html/. )
......
72 75
	mv doc/man/man3/{,cuda-}deprecated.3 || die
73 76
	doman doc/man/man*/*
74 77

  
75
	use debugger || remove+=( bin/cuda-gdb extras/Debugger extras/cuda-gdb-${PV}.src.tar.gz )
78
	use debugger || remove+=( bin/cuda-gdb bin/cuda-gdbserver extras/Debugger share/gdb extras/cuda-gdb-${PV}.src.tar.gz )
76 79

  
77 80
	if use profiler; then
78 81
		# hack found in install-linux.pl
......
86 89
			chmod a+x bin/${i} || die
87 90
		done
88 91
	else
89
		use eclipse || remove+=( libnvvp libnsight )
90
		remove+=( extras/CUPTI )
92
		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 )
93
		remove+=( extras/CUPTI bin/nvprof )
91 94
	fi
92 95

  
93 96
	for i in "${remove[@]}"; do
94 97
		ebegin "Cleaning ${i}..."
95
		rm -rf "${i}" || die
98
		rm -r "${i}" || die
96 99
		eend
97 100
	done
98 101

  
99 102
	dodir ${cudadir}
100
	mv * "${ED%/}${cudadir}" || die
103
	into ${cudadir}
104

  
105
	# Install binaries separately to make sure the X permission is set
106
	local bindirs=( bin nvvm/bin extras/demo_suite  $(usex profiler "libnsight/nsight") )
107
	for i in $(find "${bindirs[@]}" -maxdepth 1 -type f); do
108
		exeinto ${cudadir}/${i%/*}
109
		doexe ${i}
110
		rm ${i} || die
111
	done
112
	exeinto ${cudadir}/bin
113
	doexe "${T}"/cuda-config
114

  
115
	# Install the rest
116
	insinto ${cudadir}
117
	doins -r *
101 118

  
102 119
	cat > "${T}"/99cuda <<- EOF || die
103 120
		PATH=${ecudadir}/bin$(usex profiler ":${ecudadir}/libnvvp" "")
......
106 123
	EOF
107 124
	doenvd "${T}"/99cuda
108 125

  
109
	use profiler && \
110
		make_wrapper nvprof "${ecudadir}/bin/nvprof" "." "${ecudadir}/lib64:${ecudadir}/lib"
111

  
112
	dobin "${T}"/cuda-config
126
	#Cuda prepackages libraries, don't revdep-build on them
127
	echo "SEARCH_DIRS_MASK=\"${ecudadir}\"" > "${T}/80${PN}" || die
128
	insinto "/etc/revdep-rebuild"
129
	doins "${T}/80${PN}"
113 130
}
114 131

  
115 132
pkg_postinst_check() {
116 133
	local a b
117
	a="$(version_sort $(cuda-config -s))"; a=( $a )
118
	# greatest supported version
119
	b="${a[${#a[@]}-1]}"
134
	a="$(${EROOT}/opt/cuda/bin/cuda-config -s)"
135
	b="0.0"
136
	for v in $a; do
137
		if ver_test "${v}" -gt "${b}"; then
138
			b="${v}"
139
		fi
140
	done
120 141

  
121 142
	# if gcc and if not gcc-version is at least greatest supported
122 143
	if tc-is-gcc && \
123
		! version_is_at_least gcc-version ${b}; then
144
		ver_test $(gcc-version) -gt ${b}; then
124 145
			ewarn ""
125
			ewarn "gcc >= ${b} will not work with CUDA"
146
			ewarn "gcc > ${b} will not work with CUDA"
126 147
			ewarn "Make sure you set an earlier version of gcc with gcc-config"
127 148
			ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
128 149
			ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
Thank you!