diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-04-28 20:21:43 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-04-28 20:21:43 +0100 |
commit | 40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 (patch) | |
tree | 758c221bad35c9288d0bd6df9c7dfc226728e52c /x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild | |
parent | 8d5dbd847cbc704a6a06405856e94b461011afe3 (diff) |
gentoo resync : 28.04.2021
Diffstat (limited to 'x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild')
-rw-r--r-- | x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild | 211 |
1 files changed, 114 insertions, 97 deletions
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild index e6d9570a2714..81f6e62f3d37 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-460.67.ebuild @@ -4,10 +4,10 @@ EAPI=7 MODULES_OPTIONAL_USE="driver" -inherit desktop linux-info linux-mod multilib-build \ - optfeature systemd toolchain-funcs unpacker +inherit desktop linux-info linux-mod multilib-build optfeature \ + readme.gentoo-r1 systemd toolchain-funcs unpacker -NV_KERNEL_MAX="5.11" +NV_KERNEL_MAX="5.12" NV_BIN_URI="https://download.nvidia.com/XFree86/Linux-" NV_GIT_URI="https://github.com/NVIDIA/nvidia-" @@ -26,7 +26,7 @@ S="${WORKDIR}" LICENSE="GPL-2 MIT NVIDIA-r2 ZLIB" SLOT="0/${PV%%.*}" -KEYWORDS="-* ~amd64" +KEYWORDS="-* amd64" IUSE="+X +driver static-libs +tools" COMMON_DEPEND=" @@ -72,17 +72,6 @@ BDEPEND=" QA_PREBUILT="opt/* usr/lib*" -CONFIG_CHECK=" - ~DRM_KMS_HELPER - ~SYSVIPC - ~!AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT - ~!LOCKDEP - !DEBUG_MUTEXES" -ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection - of drivers (no custom config), and optional nvidia-drm.modeset=1. - Cannot be directly selected in the kernel's menuconfig, so enable - options such as CONFIG_DRM_FBDEV_EMULATION instead." - PATCHES=( "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch ) @@ -92,8 +81,32 @@ DOCS=( ) HTML_DOCS=( html/. ) +DISABLE_AUTOFORMATTING="yes" +DOC_CONTENTS="Users should be in the 'video' group to use NVIDIA devices. +You can add yourself by using: gpasswd -a my-user video + +For general information on using nvidia-drivers, please see: +https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" + pkg_setup() { use driver || return + + local CONFIG_CHECK=" + PROC_FS + ~DRM_KMS_HELPER + ~SYSVIPC + ~!LOCKDEP + !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 optional nvidia-drm.modeset=1. + Cannot be directly selected in the kernel's menuconfig, so enable + options such as CONFIG_DRM_FBDEV_EMULATION instead." + + if kernel_is -lt 5 10; then + CONFIG_CHECK+=" PM" # needed since 460.67 (bug #778920) + local ERROR_PM="CONFIG_PM: is not set but needed with kernel version <5.10" + fi + BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" # defaults' clean sometimes deletes modules MODULE_NAMES=" @@ -101,9 +114,10 @@ pkg_setup() { nvidia-drm(video:kernel) nvidia-modeset(video:kernel) nvidia-uvm(video:kernel)" + linux-mod_pkg_setup - if [[ ${MERGE_TYPE} != binary ]] && kernel_is gt ${NV_KERNEL_MAX/./ }; then + if [[ ${MERGE_TYPE} != binary ]] && kernel_is -gt ${NV_KERNEL_MAX/./ }; then ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of nvidia-drivers" ewarn "or was not tested with it. It is recommended to use one of:" ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}" @@ -144,16 +158,18 @@ src_prepare() { gzip -d nvidia-{cuda-mps-control,smi}.1.gz || die } -nvidia-drivers_make() { - emake -C nvidia-${1} ${2} \ - DESTDIR="${ED}" PREFIX=/usr LIBDIR="${ED}/usr/$(get_libdir)" \ - HOST_CC="$(tc-getBUILD_CC)" HOST_LD="$(tc-getBUILD_LD)" \ - DO_STRIP= MANPAGE_GZIP= \ - NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 OUTPUTDIR=out -} - src_compile() { + nvidia-drivers_make() { + emake -C nvidia-${1} ${2} \ + PREFIX="${EPREFIX}/usr" \ + HOST_CC="$(tc-getBUILD_CC)" \ + HOST_LD="$(tc-getBUILD_LD)" \ + NV_USE_BUNDLED_LIBJANSSON=0 \ + NV_VERBOSE=1 DO_STRIP= OUTPUTDIR=out + } + tc-export AR CC LD OBJCOPY + # may no longer be relevant but kept as a safety export DISTCC_DISABLE=1 CCACHE_DISABLE=1 @@ -170,69 +186,78 @@ src_compile() { fi } -nvidia-drivers_libs_install() { - local libs=( - EGL_nvidia - GLESv1_CM_nvidia - GLESv2_nvidia - cuda - nvcuvid - nvidia-allocator - nvidia-eglcore - nvidia-encode - nvidia-glcore - nvidia-glsi - nvidia-glvkspirv - nvidia-ml - nvidia-opencl - nvidia-opticalflow - nvidia-ptxjitcompiler - nvidia-tls - ) - use amd64 && libs+=( nvidia-compiler ) - - if use X; then - libs+=( - GLX_nvidia - vdpau_nvidia +src_install() { + nvidia-drivers_make_install() { + emake -C nvidia-${1} install \ + DESTDIR="${D}" \ + PREFIX="${EPREFIX}/usr" \ + LIBDIR="${ED}/usr/$(get_libdir)" \ + NV_USE_BUNDLED_LIBJANSSON=0 \ + NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out + } + + nvidia-drivers_libs_install() { + local libs=( + EGL_nvidia + GLESv1_CM_nvidia + GLESv2_nvidia + cuda + nvcuvid + nvidia-allocator + nvidia-eglcore + nvidia-encode + nvidia-glcore + nvidia-glsi + nvidia-glvkspirv + nvidia-ml + nvidia-opencl + nvidia-opticalflow + nvidia-ptxjitcompiler + nvidia-tls ) - if use amd64; then + use amd64 && libs+=( nvidia-compiler ) + + if use X; then libs+=( - nvidia-fbc - nvidia-ifr + GLX_nvidia + vdpau_nvidia ) + if use amd64; then + libs+=( + nvidia-fbc + nvidia-ifr + ) + fi fi - fi - local libdir=. - if multilib_is_native_abi; then - libs+=( - nvidia-cbl - nvidia-cfg - nvidia-rtcore - nvoptix - ) - use amd64 && libs+=( nvidia-ngx ) - else - libdir+=/32 - fi + local libdir=. + if [[ ${ABI} == x86 ]]; then + libdir+=/32 + else + libs+=( + nvidia-cbl + nvidia-cfg + nvidia-rtcore + nvoptix + ) + use amd64 && libs+=( nvidia-ngx ) + fi - local lib soname - for lib in "${libs[@]}"; do - [[ ${lib:0:3} != lib ]] && lib=lib${lib}.so.${PV} + local lib soname + for lib in "${libs[@]}"; do + lib=lib${lib}.so.${PV} - # auto-detect soname and create appropriate symlinks - soname=$(scanelf -qF'%S#F' "${lib}") || die "Scanning ${lib} failed" - if [[ ${soname} && ${soname} != ${lib} ]]; then - ln -s ${lib} ${libdir}/${soname} || die - fi - ln -s ${lib} ${libdir}/${lib%.so*}.so || die + # auto-detect soname and create appropriate symlinks + soname=$(scanelf -qF'%S#F' ${lib}) || die "Scanning ${lib} failed" + if [[ ${soname} && ${soname} != ${lib} ]]; then + ln -s ${lib} ${libdir}/${soname} || die + fi + ln -s ${lib} ${libdir}/${lib%.so*}.so || die - dolib.so ${libdir}/${lib%.so*}* - done -} + dolib.so ${libdir}/${lib%.so*}* + done + } -src_install() { if use driver; then linux-mod_src_install @@ -273,20 +298,20 @@ src_install() { newins nvidia-application-profiles{-${PV},}-rc # install built helpers - nvidia-drivers_make modprobe install + nvidia-drivers_make_install modprobe # allow video group to load mods and create devs (bug #505092) fowners root:video /usr/bin/nvidia-modprobe fperms 4710 /usr/bin/nvidia-modprobe - nvidia-drivers_make persistenced install + nvidia-drivers_make_install persistenced newconfd "${FILESDIR}/nvidia-persistenced.confd" nvidia-persistenced newinitd "${FILESDIR}/nvidia-persistenced.initd" nvidia-persistenced systemd_dounit nvidia-persistenced.service - use X && nvidia-drivers_make xconfig install + use X && nvidia-drivers_make_install xconfig if use tools; then - nvidia-drivers_make settings install + nvidia-drivers_make_install settings doicon nvidia-settings/doc/nvidia-settings.png domenu nvidia-settings/doc/nvidia-settings.desktop @@ -320,12 +345,14 @@ src_install() { # install prebuilt-only libraries multilib_foreach_abi nvidia-drivers_libs_install + # install systemd sleep services exeinto /lib/systemd/system-sleep doexe nvidia dobin nvidia-sleep.sh - systemd_dounit *.service + systemd_dounit nvidia-{hibernate,resume,suspend}.service einstalldocs + readme.gentoo_create_doc } pkg_preinst() { @@ -340,7 +367,7 @@ pkg_preinst() { # try to find driver mismatches using temporary supported-gpus.json for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do - g=$(grep -io "\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \ + 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)) @@ -356,17 +383,18 @@ pkg_preinst() { pkg_postinst() { use driver && linux-mod_pkg_postinst + readme.gentoo_print_elog + optfeature "wayland EGLStream with nvidia-drm.modeset=1" gui-libs/egl-wayland if [[ -r /proc/driver/nvidia/version && $(grep -o ' [0-9.]* ' /proc/driver/nvidia/version) != " ${PV} " ]]; then ewarn "Currently loaded NVIDIA modules do not match the newly installed" ewarn "libraries and will lead to GPU-using application issues." - use driver && ewarn "The easiest way to fix this is to reboot." + use driver && ewarn "The easiest way to fix this is usually to reboot." fi if [[ ${NV_LEGACY_MASK} ]]; then - ewarn "***** WARNING *****" ewarn "You are installing a version of nvidia-drivers known not to work" ewarn "with a GPU of the current system. If unwanted, add the mask:" if [[ -d ${EROOT}/etc/portage/package.mask ]]; then @@ -377,15 +405,4 @@ pkg_postinst() { ewarn "...then downgrade to a legacy branch if possible. For details, see:" ewarn "https://www.nvidia.com/object/IO_32667.html" fi - - if ! [[ ${REPLACING_VERSIONS} && $(getent group video | cut -d: -f4) ]]; then - elog "***** WARNING *****" - elog "Users should be in the 'video' group to use NVIDIA devices." - elog "You can add yourself by using: gpasswd -a myuser video" - fi - - if [[ ! ${REPLACING_VERSIONS} ]]; then - elog "For general information with using NVIDIA on Gentoo, please see:" - elog "https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" - fi } |