diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-12-27 14:10:06 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-12-27 14:10:06 +0000 |
commit | 4429be000a778f363162554d59d903a725283d7d (patch) | |
tree | 16a6de16cbef2e9dcb36233f2e0c825f3ff60493 /x11-drivers/nvidia-drivers | |
parent | 2d9c9c77c273a982d69ad4caefcc1a3783844056 (diff) |
gentoo auto-resync : 27:12:2022 - 14:10:05
Diffstat (limited to 'x11-drivers/nvidia-drivers')
7 files changed, 406 insertions, 107 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index 95b86ed91deb..2adee9576653 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -52,10 +52,10 @@ DIST nvidia-xconfig-510.108.03.tar.bz2 109729 BLAKE2B 48378155d57f9b4a2b58b044da DIST nvidia-xconfig-515.86.01.tar.bz2 109747 BLAKE2B d6253f9d052be5aaa1a2be82bf4a36c971aae8b6e9f61e4ff5f27ec415d945bab8289678d6a2495ff7521c66478421090a452ceb19d87803de4290aeb7f69bba SHA512 f4e66f23d9227671158ee0b99b1ccc44f25dc6a910d3b00332d135fb94f21b67f581804b53a40945a652777c898e20069962721931c7b58d2c33d38925da5e35 DIST nvidia-xconfig-525.60.13.tar.bz2 110584 BLAKE2B a06b951f91cef5ce17843876de5b5e5988f2e869f8d6a4478e186597698c3fb05daf176581cfb05bc3dadf79c817cf2df2b947b02f6152c2ea4b960f3aecf2df SHA512 ffba8aabfda510f6546d0c7786d935f432fbbc87ce78d38ce5f9fa22ab5862e7adee0f699b46bb73270b89b092d988af2fed3915b0c9be66d642d39a533fc880 DIST open-gpu-kernel-modules-525.47.04.tar.gz 10254204 BLAKE2B 0cea11c7cdc88602c4eb6262d26ff9843f4f3be75a1b524caf0f58b092c681e87006f264a7d61a3ced7051544bd1f036060786585ba63086d085ec34ff4b7922 SHA512 ddf55e2ae391ba884aaf3703f7c26dd167f7bb1720062d015735d1216441089597ea33ef540c384b630e3655dde65470bc430bb70d3f43abaa7fda23106e86f3 -EBUILD nvidia-drivers-390.157.ebuild 17232 BLAKE2B cca8a57a61cccd8f0384b67fdd727eeb266c38730fd4d043ce934ed160ed0d46e3ecdad955f9b98f9739ab8f40a5ee22322a07ad0fdc70b2fcc0603da5724527 SHA512 baa755680de1ca3134d2d63cc5c2406a79302be6382b4527f4cead8a744cc33ab8ca3e488ef3732a40452bd4f5c18ac3dbffae63906d0691a57875d5747d6a8e -EBUILD nvidia-drivers-470.161.03.ebuild 17941 BLAKE2B 2818d590fbc78bd8f862a55acf327c11e9347c517fcc4dfb39c3d4d0f3013dac316f668e97236b9ec9ad9e6fc7a76222fea3c14b3c626872b677e641dce95f27 SHA512 d807ea27d1c790c6a5664d52b3a3a497950b475b4372a9b88350e707fe0bd6b26043c1530821c9578e3995a4e0650809ce311c3787679018d418b44252ca46e4 -EBUILD nvidia-drivers-510.108.03.ebuild 18271 BLAKE2B 2f799593db032ab644df6c10f4c2d7748e9d252a99886f25443fc529610f5e91ba267e1c7f8f9f0b6f7c8a7bc6cdaff4bf62ee11756ec9b99f756ec2946cd8c9 SHA512 27017fd702e039167ffc96aa4ee48df27fdf4d42ee802228a7afc026b886f6fc6a0a8817f20da95edb8d6e65f62073caf7c78a5c1a8885aa6761711c58e966ff -EBUILD nvidia-drivers-515.86.01.ebuild 20087 BLAKE2B 31b9f452db43b6eed0cbadb2298d8277f2806805ee3446c02e8e5a92bbbca3dcf7d7261e364cb9f295fa8fdb497e69da05c862e25f24e10cc8b1f9cd2dd49456 SHA512 08c479aba86832aa8467a48c1b7ca89df198046e70f5a6dcd6e6a98c627e09806dc83614cbb1be14f355631bc7eafc1414ce5d5100884527204a5c3094e48e15 -EBUILD nvidia-drivers-525.47.04.ebuild 19895 BLAKE2B d55895c7a75f27ba2cf4a565b56f2f6fff85ba728bdcd7555fdb12d52da0818ad9381e2cffa50b2515f99d1cdb1d7c099c14d30694ab2c2a9ce67b0b77e20f3f SHA512 898dba3de10c7f08195e36932b9101fbc878c32f3671561c04c1c2881b14d2013b479198895cee5a94866ee3fde16d445ec7b80159b1609b33fc4a4af95557a4 -EBUILD nvidia-drivers-525.60.13.ebuild 19884 BLAKE2B 826dd037b5d525ad1cbfc17d563cb696cf56b6b7af0342552d5488a2f91d064bacf163a3a43f2353f31ce8ef33c1ed7b7bb10febb95c9b8e6500ec7e67cafedb SHA512 8e702b2773aca39841dffcbb8aee9b06ddcb83e5067941e65e3f33ba3a43354c4d98062a291ac325fe2e08dd2931e92e5b3cc2c607f850059202270971a3476e +EBUILD nvidia-drivers-390.157.ebuild 18429 BLAKE2B 1e2ea98beb53cf973c0318c5cbd30789c5a2533f3f82f1c7d0a33332379950b638f39e30c3f702aca8270e10950984c00a4e95f09ae25805d990084bc38d7e03 SHA512 388c84c2cd76a3eb85651a5f567105130250be78451e5e9ef872dba756bb1f9f3d0d93563838fa5c20afc8077a75aa30ceff409578bbcb5f7299e9df06a2c4a8 +EBUILD nvidia-drivers-470.161.03.ebuild 19402 BLAKE2B 9591b049c7a6f632f155e6f9e750d09c273b0e283bf97192fcdff873af8a6bf3db6a1dce2ebea46b7f5f08735ae72a8b297d1cfdb11e995193db6196d4f05edb SHA512 b47f60737f76cc7c24565868ca2c8a0e765e31643b200fb29ea181a73f563a64d660aeb2902586b7d618abe1b816cfa66d3aea9954df04a8af43708334df7873 +EBUILD nvidia-drivers-510.108.03.ebuild 19732 BLAKE2B eee07dcd758004f84dc0313194801bd3320dc75fba60b82125a8cdca46848ceec9d4873e91dd68b22f4400358883c83756895d2bf58abd4837e70f73132468e3 SHA512 4e626ffefa96437e924e3d93b59a73e4f2ce8f82696232de19c365c66f5cfb7a40722caf1d1a8c86bc32f832199dbef31f8187cc2d6adb5de5c66c7c5f2a6599 +EBUILD nvidia-drivers-515.86.01.ebuild 21987 BLAKE2B a62fd126b0d9cf4529a686121993cd2d79058956be5a70a90fbb7ba3d11fa5b4e44a3d204253d96b0d9e99a0a41a57a1953cc0c102e58fb98222e7174281d4cf SHA512 619c3cd6e12c025ff80c1c48a7f41b6271b89ea804fe1a0cf414af0623bda7fdca70bd5af494205f370e225d2307ce7e4f6c1a0857e1737d86d4ef9fbe267c03 +EBUILD nvidia-drivers-525.47.04.ebuild 21795 BLAKE2B 3d6662e71796b7892bb962ed66fa1935304e1b7478c900e2a5bfaf1ac96af3a0093af969986105efed7ebcee587e3a277543d1885b23bbdba8749ddc20f8c0bc SHA512 16b8f2e0047d94ac0534438ea1cac86007e3d50fccb15ffc3c6021b2d38d145355922b5952c8b567301ccee7c3ecbf498dc046ce5454a37d0c55e9e56d604c41 +EBUILD nvidia-drivers-525.60.13.ebuild 21784 BLAKE2B bd1ddf35e2a6b6aef94057368fbbc31c9143592a4b8ef87244d481f602554fdf464402a6e396aed0ce73a309dac1df50978fba9361bea6080cc3ee7fda0783fa SHA512 9aeb21ab53a5b80d84789eefa139480531121218682627b92e6741c8fb1791bb4775c19f5b76e82d0d1f885f7f392f61bef41dd2c865fdc0e778cda6ef38ea2d MISC metadata.xml 1320 BLAKE2B f8aa8f9a39d6da284b60afb50087acf75744057628e79b77a95e6bebb1e386e9d1a819f41e73d3e94b8ab74322ec8e8b077ad6d2af0804a5c6f20b4dd5f2897d SHA512 9fb939f8c8892ce43afc4f577181474c88a0aae3cc58af57987000b82f6c52f3f7b40fc538fa8eae0d5dbaf1fe3734d84f72fda2106853edd945149b3f2d2747 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild index a11919a78e4e..3bda88a05d31 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-390.157.ebuild @@ -180,20 +180,58 @@ pkg_setup() { use x86 && BUILD_PARAMS+=' ARCH=i386' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 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 + 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 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 - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' if kernel_is -gt ${NV_KERNEL_MAX/./ }; then ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" @@ -255,12 +293,13 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.161.03.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.161.03.ebuild index 81550f6d18cf..87a70528199f 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-470.161.03.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.161.03.ebuild @@ -183,20 +183,58 @@ pkg_setup() { BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 + 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 fi fi - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' + + 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 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}" @@ -238,13 +276,17 @@ 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)" NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out - XNVCTRL_CFLAGS=-fPIC #840389 + XNVCTRL_CFLAGS="${xnvflags}" ) if use driver; then @@ -253,12 +295,13 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 @@ -454,6 +497,9 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" # 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() { diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-510.108.03.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-510.108.03.ebuild index 814e065fee3d..fb50c6c899e2 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-510.108.03.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-510.108.03.ebuild @@ -185,20 +185,58 @@ pkg_setup() { BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 + 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 fi fi - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' + + 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 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}" @@ -242,13 +280,17 @@ 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)" NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out - XNVCTRL_CFLAGS=-fPIC #840389 + XNVCTRL_CFLAGS="${xnvflags}" ) if use driver; then @@ -257,12 +299,13 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 @@ -468,6 +511,9 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" # 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() { diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-515.86.01.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-515.86.01.ebuild index 37fd3aaecee8..97648a86e8c4 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-515.86.01.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-515.86.01.ebuild @@ -195,20 +195,60 @@ pkg_setup() { BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' if kernel_is -gt ${NV_KERNEL_MAX/./ }; then ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" @@ -267,6 +307,10 @@ 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)" @@ -274,7 +318,7 @@ src_compile() { NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out WAYLAND_AVAILABLE=$(usex wayland 1 0) - XNVCTRL_CFLAGS=-fPIC #840389 + XNVCTRL_CFLAGS="${xnvflags}" ) if use driver; then @@ -283,16 +327,25 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 @@ -494,6 +547,9 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" # 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() { diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.04.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.04.ebuild index cb4b15e6013e..bdab775a8f7b 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.04.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.47.04.ebuild @@ -191,20 +191,60 @@ pkg_setup() { BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' if kernel_is -gt ${NV_KERNEL_MAX/./ }; then ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" @@ -263,6 +303,10 @@ 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)" @@ -271,7 +315,7 @@ src_compile() { NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out WAYLAND_AVAILABLE=$(usex wayland 1 0) - XNVCTRL_CFLAGS=-fPIC #840389 + XNVCTRL_CFLAGS="${xnvflags}" ) if use driver; then @@ -280,16 +324,25 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 @@ -493,6 +546,9 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" # 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() { diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-525.60.13.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-525.60.13.ebuild index 8c14118f83d2..b3d834f2d113 100644 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-525.60.13.ebuild +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-525.60.13.ebuild @@ -190,20 +190,60 @@ pkg_setup() { BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' BUILD_TARGETS="modules" - if linux_chkconfig_present CC_IS_CLANG; then - ewarn "Warning: clang-built kernel detected, using clang for modules (experimental)" - ewarn "Can use KERNEL_CC and KERNEL_LD environment variables to override if needed." - - tc-is-clang || : "${KERNEL_CC:=${CHOST}-clang}" - if linux_chkconfig_present LD_IS_LLD; then - : "${KERNEL_LD:=ld.lld}" - 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 + # 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 - BUILD_PARAMS+=' ${KERNEL_CC:+CC="${KERNEL_CC}"} ${KERNEL_LD:+LD="${KERNEL_LD}"}' if kernel_is -gt ${NV_KERNEL_MAX/./ }; then ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" @@ -262,6 +302,10 @@ 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)" @@ -270,7 +314,7 @@ src_compile() { NV_USE_BUNDLED_LIBJANSSON=0 NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out WAYLAND_AVAILABLE=$(usex wayland 1 0) - XNVCTRL_CFLAGS=-fPIC #840389 + XNVCTRL_CFLAGS="${xnvflags}" ) if use driver; then @@ -279,16 +323,25 @@ src_compile() { 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)" M="${T}"/plugin-test 2>&1) \ + HOSTCC="$(tc-getBUILD_CC)" CC="${CC}" M="${T}"/plugin-test 2>&1) \ =~ "error: incompatible gcc/plugin version" ]] then - ewarn "Warning: detected kernel was built with different gcc/plugin versions," - ewarn "you may need to 'make clean' and rebuild your kernel with the current" - ewarn "gcc version (or re-emerge for distribution kernels, including kernel-bin)." + 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 @@ -492,6 +545,9 @@ https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" # 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() { |