Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/
Date: Wed, 12 Jan 2022 03:29:35
Message-Id: 1641958138.fcc779a9f7cfcd2c0f2de3ef16fb5ab51eca7d36.ionen@gentoo
1 commit: fcc779a9f7cfcd2c0f2de3ef16fb5ab51eca7d36
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 12 03:25:21 2022 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 12 03:28:58 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fcc779a9
7
8 x11-drivers/nvidia-drivers: drop 495.46, 495.46-r20
9
10 Keep 495.44-r2 and 495.46-r10 for now in case of regressions, but
11 -r0 and -r20 should have no real uses.
12
13 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
14
15 .../nvidia-drivers-495.46-r20.ebuild | 461 ---------------------
16 .../nvidia-drivers/nvidia-drivers-495.46.ebuild | 447 --------------------
17 2 files changed, 908 deletions(-)
18
19 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-495.46-r20.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-495.46-r20.ebuild
20 deleted file mode 100644
21 index 694ae76105ad..000000000000
22 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-495.46-r20.ebuild
23 +++ /dev/null
24 @@ -1,461 +0,0 @@
25 -# Copyright 1999-2022 Gentoo Authors
26 -# Distributed under the terms of the GNU General Public License v2
27 -
28 -EAPI=7
29 -
30 -MODULES_OPTIONAL_USE="driver"
31 -inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
32 - systemd toolchain-funcs unpacker
33 -
34 -NV_KERNEL_MAX="5.15"
35 -
36 -DESCRIPTION="NVIDIA Accelerated Graphics Driver"
37 -HOMEPAGE="https://www.nvidia.com/download/index.aspx"
38 -SRC_URI="
39 - amd64? ( https://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/NVIDIA-Linux-x86_64-${PV}.run )
40 - arm64? ( https://us.download.nvidia.com/XFree86/aarch64/${PV}/NVIDIA-Linux-aarch64-${PV}.run )
41 - $(printf "https://github.com/NVIDIA/%s/archive/refs/tags/${PV}.tar.gz -> %s-${PV}.tar.gz " \
42 - nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})"
43 -# nvidia-installer is unused but here for GPL-2's "distribute sources"
44 -S="${WORKDIR}"
45 -
46 -LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
47 -SLOT="0/${PV%%.*}"
48 -#KEYWORDS="-* ~amd64"
49 -IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced static-libs +tools wayland"
50 -RESTRICT="bindist"
51 -
52 -COMMON_DEPEND="
53 - acct-group/video
54 - persistenced? (
55 - acct-user/nvpd
56 - net-libs/libtirpc:=
57 - )
58 - tools? (
59 - dev-libs/atk
60 - dev-libs/glib:2
61 - dev-libs/jansson:=
62 - media-libs/harfbuzz:=
63 - x11-libs/cairo
64 - x11-libs/gdk-pixbuf:2
65 - x11-libs/gtk+:3
66 - x11-libs/libX11
67 - x11-libs/libXext
68 - x11-libs/libXxf86vm
69 - x11-libs/pango
70 - )"
71 -RDEPEND="
72 - ${COMMON_DEPEND}
73 - X? (
74 - media-libs/libglvnd[X,abi_x86_32(-)?]
75 - x11-libs/libX11[abi_x86_32(-)?]
76 - x11-libs/libXext[abi_x86_32(-)?]
77 - )
78 - wayland? (
79 - gui-libs/egl-gbm
80 - >=gui-libs/egl-wayland-1.1.7-r1
81 - media-libs/libglvnd
82 - )"
83 -DEPEND="
84 - ${COMMON_DEPEND}
85 - static-libs? (
86 - x11-libs/libX11
87 - x11-libs/libXext
88 - )
89 - tools? (
90 - media-libs/libglvnd
91 - sys-apps/dbus
92 - x11-base/xorg-proto
93 - x11-libs/libXrandr
94 - x11-libs/libXv
95 - x11-libs/libvdpau
96 - )"
97 -BDEPEND="
98 - sys-devel/m4
99 - virtual/pkgconfig"
100 -
101 -QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
102 -
103 -PATCHES=(
104 - "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
105 - "${FILESDIR}"/nvidia-settings-390.144-desktop.patch
106 - "${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch
107 - "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch
108 -)
109 -
110 -pkg_setup() {
111 - use driver || return
112 -
113 - local CONFIG_CHECK="
114 - PROC_FS
115 - ~DRM_KMS_HELPER
116 - ~SYSVIPC
117 - ~!DRM_SIMPLEDRM
118 - ~!LOCKDEP
119 - ~!SLUB_DEBUG_ON
120 - !DEBUG_MUTEXES"
121 - local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection
122 - of drivers (no custom config), and for wayland / nvidia-drm.modeset=1.
123 - Cannot be directly selected in the kernel's menuconfig, and may need
124 - selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or
125 - DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in.
126 - Note: DRM_SIMPLEDRM may cause issues and is better disabled for now."
127 -
128 - use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
129 -
130 - MODULE_NAMES="
131 - nvidia(video:kernel)
132 - nvidia-drm(video:kernel)
133 - nvidia-modeset(video:kernel)
134 - nvidia-peermem(video:kernel)
135 - nvidia-uvm(video:kernel)"
136 -
137 - linux-mod_pkg_setup
138 -
139 - [[ ${MERGE_TYPE} == binary ]] && return
140 -
141 - BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
142 - BUILD_TARGETS="modules"
143 -
144 - if linux_chkconfig_present CC_IS_CLANG; then
145 - ewarn "Warning: building ${PN} with a clang-built kernel is experimental"
146 -
147 - BUILD_PARAMS+=' CC=${CHOST}-clang'
148 - if linux_chkconfig_present LD_IS_LLD; then
149 - BUILD_PARAMS+=' LD=ld.lld'
150 - if linux_chkconfig_present LTO_CLANG_THIN; then
151 - # kernel enables cache by default leading to sandbox violations
152 - BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
153 - fi
154 - fi
155 - fi
156 -
157 - if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
158 - ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
159 - ewarn "or was not tested with it. It is recommended to use one of:"
160 - ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
161 - ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
162 - ewarn "You are free to try or use /etc/portage/patches, but support will"
163 - ewarn "not be given and issues wait until NVIDIA releases a fixed version."
164 - ewarn
165 - ewarn "Do _not_ file a bug report if run into issues."
166 - ewarn
167 - fi
168 -}
169 -
170 -src_prepare() {
171 - # make patches usable across versions
172 - rm nvidia-modprobe && mv nvidia-modprobe{-${PV},} || die
173 - rm nvidia-persistenced && mv nvidia-persistenced{-${PV},} || die
174 - rm nvidia-settings && mv nvidia-settings{-${PV},} || die
175 - rm nvidia-xconfig && mv nvidia-xconfig{-${PV},} || die
176 -
177 - default
178 -
179 - # prevent detection of incomplete kernel DRM support (bug #603818)
180 - sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \
181 - -i kernel/conftest.sh || die
182 -
183 - sed 's/__USER__/nvpd/' \
184 - nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \
185 - > "${T}"/nvidia-persistenced.service || die
186 -
187 - # enable nvidia-drm.modeset=1 by default with USE=wayland
188 - cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die
189 - use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die
190 -
191 - # temporary workaround for dbus powerd spam in 495 series
192 - # (jz -> jmp after nvidia.powerd.server, need RESTRICT=bindist)
193 - # https://forums.developer.nvidia.com/t/bug-nvidia-v495-29-05-driver-spamming-dbus-enabled-applications-with-invalid-messages/192892/14
194 - if use amd64; then
195 - sed 's/\x0f\x84\[\x01\x00\x00\x4c\x8d/\xe9\x5c\x01\x00\x00\x00\x4c\x8d/' \
196 - -i libnvidia-glcore.so.495.46 || die
197 - sed 's/\x0f\x84\x65\x01\x00\x00\x83\xec\x08\x89/\xe9\x66\x01\x00\x00\x00\x83\xec\x08\x89/' \
198 - -i 32/libnvidia-glcore.so.495.46 || die
199 - fi
200 -}
201 -
202 -src_compile() {
203 - tc-export AR CC LD OBJCOPY
204 -
205 - NV_ARGS=(
206 - PREFIX="${EPREFIX}"/usr
207 - HOST_CC="$(tc-getBUILD_CC)"
208 - HOST_LD="$(tc-getBUILD_LD)"
209 - NV_USE_BUNDLED_LIBJANSSON=0
210 - NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out
211 - )
212 -
213 - use driver && linux-mod_src_compile
214 -
215 - emake "${NV_ARGS[@]}" -C nvidia-modprobe
216 - use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced
217 - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig
218 -
219 - if use tools; then
220 - # cflags: avoid noisy logs, only use here and set first to let override
221 - # ldflags: abi currently needed if LD=ld.lld
222 - CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \
223 - RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" \
224 - emake "${NV_ARGS[@]}" -C nvidia-settings
225 - elif use static-libs; then
226 - emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a
227 - fi
228 -}
229 -
230 -src_install() {
231 - local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir)
232 -
233 - NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} )
234 -
235 - local -A paths=(
236 - [APPLICATION_PROFILE]=/usr/share/nvidia
237 - [CUDA_ICD]=/etc/OpenCL/vendors
238 - [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d
239 - [FIRMWARE]=/lib/firmware/nvidia/${PV}
240 - [GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm
241 - [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d
242 - [VULKAN_ICD_JSON]=/usr/share/vulkan
243 - [WINE_LIB]=/usr/${libdir}/nvidia/wine
244 - [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d
245 -
246 - [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions
247 - [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules
248 - [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules
249 - )
250 -
251 - local skip_files=(
252 - $(usex X '' '
253 - libGLX_nvidia libglxserver_nvidia
254 - nvidia_icd.json nvidia_layers.json')
255 - $(usex wayland '' 'libnvidia-vulkan-producer')
256 - libGLX_indirect # non-glvnd unused fallback
257 - libnvidia-gtk nvidia-{settings,xconfig} # built from source
258 - libnvidia-egl-gbm 15_nvidia_gbm # gui-libs/egl-gbm
259 - libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland
260 - )
261 - local skip_modules=(
262 - $(usex X '' 'nvfbc vdpau xdriver')
263 - $(usex driver '' 'gsp')
264 - installer nvpd # handled separately / built from source
265 - )
266 - local skip_types=(
267 - GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd
268 - OPENCL_WRAPPER.\* # virtual/opencl
269 - DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused
270 - )
271 -
272 - local DOCS=(
273 - README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json
274 - nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt
275 - )
276 - local HTML_DOCS=( html/. )
277 - einstalldocs
278 -
279 - local DISABLE_AUTOFORMATTING=yes
280 - local DOC_CONTENTS="\
281 -Trusted users should be in the 'video' group to use NVIDIA devices.
282 -You can add yourself by using: gpasswd -a my-user video\
283 -$(usex driver "
284 -
285 -Like all out-of-tree kernel modules, it is necessary to rebuild
286 -${PN} after upgrading or rebuilding the Linux kernel
287 -by for example running \`emerge @module-rebuild\`. Alternatively,
288 -if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}),
289 -this can be automated by setting USE=dist-kernel globally.
290 -
291 -Loaded kernel modules also must not mismatch with the installed
292 -${PN} version (excluding -r revision), meaning should
293 -ensure \`eselect kernel list\` points to the kernel that will be
294 -booted before building and preferably reboot after upgrading
295 -${PN} (the ebuild will emit a warning if mismatching).
296 -
297 -See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options." '')\
298 -$(use amd64 && usex abi_x86_32 '' "
299 -
300 -Note that without USE=abi_x86_32 on ${PN}, 32bit applications
301 -(typically using wine / steam) will not be able to use GPU acceleration.")
302 -
303 -For general information on using ${PN}, please see:
304 -https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
305 - readme.gentoo_create_doc
306 -
307 - if use driver; then
308 - linux-mod_src_install
309 -
310 - insinto /etc/modprobe.d
311 - doins "${T}"/nvidia.conf
312 -
313 - # used for gpu verification with binpkgs (not kept, see pkg_preinst)
314 - insinto /usr/share/nvidia
315 - doins supported-gpus/supported-gpus.json
316 - fi
317 -
318 - emake "${NV_ARGS[@]}" -C nvidia-modprobe install
319 - fowners :video /usr/bin/nvidia-modprobe #505092
320 - fperms 4710 /usr/bin/nvidia-modprobe
321 -
322 - if use persistenced; then
323 - emake "${NV_ARGS[@]}" -C nvidia-persistenced install
324 - newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced
325 - newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced
326 - systemd_dounit "${T}"/nvidia-persistenced.service
327 - fi
328 -
329 - if use tools; then
330 - emake "${NV_ARGS[@]}" -C nvidia-settings install
331 -
332 - doicon nvidia-settings/doc/nvidia-settings.png
333 - domenu nvidia-settings/doc/nvidia-settings.desktop
334 -
335 - exeinto /etc/X11/xinit/xinitrc.d
336 - newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
337 - fi
338 -
339 - if use static-libs; then
340 - dolib.a nvidia-settings/src/out/libXNVCtrl.a
341 -
342 - insinto /usr/include/NVCtrl
343 - doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h
344 - fi
345 -
346 - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install
347 -
348 - # mimic nvidia-installer by reading .manifest to install files
349 - # 0:file 1:perms 2:type 3+:subtype/arguments -:module
350 - local m into
351 - while IFS=' ' read -ra m; do
352 - ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] ||
353 - eval '[[ " ${m[0]##*/}" =~ ^(\ '${skip_files[*]/%/.*|\\}' )$ ]]' ||
354 - eval '[[ " ${m[2]}" =~ ^(\ '${skip_types[*]/%/|\\}' )$ ]]' ||
355 - has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue
356 -
357 - case ${m[2]} in
358 - MANPAGE)
359 - gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert
360 - continue
361 - ;;
362 - GBM_BACKEND_LIB_SYMLINK) m[4]=../${m[4]};; # missing ../
363 - VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/
364 - esac
365 -
366 - if [[ -v paths[${m[2]}] ]]; then
367 - into=${paths[${m[2]}]}
368 - elif [[ ${m[2]} =~ _BINARY$ ]]; then
369 - into=/opt/bin
370 - elif [[ ${m[3]} == COMPAT32 ]]; then
371 - use abi_x86_32 || continue
372 - into=/usr/${libdir32}
373 - elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then
374 - into=/usr/${libdir}
375 - else
376 - die "No known installation path for ${m[0]}"
377 - fi
378 - [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/}
379 - [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/}
380 -
381 - if [[ ${m[2]} =~ _SYMLINK$ ]]; then
382 - [[ ${m[4]: -1} == / ]] && m[4]=${m[5]}
383 - dosym ${m[4]} ${into}/${m[0]}
384 - continue
385 - fi
386 - [[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] &&
387 - dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest
388 -
389 - printf -v m[1] %o $((m[1] | 0200)) # 444->644
390 - insopts -m${m[1]}
391 - insinto ${into}
392 - doins ${m[0]}
393 - done < .manifest || die
394 -
395 - # MODULE:installer non-skipped extras
396 - exeinto /lib/systemd/system-sleep
397 - doexe systemd/system-sleep/nvidia
398 - dobin systemd/nvidia-sleep.sh
399 - systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service
400 -
401 - dobin nvidia-bug-report.sh
402 -}
403 -
404 -pkg_preinst() {
405 - has_version "${CATEGORY}/${PN}[abi_x86_32]" && NV_HAD_ABI32=
406 - has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
407 -
408 - use driver || return
409 - linux-mod_pkg_preinst
410 -
411 - # set video group id based on live system (bug #491414)
412 - local g=$(getent group video | cut -d: -f3)
413 - [[ ${g} ]] || die "Failed to determine video group id"
414 - sed -i "s/@VIDEOGID@/${g}/" "${ED}"/etc/modprobe.d/nvidia.conf || die
415 -
416 - # try to find driver mismatches using temporary supported-gpus.json
417 - for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do
418 - g=$(grep -io "\"devid\":\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \
419 - "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null)
420 - if [[ ${g} ]]; then
421 - g=$((${g##*\"}+1))
422 - if ver_test -ge ${g}; then
423 - NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}"
424 - break
425 - fi
426 - fi
427 - done
428 - rm "${ED}"/usr/share/nvidia/supported-gpus.json || die
429 -}
430 -
431 -pkg_postinst() {
432 - use driver && linux-mod_pkg_postinst
433 -
434 - readme.gentoo_print_elog
435 -
436 - if [[ -r /proc/driver/nvidia/version &&
437 - $(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
438 - ewarn "Currently loaded NVIDIA modules do not match the newly installed"
439 - ewarn "libraries and may prevent launching GPU-accelerated applications."
440 - use driver && ewarn "The easiest way to fix this is usually to reboot."
441 - fi
442 -
443 - if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
444 - ewarn "Detected that the current kernel command line is using 'slub_debug=',"
445 - ewarn "this may lead to system instability/freezes with this version of"
446 - ewarn "${PN}. Bug: https://bugs.gentoo.org/796329"
447 - fi
448 -
449 - if [[ -v NV_LEGACY_MASK ]]; then
450 - ewarn
451 - ewarn "***WARNING***"
452 - ewarn
453 - ewarn "You are installing a version of ${PN} known not to work"
454 - ewarn "with a GPU of the current system. If unwanted, add the mask:"
455 - if [[ -d ${EROOT}/etc/portage/package.mask ]]; then
456 - ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}"
457 - else
458 - ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask"
459 - fi
460 - ewarn "...then downgrade to a legacy branch if possible. For details, see:"
461 - ewarn "https://www.nvidia.com/object/IO_32667.html"
462 - fi
463 -
464 - if use !abi_x86_32 && [[ -v NV_HAD_ABI32 ]]; then
465 - elog
466 - elog "USE=abi_x86_32 is disabled, 32bit applications will not be able to"
467 - elog "use nvidia-drivers for acceleration without it (e.g. commonly used"
468 - elog "with app-emulation/wine-* or steam). Re-enable if needed."
469 - fi
470 -
471 - if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
472 - elog
473 - elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
474 - elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
475 - elog "experimental but is required for wayland."
476 - elog
477 - elog "If you experience issues, either disable wayland or edit nvidia.conf."
478 - elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
479 - fi
480 -
481 - ewarn
482 - ewarn "This revision of ${PN} is applying a binary patch to prevent heavy"
483 - ewarn "dbus spamming while using OpenGL. If you experience issues, please try to"
484 - ewarn "mask =${CATEGORY}/${PN}-${PVR} to use NVIDIA's intended version."
485 -}
486
487 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-495.46.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-495.46.ebuild
488 deleted file mode 100644
489 index 5ccf1a12923c..000000000000
490 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-495.46.ebuild
491 +++ /dev/null
492 @@ -1,447 +0,0 @@
493 -# Copyright 1999-2022 Gentoo Authors
494 -# Distributed under the terms of the GNU General Public License v2
495 -
496 -EAPI=7
497 -
498 -MODULES_OPTIONAL_USE="driver"
499 -inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \
500 - systemd toolchain-funcs unpacker
501 -
502 -NV_KERNEL_MAX="5.15"
503 -
504 -DESCRIPTION="NVIDIA Accelerated Graphics Driver"
505 -HOMEPAGE="https://www.nvidia.com/download/index.aspx"
506 -SRC_URI="
507 - amd64? ( https://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/NVIDIA-Linux-x86_64-${PV}.run )
508 - arm64? ( https://us.download.nvidia.com/XFree86/aarch64/${PV}/NVIDIA-Linux-aarch64-${PV}.run )
509 - $(printf "https://github.com/NVIDIA/%s/archive/refs/tags/${PV}.tar.gz -> %s-${PV}.tar.gz " \
510 - nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})"
511 -# nvidia-installer is unused but here for GPL-2's "distribute sources"
512 -S="${WORKDIR}"
513 -
514 -LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
515 -SLOT="0/${PV%%.*}"
516 -KEYWORDS="-* ~amd64"
517 -IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced static-libs +tools wayland"
518 -
519 -COMMON_DEPEND="
520 - acct-group/video
521 - persistenced? (
522 - acct-user/nvpd
523 - net-libs/libtirpc:=
524 - )
525 - tools? (
526 - dev-libs/atk
527 - dev-libs/glib:2
528 - dev-libs/jansson:=
529 - media-libs/harfbuzz:=
530 - x11-libs/cairo
531 - x11-libs/gdk-pixbuf:2
532 - x11-libs/gtk+:3
533 - x11-libs/libX11
534 - x11-libs/libXext
535 - x11-libs/libXxf86vm
536 - x11-libs/pango
537 - )"
538 -RDEPEND="
539 - ${COMMON_DEPEND}
540 - X? (
541 - media-libs/libglvnd[X,abi_x86_32(-)?]
542 - x11-libs/libX11[abi_x86_32(-)?]
543 - x11-libs/libXext[abi_x86_32(-)?]
544 - )
545 - wayland? (
546 - >=gui-libs/egl-wayland-1.1.7-r1
547 - media-libs/libglvnd
548 - >=media-libs/mesa-21.2[gbm(+)]
549 - x11-libs/libdrm
550 - )"
551 -DEPEND="
552 - ${COMMON_DEPEND}
553 - static-libs? (
554 - x11-libs/libX11
555 - x11-libs/libXext
556 - )
557 - tools? (
558 - media-libs/libglvnd
559 - sys-apps/dbus
560 - x11-base/xorg-proto
561 - x11-libs/libXrandr
562 - x11-libs/libXv
563 - x11-libs/libvdpau
564 - )"
565 -BDEPEND="
566 - sys-devel/m4
567 - virtual/pkgconfig"
568 -
569 -QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
570 -
571 -PATCHES=(
572 - "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
573 - "${FILESDIR}"/nvidia-settings-390.144-desktop.patch
574 - "${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch
575 - "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch
576 -)
577 -
578 -pkg_setup() {
579 - use driver || return
580 -
581 - local CONFIG_CHECK="
582 - PROC_FS
583 - ~DRM_KMS_HELPER
584 - ~SYSVIPC
585 - ~!DRM_SIMPLEDRM
586 - ~!LOCKDEP
587 - ~!SLUB_DEBUG_ON
588 - !DEBUG_MUTEXES"
589 - local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection
590 - of drivers (no custom config), and for wayland / nvidia-drm.modeset=1.
591 - Cannot be directly selected in the kernel's menuconfig, and may need
592 - selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or
593 - DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in.
594 - Note: DRM_SIMPLEDRM may cause issues and is better disabled for now."
595 -
596 - use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
597 -
598 - MODULE_NAMES="
599 - nvidia(video:kernel)
600 - nvidia-drm(video:kernel)
601 - nvidia-modeset(video:kernel)
602 - nvidia-peermem(video:kernel)
603 - nvidia-uvm(video:kernel)"
604 -
605 - linux-mod_pkg_setup
606 -
607 - [[ ${MERGE_TYPE} == binary ]] && return
608 -
609 - BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"'
610 - BUILD_TARGETS="modules"
611 -
612 - if linux_chkconfig_present CC_IS_CLANG; then
613 - ewarn "Warning: building ${PN} with a clang-built kernel is experimental"
614 -
615 - BUILD_PARAMS+=' CC=${CHOST}-clang'
616 - if linux_chkconfig_present LD_IS_LLD; then
617 - BUILD_PARAMS+=' LD=ld.lld'
618 - if linux_chkconfig_present LTO_CLANG_THIN; then
619 - # kernel enables cache by default leading to sandbox violations
620 - BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir='
621 - fi
622 - fi
623 - fi
624 -
625 - if kernel_is -gt ${NV_KERNEL_MAX/./ }; then
626 - ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}"
627 - ewarn "or was not tested with it. It is recommended to use one of:"
628 - ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x"
629 - ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x"
630 - ewarn "You are free to try or use /etc/portage/patches, but support will"
631 - ewarn "not be given and issues wait until NVIDIA releases a fixed version."
632 - ewarn
633 - ewarn "Do _not_ file a bug report if run into issues."
634 - ewarn
635 - fi
636 -}
637 -
638 -src_prepare() {
639 - # make patches usable across versions
640 - rm nvidia-modprobe && mv nvidia-modprobe{-${PV},} || die
641 - rm nvidia-persistenced && mv nvidia-persistenced{-${PV},} || die
642 - rm nvidia-settings && mv nvidia-settings{-${PV},} || die
643 - rm nvidia-xconfig && mv nvidia-xconfig{-${PV},} || die
644 -
645 - default
646 -
647 - # prevent detection of incomplete kernel DRM support (bug #603818)
648 - sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \
649 - -i kernel/conftest.sh || die
650 -
651 - sed 's/__USER__/nvpd/' \
652 - nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \
653 - > "${T}"/nvidia-persistenced.service || die
654 -
655 - # enable nvidia-drm.modeset=1 by default with USE=wayland
656 - cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die
657 - use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die
658 -}
659 -
660 -src_compile() {
661 - tc-export AR CC LD OBJCOPY
662 -
663 - NV_ARGS=(
664 - PREFIX="${EPREFIX}"/usr
665 - HOST_CC="$(tc-getBUILD_CC)"
666 - HOST_LD="$(tc-getBUILD_LD)"
667 - NV_USE_BUNDLED_LIBJANSSON=0
668 - NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out
669 - )
670 -
671 - use driver && linux-mod_src_compile
672 -
673 - emake "${NV_ARGS[@]}" -C nvidia-modprobe
674 - use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced
675 - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig
676 -
677 - if use tools; then
678 - # cflags: avoid noisy logs, only use here and set first to let override
679 - # ldflags: abi currently needed if LD=ld.lld
680 - CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \
681 - RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" \
682 - emake "${NV_ARGS[@]}" -C nvidia-settings
683 - elif use static-libs; then
684 - emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a
685 - fi
686 -}
687 -
688 -src_install() {
689 - local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir)
690 -
691 - NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} )
692 -
693 - local -A paths=(
694 - [APPLICATION_PROFILE]=/usr/share/nvidia
695 - [CUDA_ICD]=/etc/OpenCL/vendors
696 - [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d
697 - [FIRMWARE]=/lib/firmware/nvidia/${PV}
698 - [GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm
699 - [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d
700 - [VULKAN_ICD_JSON]=/usr/share/vulkan
701 - [WINE_LIB]=/usr/${libdir}/nvidia/wine
702 - [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d
703 -
704 - [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions
705 - [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules
706 - [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules
707 - )
708 -
709 - local skip_files=(
710 - $(usex X '' '
711 - libGLX_nvidia libglxserver_nvidia
712 - nvidia_icd.json nvidia_layers.json')
713 - $(usex wayland '' '
714 - libnvidia-egl-gbm 15_nvidia_gbm
715 - libnvidia-vulkan-producer')
716 - libGLX_indirect # non-glvnd unused fallback
717 - libnvidia-gtk nvidia-{settings,xconfig} # built from source
718 - libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland
719 - )
720 - local skip_modules=(
721 - $(usex X '' 'nvfbc vdpau xdriver')
722 - $(usex driver '' 'gsp')
723 - installer nvpd # handled separately / built from source
724 - )
725 - local skip_types=(
726 - GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd
727 - OPENCL_WRAPPER.\* # virtual/opencl
728 - DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused
729 - )
730 -
731 - local DOCS=(
732 - README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json
733 - nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt
734 - )
735 - local HTML_DOCS=( html/. )
736 - einstalldocs
737 -
738 - local DISABLE_AUTOFORMATTING=yes
739 - local DOC_CONTENTS="\
740 -Trusted users should be in the 'video' group to use NVIDIA devices.
741 -You can add yourself by using: gpasswd -a my-user video\
742 -$(usex driver "
743 -
744 -Like all out-of-tree kernel modules, it is necessary to rebuild
745 -${PN} after upgrading or rebuilding the Linux kernel
746 -by for example running \`emerge @module-rebuild\`. Alternatively,
747 -if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}),
748 -this can be automated by setting USE=dist-kernel globally.
749 -
750 -Loaded kernel modules also must not mismatch with the installed
751 -${PN} version (excluding -r revision), meaning should
752 -ensure \`eselect kernel list\` points to the kernel that will be
753 -booted before building and preferably reboot after upgrading
754 -${PN} (the ebuild will emit a warning if mismatching).
755 -
756 -See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options." '')\
757 -$(use amd64 && usex abi_x86_32 '' "
758 -
759 -Note that without USE=abi_x86_32 on ${PN}, 32bit applications
760 -(typically using wine / steam) will not be able to use GPU acceleration.")
761 -
762 -For general information on using ${PN}, please see:
763 -https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
764 - readme.gentoo_create_doc
765 -
766 - if use driver; then
767 - linux-mod_src_install
768 -
769 - insinto /etc/modprobe.d
770 - doins "${T}"/nvidia.conf
771 -
772 - # used for gpu verification with binpkgs (not kept, see pkg_preinst)
773 - insinto /usr/share/nvidia
774 - doins supported-gpus/supported-gpus.json
775 - fi
776 -
777 - emake "${NV_ARGS[@]}" -C nvidia-modprobe install
778 - fowners :video /usr/bin/nvidia-modprobe #505092
779 - fperms 4710 /usr/bin/nvidia-modprobe
780 -
781 - if use persistenced; then
782 - emake "${NV_ARGS[@]}" -C nvidia-persistenced install
783 - newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced
784 - newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced
785 - systemd_dounit "${T}"/nvidia-persistenced.service
786 - fi
787 -
788 - if use tools; then
789 - emake "${NV_ARGS[@]}" -C nvidia-settings install
790 -
791 - doicon nvidia-settings/doc/nvidia-settings.png
792 - domenu nvidia-settings/doc/nvidia-settings.desktop
793 -
794 - exeinto /etc/X11/xinit/xinitrc.d
795 - newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings
796 - fi
797 -
798 - if use static-libs; then
799 - dolib.a nvidia-settings/src/out/libXNVCtrl.a
800 -
801 - insinto /usr/include/NVCtrl
802 - doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h
803 - fi
804 -
805 - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install
806 -
807 - # mimic nvidia-installer by reading .manifest to install files
808 - # 0:file 1:perms 2:type 3+:subtype/arguments -:module
809 - local m into
810 - while IFS=' ' read -ra m; do
811 - ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] ||
812 - eval '[[ " ${m[0]##*/}" =~ ^(\ '${skip_files[*]/%/.*|\\}' )$ ]]' ||
813 - eval '[[ " ${m[2]}" =~ ^(\ '${skip_types[*]/%/|\\}' )$ ]]' ||
814 - has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue
815 -
816 - case ${m[2]} in
817 - MANPAGE)
818 - gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert
819 - continue
820 - ;;
821 - GBM_BACKEND_LIB_SYMLINK) m[4]=../${m[4]};; # missing ../
822 - VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/
823 - esac
824 -
825 - if [[ -v paths[${m[2]}] ]]; then
826 - into=${paths[${m[2]}]}
827 - elif [[ ${m[2]} =~ _BINARY$ ]]; then
828 - into=/opt/bin
829 - elif [[ ${m[3]} == COMPAT32 ]]; then
830 - use abi_x86_32 || continue
831 - into=/usr/${libdir32}
832 - elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then
833 - into=/usr/${libdir}
834 - else
835 - die "No known installation path for ${m[0]}"
836 - fi
837 - [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/}
838 - [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/}
839 -
840 - if [[ ${m[2]} =~ _SYMLINK$ ]]; then
841 - [[ ${m[4]: -1} == / ]] && m[4]=${m[5]}
842 - dosym ${m[4]} ${into}/${m[0]}
843 - continue
844 - fi
845 - [[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] &&
846 - dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest
847 -
848 - printf -v m[1] %o $((m[1] | 0200)) # 444->644
849 - insopts -m${m[1]}
850 - insinto ${into}
851 - doins ${m[0]}
852 - done < .manifest || die
853 -
854 - # MODULE:installer non-skipped extras
855 - exeinto /lib/systemd/system-sleep
856 - doexe systemd/system-sleep/nvidia
857 - dobin systemd/nvidia-sleep.sh
858 - systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service
859 -
860 - dobin nvidia-bug-report.sh
861 -}
862 -
863 -pkg_preinst() {
864 - has_version "${CATEGORY}/${PN}[abi_x86_32]" && NV_HAD_ABI32=
865 - has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND=
866 -
867 - use driver || return
868 - linux-mod_pkg_preinst
869 -
870 - # set video group id based on live system (bug #491414)
871 - local g=$(getent group video | cut -d: -f3)
872 - [[ ${g} ]] || die "Failed to determine video group id"
873 - sed -i "s/@VIDEOGID@/${g}/" "${ED}"/etc/modprobe.d/nvidia.conf || die
874 -
875 - # try to find driver mismatches using temporary supported-gpus.json
876 - for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do
877 - g=$(grep -io "\"devid\":\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \
878 - "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null)
879 - if [[ ${g} ]]; then
880 - g=$((${g##*\"}+1))
881 - if ver_test -ge ${g}; then
882 - NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}"
883 - break
884 - fi
885 - fi
886 - done
887 - rm "${ED}"/usr/share/nvidia/supported-gpus.json || die
888 -}
889 -
890 -pkg_postinst() {
891 - use driver && linux-mod_pkg_postinst
892 -
893 - readme.gentoo_print_elog
894 -
895 - if [[ -r /proc/driver/nvidia/version &&
896 - $(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then
897 - ewarn "Currently loaded NVIDIA modules do not match the newly installed"
898 - ewarn "libraries and may prevent launching GPU-accelerated applications."
899 - use driver && ewarn "The easiest way to fix this is usually to reboot."
900 - fi
901 -
902 - if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then
903 - ewarn "Detected that the current kernel command line is using 'slub_debug=',"
904 - ewarn "this may lead to system instability/freezes with this version of"
905 - ewarn "${PN}. Bug: https://bugs.gentoo.org/796329"
906 - fi
907 -
908 - if [[ -v NV_LEGACY_MASK ]]; then
909 - ewarn
910 - ewarn "***WARNING***"
911 - ewarn
912 - ewarn "You are installing a version of ${PN} known not to work"
913 - ewarn "with a GPU of the current system. If unwanted, add the mask:"
914 - if [[ -d ${EROOT}/etc/portage/package.mask ]]; then
915 - ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}"
916 - else
917 - ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask"
918 - fi
919 - ewarn "...then downgrade to a legacy branch if possible. For details, see:"
920 - ewarn "https://www.nvidia.com/object/IO_32667.html"
921 - fi
922 -
923 - if use !abi_x86_32 && [[ -v NV_HAD_ABI32 ]]; then
924 - elog
925 - elog "USE=abi_x86_32 is disabled, 32bit applications will not be able to"
926 - elog "use nvidia-drivers for acceleration without it (e.g. commonly used"
927 - elog "with app-emulation/wine-* or steam). Re-enable if needed."
928 - fi
929 -
930 - if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then
931 - elog
932 - elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
933 - elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered"
934 - elog "experimental but is required for wayland."
935 - elog
936 - elog "If you experience issues, either disable wayland or edit nvidia.conf."
937 - elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
938 - fi
939 -}