From 2099ff9b640e648be67527e29760263a7c6274e5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 28 Apr 2023 05:11:40 +0100 Subject: gentoo auto-resync : 28:04:2023 - 05:11:40 --- x11-drivers/Manifest.gz | Bin 4730 -> 4728 bytes x11-drivers/nvidia-drivers/Manifest | 6 +- .../nvidia-drivers/nvidia-drivers-525.47.18.ebuild | 634 --------------------- .../nvidia-drivers/nvidia-drivers-525.47.22.ebuild | 634 +++++++++++++++++++++ 4 files changed, 637 insertions(+), 637 deletions(-) delete mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-525.47.18.ebuild create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-525.47.22.ebuild (limited to 'x11-drivers') diff --git a/x11-drivers/Manifest.gz b/x11-drivers/Manifest.gz index 77c72028908f..a189e30c9f5b 100644 Binary files a/x11-drivers/Manifest.gz and b/x11-drivers/Manifest.gz differ diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index 3a6dc60f9045..b2264bcddfef 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -24,7 +24,7 @@ DIST NVIDIA-Linux-x86_64-470.182.03.run 271685302 BLAKE2B 47acdc53dea1698558fea8 DIST NVIDIA-Linux-x86_64-515.105.01.run 363738348 BLAKE2B b78b7e9dbc1450a7d01d9b3b75e0612ce0b71f8647dc5ee084660c9cb12a8ac4b2f278d49b195e0f4600d02f3297af796158cbca9cdaff0d27f78f56153bdefd SHA512 9b9e820754254c70aeab2bcc1cfdae396d3b30fb948198e378f764a6f0d89ad6f6687afffa2d6f48072ab726c6d180dc3c83891eef61f273c0b11f7bc2c9bd67 DIST NVIDIA-Linux-x86_64-525.105.17.run 414594622 BLAKE2B c1db447a2e121fb13a90a26a4086f8759e8ef5e6eb3b355e3f4497cd67169b8b38506e00bdb8cfd0f5f7f25e0cacbe6e5ed05732815dbf4e63f2e800830ae3dd SHA512 1a44a8d92d8434d356dcd6087c8a3277136e0819ffa5e4b6895854811cf63e44ad3dc08e0d248f149f8dc2280ab0993be6ee7fdf3c676fb9a85ff3dce83fd69a DIST NVIDIA-Linux-x86_64-525.116.03.run 414602354 BLAKE2B f46c88b579901cd4bf0263f046fc2915a8f147af4c4669d849fadd3df1dd6aad913a8cc27f9dde3c5ba9aa3f40df725220d06b590ccf9e185ecd720eb3977836 SHA512 684c2eddb621a18dddf047cc7d89521a4841fedbfad674e6ccb0bac7dba141a6e8e3ee77b6f2a692dab6d6e3310a88d38ea14f8198e94b21a299927e69234114 -DIST NVIDIA-Linux-x86_64-525.47.18.run 414104155 BLAKE2B 6e3e20d1be55e7d71e5ed766b2504e087caf786d204a59fbdea973fc8035da0152b9b339603304041683d442832251d4458268ba1b4079b32d0de0485e16f2ac SHA512 c3163da87bfb9b46453c6553dc7666c109b4d20dc45ba7ba9e05a9abb0af7f93e30e249d87b75b27d8849b82129aaec583708f4dee01c5920af3a125448226d0 +DIST NVIDIA-Linux-x86_64-525.47.22.run 412530731 BLAKE2B d73a76d4319bd21dc44400f22df8e23345c169f2fb976f9048cddf06bd24eef7d98f37e91adf7e41055879040ba808772c06348217d0a0e094f24d7e2a583a2d SHA512 9d2817e323cc13e43b5461421e88f17f9916ce3c3eb471453846f90f9f232e5cabaecb727580e1df957647ab1d33c1f06ebd8dd134a4d4a31633f66026985d2d DIST NVIDIA-Linux-x86_64-530.41.03.run 344312858 BLAKE2B bb5507afd23e6e063314532f37e5c7cc2530f96f359664d79ebac998c6a32ee238790b4aa66339a913e31114d22795e8e80aebced2260ff04b5d3589af472fc9 SHA512 90068122824322884ec8f3e4be2fe7f76bf07ee1163baf6da15d09ba3ff886e5c5ef72016509eef9f4af9d85f154ebbe051d5fb3af5e867f1f67f03af8068100 DIST NVIDIA-kernel-module-source-515.105.01.tar.xz 7531676 BLAKE2B 05a2e00141ce699956366dfc513c12b766b17b95bbabeb0e6da496a3babd4d8ce02ef82a7c125b3dd9d884b132079398225c5588a5ec853dfd3db7359cafea74 SHA512 5eb4ebb3641343eedaa3f6df9cfcc539011e4141f109c6ea585f6e7f2efc41ae1156fb5b056b070a17d8781f62028b396da9ec47972660548f8a651a032a6877 DIST NVIDIA-kernel-module-source-525.105.17.tar.xz 10120440 BLAKE2B 00fdaaa690a8ae14db333237e2ee3ef14d83ac7be84d53c0300e0ed70e5b2681e293730d737f82e2e74487ddf895c831ee620b6a8162dea9f0f0b979357992fc SHA512 bdb475cc9e5332e383a5375baeae444c9148c6f145e7870392e4eecc1f91708d4e52fb5eb844accda19bcd749ae0c2850c29310cb234b015e9307c3c62088bd8 @@ -60,12 +60,12 @@ DIST nvidia-xconfig-515.105.01.tar.bz2 109756 BLAKE2B 7eef6613197909f9c2188e904f DIST nvidia-xconfig-525.105.17.tar.bz2 110608 BLAKE2B 3db4f55f34fb16e00224d2dff7596e15960d0f6555bb90c141566e48cbcee65080d1f3addfbc40f9cdd81b8b75d11659f007499c5cd6d31eb0c082a3c26f61e6 SHA512 d794459dd292e18310a549d4f09aec405b5f7f065cc3dd61e6bc98d19f08bc56cceb4e667e6442831c1c49e6709e403012b302892d93ebe6368d152ef921b762 DIST nvidia-xconfig-525.116.03.tar.bz2 110982 BLAKE2B 9aec023c8ab61e2a184bf8f341a458d17c2e6c4fd19b3e16a56e9eb9180b27a5745fd8073db613f26d501d277aacbda1479baae046eeef26e12a2a539313c6c6 SHA512 0f60dc86117670e52a15d09ec6a71fb6e3354bcc6d5f67ddddb3650bc3dcb9c01a36eb74776da14476a8c6f6363972c100ca12665cfbd17b55ae22391c1c7ed5 DIST nvidia-xconfig-530.41.03.tar.bz2 110920 BLAKE2B c7b90382b0e42f9f0d839c40c53c613243314399c715c303d9221c1d9558bed4d159bc1b76c2ab8ff4831d32fc93b661650b9833ef7397559847c3a14763cdfa SHA512 72cb1b44ff2fd162fc76fa4993b24a2994545b2b5e8f23252729a55e2deb2d10cc9263dfbe6449a81e3e18beca0bd6506b295a7299696bb9fea628fd99dca555 -DIST open-gpu-kernel-modules-525.47.18.tar.gz 10311905 BLAKE2B 3b2b826953aa35b2ddf9fd296d0d4641bead8dffe62bd3dd57bcea336874fd099f8983a868349deca4174b09b3255d7cf9fc0597bf3d85e72c898b4c21e106b2 SHA512 3a1b698f3e238472e7f50581142ae793eea0cd8a4e4cc6567588d12de679f915eaa3a0f853dbea814873cf9480d08e0b2439729e6cdd310c05d48065f06515a1 +DIST open-gpu-kernel-modules-525.47.22.tar.gz 10323980 BLAKE2B 4bfe11716a88d4dd43aa3ff8abf857572cabc8379cac7cdd3a3f761d8c096323f16378cba359472f40a80898a88d0b42e11a63708c58e56d2abde51de838da16 SHA512 d6524a8e00fff730b54533fa0f836e96b1febf66e2e24f01d7639c0d3ecaa4cece5b6da8ac6074c66867f5ffd87397d2878d95d83c34ae15f612a3fe28764429 EBUILD nvidia-drivers-390.157.ebuild 18829 BLAKE2B e8ea620be73e325613179bbfa02daf269699d2fa12f3338b3e1bab90f620d3ade276977e6037d603f6f7ea36bc5e803c10b415512335c89c0e2f82274265a241 SHA512 fe0e5b627eba87cf0b880636b11d15aea9968f941b162e3c785daabba6f556532328a8a4f4375b7b17a9d1329e58b86172e9d7d4815a304347a0f60e0f1d5d73 EBUILD nvidia-drivers-470.182.03.ebuild 19487 BLAKE2B 8c85ad2e1c300e62c29086a5153fd2a762763bd823a46fcff34df3e322591beebce94bfa6cf13f6ac266a53b37b8ce713465a29d299ac435dd81dd9508f71b3e SHA512 c44cf24eec21fa2f9b4a1e9dac7db5a6aa1ce88c14340708fe867911acec54a985b44dcb4efa222e883de394dab0c8b1b1fd8f59ed89615e57d666d1cb0ae4f5 EBUILD nvidia-drivers-515.105.01.ebuild 22072 BLAKE2B 2c60697e5c43596d569100e883b78c8b41029abad70ca1aa5d5c766be4583afc30ff04c7ba33fdbc07eee8eb9da55775ef06b15843b88416eb9d6d9000f61fab SHA512 91874095f309f8ecbbbe6b91f218b02bc8c61036045daae1424a9246cca732b2873dc9ffe79a1a6fe4b97fed9fad89abd37b770da6d6105cfefa03615411d710 EBUILD nvidia-drivers-525.105.17.ebuild 21950 BLAKE2B 28cf57b8ced717ce6c72e9ea152ab9a47bcef0379025c82b0a37483a20c768ed810a00e1448b0f1883332a05a225a6fb0a5c8b72eccd667e524f7fe3ffd60526 SHA512 ca1301ecb041cdce7ada63e5b08761cbe3b1c0b448ebcc0dfb6f1d402df22d98ff86df209110e6f332d5711f712f002d2aea9bfe26dcf8d5bd7ea2270d0234cd EBUILD nvidia-drivers-525.116.03.ebuild 21951 BLAKE2B 72cdebeff1a429143dda55d2d273038aa4bdf96b4573bf9e304e0604a94749d1446bae782d903827af7bcf522e449ed3f26889745bbe2902c6c15dfe76ffad0e SHA512 3e7750947838ae9dbca7224e332c9c25b9766eed409bc55287d13b6159e22850102ba937d1b0727d84fd8ec6f3f10e29c83bdcc774ac65f3359b1ec83f5e30a4 -EBUILD nvidia-drivers-525.47.18.ebuild 21963 BLAKE2B 12dbe5c46efff54b2e084a3e8c59da82c8ad77c9f7c6b58eeb0ec7e470cdedf03b76ced86729ed0fc7ad7e76b691e3dccd275c8cbac8afabaae158f7901065e8 SHA512 bb8855894a998c25aee17299aa4b85065696b388fa78a33263617fe4c8065a3f34c475ed8ba1574dfb947a16d1bfe2a6b3c82130e5a7f0d75df4bee528f492cf +EBUILD nvidia-drivers-525.47.22.ebuild 21963 BLAKE2B b106cc90004d9d206863aa891409821655f0b92705266599463d128531d287dd5e9d3028dc4f3c58f34d35947c6bd2855edf198afa1d83e4f8ae9a6740bedd4c SHA512 cfa911dc3bbcc2140e4c7daa31b5d62fea2dc8b2dc24e65c5cb0393ef9461570e67fea09e89ddf7ece79d3adf2fecb253e2f829112554e5575050694aef02069 EBUILD nvidia-drivers-530.41.03.ebuild 21953 BLAKE2B 269d883e56e371af0e4870c3001113bad2053deef9ac9f604393875c2870b0d95a292a104b56a9006838df4e0b4bce77efe699c0184c935129cf093325dcca82 SHA512 445973a185dd53a163059fa20bf3e3604f1743b05860e49bf759c58cfc5dc71e3c6d4349892686b2d027364ef05db24ca34b2924b4401e56c697ce79a12b9a56 MISC metadata.xml 1320 BLAKE2B f8aa8f9a39d6da284b60afb50087acf75744057628e79b77a95e6bebb1e386e9d1a819f41e73d3e94b8ab74322ec8e8b077ad6d2af0804a5c6f20b4dd5f2897d SHA512 9fb939f8c8892ce43afc4f577181474c88a0aae3cc58af57987000b82f6c52f3f7b40fc538fa8eae0d5dbaf1fe3734d84f72fda2106853edd945149b3f2d2747 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.18.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.18.ebuild deleted file mode 100644 index 29a269054c53..000000000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.18.ebuild +++ /dev/null @@ -1,634 +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.105.17" - -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[1] branch if possible (not all old versions" - ewarn "are available or fully functional, may need to consider nouveau[2])." - ewarn "[1] https://www.nvidia.com/object/IO_32667.html" - ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau" - 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.22.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.22.ebuild new file mode 100644 index 000000000000..a0cc19bafe4d --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.22.ebuild @@ -0,0 +1,634 @@ +# 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.3" +NV_PIN="525.116.03" + +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[1] branch if possible (not all old versions" + ewarn "are available or fully functional, may need to consider nouveau[2])." + ewarn "[1] https://www.nvidia.com/object/IO_32667.html" + ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau" + 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