From dd5b71d2ad69f1887985ee1ca67b254e04157f73 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 23 Mar 2023 06:44:33 +0000 Subject: gentoo auto-resync : 23:03:2023 - 06:44:33 --- x11-drivers/nvidia-drivers/Manifest | 6 +- .../nvidia-drivers/nvidia-drivers-525.47.14.ebuild | 632 --------------------- .../nvidia-drivers/nvidia-drivers-525.47.15.ebuild | 632 +++++++++++++++++++++ 3 files changed, 635 insertions(+), 635 deletions(-) delete mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-525.47.14.ebuild create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-525.47.15.ebuild (limited to 'x11-drivers/nvidia-drivers') diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index c1f3c2c28f72..fcfb9ef27b58 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -24,7 +24,7 @@ DIST NVIDIA-Linux-x86_64-390.157.run 85835541 BLAKE2B 44b855cd11f3b2f231f9fb9049 DIST NVIDIA-Linux-x86_64-470.161.03.run 272397700 BLAKE2B eaa94b7398b3aaadf30c33c95c95b167094ca56114e2e3032978b0959264ac8b8663181485eb1af0282a59b43f912c0ecd48e5eadcb06b6fda601b357ac49bc7 SHA512 26b1640f9427847b68233ffacf5c4a07e75ed9923429dfc9e5de3d7e5c1f109dfaf0fe0a0639cbd47f056784ed3e00e2e741d5c84532df79590a0c9ffa5ba625 DIST NVIDIA-Linux-x86_64-510.108.03.run 329603898 BLAKE2B ec7327628cc0d5929f91fa7dcf09d741341b15a509169d8de187f66a99a9196077362bd9a370ba5e294fd644a3aee1bd3abfc45f20c9cb5b05660d299c9e0479 SHA512 70fbd91b0dc5db119acf20654854c417bb14889e84145e2675dc893e7247a9c34f90820cddb8202cf5c3219abc286c7014b247a2ce94bdb5681a1bca96f41a29 DIST NVIDIA-Linux-x86_64-515.86.01.run 363743089 BLAKE2B aa03a0f059da99fa549cd9d672cef0194f2b22b349470d80ce626b3f4afb89b1f130b451735f92f5a66dfec02735bd6395053be609668371991837e3be4026cb SHA512 9a31e14afc017e847f1208577f597c490adb63c256d6dff1a9eae56b65cf85374a604516b0be9da7a43e9af93b3c5aec47b2ffefd6b4050a4b7e55f348cf4e7b -DIST NVIDIA-Linux-x86_64-525.47.14.run 414545151 BLAKE2B 8e3324d3a10f9008e561c4955cc0809134cca3c24be13db5193f052e5442e477275c87b49e823500ac7d54745560997e4ccd89dd94fb560910d399fd664aa02d SHA512 9d6740e0edf08f8641e4a3d72f2fbd2348629c5c7a449a8451145f04676abc2e0695250589d552413f714b17e74f5ad53f3f016b12c8c46344346891406401d6 +DIST NVIDIA-Linux-x86_64-525.47.15.run 414194155 BLAKE2B df2cf08bd81d19b0215b378be2e7c2dd14a4e415988baf284008acd2648ce43c4ae73627e761921a26e205547025fe9166b6192c02c4d6b00646ef51c6af9acc SHA512 09684294561c0796cfe1bb027388af342a009af33b00901869b4b1c4399583611e2843c45fb436a901095c53844a45b5a4a5642bd3abd019e4f00d6e3395b692 DIST NVIDIA-Linux-x86_64-525.85.05.run 415131239 BLAKE2B 38bdcce884011cfc0a1b5d08807c0a163ac7807621f3ec69feabbdf27af9e0409491db893912776b05a45f8f56c06f281a84074ab8ff21a71774b890bdff2cf8 SHA512 db30b9186cdcf22b2dde267c08a10cadfc3d37190c57a26a71e282b0f661b187b5b28764418eacf8b2344ebfa8feb7480ae1de31b3bc3026feaf9482a3b51741 DIST NVIDIA-Linux-x86_64-525.89.02.run 414116295 BLAKE2B 22a6da77876557c256cb5571b6ae78133bc150ceb16aaf331a332bdd891df40beac07ac70efedb11ec2458fcdf2a23247b54274d509a2b54e50f4da1251425e7 SHA512 a991c5a843957aa81cf619c39d699100ff69fc723fb195c68fd50cd69ee9d5651a223d3b5d254c8c1b7c8cad09e24846ba4e64869a8b3777e85cd3e5ba515bb5 DIST NVIDIA-Linux-x86_64-530.30.02.run 344142236 BLAKE2B 68a7bc7baf8f09fa827c9e370e70a2c00d083554d4926eec523923815b71722c28c990cfb9b689e4cd5ed990de42f884e66a57a30f6ad87fe4cd3654c2fa2c9c SHA512 62a497a3f1b2f32692f756113a34caaf193f4d4d2488e02b832c9ebb8ef1a8c72722ae29b044068fac8c7edc25376ebb50cfc26e28ca9a74f37895138260de22 @@ -67,12 +67,12 @@ DIST nvidia-xconfig-515.86.01.tar.bz2 109747 BLAKE2B d6253f9d052be5aaa1a2be82bf4 DIST nvidia-xconfig-525.85.05.tar.bz2 110595 BLAKE2B 249263ad84c72c5682836bc3717774b95238197319a88b35adb9174e6023c385c49bf95ed1bf89a6d4fef0ba445a9802e437324358bddbe999f61849ea68afc0 SHA512 b2cad5f509e817e1e9f43bfce279a512d5899dbbb3dae212161b1ce7237ac3598e335779fbb7abb8b77327827838d7d310522f0b0a014498cff26f4ed5824841 DIST nvidia-xconfig-525.89.02.tar.bz2 111065 BLAKE2B 762354ad413253389ca8f57fbfcc483a0b26026420f24f0b72af03716b4226e7a97d95a0e0a88e161200dac5d2257792ab0ae8b581436c3b92c733cf75a80a21 SHA512 a90df9a051472962aa7423fab3bcf6dbaab4669a223181da41922ec65c5c78927c68fef43c8031685439f037bae9d4553d7b388878109d45c8bdd5004cbf954f DIST nvidia-xconfig-530.30.02.tar.bz2 110940 BLAKE2B 28a641642cb924fe15455fdf6d1b0861d08d475cbb4b69c23535857a1e3a28b133bc063f3f74241d55ee6def5d4ba70066943fcc1b5ae0ad80478466abbdeba7 SHA512 595ff2cbbe3393c38e7daa7ea72ff21f2e77773c7bf284f0b72aca41b587e6c87405e513b88aea74784853bf371c02de0924a327ad23be4042353b19c3e2fc1e -DIST open-gpu-kernel-modules-525.47.14.tar.gz 10311547 BLAKE2B f0e8ac830129974656c8b4cca14d2a4134c50743f424210a79f38694ea0f7ab1395cc91a1601138c22d76a1ea368b73e0cea7aebad2244d00a9bb7e739470865 SHA512 b47d7c003ec9f474c5fde33646393f8ba6a77cc9e2e810d5ec1c3116141f1c0a8e10b1a63e17cef2128ffd4fa4dad784a955004e36b2a2dee3c09b3019415f4e +DIST open-gpu-kernel-modules-525.47.15.tar.gz 10311650 BLAKE2B 8a3a41a5a0b378d0db480842757e361a7ef50393b66ad2ea69e51838b33de73fbeea9a70d86418368ecfbf087f1ecf758f89ac99c2431a41abc4f0de5d89d6c4 SHA512 e91d60a080178e302c2a81ecabeba6afabba3a0c42d8c8f6a64e1fb7036781b0fc28301e7ba11a5b96866617e1b79cbe74d2956e2dfa7e6b81a65720ebf79ec4 EBUILD nvidia-drivers-390.157.ebuild 18374 BLAKE2B d7a3882a37e4441998201365a0203c164b96379ff0ee92b537f64fa923a4b039b009d96aa4857990b9df7975b5821d3860c348dd8707590616ca3eb3dbab6ace SHA512 91a65841f565122fcedcfafd831a55c2ebda3d87e3198828e098af0f6c1a88baf36dc4f24595c4b0ce4b1b1971ca489145b222c7e710c3ef9f15a0c07d387910 EBUILD nvidia-drivers-470.161.03.ebuild 19347 BLAKE2B 9d8e05f763a50e569874f5c9fa48e9bab89018b8565a2fafb6eecd07452e3fad201743e74cedebaf7c00e581b4c1fc29e8f75b77bb6aafda9139965cbec74400 SHA512 299238e415659ab76cbd0c1fe47ad1569bb2ac8950817b32a0d5deabcd63b8b9804237d124378a488a8d19e6250b97088c09d9f6bf829c88b5e61bf59df56d94 EBUILD nvidia-drivers-510.108.03.ebuild 19677 BLAKE2B 43893ef60edfe12072a9d21ec0ece3b05d8abcd6b89f0e1f48e043595aa65b52ce6bcfe59f86ba3297373f6db55f76435dbed8131ad71f6d2c0cd0215f301e33 SHA512 daf79d2f756c1e93dc659384a7f61a92a124937fb3da0286f7af0290cfa7f39f793c8a2a16f19f572f0f80e43c612bb9f7d322c6b4a27ec7f40b705f54eaad3a EBUILD nvidia-drivers-515.86.01.ebuild 21932 BLAKE2B 3f60b9d62853caaf74221863cef7ec05ee782ad0fe2e35bb75e135da945c2ad864399b438f4608cde71881967345d889b0af5275b7fb225356c9e1f13945640e SHA512 9f9be1e4f552715eb9356009da263caa6aa0cc6c8e40865d7d441c6280e8051b9cd75652283f6231f0396210fc343b334b698ec0b8820c6b7353e571248bdb8e -EBUILD nvidia-drivers-525.47.14.ebuild 21822 BLAKE2B 07a891d42ecd0808852e84e54b392c6cfe5a6299fc38f3655af4fec9eb21cfaba7aad2aec8aa855531473ff58731a3c6cd76f31964445a88ef98980689ca7526 SHA512 defe15ade17d6b0e70b4100b3d4b143d8cd75d9cd1b4a5ebbf3041877cbb28d3d5e739a921d717b346987b905a7a19c8d51730e657908f7994d4b7b73f7e98b9 +EBUILD nvidia-drivers-525.47.15.ebuild 21822 BLAKE2B 07a891d42ecd0808852e84e54b392c6cfe5a6299fc38f3655af4fec9eb21cfaba7aad2aec8aa855531473ff58731a3c6cd76f31964445a88ef98980689ca7526 SHA512 defe15ade17d6b0e70b4100b3d4b143d8cd75d9cd1b4a5ebbf3041877cbb28d3d5e739a921d717b346987b905a7a19c8d51730e657908f7994d4b7b73f7e98b9 EBUILD nvidia-drivers-525.85.05.ebuild 21810 BLAKE2B db04373abf4d0787a7c37b644ca09d827839353abb5188e58077ca2fdbb58ac78a6fce4e2e81bbd80af7031346fdfd85db7b0f81a622589b2314cc14dfbe4da4 SHA512 e3fc1c00418e211f808825ba49c5cb5ae1ae07ba05fc259884440b341211bb33750dd2c7be9ef6f379c96de20184d988cc333b58b3a385c3d62088289aa00c42 EBUILD nvidia-drivers-525.89.02.ebuild 21810 BLAKE2B db04373abf4d0787a7c37b644ca09d827839353abb5188e58077ca2fdbb58ac78a6fce4e2e81bbd80af7031346fdfd85db7b0f81a622589b2314cc14dfbe4da4 SHA512 e3fc1c00418e211f808825ba49c5cb5ae1ae07ba05fc259884440b341211bb33750dd2c7be9ef6f379c96de20184d988cc333b58b3a385c3d62088289aa00c42 EBUILD nvidia-drivers-530.30.02.ebuild 21828 BLAKE2B d91f8d8c287a50d17a0418fd06ac5a2df39675f7da5ca2e3d1bae7a4db2e6c9fb63e65ac744b5849b56642ade5a52bfade25fea148609c696ebbb59a1efec1fb SHA512 eb885a041f0c2cb0f85b1747852d94fe404f5784ba96013fcc2f2599aec59c60c2f5ada052013bee3ecb6977965b7569ea28b0d60763130e27814dd1fde24bce diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.14.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.14.ebuild deleted file mode 100644 index b82004cf88ef..000000000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.14.ebuild +++ /dev/null @@ -1,632 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -MODULES_OPTIONAL_USE="driver" -inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \ - systemd toolchain-funcs unpacker user-info - -NV_KERNEL_MAX="6.2" -NV_PIN="525.89.02" - -DESCRIPTION="NVIDIA Accelerated Graphics Driver" -HOMEPAGE="https://developer.nvidia.com/vulkan-driver" -SRC_URI=" - https://developer.nvidia.com/downloads/vulkan-beta-${PV//.}-linux - -> NVIDIA-Linux-x86_64-${PV}.run - $(printf "https://download.nvidia.com/XFree86/%s/%s-${NV_PIN}.tar.bz2 " \ - nvidia-{installer,modprobe,persistenced,settings,xconfig}{,}) - https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${PV}.tar.gz - -> open-gpu-kernel-modules-${PV}.tar.gz" -# nvidia-installer is unused but here for GPL-2's "distribute sources" -S="${WORKDIR}" - -LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl" -SLOT="0/vulkan" -KEYWORDS="-* ~amd64" -IUSE="+X abi_x86_32 abi_x86_64 +driver kernel-open persistenced +static-libs +tools wayland" -REQUIRED_USE="kernel-open? ( driver )" - -COMMON_DEPEND=" - acct-group/video - sys-libs/glibc - X? ( x11-libs/libpciaccess ) - persistenced? ( - acct-user/nvpd - net-libs/libtirpc:= - ) - tools? ( - >=app-accessibility/at-spi2-core-2.46:2 - dev-libs/glib:2 - dev-libs/jansson:= - media-libs/harfbuzz:= - x11-libs/cairo - x11-libs/gdk-pixbuf:2 - x11-libs/gtk+:3[X] - x11-libs/libX11 - x11-libs/libXext - x11-libs/libXxf86vm - x11-libs/pango - )" -RDEPEND=" - ${COMMON_DEPEND} - X? ( - media-libs/libglvnd[X,abi_x86_32(-)?] - x11-libs/libX11[abi_x86_32(-)?] - x11-libs/libXext[abi_x86_32(-)?] - ) - wayland? ( - gui-libs/egl-gbm - >=gui-libs/egl-wayland-1.1.10 - media-libs/libglvnd - )" -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=" - sys-devel/m4 - virtual/pkgconfig" - -QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*" - -PATCHES=( - "${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch - "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch - "${FILESDIR}"/nvidia-settings-390.144-desktop.patch - "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch -) - -pkg_setup() { - use driver || return - - local CONFIG_CHECK=" - PROC_FS - ~DRM_KMS_HELPER - ~SYSVIPC - ~!LOCKDEP - ~!SLUB_DEBUG_ON - ~!X86_KERNEL_IBT - !DEBUG_MUTEXES" - local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection - of drivers (no custom config), and for wayland / nvidia-drm.modeset=1. - Cannot be directly selected in the kernel's menuconfig, and may need - selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or - DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in." - local ERROR_X86_KERNEL_IBT="CONFIG_X86_KERNEL_IBT: is set, be warned the modules may not load. - If run into problems, either unset or try to pass ibt=off to the kernel." - - use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764 - - use kernel-open && CONFIG_CHECK+=" MMU_NOTIFIER" #843827 - local ERROR_MMU_NOTIFIER="CONFIG_MMU_NOTIFIER: is not set but needed to build with USE=kernel-open. - Cannot be directly selected in the kernel's menuconfig, and may need - selection of another option that requires it such as CONFIG_KVM." - - MODULE_NAMES=" - nvidia(video:kernel) - nvidia-drm(video:kernel) - nvidia-modeset(video:kernel) - nvidia-peermem(video:kernel) - nvidia-uvm(video:kernel)" - use kernel-open && - MODULE_NAMES=${MODULE_NAMES//:kernel/:kernel-module-source:kernel-module-source/kernel-open} - - linux-mod_pkg_setup - - [[ ${MERGE_TYPE} == binary ]] && return - - # do some extra checks manually as it gets messy to handle builtin-only - # and some other conditional checks through CONFIG_CHECK - # TODO?: maybe move other custom checks here for uniformity - local warn=() - - if linux_chkconfig_builtin DRM_NOUVEAU; then - # suggest =m given keeps KMS_HELPER enabled and can serve as fallback - warn+=( - " CONFIG_DRM_NOUVEAU: is builtin (=y), and will prevent loading NVIDIA" - " modules (can be safely kept as a module (=m) instead)." - ) - fi - - if linux_chkconfig_builtin DRM_SIMPLEDRM; then - # wrt prebuilts, Fedora is pushing =y and gentoo-kernel-bin uses its - # configs (bug #840439), but without Fedora's kernel patch to - # workaround this issue (which is unlikely to work for us anyway) - # https://github.com/NVIDIA/open-gpu-kernel-modules/issues/228 - warn+=( - " CONFIG_DRM_SIMPLEDRM: is builtin (=y), and may conflict with NVIDIA" - " (i.e. blanks when X/wayland starts, and tty loses display)." - " For prebuilt kernels, unfortunately no known good workarounds." - ) - fi - - if ! linux_chkconfig_present FB_EFI && - ! linux_chkconfig_present FB_SIMPLE && - ! linux_chkconfig_present FB_VESA - then - # nvidia-drivers does not handle the tty (beside mode restoration) but, - # given few options are viable, try to warn if all missing - warn+=( - " CONFIG_FB_(EFI|SIMPLE|VESA): none set, but note at least one is normally" - " needed to get a display for the tty console. In most cases, it is" - " recommended to enable FB_EFI=y and disable FB_SIMPLE (can be quirky)." - " Non-EFI systems are likely to want FB_VESA=y. Users with multiple GPUs" - " or not using the tty may be able to safely ignore this warning." - ) - fi - - if kernel_is -ge 5 18 13; then - if linux_chkconfig_present FB_SIMPLE; then - warn+=( - " CONFIG_FB_SIMPLE: is set, recommended to disable and switch to FB_EFI or" - " FB_VESA as it currently may be broken with >=kernel-5.18.13 + NVIDIA:" - " https://github.com/NVIDIA/open-gpu-kernel-modules/issues/341" - " (feel free to ignore this if it works for you)" - ) - fi - - if linux_chkconfig_present SYSFB_SIMPLEFB && - { linux_chkconfig_present FB_EFI || linux_chkconfig_present FB_VESA; } - then - warn+=( - " CONFIG_SYSFB_SIMPLEFB: is set, this may prevent FB_EFI or FB_VESA" - " from providing a working tty console display (ignore if unused)." - ) - fi - fi - - (( ${#warn[@]} )) && - ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}" - - BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' - BUILD_TARGETS="modules" - - # Try to match toolchain with kernel only for modules - # (experimental, ideally this should be handled in linux-mod.eclass) - nvidia-tc-set() { - local -n var=KERNEL_${1} - if [[ ! -v var ]]; then - read -r var < <(type -P "${@:2}") || - die "failed to find in PATH at least one of: ${*:2}" - einfo "Forcing '${var}' for modules (set ${!var} to override)" - fi - } - - local tool switch - if linux_chkconfig_present CC_IS_GCC; then - if ! tc-is-gcc; then - switch= - nvidia-tc-set CC {${CHOST}-,}gcc - nvidia-tc-set CXX {${CHOST}-,}g++ # needed by kernel-open - fi - elif linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: using ${PN} with a clang-built kernel is largely untested" - if ! tc-is-clang; then - switch=llvm- - nvidia-tc-set CC {${CHOST}-,}clang - nvidia-tc-set CXX {${CHOST}-,}clang++ - fi - fi - - if linux_chkconfig_present LD_IS_BFD; then - # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355 - [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] || - nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld} - elif linux_chkconfig_present LD_IS_LLD; then - tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld} - fi - - if [[ -v switch ]]; then - # only need llvm-nm for lto, but use complete set to be safe - for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do - case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in - LLVM*|llvm*) [[ ! ${switch} ]];; - *) [[ ${switch} ]];; - esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,} - done - fi - - # pass unconditionally given exports are semi-ignored except CC/LD - for tool in CC CXX LD AR NM OBJCOPY OBJDUMP READELF STRIP; do - BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\"" - done - - if linux_chkconfig_present LTO_CLANG_THIN; then - # kernel enables cache by default leading to sandbox violations - BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=' - fi - - if kernel_is -gt ${NV_KERNEL_MAX/./ }; then - ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" - ewarn "or was not tested with it. It is recommended to use one of:" - ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x" - ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x" - 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 "(Gentoo will not accept patches for this)." - ewarn - ewarn "Do _not_ file a bug report if run into issues." - ewarn - fi -} - -src_prepare() { - # make patches usable across versions - rm nvidia-modprobe && mv nvidia-modprobe{-${NV_PIN},} || die - rm nvidia-persistenced && mv nvidia-persistenced{-${NV_PIN},} || die - rm nvidia-settings && mv nvidia-settings{-${NV_PIN},} || die - rm nvidia-xconfig && mv nvidia-xconfig{-${NV_PIN},} || die - mv open-gpu-kernel-modules-${PV} kernel-module-source || die - - default - - # prevent detection of incomplete kernel DRM support (bug #603818) - sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \ - -i kernel{,-module-source/kernel-open}/conftest.sh || die - - # adjust service files - sed 's/__USER__/nvpd/' \ - nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \ - > "${T}"/nvidia-persistenced.service || die - use !amd64 || sed -i "s|/usr|${EPREFIX}/opt|" systemd/system/nvidia-powerd.service || die - - # enable nvidia-drm.modeset=1 by default with USE=wayland - cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die - use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die - - # makefile attempts to install wayland library even if not built - use wayland || sed -i 's/ WAYLAND_LIB_install$//' \ - nvidia-settings/src/Makefile || die - - # temporary option, nvidia will remove in the future - use !kernel-open || - sed -i '/blacklist/a\ -\ -# Enable using kernel-open with workstation GPUs (experimental)\ -options nvidia NVreg_OpenRmEnableUnsupportedGpus=1' "${T}"/nvidia.conf || die -} - -src_compile() { - tc-export AR CC CXX LD OBJCOPY OBJDUMP - local -x RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" # raw-ldflags.patch - - local xnvflags=-fPIC #840389 - # lto static libraries tend to cause problems without fat objects - is-flagq '-flto@(|=*)' && xnvflags+=" $(test-flags-CC -ffat-lto-objects)" - - NV_ARGS=( - PREFIX="${EPREFIX}"/usr - HOST_CC="$(tc-getBUILD_CC)" - HOST_LD="$(tc-getBUILD_LD)" - BUILD_GTK2LIB= - NV_USE_BUNDLED_LIBJANSSON=0 - NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out - WAYLAND_AVAILABLE=$(usex wayland 1 0) - XNVCTRL_CFLAGS="${xnvflags}" - ) - - if use driver; then - if linux_chkconfig_present GCC_PLUGINS; then - mkdir "${T}"/plugin-test || die - echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die - :> "${T}"/plugin-test/test.c || die - if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \ - HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ - =~ "error: incompatible gcc/plugin version" ]] - then - eerror "Detected kernel was built with a different gcc/plugin version," - eerror "Please 'make clean' and rebuild your kernel with the current" - eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)." - die "kernel ${KV_FULL} needs to be rebuilt" - fi - fi - - local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS} - if use kernel-open; then - # building the nvidia "blob" fails with lto, and also need - # to strip in case of a different toolchain for the kernel - filter-lto - strip-unsupported-flags - fi - linux-mod_src_compile - CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags} - fi - - emake "${NV_ARGS[@]}" -C nvidia-modprobe - use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig - - if use tools; then - # cflags: avoid noisy logs, only use here and set first to let override - CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \ - emake "${NV_ARGS[@]}" -C nvidia-settings - elif use static-libs; then - # pretend GTK+3 is available, not actually used (bug #880879) - emake "${NV_ARGS[@]}" BUILD_GTK3LIB=1 \ - -C nvidia-settings/src out/libXNVCtrl.a - fi -} - -src_install() { - local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir) - - NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} ) - - local -A paths=( - [APPLICATION_PROFILE]=/usr/share/nvidia - [CUDA_ICD]=/etc/OpenCL/vendors - [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d - [FIRMWARE]=/lib/firmware/nvidia/${PV} - [GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm - [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d - [VULKAN_ICD_JSON]=/usr/share/vulkan - [WINE_LIB]=/usr/${libdir}/nvidia/wine - [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d - - [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions - [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules - [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules - ) - - local skip_files=( - # nvidia_icd/layers(vulkan): skip with -X too as it uses libGLX_nvidia - $(usev !X " - libGLX_nvidia libglxserver_nvidia - nvidia_icd.json nvidia_layers.json") - $(usev !wayland libnvidia-vulkan-producer) - libGLX_indirect # non-glvnd unused fallback - libnvidia-{gtk,wayland-client} nvidia-{settings,xconfig} # from source - libnvidia-egl-gbm 15_nvidia_gbm # gui-libs/egl-gbm - libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland - ) - local skip_modules=( - $(usev !X "nvfbc vdpau xdriver") - $(usev !driver gsp) - installer nvpd # handled separately / built from source - ) - local skip_types=( - GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd - OPENCL_WRAPPER.\* # virtual/opencl - DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF SYSTEMD_UNIT # handled separately / unused - ) - - local DOCS=( - README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json - nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt - ) - local HTML_DOCS=( html/. ) - einstalldocs - - local DISABLE_AUTOFORMATTING=yes - local DOC_CONTENTS="\ -Trusted users should be in the 'video' group to use NVIDIA devices. -You can add yourself by using: gpasswd -a my-user video\ -$(usev driver " - -Like all out-of-tree kernel modules, it is necessary to rebuild -${PN} after upgrading or rebuilding the Linux kernel -by for example running \`emerge @module-rebuild\`. Alternatively, -if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}), -this can be automated by setting USE=dist-kernel globally. - -Loaded kernel modules also must not mismatch with the installed -${PN} version (excluding -r revision), meaning should -ensure \`eselect kernel list\` points to the kernel that will be -booted before building and preferably reboot after upgrading -${PN} (the ebuild will emit a warning if mismatching). - -See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options.")\ -$(use amd64 && usev !abi_x86_32 " - -Note that without USE=abi_x86_32 on ${PN}, 32bit applications -(typically using wine / steam) will not be able to use GPU acceleration.") - -For general information on using ${PN}, please see: -https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" - readme.gentoo_create_doc - - if use driver; then - linux-mod_src_install - - insinto /etc/modprobe.d - doins "${T}"/nvidia.conf - - # used for gpu verification with binpkgs (not kept, see pkg_preinst) - insinto /usr/share/nvidia - doins supported-gpus/supported-gpus.json - fi - - emake "${NV_ARGS[@]}" -C nvidia-modprobe install - fowners :video /usr/bin/nvidia-modprobe #505092 - fperms 4710 /usr/bin/nvidia-modprobe - - if use persistenced; then - emake "${NV_ARGS[@]}" -C nvidia-persistenced install - newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced - newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced - systemd_dounit "${T}"/nvidia-persistenced.service - fi - - if use tools; then - emake "${NV_ARGS[@]}" -C nvidia-settings install - - doicon nvidia-settings/doc/nvidia-settings.png - domenu nvidia-settings/doc/nvidia-settings.desktop - - 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 - - use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install - - # mimic nvidia-installer by reading .manifest to install files - # 0:file 1:perms 2:type 3+:subtype/arguments -:module - local m into - while IFS=' ' read -ra m; do - ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] || - [[ " ${m[0]##*/}" =~ ^(\ ${skip_files[*]/%/.*|\\} )$ ]] || - [[ " ${m[2]}" =~ ^(\ ${skip_types[*]/%/|\\} )$ ]] || - has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue - - case ${m[2]} in - MANPAGE) - gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert - continue - ;; - GBM_BACKEND_LIB_SYMLINK) m[4]=../${m[4]};; # missing ../ - VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/ - esac - - if [[ -v paths[${m[2]}] ]]; then - into=${paths[${m[2]}]} - elif [[ ${m[2]} =~ _BINARY$ ]]; then - into=/opt/bin - elif [[ ${m[3]} == COMPAT32 ]]; then - use abi_x86_32 || continue - into=/usr/${libdir32} - elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then - into=/usr/${libdir} - else - die "No known installation path for ${m[0]}" - fi - [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/} - [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/} - - if [[ ${m[2]} =~ _SYMLINK$ ]]; then - [[ ${m[4]: -1} == / ]] && m[4]=${m[5]} - dosym ${m[4]} ${into}/${m[0]} - continue - fi - [[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] && - dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest - - printf -v m[1] %o $((m[1] | 0200)) # 444->644 - insopts -m${m[1]} - insinto ${into} - doins ${m[0]} - done < .manifest || die - - # MODULE:installer non-skipped extras - : "$(systemd_get_sleepdir)" - exeinto "${_#"${EPREFIX}"}" - doexe systemd/system-sleep/nvidia - dobin systemd/nvidia-sleep.sh - systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service - - dobin nvidia-bug-report.sh - - # MODULE:powerd extras - if use amd64; then - systemd_dounit systemd/system/nvidia-powerd.service - - insinto /usr/share/dbus-1/system.d - doins nvidia-dbus.conf - fi - - # symlink non-versioned so nvidia-settings can use it even if misdetected - dosym nvidia-application-profiles-${PV}-key-documentation \ - ${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation - - # don't attempt to strip firmware files (silences errors) - dostrip -x ${paths[FIRMWARE]} -} - -pkg_preinst() { - has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND= - - use driver || return - linux-mod_pkg_preinst - - # set video group id based on live system (bug #491414) - local g=$(egetent group video | cut -d: -f3) - [[ ${g} =~ ^[0-9]+$ ]] || die "Failed to determine video group id (got '${g}')" - sed -i "s/@VIDEOGID@/${g}/" "${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 "\"devid\":\"$(<${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() { - linux-mod_pkg_postinst - - readme.gentoo_print_elog - - if [[ -r /proc/driver/nvidia/version && - $( ${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 use kernel-open; then - ewarn - ewarn "Open source variant of ${PN} was selected, be warned it is experimental" - ewarn "and only usable with Turing / Ampere and later GPUs, aka GTX 1650+." - ewarn "Please also see: ${EROOT}/usr/share/doc/${PF}/html/kernel_open.html" - ewarn - ewarn "Many features are not yet implemented in the drivers and limitations are" - ewarn "to be expected. Please do not report non-build/packaging bugs to Gentoo." - ewarn "Switch back to USE=-kernel-open to restore functionality if needed for now." - fi - - if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then - elog - elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1" - elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered" - elog "experimental but is required for wayland." - elog - elog "If you experience issues, either disable wayland or edit nvidia.conf." - elog "Of note, may possibly cause issues with SLI and Reverse PRIME." - fi -} diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.15.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.15.ebuild new file mode 100644 index 000000000000..b82004cf88ef --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.15.ebuild @@ -0,0 +1,632 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +MODULES_OPTIONAL_USE="driver" +inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \ + systemd toolchain-funcs unpacker user-info + +NV_KERNEL_MAX="6.2" +NV_PIN="525.89.02" + +DESCRIPTION="NVIDIA Accelerated Graphics Driver" +HOMEPAGE="https://developer.nvidia.com/vulkan-driver" +SRC_URI=" + https://developer.nvidia.com/downloads/vulkan-beta-${PV//.}-linux + -> NVIDIA-Linux-x86_64-${PV}.run + $(printf "https://download.nvidia.com/XFree86/%s/%s-${NV_PIN}.tar.bz2 " \ + nvidia-{installer,modprobe,persistenced,settings,xconfig}{,}) + https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${PV}.tar.gz + -> open-gpu-kernel-modules-${PV}.tar.gz" +# nvidia-installer is unused but here for GPL-2's "distribute sources" +S="${WORKDIR}" + +LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl" +SLOT="0/vulkan" +KEYWORDS="-* ~amd64" +IUSE="+X abi_x86_32 abi_x86_64 +driver kernel-open persistenced +static-libs +tools wayland" +REQUIRED_USE="kernel-open? ( driver )" + +COMMON_DEPEND=" + acct-group/video + sys-libs/glibc + X? ( x11-libs/libpciaccess ) + persistenced? ( + acct-user/nvpd + net-libs/libtirpc:= + ) + tools? ( + >=app-accessibility/at-spi2-core-2.46:2 + dev-libs/glib:2 + dev-libs/jansson:= + media-libs/harfbuzz:= + x11-libs/cairo + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:3[X] + x11-libs/libX11 + x11-libs/libXext + x11-libs/libXxf86vm + x11-libs/pango + )" +RDEPEND=" + ${COMMON_DEPEND} + X? ( + media-libs/libglvnd[X,abi_x86_32(-)?] + x11-libs/libX11[abi_x86_32(-)?] + x11-libs/libXext[abi_x86_32(-)?] + ) + wayland? ( + gui-libs/egl-gbm + >=gui-libs/egl-wayland-1.1.10 + media-libs/libglvnd + )" +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=" + sys-devel/m4 + virtual/pkgconfig" + +QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*" + +PATCHES=( + "${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch + "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch + "${FILESDIR}"/nvidia-settings-390.144-desktop.patch + "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch +) + +pkg_setup() { + use driver || return + + local CONFIG_CHECK=" + PROC_FS + ~DRM_KMS_HELPER + ~SYSVIPC + ~!LOCKDEP + ~!SLUB_DEBUG_ON + ~!X86_KERNEL_IBT + !DEBUG_MUTEXES" + local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection + of drivers (no custom config), and for wayland / nvidia-drm.modeset=1. + Cannot be directly selected in the kernel's menuconfig, and may need + selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or + DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in." + local ERROR_X86_KERNEL_IBT="CONFIG_X86_KERNEL_IBT: is set, be warned the modules may not load. + If run into problems, either unset or try to pass ibt=off to the kernel." + + use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764 + + use kernel-open && CONFIG_CHECK+=" MMU_NOTIFIER" #843827 + local ERROR_MMU_NOTIFIER="CONFIG_MMU_NOTIFIER: is not set but needed to build with USE=kernel-open. + Cannot be directly selected in the kernel's menuconfig, and may need + selection of another option that requires it such as CONFIG_KVM." + + MODULE_NAMES=" + nvidia(video:kernel) + nvidia-drm(video:kernel) + nvidia-modeset(video:kernel) + nvidia-peermem(video:kernel) + nvidia-uvm(video:kernel)" + use kernel-open && + MODULE_NAMES=${MODULE_NAMES//:kernel/:kernel-module-source:kernel-module-source/kernel-open} + + linux-mod_pkg_setup + + [[ ${MERGE_TYPE} == binary ]] && return + + # do some extra checks manually as it gets messy to handle builtin-only + # and some other conditional checks through CONFIG_CHECK + # TODO?: maybe move other custom checks here for uniformity + local warn=() + + if linux_chkconfig_builtin DRM_NOUVEAU; then + # suggest =m given keeps KMS_HELPER enabled and can serve as fallback + warn+=( + " CONFIG_DRM_NOUVEAU: is builtin (=y), and will prevent loading NVIDIA" + " modules (can be safely kept as a module (=m) instead)." + ) + fi + + if linux_chkconfig_builtin DRM_SIMPLEDRM; then + # wrt prebuilts, Fedora is pushing =y and gentoo-kernel-bin uses its + # configs (bug #840439), but without Fedora's kernel patch to + # workaround this issue (which is unlikely to work for us anyway) + # https://github.com/NVIDIA/open-gpu-kernel-modules/issues/228 + warn+=( + " CONFIG_DRM_SIMPLEDRM: is builtin (=y), and may conflict with NVIDIA" + " (i.e. blanks when X/wayland starts, and tty loses display)." + " For prebuilt kernels, unfortunately no known good workarounds." + ) + fi + + if ! linux_chkconfig_present FB_EFI && + ! linux_chkconfig_present FB_SIMPLE && + ! linux_chkconfig_present FB_VESA + then + # nvidia-drivers does not handle the tty (beside mode restoration) but, + # given few options are viable, try to warn if all missing + warn+=( + " CONFIG_FB_(EFI|SIMPLE|VESA): none set, but note at least one is normally" + " needed to get a display for the tty console. In most cases, it is" + " recommended to enable FB_EFI=y and disable FB_SIMPLE (can be quirky)." + " Non-EFI systems are likely to want FB_VESA=y. Users with multiple GPUs" + " or not using the tty may be able to safely ignore this warning." + ) + fi + + if kernel_is -ge 5 18 13; then + if linux_chkconfig_present FB_SIMPLE; then + warn+=( + " CONFIG_FB_SIMPLE: is set, recommended to disable and switch to FB_EFI or" + " FB_VESA as it currently may be broken with >=kernel-5.18.13 + NVIDIA:" + " https://github.com/NVIDIA/open-gpu-kernel-modules/issues/341" + " (feel free to ignore this if it works for you)" + ) + fi + + if linux_chkconfig_present SYSFB_SIMPLEFB && + { linux_chkconfig_present FB_EFI || linux_chkconfig_present FB_VESA; } + then + warn+=( + " CONFIG_SYSFB_SIMPLEFB: is set, this may prevent FB_EFI or FB_VESA" + " from providing a working tty console display (ignore if unused)." + ) + fi + fi + + (( ${#warn[@]} )) && + ewarn "Detected potential configuration issues with used kernel:${warn[*]/#/$'\n'}" + + BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' + BUILD_TARGETS="modules" + + # Try to match toolchain with kernel only for modules + # (experimental, ideally this should be handled in linux-mod.eclass) + nvidia-tc-set() { + local -n var=KERNEL_${1} + if [[ ! -v var ]]; then + read -r var < <(type -P "${@:2}") || + die "failed to find in PATH at least one of: ${*:2}" + einfo "Forcing '${var}' for modules (set ${!var} to override)" + fi + } + + local tool switch + if linux_chkconfig_present CC_IS_GCC; then + if ! tc-is-gcc; then + switch= + nvidia-tc-set CC {${CHOST}-,}gcc + nvidia-tc-set CXX {${CHOST}-,}g++ # needed by kernel-open + fi + elif linux_chkconfig_present CC_IS_CLANG; then + ewarn "Warning: using ${PN} with a clang-built kernel is largely untested" + if ! tc-is-clang; then + switch=llvm- + nvidia-tc-set CC {${CHOST}-,}clang + nvidia-tc-set CXX {${CHOST}-,}clang++ + fi + fi + + if linux_chkconfig_present LD_IS_BFD; then + # tc-ld-is-bfd needs https://github.com/gentoo/gentoo/pull/28355 + [[ $(LC_ALL=C $(tc-getLD) --version 2>/dev/null) == "GNU ld"* ]] || + nvidia-tc-set LD {${CHOST}-,}{ld.bfd,ld} + elif linux_chkconfig_present LD_IS_LLD; then + tc-ld-is-lld || nvidia-tc-set LD {${CHOST}-,}{ld.lld,lld} + fi + + if [[ -v switch ]]; then + # only need llvm-nm for lto, but use complete set to be safe + for tool in AR NM OBJCOPY OBJDUMP READELF STRIP; do + case $(LC_ALL=C $(tc-get${tool}) --version 2>/dev/null) in + LLVM*|llvm*) [[ ! ${switch} ]];; + *) [[ ${switch} ]];; + esac && nvidia-tc-set ${tool} {${CHOST}-,}${switch}${tool,,} + done + fi + + # pass unconditionally given exports are semi-ignored except CC/LD + for tool in CC CXX LD AR NM OBJCOPY OBJDUMP READELF STRIP; do + BUILD_PARAMS+=" ${tool}=\"\${KERNEL_${tool}:-\$(tc-get${tool})}\"" + done + + if linux_chkconfig_present LTO_CLANG_THIN; then + # kernel enables cache by default leading to sandbox violations + BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=' + fi + + if kernel_is -gt ${NV_KERNEL_MAX/./ }; then + ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" + ewarn "or was not tested with it. It is recommended to use one of:" + ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x" + ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x" + 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 "(Gentoo will not accept patches for this)." + ewarn + ewarn "Do _not_ file a bug report if run into issues." + ewarn + fi +} + +src_prepare() { + # make patches usable across versions + rm nvidia-modprobe && mv nvidia-modprobe{-${NV_PIN},} || die + rm nvidia-persistenced && mv nvidia-persistenced{-${NV_PIN},} || die + rm nvidia-settings && mv nvidia-settings{-${NV_PIN},} || die + rm nvidia-xconfig && mv nvidia-xconfig{-${NV_PIN},} || die + mv open-gpu-kernel-modules-${PV} kernel-module-source || die + + default + + # prevent detection of incomplete kernel DRM support (bug #603818) + sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \ + -i kernel{,-module-source/kernel-open}/conftest.sh || die + + # adjust service files + sed 's/__USER__/nvpd/' \ + nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \ + > "${T}"/nvidia-persistenced.service || die + use !amd64 || sed -i "s|/usr|${EPREFIX}/opt|" systemd/system/nvidia-powerd.service || die + + # enable nvidia-drm.modeset=1 by default with USE=wayland + cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die + use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die + + # makefile attempts to install wayland library even if not built + use wayland || sed -i 's/ WAYLAND_LIB_install$//' \ + nvidia-settings/src/Makefile || die + + # temporary option, nvidia will remove in the future + use !kernel-open || + sed -i '/blacklist/a\ +\ +# Enable using kernel-open with workstation GPUs (experimental)\ +options nvidia NVreg_OpenRmEnableUnsupportedGpus=1' "${T}"/nvidia.conf || die +} + +src_compile() { + tc-export AR CC CXX LD OBJCOPY OBJDUMP + local -x RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" # raw-ldflags.patch + + local xnvflags=-fPIC #840389 + # lto static libraries tend to cause problems without fat objects + is-flagq '-flto@(|=*)' && xnvflags+=" $(test-flags-CC -ffat-lto-objects)" + + NV_ARGS=( + PREFIX="${EPREFIX}"/usr + HOST_CC="$(tc-getBUILD_CC)" + HOST_LD="$(tc-getBUILD_LD)" + BUILD_GTK2LIB= + NV_USE_BUNDLED_LIBJANSSON=0 + NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out + WAYLAND_AVAILABLE=$(usex wayland 1 0) + XNVCTRL_CFLAGS="${xnvflags}" + ) + + if use driver; then + if linux_chkconfig_present GCC_PLUGINS; then + mkdir "${T}"/plugin-test || die + echo "obj-m += test.o" > "${T}"/plugin-test/Kbuild || die + :> "${T}"/plugin-test/test.c || die + if [[ $(LC_ALL=C make -C "${KV_OUT_DIR}" ARCH="$(tc-arch-kernel)" \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ + =~ "error: incompatible gcc/plugin version" ]] + then + eerror "Detected kernel was built with a different gcc/plugin version," + eerror "Please 'make clean' and rebuild your kernel with the current" + eerror "gcc (or re-emerge for distribution kernels, including kernel-bin)." + die "kernel ${KV_FULL} needs to be rebuilt" + fi + fi + + local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS} + if use kernel-open; then + # building the nvidia "blob" fails with lto, and also need + # to strip in case of a different toolchain for the kernel + filter-lto + strip-unsupported-flags + fi + linux-mod_src_compile + CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags} + fi + + emake "${NV_ARGS[@]}" -C nvidia-modprobe + use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig + + if use tools; then + # cflags: avoid noisy logs, only use here and set first to let override + CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \ + emake "${NV_ARGS[@]}" -C nvidia-settings + elif use static-libs; then + # pretend GTK+3 is available, not actually used (bug #880879) + emake "${NV_ARGS[@]}" BUILD_GTK3LIB=1 \ + -C nvidia-settings/src out/libXNVCtrl.a + fi +} + +src_install() { + local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir) + + NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} ) + + local -A paths=( + [APPLICATION_PROFILE]=/usr/share/nvidia + [CUDA_ICD]=/etc/OpenCL/vendors + [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d + [FIRMWARE]=/lib/firmware/nvidia/${PV} + [GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm + [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d + [VULKAN_ICD_JSON]=/usr/share/vulkan + [WINE_LIB]=/usr/${libdir}/nvidia/wine + [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d + + [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions + [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules + [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules + ) + + local skip_files=( + # nvidia_icd/layers(vulkan): skip with -X too as it uses libGLX_nvidia + $(usev !X " + libGLX_nvidia libglxserver_nvidia + nvidia_icd.json nvidia_layers.json") + $(usev !wayland libnvidia-vulkan-producer) + libGLX_indirect # non-glvnd unused fallback + libnvidia-{gtk,wayland-client} nvidia-{settings,xconfig} # from source + libnvidia-egl-gbm 15_nvidia_gbm # gui-libs/egl-gbm + libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland + ) + local skip_modules=( + $(usev !X "nvfbc vdpau xdriver") + $(usev !driver gsp) + installer nvpd # handled separately / built from source + ) + local skip_types=( + GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd + OPENCL_WRAPPER.\* # virtual/opencl + DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF SYSTEMD_UNIT # handled separately / unused + ) + + local DOCS=( + README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json + nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt + ) + local HTML_DOCS=( html/. ) + einstalldocs + + local DISABLE_AUTOFORMATTING=yes + local DOC_CONTENTS="\ +Trusted users should be in the 'video' group to use NVIDIA devices. +You can add yourself by using: gpasswd -a my-user video\ +$(usev driver " + +Like all out-of-tree kernel modules, it is necessary to rebuild +${PN} after upgrading or rebuilding the Linux kernel +by for example running \`emerge @module-rebuild\`. Alternatively, +if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}), +this can be automated by setting USE=dist-kernel globally. + +Loaded kernel modules also must not mismatch with the installed +${PN} version (excluding -r revision), meaning should +ensure \`eselect kernel list\` points to the kernel that will be +booted before building and preferably reboot after upgrading +${PN} (the ebuild will emit a warning if mismatching). + +See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options.")\ +$(use amd64 && usev !abi_x86_32 " + +Note that without USE=abi_x86_32 on ${PN}, 32bit applications +(typically using wine / steam) will not be able to use GPU acceleration.") + +For general information on using ${PN}, please see: +https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" + readme.gentoo_create_doc + + if use driver; then + linux-mod_src_install + + insinto /etc/modprobe.d + doins "${T}"/nvidia.conf + + # used for gpu verification with binpkgs (not kept, see pkg_preinst) + insinto /usr/share/nvidia + doins supported-gpus/supported-gpus.json + fi + + emake "${NV_ARGS[@]}" -C nvidia-modprobe install + fowners :video /usr/bin/nvidia-modprobe #505092 + fperms 4710 /usr/bin/nvidia-modprobe + + if use persistenced; then + emake "${NV_ARGS[@]}" -C nvidia-persistenced install + newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced + newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced + systemd_dounit "${T}"/nvidia-persistenced.service + fi + + if use tools; then + emake "${NV_ARGS[@]}" -C nvidia-settings install + + doicon nvidia-settings/doc/nvidia-settings.png + domenu nvidia-settings/doc/nvidia-settings.desktop + + 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 + + use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install + + # mimic nvidia-installer by reading .manifest to install files + # 0:file 1:perms 2:type 3+:subtype/arguments -:module + local m into + while IFS=' ' read -ra m; do + ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] || + [[ " ${m[0]##*/}" =~ ^(\ ${skip_files[*]/%/.*|\\} )$ ]] || + [[ " ${m[2]}" =~ ^(\ ${skip_types[*]/%/|\\} )$ ]] || + has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue + + case ${m[2]} in + MANPAGE) + gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert + continue + ;; + GBM_BACKEND_LIB_SYMLINK) m[4]=../${m[4]};; # missing ../ + VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/ + esac + + if [[ -v paths[${m[2]}] ]]; then + into=${paths[${m[2]}]} + elif [[ ${m[2]} =~ _BINARY$ ]]; then + into=/opt/bin + elif [[ ${m[3]} == COMPAT32 ]]; then + use abi_x86_32 || continue + into=/usr/${libdir32} + elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then + into=/usr/${libdir} + else + die "No known installation path for ${m[0]}" + fi + [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/} + [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/} + + if [[ ${m[2]} =~ _SYMLINK$ ]]; then + [[ ${m[4]: -1} == / ]] && m[4]=${m[5]} + dosym ${m[4]} ${into}/${m[0]} + continue + fi + [[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] && + dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest + + printf -v m[1] %o $((m[1] | 0200)) # 444->644 + insopts -m${m[1]} + insinto ${into} + doins ${m[0]} + done < .manifest || die + + # MODULE:installer non-skipped extras + : "$(systemd_get_sleepdir)" + exeinto "${_#"${EPREFIX}"}" + doexe systemd/system-sleep/nvidia + dobin systemd/nvidia-sleep.sh + systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service + + dobin nvidia-bug-report.sh + + # MODULE:powerd extras + if use amd64; then + systemd_dounit systemd/system/nvidia-powerd.service + + insinto /usr/share/dbus-1/system.d + doins nvidia-dbus.conf + fi + + # symlink non-versioned so nvidia-settings can use it even if misdetected + dosym nvidia-application-profiles-${PV}-key-documentation \ + ${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation + + # don't attempt to strip firmware files (silences errors) + dostrip -x ${paths[FIRMWARE]} +} + +pkg_preinst() { + has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND= + + use driver || return + linux-mod_pkg_preinst + + # set video group id based on live system (bug #491414) + local g=$(egetent group video | cut -d: -f3) + [[ ${g} =~ ^[0-9]+$ ]] || die "Failed to determine video group id (got '${g}')" + sed -i "s/@VIDEOGID@/${g}/" "${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 "\"devid\":\"$(<${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() { + linux-mod_pkg_postinst + + readme.gentoo_print_elog + + if [[ -r /proc/driver/nvidia/version && + $( ${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 use kernel-open; then + ewarn + ewarn "Open source variant of ${PN} was selected, be warned it is experimental" + ewarn "and only usable with Turing / Ampere and later GPUs, aka GTX 1650+." + ewarn "Please also see: ${EROOT}/usr/share/doc/${PF}/html/kernel_open.html" + ewarn + ewarn "Many features are not yet implemented in the drivers and limitations are" + ewarn "to be expected. Please do not report non-build/packaging bugs to Gentoo." + ewarn "Switch back to USE=-kernel-open to restore functionality if needed for now." + fi + + if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then + elog + elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1" + elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered" + elog "experimental but is required for wayland." + elog + elog "If you experience issues, either disable wayland or edit nvidia.conf." + elog "Of note, may possibly cause issues with SLI and Reverse PRIME." + fi +} -- cgit v1.2.3