Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/
Date: Thu, 20 Sep 2018 10:10:58
Message-Id: 1537438251.d137f978e66dc9c32fa68273c42a8cd3e821087e.jer@gentoo
1 commit: d137f978e66dc9c32fa68273c42a8cd3e821087e
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 20 10:09:51 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 20 10:10:51 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d137f978
7
8 x11-drivers/nvidia-drivers: Version 410.57.
9
10 Package-Manager: Portage-2.3.49, Repoman-2.3.10
11
12 x11-drivers/nvidia-drivers/Manifest | 3 +
13 .../nvidia-drivers/nvidia-drivers-410.57.ebuild | 581 +++++++++++++++++++++
14 2 files changed, 584 insertions(+)
15
16 diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
17 index dc242c51638..148f3f2d503 100644
18 --- a/x11-drivers/nvidia-drivers/Manifest
19 +++ b/x11-drivers/nvidia-drivers/Manifest
20 @@ -15,6 +15,7 @@ DIST NVIDIA-FreeBSD-x86_64-384.130.tar.gz 62901704 BLAKE2B 50be9af398f88caa012a7
21 DIST NVIDIA-FreeBSD-x86_64-387.34.tar.gz 63387097 BLAKE2B 53689ba098b4a4de08dca056618ea533c92d17137ec954dea0ae71e1b2c825c021979871e4ff82c820be0a78d3c365f282b760940ebe2caa1ca5bfd2453e178e SHA512 0a905ee72ee6f4e9c941e5dd1f7cddf96bfb20c6da32fd05599258e1bb154f68463d775ba8ff4f67f0d4b8e637e9ed9624fc9a4873a1f2621dc86732f0d6d70d
22 DIST NVIDIA-FreeBSD-x86_64-390.87.tar.gz 63648591 BLAKE2B 88aa38b11b64b2ad91f723ec84a2adb6829571136aabb1441a9119418395d5f143736487902f0c60b49ebc1284f3100fbd089e4c941cdd3519ab8511cc1d3261 SHA512 0865fef8b8a3be8f6d9fc81908b162fd6062ba0ea81fd00200e7b2a1e3149ef62408b46bc4ccb7a77f1ac943557a22b13a10cfdde084f0b76cf2b23432e57540
23 DIST NVIDIA-FreeBSD-x86_64-396.54.tar.gz 60938322 BLAKE2B a23488b625a15703b0c40bc6871314b05d117d489f64a6f7c70ac3c934b02028b9623be10f0369c98c7d3b5e018e1eb6f1d2cde9d9e1b90be5065f06f6a646dd SHA512 52df85364bfd45a23394078855859ce85de996f7990bb96ba63eb33e516c3cf8e72c4391af9817213f735286f2cf6444bc8ed00312365f12ae17373cfbdc3fc7
24 +DIST NVIDIA-FreeBSD-x86_64-410.57.tar.gz 62103893 BLAKE2B 30313d5d0759e85ca9679e2fd5f7a6b816bf9d7b3afcb068b9de50639461d15ef3e1e0b552430271cfbfed32b20762f9bf439ed5f9450b3741c8b3436ac12cdf SHA512 1a7f0d32ce7619ebb9f6f1c1de3c1ef50747fe10864480529d6602534657cc8b9200970da080dfc0440963c00e9fb23f11e1904ced4898010757946c967af8a1
25 DIST NVIDIA-Linux-armv7l-gnueabihf-375.82.run 26650801 BLAKE2B 31446667065c56b48f6a3e737afe29a4517459d3462138136bffe383bc6fe514d6e80b49c391c27edc96b8abc3da3dd4d6ee3f3dca17f3c9a0f1cdf0e72cf099 SHA512 28554f1c24fe63c9257c0de3e84e4e739a45bf1c20ec7a53bc2c1b69b4e2355675061491ef5b03f3ae489cf623e553cfa68442f5536f137837327036d1c53d63
26 DIST NVIDIA-Linux-armv7l-gnueabihf-378.13.run 26514235 BLAKE2B 2b3c540704496a290be7ae3f1ff378487c75af2298c12488da8b3a1814446e5df02a1ed99afd8ee7fc459d950aab472155359eae0bf56ac83389711d70638152 SHA512 253786a821df85fa926ae842114321b3c70502f887ea7c2b6790dfe3836039ee5d390e6722ca8785904ec6487e465916923d3042dc6191b3b4522c3161b80cb0
27 DIST NVIDIA-Linux-armv7l-gnueabihf-381.22.run 26815484 BLAKE2B e5f0241b07d1e54edea2025dd30061d1018c68cc2c7136c507eb894bbad5be3d0724494e2b9f33d1f8f60da4904999bbb964e6f2e78d045d7cd86bcd46b7f6d0 SHA512 934cda37c7aed26243b5b661122e1c060de5b4df890aaf2295b6650dddea37cb4f0e3f0bebddb00b5d687b66ab5e028a203195c4d4ad3379593babda42febe77
28 @@ -38,6 +39,7 @@ DIST NVIDIA-Linux-x86_64-384.130.run 82260837 BLAKE2B 55b6f3627680c881821f5d20f0
29 DIST NVIDIA-Linux-x86_64-387.34.run 82784271 BLAKE2B b7140d5d6a693892df50b3ad2e20387673dec6b5ac609cc0300bdc4b4a93ca94849255699126e4d55e67f10e488bfe6008e987197ea239b1a1b643b4ae5c7808 SHA512 6742768f1258a028c9ba56ad1d72f27d7eea4b6bfd324ba29c7f057ab5819816bd728aeaf2a8058031dadcd4c51bc6d08f0e0e0e26c68ed57955e90d68ac5a4b
30 DIST NVIDIA-Linux-x86_64-390.87.run 82690871 BLAKE2B b43a45a7d48160a72185417360a4ff4238922f6d77c7b58c0562f0e01c8aa33e89057e8a5d354e8d3c8e6fa86acf8908a6c2eab81e06158a92908eec18a9b02e SHA512 f4883744f5e07150677918669eed03c7b87774f752112aabd52d903a09ae16351b34105075da2ff0fcb7a847cf66ec17e9797826859fcaecc44fdcd464a61805
31 DIST NVIDIA-Linux-x86_64-396.54.run 86946680 BLAKE2B 9b3ab39c9d09c663238d0fac6346c24feea6ecc44b0ecaf3de871522697685c1c474ec4cc83f3bab0a2bcfecc7c77acea0e6bfee6e8ca8e6883bd338fd6da8a2 SHA512 17139abe99d4f32ec87379ee57af2cc0fec7d24605b2be7e3cd6609d9fcdf871e3c1cb7414b3544e14eb32d2213fec7ac45b3261f27c8d6565d510ccb14a1247
32 +DIST NVIDIA-Linux-x86_64-410.57.run 107221029 BLAKE2B e873c9a21422fde847c10fd4286705e6ad6942c8a8f86cd514cbb8782f792051b1b1645990bd3a8ad025eeded853d23f9925b16a5bb108524346602462eaa1b8 SHA512 2ba6b4b7829410152e0fa57772969ca59f134995ef93d08c12cc6a7a97e081c1d718600a25f541444ce66603ed84b99e66b0ced6fb773ca40f98cd5dc1348d79
33 DIST nvidia-settings-304.137.tar.bz2 1481361 BLAKE2B cf52a55a34eeb03a685a683487af6a198ba467dd8ba9983cc75624a37a226373cd931d98e8448b7b8ed430c54be2118c7b240ed2a9100b19bec5e832e2f6cdad SHA512 676d1f70c9a78ee234f5f1a283412430a386fa604de211afba02806a45906c5e246a002989b724d74752178d28c92a268de1c98d4c87876797d991253f16b0cc
34 DIST nvidia-settings-340.107.tar.bz2 1549413 BLAKE2B 127442ee2c35ceec47ab4f103bdd2d0278c621fcb9be47051111f6f8728ef5699bdc95fe33a3812a807c38c4868b04c2176e2ed218a422171d2a88ac0c00de96 SHA512 593e7e83aa350a3a7beaaa32aca8660d7e203f6f2e460a6e6eabcdc092087f9917ee4e6d141e37ad4e3b0a1b9908c085e4a71d2f579e481a03bbd1c6f75ca776
35 DIST nvidia-settings-375.82.tar.gz 2114647 BLAKE2B 26413fde8397e748fae362984039286c53a7fe104228452f3188b5e77b084ff4bf00131e77359ff5e92dfc325680c1f662950175cf806403d2a524ba86158f51 SHA512 7a374be56c8be52767d73a048029d9e55dc2abcf2f6a97eb4931544c927c85a1103a206be9e8d1ffcef36fec2caf2416f33699ad4d51e7dca17e4e844c37a595
36 @@ -47,3 +49,4 @@ DIST nvidia-settings-384.130.tar.bz2 1633217 BLAKE2B ffc1381e680e94aee95752074c3
37 DIST nvidia-settings-387.34.tar.gz 1267616 BLAKE2B 62d2fd329417f54bf384918889603921065e0ef6d4fb691e914534a75ab0062a17d8f886c593cf772d29bb6b56ce30aaf7b1548191b2f9ad5fbee71770ed5308 SHA512 559c859c0740575ab93edce013587250b98d7d2cd55198b5103fe97423d31ed9f113d83c240c402404de88074c285a07e46342538610d3d5dade7bed59d60090
38 DIST nvidia-settings-390.87.tar.bz2 1109274 BLAKE2B 20eb809ceeade932e89592ac91071e6d3311f4a075812225d68342806b7ab1f9f8ed0399ea7a47241b7974311794852fd932fd8e824065589de6c124a3c81ef3 SHA512 cafdf2bfefac187409dfcffd593ff23eaba5ab7ab8dd85a9f14a4b6a47ffb3649af770bd2615887af9d30de3ef8fedaad7afc2ebe9f60a8ba7355a9004702959
39 DIST nvidia-settings-396.54.tar.bz2 1116371 BLAKE2B 114b88f393b0909c8d84a56a280854e258d0e7e7ce800ee58547ef68b4989f22a3bbb380795472b8222493a988dc9308fc20ef03c81589448b518a12285cf204 SHA512 23dc3c61bef71200b3e8185940dd52a50dae7ca7f2b8a68fa96eaa937aabc87ded5d5f73081af51d1e7af2b78b0ec10ab80d28dadbcf10a046c32ec14db1d83c
40 +DIST nvidia-settings-410.57.tar.bz2 1115668 BLAKE2B 7c6554226110da4dcff9b71bde0f1caa9c857a170da65d0224db0c1c0445b34a91db2858d371cc1f0ddc895d361fe074b95c7c421dc55eeebe478a7faa313db8 SHA512 c909af30b31d32e1369970c9a52eae0cf8018be509ce8297f5a60d25a937ec1abe18dc6462f12c9b20fb52d83157c60af53eb599a353748ad976f7a0a67cd756
41
42 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-410.57.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-410.57.ebuild
43 new file mode 100644
44 index 00000000000..76fd7d20ca9
45 --- /dev/null
46 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-410.57.ebuild
47 @@ -0,0 +1,581 @@
48 +# Copyright 1999-2018 Gentoo Foundation
49 +# Distributed under the terms of the GNU General Public License v2
50 +
51 +EAPI=6
52 +inherit eutils flag-o-matic linux-info linux-mod multilib-minimal nvidia-driver \
53 + portability toolchain-funcs unpacker user udev
54 +
55 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
56 +HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx"
57 +
58 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
59 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
60 +ARM_NV_PACKAGE="NVIDIA-Linux-armv7l-gnueabihf-${PV}"
61 +
62 +NV_URI="http://us.download.nvidia.com/XFree86/"
63 +SRC_URI="
64 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
65 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
66 + tools? (
67 + https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-${PV}.tar.bz2
68 + )
69 +"
70 +
71 +LICENSE="GPL-2 NVIDIA-r2"
72 +SLOT="0/${PV%.*}"
73 +KEYWORDS="-* ~amd64 ~amd64-fbsd"
74 +RESTRICT="bindist mirror"
75 +EMULTILIB_PKG="true"
76 +
77 +IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms multilib pax_kernel static-libs +tools uvm wayland +X"
78 +REQUIRED_USE="
79 + tools? ( X )
80 + static-libs? ( tools )
81 +"
82 +
83 +COMMON="
84 + app-eselect/eselect-opencl
85 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
86 + tools? (
87 + dev-libs/atk
88 + dev-libs/glib:2
89 + dev-libs/jansson
90 + gtk3? (
91 + x11-libs/gtk+:3
92 + )
93 + x11-libs/cairo
94 + x11-libs/gdk-pixbuf[X]
95 + x11-libs/gtk+:2
96 + x11-libs/libX11
97 + x11-libs/libXext
98 + x11-libs/libXrandr
99 + x11-libs/libXv
100 + x11-libs/libXxf86vm
101 + x11-libs/pango[X]
102 + )
103 + X? (
104 + >=app-eselect/eselect-opengl-1.0.9
105 + app-misc/pax-utils
106 + )
107 +"
108 +DEPEND="
109 + ${COMMON}
110 + kernel_linux? ( virtual/linux-sources )
111 + tools? ( sys-apps/dbus )
112 +"
113 +RDEPEND="
114 + ${COMMON}
115 + acpi? ( sys-power/acpid )
116 + tools? ( !media-video/nvidia-settings )
117 + wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] )
118 + X? (
119 + <x11-base/xorg-server-1.20.99:=
120 + >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
121 + >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
122 + >=x11-libs/libvdpau-1.0[${MULTILIB_USEDEP}]
123 + sys-libs/zlib[${MULTILIB_USEDEP}]
124 + )
125 +"
126 +QA_PREBUILT="opt/* usr/lib*"
127 +S=${WORKDIR}/
128 +
129 +nvidia_drivers_versions_check() {
130 + if use amd64 && has_multilib_profile && \
131 + [ "${DEFAULT_ABI}" != "amd64" ]; then
132 + eerror "This ebuild doesn't currently support changing your default ABI"
133 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
134 + fi
135 +
136 + if use kernel_linux && kernel_is ge 4 19; then
137 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
138 + ewarn "which are limited to the following kernels:"
139 + ewarn "<sys-kernel/gentoo-sources-4.19"
140 + ewarn "<sys-kernel/vanilla-sources-4.19"
141 + ewarn ""
142 + ewarn "You are free to utilize epatch_user to provide whatever"
143 + ewarn "support you feel is appropriate, but will not receive"
144 + ewarn "support as a result of those changes."
145 + ewarn ""
146 + ewarn "Do not file a bug report about this."
147 + ewarn ""
148 + fi
149 +
150 + # Since Nvidia ships many different series of drivers, we need to give the user
151 + # some kind of guidance as to what version they should install. This tries
152 + # to point the user in the right direction but can't be perfect. check
153 + # nvidia-driver.eclass
154 + nvidia-driver-check-warning
155 +
156 + # Kernel features/options to check for
157 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
158 +
159 + # Now do the above checks
160 + use kernel_linux && check_extra_config
161 +}
162 +
163 +pkg_pretend() {
164 + nvidia_drivers_versions_check
165 +}
166 +
167 +pkg_setup() {
168 + nvidia_drivers_versions_check
169 +
170 + # try to turn off distcc and ccache for people that have a problem with it
171 + export DISTCC_DISABLE=1
172 + export CCACHE_DISABLE=1
173 +
174 + if use driver && use kernel_linux; then
175 + MODULE_NAMES="nvidia(video:${S}/kernel)"
176 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)"
177 + use kms && MODULE_NAMES+=" nvidia-modeset(video:${S}/kernel) nvidia-drm(video:${S}/kernel)"
178 +
179 + # This needs to run after MODULE_NAMES (so that the eclass checks
180 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
181 + # is set (so that KV_DIR is populated).
182 + linux-mod_pkg_setup
183 +
184 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
185 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
186 +
187 + # linux-mod_src_compile calls set_arch_to_kernel, which
188 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
189 + # expects x86_64 or i386 and then converts it to x86
190 + # later on in the build process
191 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
192 + fi
193 +
194 + if use kernel_linux && kernel_is lt 2 6 9; then
195 + eerror "You must build this against 2.6.9 or higher kernels."
196 + fi
197 +
198 + # set variables to where files are in the package structure
199 + if use kernel_FreeBSD; then
200 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
201 + NV_DOC="${S}/doc"
202 + NV_OBJ="${S}/obj"
203 + NV_SRC="${S}/src"
204 + NV_MAN="${S}/x11/man"
205 + NV_X11="${S}/obj"
206 + NV_SOVER=1
207 + elif use kernel_linux; then
208 + NV_DOC="${S}"
209 + NV_OBJ="${S}"
210 + NV_SRC="${S}/kernel"
211 + NV_MAN="${S}"
212 + NV_X11="${S}"
213 + NV_SOVER=${PV}
214 + else
215 + die "Could not determine proper NVIDIA package"
216 + fi
217 +}
218 +
219 +src_prepare() {
220 + if use pax_kernel; then
221 + ewarn "Using PAX patches is not supported. You will be asked to"
222 + ewarn "use a standard kernel should you have issues. Should you"
223 + ewarn "need support with these patches, contact the PaX team."
224 + eapply "${FILESDIR}"/${PN}-375.20-pax.patch
225 + fi
226 +
227 + local man_file
228 + for man_file in "${NV_MAN}"/*1.gz; do
229 + gunzip $man_file || die
230 + done
231 +
232 + if use tools; then
233 + cp "${FILESDIR}"/nvidia-settings-linker.patch "${WORKDIR}" || die
234 + sed -i \
235 + -e "s:@PV@:${PV}:g" \
236 + "${WORKDIR}"/nvidia-settings-linker.patch || die
237 + eapply "${WORKDIR}"/nvidia-settings-linker.patch
238 + fi
239 +
240 + default
241 +
242 + if ! [ -f nvidia_icd.json ]; then
243 + cp nvidia_icd.json.template nvidia_icd.json || die
244 + sed -i -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:g' nvidia_icd.json || die
245 + fi
246 +}
247 +
248 +src_compile() {
249 + # This is already the default on Linux, as there's no toplevel Makefile, but
250 + # on FreeBSD there's one and triggers the kernel module build, as we install
251 + # it by itself, pass this.
252 +
253 + cd "${NV_SRC}"
254 + if use kernel_FreeBSD; then
255 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
256 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
257 + elif use driver && use kernel_linux; then
258 + MAKEOPTS=-j1 linux-mod_src_compile
259 + fi
260 +
261 + if use tools; then
262 + emake -C "${S}"/nvidia-settings-${PV}/src \
263 + AR="$(tc-getAR)" \
264 + CC="$(tc-getCC)" \
265 + DO_STRIP= \
266 + LD="$(tc-getCC)" \
267 + LIBDIR="$(get_libdir)" \
268 + NVLD="$(tc-getLD)" \
269 + NV_VERBOSE=1 \
270 + RANLIB="$(tc-getRANLIB)" \
271 + build-xnvctrl
272 +
273 + emake -C "${S}"/nvidia-settings-${PV}/src \
274 + CC="$(tc-getCC)" \
275 + DO_STRIP= \
276 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
277 + LD="$(tc-getCC)" \
278 + LIBDIR="$(get_libdir)" \
279 + NVLD="$(tc-getLD)" \
280 + NVML_ENABLED=0 \
281 + NV_USE_BUNDLED_LIBJANSSON=0 \
282 + NV_VERBOSE=1
283 + fi
284 +}
285 +
286 +# Install nvidia library:
287 +# the first parameter is the library to install
288 +# the second parameter is the provided soversion
289 +# the third parameter is the target directory if it is not /usr/lib
290 +donvidia() {
291 + # Full path to library
292 + nv_LIB="${1}"
293 +
294 + # SOVER to use
295 + nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})"
296 +
297 + # Where to install
298 + nv_DEST="${2}"
299 +
300 + # Get just the library name
301 + nv_LIBNAME=$(basename "${nv_LIB}")
302 +
303 + if [[ "${nv_DEST}" ]]; then
304 + exeinto ${nv_DEST}
305 + action="doexe"
306 + else
307 + nv_DEST="/usr/$(get_libdir)"
308 + action="dolib.so"
309 + fi
310 +
311 + # Install the library
312 + ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}"
313 +
314 + # If the library has a SONAME and SONAME does not match the library name,
315 + # then we need to create a symlink
316 + if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then
317 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} \
318 + || die "failed to create ${nv_DEST}/${nv_SOVER} symlink"
319 + fi
320 +
321 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} \
322 + || die "failed to create ${nv_LIBNAME/.so*/.so} symlink"
323 +}
324 +
325 +src_install() {
326 + if use driver && use kernel_linux; then
327 + linux-mod_src_install
328 +
329 + # Add the aliases
330 + # This file is tweaked with the appropriate video group in
331 + # pkg_preinst, see bug #491414
332 + insinto /etc/modprobe.d
333 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
334 + doins "${FILESDIR}"/nvidia-rmmod.conf
335 +
336 + # Ensures that our device nodes are created when not using X
337 + exeinto "$(get_udevdir)"
338 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
339 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
340 + elif use kernel_FreeBSD; then
341 + if use x86-fbsd; then
342 + insinto /boot/modules
343 + doins "${S}/src/nvidia.kld"
344 + fi
345 +
346 + exeinto /boot/modules
347 + doexe "${S}/src/nvidia.ko"
348 + fi
349 +
350 + # NVIDIA kernel <-> userspace driver config lib
351 + donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER}
352 +
353 + # NVIDIA framebuffer capture library
354 + donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER}
355 +
356 + # NVIDIA video encode/decode <-> CUDA
357 + if use kernel_linux; then
358 + donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER}
359 + donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER}
360 + fi
361 +
362 + if use X; then
363 + # Xorg DDX driver
364 + insinto /usr/$(get_libdir)/xorg/modules/drivers
365 + doins ${NV_X11}/nvidia_drv.so
366 +
367 + # Xorg GLX driver
368 + donvidia ${NV_X11}/libglxserver_nvidia.so.${NV_SOVER} \
369 + /usr/$(get_libdir)/xorg/modules/extensions
370 +
371 + # Xorg nvidia.conf
372 + if has_version '>=x11-base/xorg-server-1.16'; then
373 + insinto /usr/share/X11/xorg.conf.d
374 + newins {,50-}nvidia-drm-outputclass.conf
375 + fi
376 +
377 + insinto /usr/share/glvnd/egl_vendor.d
378 + doins ${NV_X11}/10_nvidia.json
379 + fi
380 +
381 + if use wayland; then
382 + insinto /usr/share/egl/egl_external_platform.d
383 + doins ${NV_X11}/10_nvidia_wayland.json
384 + fi
385 +
386 + # OpenCL ICD for NVIDIA
387 + if use kernel_linux; then
388 + insinto /etc/OpenCL/vendors
389 + doins ${NV_OBJ}/nvidia.icd
390 + fi
391 +
392 + # Documentation
393 + if use kernel_FreeBSD; then
394 + dodoc "${NV_DOC}/README"
395 + use X && doman "${NV_MAN}"/nvidia-xconfig.1
396 + use tools && doman "${NV_MAN}"/nvidia-settings.1
397 + else
398 + # Docs
399 + newdoc "${NV_DOC}/README.txt" README
400 + dodoc "${NV_DOC}/NVIDIA_Changelog"
401 + doman "${NV_MAN}"/nvidia-smi.1
402 + use X && doman "${NV_MAN}"/nvidia-xconfig.1
403 + use tools && doman "${NV_MAN}"/nvidia-settings.1
404 + doman "${NV_MAN}"/nvidia-cuda-mps-control.1
405 + fi
406 +
407 + docinto html
408 + dodoc -r ${NV_DOC}/html/*
409 +
410 + # Helper Apps
411 + exeinto /opt/bin/
412 +
413 + if use X; then
414 + doexe ${NV_OBJ}/nvidia-xconfig
415 +
416 + insinto /etc/vulkan/icd.d
417 + doins nvidia_icd.json
418 + fi
419 +
420 + if use kernel_linux; then
421 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
422 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
423 + doexe ${NV_OBJ}/nvidia-debugdump
424 + doexe ${NV_OBJ}/nvidia-persistenced
425 + doexe ${NV_OBJ}/nvidia-smi
426 +
427 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
428 + doexe ${NV_OBJ}/nvidia-modprobe
429 + fowners root:video /opt/bin/nvidia-modprobe
430 + fperms 4710 /opt/bin/nvidia-modprobe
431 + dosym /{opt,usr}/bin/nvidia-modprobe
432 +
433 + doman nvidia-cuda-mps-control.1
434 + doman nvidia-modprobe.1
435 + doman nvidia-persistenced.1
436 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
437 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
438 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
439 + fi
440 +
441 + if use tools; then
442 + emake -C "${S}"/nvidia-settings-${PV}/src/ \
443 + DESTDIR="${D}" \
444 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
445 + LIBDIR="${D}/usr/$(get_libdir)" \
446 + NV_USE_BUNDLED_LIBJANSSON=0 \
447 + NV_VERBOSE=1 \
448 + PREFIX=/usr \
449 + DO_STRIP= \
450 + install
451 +
452 + if use static-libs; then
453 + dolib.a "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/libXNVCtrl.a
454 +
455 + insinto /usr/include/NVCtrl
456 + doins "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/*.h
457 + fi
458 +
459 + insinto /usr/share/nvidia/
460 + doins nvidia-application-profiles-${PV}-key-documentation
461 +
462 + insinto /etc/nvidia
463 + newins \
464 + nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
465 +
466 + # There is no icon in the FreeBSD tarball.
467 + use kernel_FreeBSD || \
468 + doicon ${NV_OBJ}/nvidia-settings.png
469 +
470 + domenu "${FILESDIR}"/nvidia-settings.desktop
471 +
472 + exeinto /etc/X11/xinit/xinitrc.d
473 + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
474 + fi
475 +
476 + dobin ${NV_OBJ}/nvidia-bug-report.sh
477 +
478 + if has_multilib_profile && use multilib; then
479 + local OABI=${ABI}
480 + for ABI in $(get_install_abis); do
481 + src_install-libs
482 + done
483 + ABI=${OABI}
484 + unset OABI
485 + else
486 + src_install-libs
487 + fi
488 +
489 + is_final_abi || die "failed to iterate through all ABIs"
490 +
491 + readme.gentoo_create_doc
492 +}
493 +
494 +src_install-libs() {
495 + local inslibdir=$(get_libdir)
496 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
497 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
498 + local nv_libdir="${NV_OBJ}"
499 +
500 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
501 + nv_libdir="${NV_OBJ}"/32
502 + fi
503 +
504 + if use X; then
505 + NV_GLX_LIBRARIES=(
506 + "libEGL.so.$(usex compat ${NV_SOVER} 1.1.0) ${GL_ROOT}"
507 + "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}"
508 + "libGL.so.$(usex compat ${NV_SOVER} 1.7.0) ${GL_ROOT}"
509 + "libGLESv1_CM.so.1.2.0 ${GL_ROOT}"
510 + "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
511 + "libGLESv2.so.2.1.0 ${GL_ROOT}"
512 + "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}"
513 + "libGLX.so.0 ${GL_ROOT}"
514 + "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}"
515 + "libGLdispatch.so.0 ${GL_ROOT}"
516 + "libOpenCL.so.1.0.0 ${CL_ROOT}"
517 + "libOpenGL.so.0 ${GL_ROOT}"
518 + "libcuda.so.${NV_SOVER}"
519 + "libnvcuvid.so.${NV_SOVER}"
520 + "libnvidia-compiler.so.${NV_SOVER}"
521 + "libnvidia-eglcore.so.${NV_SOVER}"
522 + "libnvidia-encode.so.${NV_SOVER}"
523 + "libnvidia-fatbinaryloader.so.${NV_SOVER}"
524 + "libnvidia-fbc.so.${NV_SOVER}"
525 + "libnvidia-glcore.so.${NV_SOVER}"
526 + "libnvidia-glsi.so.${NV_SOVER}"
527 + "libnvidia-glvkspirv.so.${NV_SOVER}"
528 + "libnvidia-ifr.so.${NV_SOVER}"
529 + "libnvidia-opencl.so.${NV_SOVER}"
530 + "libnvidia-ptxjitcompiler.so.${NV_SOVER}"
531 + "libvdpau_nvidia.so.${NV_SOVER}"
532 + )
533 +
534 + if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]];
535 + then
536 + NV_GLX_LIBRARIES+=(
537 + "libnvidia-egl-wayland.so.1.1.0"
538 + )
539 + fi
540 +
541 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
542 + then
543 + NV_GLX_LIBRARIES+=(
544 + "libnvidia-wfb.so.${NV_SOVER}"
545 + )
546 + fi
547 +
548 + if use kernel_FreeBSD; then
549 + NV_GLX_LIBRARIES+=(
550 + "libnvidia-tls.so.${NV_SOVER}"
551 + )
552 + fi
553 +
554 + if use kernel_linux; then
555 + NV_GLX_LIBRARIES+=(
556 + "libnvidia-ml.so.${NV_SOVER}"
557 + "tls/libnvidia-tls.so.${NV_SOVER}"
558 + )
559 + fi
560 +
561 + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
562 + donvidia "${nv_libdir}"/${NV_LIB}
563 + done
564 + fi
565 +}
566 +
567 +pkg_preinst() {
568 + if use driver && use kernel_linux; then
569 + linux-mod_pkg_preinst
570 +
571 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
572 + if [ -z "${videogroup}" ]; then
573 + eerror "Failed to determine the video group gid"
574 + die "Failed to determine the video group gid"
575 + else
576 + sed -i \
577 + -e "s:PACKAGE:${PF}:g" \
578 + -e "s:VIDEOGID:${videogroup}:" \
579 + "${D}"/etc/modprobe.d/nvidia.conf || die
580 + fi
581 + fi
582 +
583 + # Clean the dynamic libGL stuff's home to ensure
584 + # we dont have stale libs floating around
585 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then
586 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
587 + fi
588 + # Make sure we nuke the old nvidia-glx's env.d file
589 + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then
590 + rm -f "${ROOT}"/etc/env.d/09nvidia
591 + fi
592 +}
593 +
594 +pkg_postinst() {
595 + use driver && use kernel_linux && linux-mod_pkg_postinst
596 +
597 + # Switch to the nvidia implementation
598 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
599 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
600 +
601 + readme.gentoo_print_elog
602 +
603 + if ! use X; then
604 + elog "You have elected to not install the X.org driver. Along with"
605 + elog "this the OpenGL libraries and VDPAU libraries were not"
606 + elog "installed. Additionally, once the driver is loaded your card"
607 + elog "and fan will run at max speed which may not be desirable."
608 + elog "Use the 'nvidia-smi' init script to have your card and fan"
609 + elog "speed scale appropriately."
610 + elog
611 + fi
612 + if ! use tools; then
613 + elog "USE=tools controls whether the nvidia-settings application"
614 + elog "is installed. If you would like to use it, enable that"
615 + elog "flag and re-emerge this ebuild. Optionally you can install"
616 + elog "media-video/nvidia-settings"
617 + elog
618 + fi
619 +}
620 +
621 +pkg_prerm() {
622 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
623 +}
624 +
625 +pkg_postrm() {
626 + use driver && use kernel_linux && linux-mod_pkg_postrm
627 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
628 +}