diff options
author | Ionen Wolkens <sudinave@gmail.com> | 2021-03-21 16:52:13 +0100 |
---|---|---|
committer | David Seifert <soap@gentoo.org> | 2021-03-21 16:52:13 +0100 |
commit | 1c9748e1bfa1bbe3c3147630d351a01bb267e318 (patch) | |
tree | a6c5838d7a3c1f3720e08f3b848c7e469e159abe /x11-drivers | |
parent | x11-drivers/nvidia-drivers: bump to 460.67 with refactored ebuild (diff) | |
download | gentoo-1c9748e1bfa1bbe3c3147630d351a01bb267e318.tar.gz gentoo-1c9748e1bfa1bbe3c3147630d351a01bb267e318.tar.bz2 gentoo-1c9748e1bfa1bbe3c3147630d351a01bb267e318.zip |
x11-drivers/nvidia-drivers: revbump to sync 450.102.04 with 460.67
Identical to 460.67 except few different paths and no 5.11 support.
Signed-off-by: Ionen Wolkens <sudinave@gmail.com>
Signed-off-by: David Seifert <soap@gentoo.org>
Diffstat (limited to 'x11-drivers')
-rw-r--r-- | x11-drivers/nvidia-drivers/Manifest | 6 | ||||
-rw-r--r-- | x11-drivers/nvidia-drivers/nvidia-drivers-450.102.04-r1.ebuild | 391 |
2 files changed, 397 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index a85b7fa514e7..42a3a7005c19 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -1,3 +1,4 @@ +DIST NVIDIA-Linux-aarch64-450.102.04.run 80469462 BLAKE2B dcabed08bdd2c4c328794238e175e96831ceb0ff683c7727a1873b5aaf07612f997d47c915ef7d3c5dcfcd1d40e75f9a51a83fb28eb84d4200e7e5bc41245d9f SHA512 6b0fcdbe8a0ef3a86357bcd7a48d38c2bb65d9608bfbde0fa270b7cec198acaf9b60d458406fc7c841c75c98089644e8dcfb87bd9d0d3c45bc77ec3c936d9371 DIST NVIDIA-Linux-aarch64-460.67.run 112551235 BLAKE2B cc1166454f6e8771c7fe97010906919e9f2afd74ac86321006628f90f4d8dee033c3e09b2d9cac9063fe3fd313c0b529b347bcf38c051588ca7a972617c45026 SHA512 6ba17844dd215967f2f55a6620535464f244075a13f4b2b6d0ffaeeb6d97397fae0ba0de032d971847556d7b78ac8a1010ecec5127f45eb7ec73db87b1507ca1 DIST NVIDIA-Linux-x86-390.141.run 49589744 BLAKE2B 304672806b89885adbf8459ea99ca872769e44a42ff041a5b79ef05d113d7717f505f543441e7a2fc6c569f6d66391f0380a4f23f3e68108c8de817bf251f850 SHA512 6dfde3b54520070954b45f6bc071251084e1741f55e582b1abd806eb367e4b9ce0015615bf6a887fa784d075b3db08b6940da4163b960969773d1bdc52b4961e DIST NVIDIA-Linux-x86_64-390.141.run 85330901 BLAKE2B 7759d8cf6c9a75607b9a3ecd53cdd6f6a93f2f372d740a5a87d4d3f41a22f3bd953cc7dd6a0dc0e23a829ec86df8d65b9de499a76cfd4266a13b0aa3288aceb5 SHA512 5448d70e6e64a6403e61a004d83c69a442dd8ed0d61da3a31d3e3b7943c06c559a66b0f8d135982868ecbf209a965f60dae1a633367630b4d9287f725bbaa53c @@ -5,12 +6,17 @@ DIST NVIDIA-Linux-x86_64-450.102.04.run 141391114 BLAKE2B 019f928464b23d2a86bfdd DIST NVIDIA-Linux-x86_64-460.39.run 178310565 BLAKE2B 65931f34ff47de02933797f60128c66c8774f3b217b79e82f781cd50560835ec79c37b7e63fb50231a22646f0cd7cf968d1fbe1ec6c2b3732a1c565b68de7bcb SHA512 9275a58ff0e72c3ee033bd18fa9e9dbb0203d2961a63e7cc04444889118eb4029c60bb10c2af8f230c1aa4aa30769131ea8c01f3bc4e7453336ad9c03ba23b42 DIST NVIDIA-Linux-x86_64-460.56.run 178496173 BLAKE2B 8f84a403ccaa9a92186cac9fb2dee9600cd29915cdacf475b6a1105772ffd52c671ef217a1201fbcd9192e858ec17796fd77b817887c79c43c266d32671fe7d0 SHA512 a61855576a27cdd2e48906ecb49cd1e9f88d14a8358aa4bdc57d59e2dfa64b394b2dcee45184d75e889fac6ebedcaaff902a07428c7f9eb011cf265228c6eb4e DIST NVIDIA-Linux-x86_64-460.67.run 177691692 BLAKE2B 25a7d87cc128933a98100d7c5ef37f93c3a870c096eea3228a28ef79d712ce104608f9422221cc1eadc21dccbbc8bc41ab1832795cfee75e217600ed0d76489e SHA512 80fdc023a8ce80e3a103896f28a5564bb43903af6bfc719f755c48eb225e79ec6abf219ab20eb80ada5808ef932ef5fa0fe710c6e0a07dd8a248daff2ba3b898 +DIST nvidia-installer-450.102.04.tar.gz 197642 BLAKE2B 5d94dee76057eaea236090e2eb8cba4fdf90f4959a0ae26805bc771262a0eb05640846c191f2a5a5485e0584ae07ba64d2989201118594df747c3ac13503f90d SHA512 2c1608c0dd971122978a395edc5a51de6cb76d72aac45b4f9303e1a99e292ec0ddd9c03f2e95b10c357c0da1dc2824197c2553828eedbd0c4434b431aa593f6f DIST nvidia-installer-460.67.tar.gz 198484 BLAKE2B 0eaf3e3eccd6749e4fe89394905dded58e739f42cbc33c8a91575f4505030a216670fc8c0fd4d1d42659acf301c9ba59d4052a80c6eba6c5db84ed022acb2620 SHA512 8fff0fa13a82cb7eaf2fd1d05be509e9124e67bb05810f8937fb1f16c4a2362a5c1a50bc9a5155cfc90a9bbcee38a54fb5ae0ae164e205900a49f6d21779d54f +DIST nvidia-modprobe-450.102.04.tar.gz 42139 BLAKE2B 79218a4e76dacdafadd31e45a27d3578924db6a74894064ce856498121fbf9d80e7b07046dfc36426340e0cefd78b416b017202bc93858fdf8cc77ba335bbaf8 SHA512 ac9d8d8849606d7ef3772570c976e5efab36f66e83a62f959b28c88cd798bba860052033dc5eb18c0f9e4a6f2d8e6082456d9b1586977a23f240cfa3a750d7ef DIST nvidia-modprobe-460.67.tar.gz 43140 BLAKE2B 8243d355f9d51495c9d09f25ccbcb39c0a6ef472cbfaded98f10818fae655e1cf62ff2edcf40baea72b8cca9eebc947742b2516bb057410239193201bb843538 SHA512 16c8239b54988622196e0eea113173e44ff8b60cdcdf585bf859e6440aff2c6699bb107962776e69056dd7d5e3bbd6289ea628a2255ac27e22ef79521e9baad3 +DIST nvidia-persistenced-450.102.04.tar.gz 52485 BLAKE2B 1fec24c86875789303aee8bf4362c9c35f76957a2906e2682aa5c07e914cc2acde769439d88007420904a71526e9f0d03ab9d0a3c5dcd1355047e03958d006f9 SHA512 6c51daaed3e7ecdb8d98bdcf0618e50962895895f88cc45a5f861c08d3c10f590d4a6a3f0a683ce0dce0e327d5977da1a76fdde974a97031dc698120ef990b07 DIST nvidia-persistenced-460.67.tar.gz 53334 BLAKE2B 1354ec98fd2b95d264fd7df6219f639cf5d73173e6f0843a0880e6b18953904412cb756bd2c60432f6ae4c253d047515a9e32a128210fd94386ae6bc9a341b5c SHA512 0b4f7d8aa781c3536f6cd020225d2a3bab4b83498090419198488a2bec811534e61ba90461ae846bd09f4530f19984d77ca41edf0a851b1b700d1c0e053d537f DIST nvidia-settings-390.141.tar.bz2 1108755 BLAKE2B 210c33d4bb483dd9abe13275feb641a00d7c39a7222cbe828c925b9cfca6d4422f8fa3333dd77b73f2ba4071a7badf77625be88e02a1835177bda490c3c3c368 SHA512 44bf5f6b5bfbe3146f97d9ac82a75cc5653b6002002623ac6fa6cd233bbd3ef0d15f0b8091b59de5dbfdbde4fbe1b5212c9f9a1653ec98597c9049c9b137902e DIST nvidia-settings-450.102.04.tar.bz2 1057126 BLAKE2B 4e27ac75441d455122860b3834f2584e4736fff1f641e9a1d3ced4a354cb0e0e35c4e7a71e7bc05940d585e0ceca576f726fdfffbb84aae8057d06355b91293f SHA512 33f27b9a2832f7f24603d3a741b6c34cdd3f27a7075b523f8b98ae89325f810e13c134fcc7503e72d44a6f6c7a0d8587bfdad898a4ab5fa252bd9c7360a32341 +DIST nvidia-settings-450.102.04.tar.gz 1229675 BLAKE2B 166b73a0e9fe1cc1c16f83128aa94f3b9ef44fc71004e80c2681299dd564df6b458b52bedfd60eaaecf6142d0ea7d5147cb9c509d4db4e6b85bc72dd4dc75751 SHA512 c514bb3cc72954a52f4821674f9b783ebc0bd8c7294a296716619ddad15f2b63f50ada47797dee1386709deb7d407cb1d6c04532b7ca6e03d84234555751c9a9 DIST nvidia-settings-460.39.tar.bz2 1060391 BLAKE2B badfe9e5fa3ca7f5389369b01f839aa37b687e99bac47663b320602ada4d4e8dfb7c6fa4f64cee358a25ced7d9393ddfa4242147d9b645ae4fbd1b68310f3363 SHA512 a5f01d2a627695932399804776923a90050ec66b19c9d95ed34d11fc79e41604fe25474ed7b7bfec68b2115dd6fccb444b66427ce78c1d67b1b01f072bc8892a DIST nvidia-settings-460.56.tar.bz2 1060604 BLAKE2B cd1480e42ab2b25b399f19b458a1d5252d1b77d263ddecbad2d61f0445ba9f0ddf81fc944ac1136c273dfd1d21d06385bcfac9bdd7a7dc02f75302a6b8276df4 SHA512 018eb3cb7f25b926aa620201979b0efaaa82e7f036c4870a1e1234f5aac3ab9cfd48846d7eedd7ed38c3035eface3f2afe1a0d5de7a67e53e6bea760aa99fa72 DIST nvidia-settings-460.67.tar.gz 1233189 BLAKE2B 33ffceefea4e184cb1873cdce97db26637e87cd20c82bcabcbfe88bcb084ac3d833ac5688cafa33a5a89383040d5c1c5d46de9c3f9a8ba6174574aa57aea2e46 SHA512 d1828379aa477394747ae3e5d3505e864d38a349dd159a04cb263613380afea9aea2081300b0d2b8ae205b800bfe6e8ba504e612989da394d757f00e4399b617 +DIST nvidia-xconfig-450.102.04.tar.gz 141072 BLAKE2B 0d299429ccb10f351de0e7b81fa7ce8199da83db346483a7d791fd77276ff6d70b46ba153cdf6503b945d80f4a0108a6ec02a3955c9d7310de901f0e3b1e6e36 SHA512 f5752d7c49d1cb3c0061caace8cf5899c8d61e76f0b7080e05d70cd77758496dd8646a1551d93a12c8ad5f9fcfd53a49c51206af96f36ec1eec7ccfe59505f2d DIST nvidia-xconfig-460.67.tar.gz 142323 BLAKE2B 09c7281de09a2c2968b5f4a48eca63110e6db988429c844b55f8efc28fbcd9d44c79ad47149c25f657c2a98ae7576c01b2c9b7f643b8321fe1393adc571ebcaa SHA512 0e65c81ec40d3eaeec036fbd8f46a3052a75ff0ad200c58438ff6c782a5764e62e51d03b4a2080770c32522894641288ac495f62bc39c3d5658b1ff87c9f6cdd diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-450.102.04-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-450.102.04-r1.ebuild new file mode 100644 index 000000000000..c48fc1a10ba1 --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-450.102.04-r1.ebuild @@ -0,0 +1,391 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +MODULES_OPTIONAL_USE="driver" +inherit desktop linux-info linux-mod multilib-build \ + optfeature systemd toolchain-funcs unpacker + +NV_KERNEL_MAX="5.10" +NV_BIN_URI="https://download.nvidia.com/XFree86/Linux-" +NV_GIT_URI="https://github.com/NVIDIA/nvidia-" + +DESCRIPTION="NVIDIA Accelerated Graphics Driver" +HOMEPAGE="https://www.nvidia.com/download/index.aspx" +SRC_URI=" + amd64? ( ${NV_BIN_URI}x86_64/${PV}/NVIDIA-Linux-x86_64-${PV}.run ) + arm64? ( ${NV_BIN_URI}aarch64/${PV}/NVIDIA-Linux-aarch64-${PV}.run ) + ${NV_GIT_URI}installer/archive/${PV}.tar.gz -> nvidia-installer-${PV}.tar.gz + ${NV_GIT_URI}modprobe/archive/${PV}.tar.gz -> nvidia-modprobe-${PV}.tar.gz + ${NV_GIT_URI}persistenced/archive/${PV}.tar.gz -> nvidia-persistenced-${PV}.tar.gz + ${NV_GIT_URI}settings/archive/${PV}.tar.gz -> nvidia-settings-${PV}.tar.gz + ${NV_GIT_URI}xconfig/archive/${PV}.tar.gz -> nvidia-xconfig-${PV}.tar.gz" +# nvidia-installer is unused but here for GPL-2's "distribute sources" +S="${WORKDIR}" + +LICENSE="GPL-2 MIT NVIDIA-r2 ZLIB" +SLOT="0/${PV%%.*}" +KEYWORDS="-* ~amd64" +IUSE="+X +driver static-libs +tools" + +COMMON_DEPEND=" + acct-group/video + acct-user/nvpd + net-libs/libtirpc + tools? ( + dev-libs/atk + dev-libs/glib:2 + dev-libs/jansson + x11-libs/cairo + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3 + x11-libs/libX11 + x11-libs/libXext + x11-libs/libXxf86vm + x11-libs/pango + )" +RDEPEND=" + ${COMMON_DEPEND} + X? ( + media-libs/libglvnd[X,${MULTILIB_USEDEP}] + x11-libs/libX11[${MULTILIB_USEDEP}] + x11-libs/libXext[${MULTILIB_USEDEP}] + )" +DEPEND=" + ${COMMON_DEPEND} + static-libs? ( + x11-libs/libX11 + x11-libs/libXext + ) + tools? ( + media-libs/libglvnd + sys-apps/dbus + x11-base/xorg-proto + x11-libs/libXrandr + x11-libs/libXv + x11-libs/libvdpau + )" +BDEPEND=" + app-misc/pax-utils + virtual/pkgconfig" + +QA_PREBUILT="opt/* usr/lib*" + +CONFIG_CHECK=" + ~DRM_KMS_HELPER + ~SYSVIPC + ~!AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT + ~!LOCKDEP + !DEBUG_MUTEXES" +ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection + of drivers (no custom config), and optional nvidia-drm.modeset=1. + Cannot be directly selected in the kernel's menuconfig, so enable + options such as CONFIG_DRM_FBDEV_EMULATION instead." + +PATCHES=( + "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch +) +DOCS=( + README.txt NVIDIA_Changelog supported-gpus.json + nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt +) +HTML_DOCS=( html/. ) + +pkg_setup() { + use driver || return + BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KERNEL_DIR}"' + BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules + MODULE_NAMES=" + nvidia(video:kernel) + nvidia-drm(video:kernel) + nvidia-modeset(video:kernel) + nvidia-uvm(video:kernel)" + linux-mod_pkg_setup + + if [[ ${MERGE_TYPE} != binary ]] && kernel_is gt ${NV_KERNEL_MAX/./ }; then + ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of nvidia-drivers" + ewarn "or was not tested with it. It is recommended to use one of:" + ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}" + ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}" + ewarn "You are free to try or use /etc/portage/patches, but support will" + ewarn "not be given and issues wait until NVIDIA releases a fixed version." + ewarn + ewarn "Do _not_ file a bug report if run into issues." + ewarn + fi +} + +src_prepare() { + # make user patches usable across versions + rm nvidia-modprobe && mv nvidia-modprobe{-${PV},} || die + rm nvidia-persistenced && mv nvidia-persistenced{-${PV},} || die + rm nvidia-settings && mv nvidia-settings{-${PV},} || die + rm nvidia-xconfig && mv nvidia-xconfig{-${PV},} || die + + default + + # prevent detection of incomplete kernel DRM support (bug #603818) + sed 's/defined(CONFIG_DRM)/defined(CONFIG_DRM_KMS_HELPER)/' \ + -i kernel/conftest.sh || die + + sed -e '/Exec=\|Icon=/s/_.*/nvidia-settings/' \ + -e '/Categories=/s/_.*/System;Settings;/' \ + -i nvidia-settings/doc/nvidia-settings.desktop || die + + # remove gtk2 support (bug #592730) + sed '/^GTK2LIB = /d;/INSTALL.*GTK2LIB/,+1d' \ + -i nvidia-settings/src/Makefile || die + + sed 's/__USER__/nvpd/' \ + nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \ + > nvidia-persistenced.service || die + + gzip -d nvidia-{cuda-mps-control,smi}.1.gz || die +} + +nvidia-drivers_make() { + emake -C nvidia-${1} ${2} \ + DESTDIR="${ED}" PREFIX=/usr LIBDIR="${ED}/usr/$(get_libdir)" \ + HOST_CC="$(tc-getBUILD_CC)" HOST_LD="$(tc-getBUILD_LD)" \ + DO_STRIP= MANPAGE_GZIP= \ + NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 OUTPUTDIR=out +} + +src_compile() { + tc-export AR CC LD OBJCOPY + # may no longer be relevant but kept as a safety + export DISTCC_DISABLE=1 CCACHE_DISABLE=1 + + use driver && linux-mod_src_compile + + nvidia-drivers_make modprobe + nvidia-drivers_make persistenced + use X && nvidia-drivers_make xconfig + + if use tools; then + nvidia-drivers_make settings + elif use static-libs; then + nvidia-drivers_make settings/src out/libXNVCtrl.a + fi +} + +nvidia-drivers_libs_install() { + local libs=( + EGL_nvidia + GLESv1_CM_nvidia + GLESv2_nvidia + cuda + nvcuvid + nvidia-allocator + nvidia-eglcore + nvidia-encode + nvidia-glcore + nvidia-glsi + nvidia-glvkspirv + nvidia-ml + nvidia-opencl + nvidia-opticalflow + nvidia-ptxjitcompiler + nvidia-tls + ) + use amd64 && libs+=( nvidia-compiler ) + + if use X; then + libs+=( + GLX_nvidia + vdpau_nvidia + ) + if use amd64; then + libs+=( + nvidia-fbc + nvidia-ifr + ) + fi + fi + + local libdir=. + if multilib_is_native_abi; then + libs+=( + nvidia-cbl + nvidia-cfg + nvidia-rtcore + nvoptix + ) + use amd64 && libs+=( nvidia-ngx ) + else + libdir+=/32 + fi + + local lib soname + for lib in "${libs[@]}"; do + [[ ${lib:0:3} != lib ]] && lib=lib${lib}.so.${PV} + + # auto-detect soname and create appropriate symlinks + soname=$(scanelf -qF'%S#F' "${lib}") || die "Scanning ${lib} failed" + if [[ ${soname} && ${soname} != ${lib} ]]; then + ln -s ${lib} ${libdir}/${soname} || die + fi + ln -s ${lib} ${libdir}/${lib%.so*}.so || die + + dolib.so ${libdir}/${lib%.so*}* + done +} + +src_install() { + if use driver; then + linux-mod_src_install + + insinto /etc/modprobe.d + newins "${FILESDIR}"/nvidia-430.conf nvidia.conf + doins "${FILESDIR}"/nvidia-blacklist-nouveau.conf + doins "${FILESDIR}"/nvidia-rmmod.conf + + # used for gpu verification with binpkgs (not kept) + insinto /usr/share/nvidia + doins supported-gpus.json + fi + + if use X; then + exeinto /usr/$(get_libdir)/xorg/modules/drivers + doexe nvidia_drv.so + + exeinto /usr/$(get_libdir)/xorg/modules/extensions + newexe libglxserver_nvidia.so{.${PV},} + + insinto /usr/share/X11/xorg.conf.d + newins {,50-}nvidia-drm-outputclass.conf + + # vulkan icd uses libGLX_nvidia.so and so requires X + insinto /usr/share/vulkan/icd.d + doins nvidia_icd.json + insinto /usr/share/vulkan/implicit_layer.d + doins nvidia_layers.json + fi + + insinto /usr/share/glvnd/egl_vendor.d + doins 10_nvidia.json + + insinto /etc/OpenCL/vendors + doins nvidia.icd + + insinto /etc/nvidia + newins nvidia-application-profiles{-${PV},}-rc + + # install built helpers + nvidia-drivers_make modprobe install + # allow video group to load mods and create devs (bug #505092) + fowners root:video /usr/bin/nvidia-modprobe + fperms 4710 /usr/bin/nvidia-modprobe + + nvidia-drivers_make persistenced install + newconfd "${FILESDIR}/nvidia-persistenced.confd" nvidia-persistenced + newinitd "${FILESDIR}/nvidia-persistenced.initd" nvidia-persistenced + systemd_dounit nvidia-persistenced.service + + use X && nvidia-drivers_make xconfig install + + if use tools; then + nvidia-drivers_make settings install + doicon nvidia-settings/doc/nvidia-settings.png + domenu nvidia-settings/doc/nvidia-settings.desktop + + insinto /usr/share/nvidia + newins nvidia-application-profiles{-${PV},}-key-documentation + + exeinto /etc/X11/xinit/xinitrc.d + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings + fi + + if use static-libs; then + dolib.a nvidia-settings/src/out/libXNVCtrl.a + + insinto /usr/include/NVCtrl + doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h + fi + + # install prebuilt-only helpers + exeinto /opt/bin + + doexe nvidia-cuda-mps-control + doman nvidia-cuda-mps-control.1 + doexe nvidia-cuda-mps-server + + doexe nvidia-debugdump + dobin nvidia-bug-report.sh + + doexe nvidia-smi + doman nvidia-smi.1 + + # install prebuilt-only libraries + multilib_foreach_abi nvidia-drivers_libs_install + + exeinto /lib/systemd/system-sleep + doexe nvidia + dobin nvidia-sleep.sh + systemd_dounit *.service + + einstalldocs +} + +pkg_preinst() { + use driver || return + linux-mod_pkg_preinst + + # set video group id based on live system (bug #491414) + local g=$(getent group video | cut -d: -f3) + [[ ${g} ]] || die "Failed to determine video group id" + sed "s/PACKAGE/${PF}/;s/VIDEOGID/${g}/" \ + -i "${ED}"/etc/modprobe.d/nvidia.conf || die + + # try to find driver mismatches using temporary supported-gpus.json + for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do + g=$(grep -io "\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \ + "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null) + if [[ ${g} ]]; then + g=$((${g##*\"}+1)) + if ver_test -ge ${g}; then + NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}" + break + fi + fi + done + rm "${ED}"/usr/share/nvidia/supported-gpus.json || die +} + +pkg_postinst() { + use driver && linux-mod_pkg_postinst + + optfeature "wayland EGLStream with nvidia-drm.modeset=1" gui-libs/egl-wayland + + if [[ -r /proc/driver/nvidia/version && + $(grep -o ' [0-9.]* ' /proc/driver/nvidia/version) != " ${PV} " ]]; then + ewarn "Currently loaded NVIDIA modules do not match the newly installed" + ewarn "libraries and will lead to GPU-using application issues." + use driver && ewarn "The easiest way to fix this is to reboot." + fi + + if [[ ${NV_LEGACY_MASK} ]]; then + ewarn "***** WARNING *****" + ewarn "You are installing a version of nvidia-drivers known not to work" + ewarn "with a GPU of the current system. If unwanted, add the mask:" + if [[ -d ${EROOT}/etc/portage/package.mask ]]; then + ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}" + else + ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask" + fi + ewarn "...then downgrade to a legacy branch if possible. For details, see:" + ewarn "https://www.nvidia.com/object/IO_32667.html" + fi + + if ! [[ ${REPLACING_VERSIONS} && $(getent group video | cut -d: -f4) ]]; then + elog "***** WARNING *****" + elog "Users should be in the 'video' group to use NVIDIA devices." + elog "You can add yourself by using: gpasswd -a myuser video" + fi + + if [[ ! ${REPLACING_VERSIONS} ]]; then + elog "For general information with using NVIDIA on Gentoo, please see:" + elog "https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" + fi +} |