summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <sudinave@gmail.com>2021-03-21 16:52:16 +0100
committerDavid Seifert <soap@gentoo.org>2021-03-21 16:52:16 +0100
commitad0532525ca174d7ee972e6435488b1d21845d39 (patch)
treef81d70e117bd16967062f5018d90c4178da35e49 /x11-drivers
parentx11-drivers/nvidia-drivers: revbump to sync 450.102.04 with 460.67 (diff)
downloadgentoo-ad0532525ca174d7ee972e6435488b1d21845d39.tar.gz
gentoo-ad0532525ca174d7ee972e6435488b1d21845d39.tar.bz2
gentoo-ad0532525ca174d7ee972e6435488b1d21845d39.zip
x11-drivers/nvidia-drivers: revbump to sync 390.141 with 460.67
Mostly same as 460.67 minus same existing 390.xx workarounds. Other than those: - Given uvm flag is gone, the x86-only uvm mask is now handled internally with an explanation to users. - nvidia-persistenced needed an extra workaround to find libtirpc - fno-common patch updated for new layout - Moved the /etc 390-specific GLX workaround to /usr/share where it replaces nvidia-drm-outputclass.conf - No supported-gpus.json so no legacy check (nor ZLIB license), but this is as far as legacy support goes on Gentoo with 340 gone. 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/Manifest5
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-settings-390.141-fno-common.patch16
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-390.141-r1.ebuild365
3 files changed, 386 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
index 42a3a7005c19..58b540cb3375 100644
--- a/x11-drivers/nvidia-drivers/Manifest
+++ b/x11-drivers/nvidia-drivers/Manifest
@@ -6,17 +6,22 @@ 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-390.141.tar.gz 205299 BLAKE2B b95ddcf9a8d61247572d73faa04558564962782b0eb222601315d741d1ee71fa0636fa87d31105ecc5ec61328d3174a3ed646046e02b6b5f29f071215a0e8bdd SHA512 3848a4ec17510bf4d3060e5ef8aafa1ad921215ec39d26c54b3bbdd8a5867c46e01d247b24b05ad6906fed7fb4ae6dc37346a7da6e5aae88b5b47584c0b07a02
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-390.141.tar.gz 39965 BLAKE2B 46c01ec3e53569454a032e42561a81154712485ffb11d0393d9e9007a3825a33c8d045ea7296dd8465ad9b2cee36a639274c55ff31c70e93d334ac9fe724f7b1 SHA512 c0abec334fee4293a55a43edbcc6a7a8cd8ff6b6fbb954b428182542a24eba90f47100977c84ea9cbe557a39fc5fb90677b4f2227f49a6f30a56f6941508f40e
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-390.141.tar.gz 55984 BLAKE2B c4e889d15643f6e8a4e37b32d89e14acaa792c681863c74281b17e414021dc56e4692e91e7552762ef8b8ef977284ee2f307b14216a2562a9d30b2ab7a1ba522 SHA512 d9ea32c842d8d13a59128b28ce985fe3a421d2848eac30fc8a671a391c63516b58c46d3c5b21403b4e5b016577d23aebaec1f5b4e59b25a20668120f52e231a5
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-390.141.tar.gz 1297261 BLAKE2B 452870df1ba598692f5da47444eb2daf4db40c79cac98c10b1c994c0ff39fc7936909b9d7788cbfe784999e68a2bdbbc12e85d63c3bc02ac872e6b3c46834697 SHA512 dbf7c389bbdc94291a1b974adfa33414148b1ab752aa7d948a27e91ee1bceb3b8435aceb6b7ef3cb806333572db11b5524667045ef7686b119d7955d2699cb04
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-390.141.tar.gz 140293 BLAKE2B 08ee93be953f75dbe078c557af7c062092ce8a3b53af0735d43b7feabe6d1c99390b9533027fbc5017d207a70dfa5aecf88d211905bf8f0e846f769a6ea16c2b SHA512 9fedee2f720d86bd24e393328249bf970a1f242b9e750543e757eb13ca30f6ecfda6c63441093ab96ae28d5f38d4e55cc6de6316eb82d2a2f33074144a1eef2f
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/files/nvidia-settings-390.141-fno-common.patch b/x11-drivers/nvidia-drivers/files/nvidia-settings-390.141-fno-common.patch
new file mode 100644
index 000000000000..499e969bf23a
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-settings-390.141-fno-common.patch
@@ -0,0 +1,16 @@
+Fix compilation with -fno-common or gcc10
+https://bugs.gentoo.org/706742
+--- a/nvidia-settings/src/gtk+-2.x/ctkvdpau.c
++++ b/nvidia-settings/src/gtk+-2.x/ctkvdpau.c
+@@ -105,2 +105,4 @@
+
++struct VDPAUDeviceImpl VDPAUDeviceFunctions;
++
+ static int queryOutputSurface(CtkVDPAU *ctk_vdpau, VdpDevice device,
+--- a/nvidia-settings/src/gtk+-2.x/ctkvdpau.h
++++ b/nvidia-settings/src/gtk+-2.x/ctkvdpau.h
+@@ -48,3 +48,3 @@
+
+-struct VDPAUDeviceImpl {
++extern struct VDPAUDeviceImpl {
+
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-390.141-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-390.141-r1.ebuild
new file mode 100644
index 000000000000..acde43fed169
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-390.141-r1.ebuild
@@ -0,0 +1,365 @@
+# 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 )
+ x86? ( ${NV_BIN_URI}x86/${PV}/NVIDIA-Linux-x86-${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"
+SLOT="0/${PV%%.*}"
+KEYWORDS="-* ~amd64 ~x86"
+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.
+ 390.xx branch: also used by a GLX workaround needed for OpenGL."
+
+PATCHES=(
+ "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
+ "${FILESDIR}"/nvidia-settings-390.141-fno-common.patch
+)
+DOCS=(
+ README.txt NVIDIA_Changelog
+ 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}"'
+ use x86 && BUILD_PARAMS+=' ARCH=i386' # needed for recognition
+ BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules
+ MODULE_NAMES="
+ nvidia(video:kernel)
+ nvidia-drm(video:kernel)
+ nvidia-modeset(video:kernel)"
+ use amd64 && MODULE_NAMES+=" nvidia-uvm(video:kernel)" # no x86 support
+ 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
+
+ sed 's/__NV_VK_ICD__/libGLX_nvidia.so.0/' \
+ nvidia_icd.json.template > nvidia_icd.json || die
+
+ sed "s/%LIBDIR%/$(get_libdir)/g" "${FILESDIR}/nvidia-390.conf" \
+ > nvidia-drm-outputclass.conf || 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
+
+ # 390.xx persistenced doesn't auto-detect libtirpc
+ LIBS=$($(tc-getPKG_CONFIG) --libs libtirpc) \
+ common_cflags=$($(tc-getPKG_CONFIG) --cflags libtirpc) \
+ nvidia-drivers_make persistenced
+
+ nvidia-drivers_make modprobe
+ use X && nvidia-drivers_make xconfig
+
+ if use tools; then
+ nvidia-drivers_make settings
+ elif use static-libs; then
+ nvidia-drivers_make settings/src build-xnvctrl
+ fi
+}
+
+nvidia-drivers_libs_install() {
+ local libs=(
+ EGL_nvidia
+ GLESv1_CM_nvidia
+ GLESv2_nvidia
+ cuda
+ nvcuvid
+ nvidia-compiler
+ nvidia-eglcore
+ nvidia-encode
+ nvidia-fatbinaryloader
+ nvidia-glcore
+ nvidia-glsi
+ nvidia-ml
+ nvidia-opencl
+ nvidia-ptxjitcompiler
+ nvidia-tls
+ )
+
+ if use X; then
+ libs+=(
+ GLX_nvidia
+ nvidia-fbc
+ nvidia-ifr
+ vdpau_nvidia
+ )
+ fi
+
+ local libdir=.
+ if multilib_is_native_abi; then
+ libs+=(
+ nvidia-cfg
+ nvidia-wfb
+ )
+ 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-169.07 nvidia.conf
+ doins "${FILESDIR}"/nvidia-blacklist-nouveau.conf
+ doins "${FILESDIR}"/nvidia-rmmod.conf
+ fi
+
+ if use X; then
+ exeinto /usr/$(get_libdir)/xorg/modules/drivers
+ doexe nvidia_drv.so
+
+ # 390 has legacy glx needing a modified .conf (bug #713546)
+ exeinto /usr/$(get_libdir)/extensions/nvidia
+ newexe libglx.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
+ 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/libXNVCtrl/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
+ mv tls/* . || die # alternate tls lib needed for libglx.so
+ multilib_foreach_abi nvidia-drivers_libs_install
+
+ 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
+}
+
+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 ! [[ ${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
+ if use x86; then
+ elog "Note that NVIDIA is no longer offering support for the unified memory"
+ elog "module (nvidia-uvm) on x86 (32bit), as such the module was not built."
+ elog "This means OpenCL/CUDA (and related, like nvenc) cannot be used."
+ elog "Other functions, like OpenGL, will continue to work."
+ elog
+ fi
+ elog "For general information with using NVIDIA on Gentoo, please see:"
+ elog "https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers"
+ fi
+}