diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2019-09-02 00:21:11 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2019-09-02 00:21:11 +0200 |
commit | fdd6b67a78a966f6a2131de8fe0e539316511083 (patch) | |
tree | 7dd65d3814c4733b311985dbeb00b879ddd0df05 /x11-drivers/nvidia-drivers | |
parent | 6109bebd80c2873d9a5763436902b17a0d68d21c (diff) | |
download | darklin4-fdd6b67a78a966f6a2131de8fe0e539316511083.tar.gz darklin4-fdd6b67a78a966f6a2131de8fe0e539316511083.tar.bz2 darklin4-fdd6b67a78a966f6a2131de8fe0e539316511083.tar.xz darklin4-fdd6b67a78a966f6a2131de8fe0e539316511083.zip |
Taglib and NVIDA
Diffstat (limited to 'x11-drivers/nvidia-drivers')
18 files changed, 756 insertions, 29 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest index 66a5419..3af5e7a 100644 --- a/x11-drivers/nvidia-drivers/Manifest +++ b/x11-drivers/nvidia-drivers/Manifest @@ -1,2 +1,18 @@ -EBUILD nvidia-drivers-399-r1.ebuild 257 BLAKE2B 17844646e14c2bb30704c57bae45c63a709ce82af7404eff58b4d6afae9a852f449666ef17c0aa879f981bd6a73d2e9ad2ed7e849eb13b4c77eecb11305da685 SHA512 659a4876e8a8f8fd7d7028db6378e8b0cc6a64116823e7aa3e3d1fedf611a467c8d36041bff0021d2d75d0ba9ec34866ac2c92a63519f7931e49527d9918b81a -EBUILD nvidia-drivers-430.40-r1.ebuild 275 BLAKE2B 9b0eef8d3deb93cccf79d2816115212f69429a45693f876dd2d1ec11b7a0e53016f7c7ae8fea417ad88127b1259a1fd8f949b38c9e633ee8fa0559beef81619a SHA512 67a151b3687cc5416b0fce5c7e9650739ea40f41913f8c10fd7c4642264e708b9302741434a11a4dd8ebadfc66a90940841d95875efebc5c859000983f9bbed1 +AUX 50nvidia-prelink-blacklist 319 BLAKE2B 5751bacd4ce890d08400323da30c2c86fb8a622504cdf70ee091419685d4ad5ff1132a5897288d269cce54d27b9635f884a315fd701ed2747c5f6bdaef3a0eae SHA512 7252b464c45669bb402859ddb2c95f4553a37027870b6aeada3e1dd58fefe7b4713d3486d301177efdcd7559dbc31ceb6078220d5c0187bdc636d817a98e1a41 +AUX 95-nvidia-settings 54 BLAKE2B 0428ef5071f8bf5dc8b7220f9963c4882d6915417d76abd0bf45989b29e04468c33c6facbb9fb0d3c6aadb324a76e3181baaa02c829445d299a2c17f457bb553 SHA512 0fdaff8701598081eeb78defcd140b78f75309ace998df67569a15d0ff653aca7ad0576912bf9a619f42990e6fb35cdb79e21f8181d3cd04dea719d912da8be9 +AUX 95-nvidia-settings-r1 54 BLAKE2B 598067babb48bd0f5680300cf3cbb37ac804edb3131c47510d3350511b918cd47fcf44f1ccd4746e4a41f2f8aa36511f20c2c6f313010e89a79b7869771b9ee6 SHA512 de9edf678c64ca3d10c912397800b2cb651ef9108b33ece97a4cc1e86dad0a9e81986cca6b96cfe80740d9cb433de7ef93f29be45178db714ee408c7f6570ac7 +AUX nvidia-169.07 639 BLAKE2B 00b279e3c338dc84258d8018fe80efc4b87f0fb1fcd61eda0ac2f698897605f4675a3ebb53d8baa3bdfa9f137aff214046464a642113a1b01a8c3e35bf5f99b8 SHA512 3af295c026280dc3a2b73c2cc7772254686b09cad15f1333ab0b4de8cb0ccf78e725ced2a399b10edcf8af6ba42ab1485dc0661af67461b0c3789f786357772f +AUX nvidia-persistenced.conf 250 BLAKE2B 8b3514f981d992d34c949011a25fda5737d85ade831f15481843db14f67494e6f271eb7947a459a28c7991cdeb86092a2a7920e6f40213bcded90b7f9f15dae0 SHA512 9c9562bb15bf4552754dd50a1b01dec5df76f7f5666fba2fff642a169f87e9ed421a260f2258ab469f7e4cd9ef8161653355795624387fe7ad5ae6a0d71e5f46 +AUX nvidia-persistenced.init 650 BLAKE2B 3be9ea563ecb9741bad4de1516ab9cf373c5b412eea52cf4d8e6446ee09f6adee47bcd1f65217c7379b55d99de1966b2335ecdfa940f9c7544cd103992ba280f SHA512 864c90573a033e30d151c9adb9f0f12c5bcba2b5a7eaaa62f86fc11747f13956825fc5acb4fb1fb453a32acefe850e73264a650fafa6014cc96bbc7e3b56fdaa +AUX nvidia-rmmod.conf 108 BLAKE2B 8a14963d7498c08f22c60f0e7286b66375c22e9db081454d973738bf847bfd4343c82f4e1c529ec6b904ae3e8cf29e2570dd4cf2fbb8c8aa9bd33491d2e4f543 SHA512 cb6b70ba0fc9c6d81d43f31d724538beff79e7e9b02c610485f1e46757d7bf16410d5cb2853d8d67ea6e4da59e7e1687ad14dc4b494415c6db6fab517a03b28b +AUX nvidia-settings-linker.patch 1048 BLAKE2B a4a0a26d93514c3c43a0bc0db87b5b8dd8c20d0a9f15942db2a2f34662886436371e72c6e033d4bb2eb4d8996962f048144b93c1493149ea603ef71044cbed41 SHA512 11cd04a3efe95046d01c749df9fc055473284cb99a6138768916db841c8fadf2af5c93646b52f7bce6454e43b8621aa518964ef734c18283162fb2671f6dd9f9 +AUX nvidia-settings.desktop 185 BLAKE2B 5fab31cdfad3e882095bf0fb5c3821b5d934992f1d330b80dd825da727b7cf587177f21ad6d2f83eabc6a451c15e2dc4bbe88684deb5892199da53fdef77f428 SHA512 30cab269daf282b9716e53ecf2f8993289e8d4ad05c40d6ddaad3ea6e95477c36a4d65a28d0ec3c1c9c7e845fde140df9012944306f70131a02c9ffef0a9f523 +AUX nvidia-smi.init 545 BLAKE2B f4a0743f1fa5136c9c0f327645d8b66932492f2539b5c2b0bd45d29b2010fff6bbdc9e97b619e67d38bce38104d29fc4d00a9e0efc31b8ff408cb02370785bec SHA512 f7f04a73d646b90cdc14a408f53650324d7c1d7754a1d92acc9a8acaef163bda1eef33acb831df77657786e7ceebe0d7f9d25d2edd57d1590be340ce12fea6e5 +AUX nvidia-udev.sh 185 BLAKE2B cf7a46f2d123d5df46138d9ad12c4c700984fb773acdda93fc4dfe5fe5bfad36db70342ce4a851fc450a90b6ee6e481d8a4f6e38884063be14c4f0d6e15a2329 SHA512 166df3a4e7c1862ca2e0f634bf5eed7aad1bdd7e55764ca42371b91a7077c59f0bc243de5616fd38dac9694159d1695d54fbd08ac89d4d3f3649c70c7db5977e +AUX nvidia-udev.sh-r1 285 BLAKE2B 6ea76f2f913b2bc2c9955e7564c770368ea6a0327887684d086040047fb95a0088387c5f87f22bc1f5a093cc79299ad72dd1495719bb344c504a342d03f34db3 SHA512 493b0d5f2698d299e3b8d5782ac7fb8174e7ee93f1dae66bc1161eb4dd16d4db91048444dc6e7bea344960936c0a5c825041f6909af004438d8009a3d3fe71c9 +AUX nvidia-uvm.udev-rule 166 BLAKE2B 235df3e85d37d7bc86ad02e32714dcd9ac569c0813767b4f04470e803a95c66b50917fa830955d729069e1e036cb4438edd56249a1cfda701edde58105857ebd SHA512 1ccfcf425b1343e532567e7afd5e1192b6b57de58a1e8c3ec883ef88ecfe2c44d96ad31944f30aafe1dab4d3c5cb9b889ce8a0145295c851d8dbc31d51fd02a8 +AUX nvidia.udev-rule 462 BLAKE2B d417e0e4f5a64c5cee235f4640554ff1ba4d34590a6c3459fd8b4e10dc7581010c006f96cfd01f2c9a847c79979631f6e5afbef01724d110201377e8f8c75966 SHA512 96f9edaa0b46bea5fce17596f868bea5265b303d7185af6ba81527bbd7b8fdf92de9311317cbde51a29d222083d451c25ab77c3d6837cbc4072a50d9af89aa86 +DIST NVIDIA-FreeBSD-x86_64-435.21.tar.gz 64153630 BLAKE2B fee655cc843c004ac0c1ec85b9417292016a013136e04ad047d2513edbdc7c732561d6bcc4603c658905972dce6618de49d4d6ac583e84fdf212cf45397b48c1 SHA512 2c160c06ca58e3009deb1ba4a4a28d39419e251ced3bfa9a442942f9cce17003d67e8a8bfa23036d3916cc0e66f4bff0fbedaae73db6f10b995235a56d7eba7c +DIST NVIDIA-Linux-x86_64-435.21.run 144387574 BLAKE2B e9afd6335182a28f5136dbef55195a2f2d8f768376ebc148190a0a82470a34d008ce04170ffc1aab36585605910c1300567a90443b5f58cb46ec3bff6ab9409c SHA512 e83b6dff80434971c0b254815945d485a45c978b8a19994244f50a463658863948b2eac8bc62d667bb10c23f41cf1c3521c409d23ac2ab6a0c0cd094a6e20270 +DIST nvidia-settings-435.21.tar.bz2 1131222 BLAKE2B 855f5c7667f4a5ec0f917fbb017d70ec6ee5e768f7087e77e54a66dea852c471bd1810a2163fb33204e5f381998a27a4254e0a5d2c73e2b6b624813ff8294f24 SHA512 8b408cc70118df3a138a99fe7fc14f6370d500b8ae26888b27b07de22f6fc6eebd65bd437d83ee82e18a1d8ee4cceec601c414b1947302ca808fff48165f31bb +EBUILD nvidia-drivers-435.21.ebuild 15872 BLAKE2B babf1f0bb26054c93910b9a006a6d0d2d80a5ebed3dc8a987931a020a91ac2337772257f55e1312e73dde1bba972914d450d78331fb4596a452d16cfed2d78a0 SHA512 a14f8ae1c021ed9b8564f8768b046a11a42c24fd7aa152126d30baa6e4603c6fffbf2813ab5c21e76df8dcef255b736165b74748e461bfa6cc89ab9ced4b7997 diff --git a/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist b/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist new file mode 100644 index 0000000..5e139de --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist @@ -0,0 +1 @@ +PRELINK_PATH_MASK="/usr/lib{,64}/tls/libnvidia-tls*:/usr/lib{,64}/libnvidia*:/usr/lib{,64}/libGL*:/usr/lib{,64}/opengl/nvidia/*:/usr/lib{,64}/OpenCL/vendors/nvidia/*:/usr/lib{,64}/xorg/modules/drivers/nvidia*:/usr/lib{,64}/libvdpau_nvidia*:/usr/lib{,64}/libXvMCNVIDIA*:/usr/lib{,64}/libcuda*:/usr/lib{,64}/libnvcuvid*" diff --git a/x11-drivers/nvidia-drivers/files/95-nvidia-settings b/x11-drivers/nvidia-drivers/files/95-nvidia-settings new file mode 100644 index 0000000..e9d6274 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/95-nvidia-settings @@ -0,0 +1,2 @@ +#!/bin/sh +/opt/bin/nvidia-settings --load-config-only diff --git a/x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1 b/x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1 new file mode 100644 index 0000000..48c41d8 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1 @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/bin/nvidia-settings --load-config-only diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07 new file mode 100644 index 0000000..a96b0cd --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-169.07 @@ -0,0 +1,14 @@ +# Nvidia drivers support +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 + +# To tweak the driver the following options can be used, note that +# you should be careful, as it could cause instability!! For more +# options see /usr/share/doc/PACKAGE/README +# +# !!! SECURITY WARNING !!! +# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW +# WHAT YOU ARE DOING. +# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH, +# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE. +options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf new file mode 100644 index 0000000..637ac1a --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf @@ -0,0 +1,8 @@ +# run-time configuration file for /etc/init.d/nvidia-persistenced + +# NVPD_USER: The user nvidia-persistenced is intended to run for +NVPD_USER="" + +# ARGS: Additional arguments to set the default persistence mode +# (see nvidia-persistenced(1)) +ARGS="" diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init new file mode 100644 index 0000000..f80456d --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init @@ -0,0 +1,24 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +pidfile="/var/run/nvidia-persistenced/nvidia-persistenced.pid" + +start() { + if ! [ "${NVPD_USER}x" = x ]; then + ebegin "Starting nvidia-persistenced for ${NVPD_USER}" + NVPD_USER_ARG="--user ${NVPD_USER}" + else + ebegin "Starting nvidia-persistenced" + fi + start-stop-daemon --start --quiet --pidfile ${pidfile} \ + --background --exec /opt/bin/nvidia-persistenced \ + -- ${NVPD_USER_ARG} ${ARGS} + eend $? +} + +stop() { + ebegin "Stopping nvidia-persistenced" + start-stop-daemon --stop --quiet --pidfile ${pidfile} + eend $? +} diff --git a/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf b/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf new file mode 100644 index 0000000..618b9b3 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf @@ -0,0 +1,3 @@ +# Nvidia UVM support + +remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia diff --git a/x11-drivers/nvidia-drivers/files/nvidia-settings-linker.patch b/x11-drivers/nvidia-drivers/files/nvidia-settings-linker.patch new file mode 100644 index 0000000..fe9d336 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-settings-linker.patch @@ -0,0 +1,22 @@ +--- a/nvidia-settings-@PV@/utils.mk ++++ b/nvidia-settings-@PV@/utils.mk +@@ -475,7 +475,7 @@ + define READ_ONLY_OBJECT_FROM_FILE_RULE + $$(OUTPUTDIR)/$$(notdir $(1)).o: $(1) + $(at_if_quiet)cd $$(dir $(1)); \ +- $$(call quiet_cmd_no_at,LD) -r -z noexecstack --format=binary \ ++ $$(call quiet_cmd_no_at,NVLD) -r -z noexecstack --format=binary \ + $$(notdir $(1)) -o $$(OUTPUTDIR_ABSOLUTE)/$$(notdir $$@) + $$(call quiet_cmd,OBJCOPY) \ + --rename-section .data=.rodata,contents,alloc,load,data,readonly \ +--- a/nvidia-settings-@PV@/src/libXNVCtrl/utils.mk ++++ b/nvidia-settings-@PV@/src/libXNVCtrl/utils.mk +@@ -475,7 +475,7 @@ + define READ_ONLY_OBJECT_FROM_FILE_RULE + $$(OUTPUTDIR)/$$(notdir $(1)).o: $(1) + $(at_if_quiet)cd $$(dir $(1)); \ +- $$(call quiet_cmd_no_at,LD) -r -z noexecstack --format=binary \ ++ $$(call quiet_cmd_no_at,NVLD) -r -z noexecstack --format=binary \ + $$(notdir $(1)) -o $$(OUTPUTDIR_ABSOLUTE)/$$(notdir $$@) + $$(call quiet_cmd,OBJCOPY) \ + --rename-section .data=.rodata,contents,alloc,load,data,readonly \ diff --git a/x11-drivers/nvidia-drivers/files/nvidia-settings.desktop b/x11-drivers/nvidia-drivers/files/nvidia-settings.desktop new file mode 100644 index 0000000..b4b452e --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-settings.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=NVIDIA X Server Settings +Comment=Configure NVIDIA X Server Settings +Exec=/usr/bin/nvidia-settings +Icon=nvidia-settings +Categories=System;Settings; diff --git a/x11-drivers/nvidia-drivers/files/nvidia-smi.init b/x11-drivers/nvidia-drivers/files/nvidia-smi.init new file mode 100644 index 0000000..8ee51e3 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-smi.init @@ -0,0 +1,24 @@ +#!/sbin/openrc-run +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +pidfile="/run/nvidia-smi.pid" + +depend() { + after modules +} + +start() { + ebegin "Starting NVIDIA System Management Interface" + rm -f ${pidfile} + start-stop-daemon --start --quiet --pidfile ${pidfile} \ + --make-pidfile --background --exec /opt/bin/nvidia-smi -- \ + -q -l 300 + eend $? +} + +stop() { + ebegin "Stopping NVIDIA System Management Interface" + start-stop-daemon --stop --quiet --pidfile ${pidfile} + eend $? +} diff --git a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh new file mode 100644 index 0000000..9487b08 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ $# -ne 1 ]; then + echo "Invalid args" >&2 + exit 1 +fi + +case $1 in + add|ADD) + /opt/bin/nvidia-smi > /dev/null + ;; + remove|REMOVE) + rm -f /dev/nvidia* + ;; +esac + +exit 0 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1 b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1 new file mode 100644 index 0000000..6579bf7 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1 @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ $# -ne 1 ]; then + echo "Invalid args" >&2 + exit 1 +fi + +case $1 in + add|ADD) + #hopefully this prevents infinite loops like bug #454740 + if lsmod | grep -iq nvidia; then + /opt/bin/nvidia-smi > /dev/null + fi + ;; + remove|REMOVE) + rm -f /dev/nvidia* + ;; +esac + +exit 0 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-uvm.udev-rule b/x11-drivers/nvidia-drivers/files/nvidia-uvm.udev-rule new file mode 100644 index 0000000..3df8a3a --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-uvm.udev-rule @@ -0,0 +1 @@ +KERNEL=="nvidia_uvm", RUN+="/bin/bash -c '/bin/mknod -m 660 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0; /bin/chgrp video /dev/nvidia-uvm'" diff --git a/x11-drivers/nvidia-drivers/files/nvidia.udev-rule b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule new file mode 100644 index 0000000..2eb30bb --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule @@ -0,0 +1,6 @@ +ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}" +# Previously the ACTION was "add|remove" but one user on bug #376527 had a +# problem until he recompiled udev-171-r5, which is one of the versions I +# tested with and it was fine. I'm breaking the rules out just to be safe +# so someone else doesn't have an issue +ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}" diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-399-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-399-r1.ebuild deleted file mode 100644 index caa8d8b..0000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-399-r1.ebuild +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: - -inherit eutils - -DESCRIPTION="NVIDIA Drivers Override" -SLOT="0" -LICENSE="GPL-2 NVIDIA-r2" -KEYWORDS="amd64 x86" - -IUSE="tools static-libs" diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-430.40-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-430.40-r1.ebuild deleted file mode 100644 index 0413d7f..0000000 --- a/x11-drivers/nvidia-drivers/nvidia-drivers-430.40-r1.ebuild +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: - -EAPI=6 - -inherit eutils - -DESCRIPTION="NVIDIA Drivers Override" -SLOT="0/${PV%.*}" - -LICENSE="GPL-2 NVIDIA-r2" -KEYWORDS="amd64 x86" - -IUSE="tools static-libs" diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-435.21.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-435.21.ebuild new file mode 100644 index 0000000..a2e7f01 --- /dev/null +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-435.21.ebuild @@ -0,0 +1,587 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +inherit eutils flag-o-matic linux-info linux-mod multilib-minimal nvidia-driver \ + portability toolchain-funcs unpacker user udev + +DESCRIPTION="NVIDIA Accelerated Graphics Driver" +HOMEPAGE="https://www.nvidia.com/" + +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}" +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" +ARM_NV_PACKAGE="NVIDIA-Linux-armv7l-gnueabihf-${PV}" + +NV_URI="https://us.download.nvidia.com/XFree86/" +SRC_URI=" + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz ) + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run ) + tools? ( + https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-${PV}.tar.bz2 + ) +" + +LICENSE="GPL-2 NVIDIA-r2" +SLOT="0/${PV%.*}" +KEYWORDS="-* amd64 ~amd64-fbsd" +RESTRICT="bindist mirror" +EMULTILIB_PKG="true" + +IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms multilib static-libs +tools uvm wayland +X" +REQUIRED_USE=" + tools? ( X ) + static-libs? ( tools ) +" +RESTRICT="test" + +COMMON=" + app-eselect/eselect-opencl + kernel_linux? ( >=sys-libs/glibc-2.6.1 ) + tools? ( + dev-libs/atk + dev-libs/glib:2 + dev-libs/jansson + gtk3? ( + x11-libs/gtk+:3 + ) + x11-libs/cairo + x11-libs/gdk-pixbuf[X] + x11-libs/gtk+:2 + x11-libs/libX11 + x11-libs/libXext + x11-libs/libXrandr + x11-libs/libXv + x11-libs/libXxf86vm + x11-libs/pango[X] + ) + X? ( + >=app-eselect/eselect-opengl-1.0.9 + app-misc/pax-utils + ) +" +DEPEND=" + ${COMMON} + kernel_linux? ( virtual/linux-sources ) + tools? ( sys-apps/dbus ) +" +RDEPEND=" + ${COMMON} + acpi? ( sys-power/acpid ) + tools? ( !media-video/nvidia-settings ) + wayland? ( dev-libs/wayland[${MULTILIB_USEDEP}] ) + X? ( + <x11-base/xorg-server-1.20.99:= + >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] + >=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}] + >=x11-libs/libvdpau-1.0[${MULTILIB_USEDEP}] + sys-libs/zlib[${MULTILIB_USEDEP}] + ) +" +QA_PREBUILT="opt/* usr/lib*" +S=${WORKDIR}/ + +nvidia_drivers_versions_check() { + if use amd64 && has_multilib_profile && \ + [ "${DEFAULT_ABI}" != "amd64" ]; then + eerror "This ebuild doesn't currently support changing your default ABI" + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}" + fi + + if use kernel_linux && kernel_is ge 5 3; then + ewarn "Gentoo supports kernels which are supported by NVIDIA" + ewarn "which are limited to the following kernels:" + ewarn "<sys-kernel/gentoo-sources-5.3" + ewarn "<sys-kernel/vanilla-sources-5.3" + ewarn "" + ewarn "You are free to utilize epatch_user to provide whatever" + ewarn "support you feel is appropriate, but will not receive" + ewarn "support as a result of those changes." + ewarn "" + ewarn "Do not file a bug report about this." + ewarn "" + fi + + # Since Nvidia ships many different series of drivers, we need to give the user + # some kind of guidance as to what version they should install. This tries + # to point the user in the right direction but can't be perfect. check + # nvidia-driver.eclass + nvidia-driver-check-warning + + # Kernel features/options to check for + # SDS + # CONFIG_CHECK="!DEBUG_MUTEXES !I2C_NVIDIA_GPU ~!LOCKDEP ~MTRR ~SYSVIPC ~ZONE_DMA" + # EDS + + # Now do the above checks + use kernel_linux && check_extra_config +} + +pkg_pretend() { + nvidia_drivers_versions_check +} + +pkg_setup() { + nvidia_drivers_versions_check + + # try to turn off distcc and ccache for people that have a problem with it + export DISTCC_DISABLE=1 + export CCACHE_DISABLE=1 + + if use driver && use kernel_linux; then + MODULE_NAMES="nvidia(video:${S}/kernel)" + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)" + use kms && MODULE_NAMES+=" nvidia-modeset(video:${S}/kernel) nvidia-drm(video:${S}/kernel)" + + # This needs to run after MODULE_NAMES (so that the eclass checks + # whether the kernel supports loadable modules) but before BUILD_PARAMS + # is set (so that KV_DIR is populated). + linux-mod_pkg_setup + + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \ + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1" + + # linux-mod_src_compile calls set_arch_to_kernel, which + # sets the ARCH to x86 but NVIDIA's wrapping Makefile + # expects x86_64 or i386 and then converts it to x86 + # later on in the build process + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')" + fi + + if use kernel_linux && kernel_is lt 2 6 9; then + eerror "You must build this against 2.6.9 or higher kernels." + fi + + # set variables to where files are in the package structure + if use kernel_FreeBSD; then + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}" + NV_DOC="${S}/doc" + NV_OBJ="${S}/obj" + NV_SRC="${S}/src" + NV_MAN="${S}/x11/man" + NV_X11="${S}/obj" + NV_SOVER=1 + elif use kernel_linux; then + NV_DOC="${S}" + NV_OBJ="${S}" + NV_SRC="${S}/kernel" + NV_MAN="${S}" + NV_X11="${S}" + NV_SOVER=${PV} + else + die "Could not determine proper NVIDIA package" + fi +} + +src_configure() { + tc-export AR CC LD + + default +} + +src_prepare() { + local man_file + for man_file in "${NV_MAN}"/*1.gz; do + gunzip $man_file || die + done + + if use tools; then + cp "${FILESDIR}"/nvidia-settings-linker.patch "${WORKDIR}" || die + sed -i \ + -e "s:@PV@:${PV}:g" \ + "${WORKDIR}"/nvidia-settings-linker.patch || die + eapply "${WORKDIR}"/nvidia-settings-linker.patch + fi + + default + + if ! [ -f nvidia_icd.json ]; then + cp nvidia_icd.json.template nvidia_icd.json || die + sed -i -e 's:__NV_VK_ICD__:libGLX_nvidia.so.0:g' nvidia_icd.json || die + fi +} + +src_compile() { + cd "${NV_SRC}" + if use kernel_FreeBSD; then + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \ + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die + elif use driver && use kernel_linux; then + BUILD_TARGETS=module linux-mod_src_compile \ + KERNELRELEASE="${KV_FULL}" \ + src="${KERNEL_DIR}" + fi + + if use tools; then + emake -C "${S}"/nvidia-settings-${PV}/src/libXNVCtrl \ + DO_STRIP= \ + LIBDIR="$(get_libdir)" \ + NVLD="$(tc-getLD)" \ + NV_VERBOSE=1 \ + OUTPUTDIR=. \ + RANLIB="$(tc-getRANLIB)" + + emake -C "${S}"/nvidia-settings-${PV}/src \ + DO_STRIP= \ + GTK3_AVAILABLE=$(usex gtk3 1 0) \ + LIBDIR="$(get_libdir)" \ + NVLD="$(tc-getLD)" \ + NVML_ENABLED=0 \ + NV_USE_BUNDLED_LIBJANSSON=0 \ + NV_VERBOSE=1 \ + OUTPUTDIR=. + fi +} + +# Install nvidia library: +# the first parameter is the library to install +# the second parameter is the provided soversion +# the third parameter is the target directory if it is not /usr/lib +donvidia() { + # Full path to library + nv_LIB="${1}" + + # SOVER to use + nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})" + + # Where to install + nv_DEST="${2}" + + # Get just the library name + nv_LIBNAME=$(basename "${nv_LIB}") + + if [[ "${nv_DEST}" ]]; then + exeinto ${nv_DEST} + action="doexe" + else + nv_DEST="/usr/$(get_libdir)" + action="dolib.so" + fi + + # Install the library + ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}" + + # If the library has a SONAME and SONAME does not match the library name, + # then we need to create a symlink + if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} \ + || die "failed to create ${nv_DEST}/${nv_SOVER} symlink" + fi + + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} \ + || die "failed to create ${nv_LIBNAME/.so*/.so} symlink" +} + +src_install() { + if use driver && use kernel_linux; then + linux-mod_src_install + + # Add the aliases + # This file is tweaked with the appropriate video group in + # pkg_preinst, see bug #491414 + insinto /etc/modprobe.d + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf + if use uvm; then + doins "${FILESDIR}"/nvidia-rmmod.conf + udev_newrules "${FILESDIR}"/nvidia-uvm.udev-rule 99-nvidia-uvm.rules + else + sed -e 's|nvidia-uvm ||g' "${FILESDIR}"/nvidia-rmmod.conf \ + > "${T}"/nvidia-rmmod.conf || die + doins "${T}"/nvidia-rmmod.conf + fi + + # Ensures that our device nodes are created when not using X + exeinto "$(get_udevdir)" + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules + elif use kernel_FreeBSD; then + if use x86-fbsd; then + insinto /boot/modules + doins "${S}/src/nvidia.kld" + fi + + exeinto /boot/modules + doexe "${S}/src/nvidia.ko" + fi + + # NVIDIA kernel <-> userspace driver config lib + donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER} + + # NVIDIA framebuffer capture library + donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER} + + # NVIDIA video encode/decode <-> CUDA + if use kernel_linux; then + donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER} + donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER} + fi + + if use X; then + # Xorg DDX driver + insinto /usr/$(get_libdir)/xorg/modules/drivers + doins ${NV_X11}/nvidia_drv.so + + # Xorg GLX driver + donvidia ${NV_X11}/libglxserver_nvidia.so.${NV_SOVER} \ + /usr/$(get_libdir)/xorg/modules/extensions + + # Xorg nvidia.conf + if has_version '>=x11-base/xorg-server-1.16'; then + insinto /usr/share/X11/xorg.conf.d + newins {,50-}nvidia-drm-outputclass.conf + fi + + insinto /usr/share/glvnd/egl_vendor.d + doins ${NV_X11}/10_nvidia.json + fi + + if use wayland; then + insinto /usr/share/egl/egl_external_platform.d + doins ${NV_X11}/10_nvidia_wayland.json + fi + + # OpenCL ICD for NVIDIA + if use kernel_linux; then + insinto /etc/OpenCL/vendors + doins ${NV_OBJ}/nvidia.icd + fi + + # Helper Apps + exeinto /opt/bin/ + + if use X; then + doexe ${NV_OBJ}/nvidia-xconfig + + insinto /etc/vulkan/icd.d + doins nvidia_icd.json + fi + + if use kernel_linux; then + doexe ${NV_OBJ}/nvidia-cuda-mps-control + doexe ${NV_OBJ}/nvidia-cuda-mps-server + doexe ${NV_OBJ}/nvidia-debugdump + doexe ${NV_OBJ}/nvidia-persistenced + doexe ${NV_OBJ}/nvidia-smi + + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092) + doexe ${NV_OBJ}/nvidia-modprobe + fowners root:video /opt/bin/nvidia-modprobe + fperms 4710 /opt/bin/nvidia-modprobe + dosym /{opt,usr}/bin/nvidia-modprobe + + doman nvidia-cuda-mps-control.1 + doman nvidia-modprobe.1 + doman nvidia-persistenced.1 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced + fi + + if use tools; then + emake -C "${S}"/nvidia-settings-${PV}/src/ \ + DESTDIR="${D}" \ + DO_STRIP= \ + GTK3_AVAILABLE=$(usex gtk3 1 0) \ + LIBDIR="${D}/usr/$(get_libdir)" \ + NV_USE_BUNDLED_LIBJANSSON=0 \ + NV_VERBOSE=1 \ + OUTPUTDIR=. \ + PREFIX=/usr \ + install + + if use static-libs; then + dolib.a "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/libXNVCtrl.a + + insinto /usr/include/NVCtrl + doins "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/*.h + fi + + insinto /usr/share/nvidia/ + doins nvidia-application-profiles-${PV}-key-documentation + + insinto /etc/nvidia + newins \ + nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc + + # There is no icon in the FreeBSD tarball. + use kernel_FreeBSD || \ + doicon ${NV_OBJ}/nvidia-settings.png + + domenu "${FILESDIR}"/nvidia-settings.desktop + + exeinto /etc/X11/xinit/xinitrc.d + newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings + fi + + dobin ${NV_OBJ}/nvidia-bug-report.sh + + if has_multilib_profile && use multilib; then + local OABI=${ABI} + for ABI in $(get_install_abis); do + src_install-libs + done + ABI=${OABI} + unset OABI + else + src_install-libs + fi + + is_final_abi || die "failed to iterate through all ABIs" + + # Documentation + if use kernel_FreeBSD; then + dodoc "${NV_DOC}/README" + use X && doman "${NV_MAN}"/nvidia-xconfig.1 + use tools && doman "${NV_MAN}"/nvidia-settings.1 + else + # Docs + newdoc "${NV_DOC}/README.txt" README + dodoc "${NV_DOC}/NVIDIA_Changelog" + doman "${NV_MAN}"/nvidia-smi.1 + use X && doman "${NV_MAN}"/nvidia-xconfig.1 + use tools && doman "${NV_MAN}"/nvidia-settings.1 + doman "${NV_MAN}"/nvidia-cuda-mps-control.1 + fi + + readme.gentoo_create_doc + + docinto html + dodoc -r ${NV_DOC}/html/* +} + +src_install-libs() { + local inslibdir=$(get_libdir) + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib" + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia" + local nv_libdir="${NV_OBJ}" + + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then + nv_libdir="${NV_OBJ}"/32 + fi + + if use X; then + NV_GLX_LIBRARIES=( + "libEGL.so.$( [[ ${ABI} == "amd64" ]] && usex compat ${NV_SOVER} 1.1.0 || echo 1.1.0) ${GL_ROOT}" + "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGL.so.1.7.0 ${GL_ROOT}" + "libGLESv1_CM.so.1.2.0 ${GL_ROOT}" + "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLESv2.so.2.1.0 ${GL_ROOT}" + "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLX.so.0 ${GL_ROOT}" + "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}" + "libGLdispatch.so.0 ${GL_ROOT}" + "libOpenCL.so.1.0.0 ${CL_ROOT}" + "libOpenGL.so.0 ${GL_ROOT}" + "libcuda.so.${NV_SOVER}" + "libnvcuvid.so.${NV_SOVER}" + "libnvidia-compiler.so.${NV_SOVER}" + "libnvidia-eglcore.so.${NV_SOVER}" + "libnvidia-encode.so.${NV_SOVER}" + "libnvidia-fatbinaryloader.so.${NV_SOVER}" + "libnvidia-fbc.so.${NV_SOVER}" + "libnvidia-glcore.so.${NV_SOVER}" + "libnvidia-glsi.so.${NV_SOVER}" + "libnvidia-glvkspirv.so.${NV_SOVER}" + "libnvidia-ifr.so.${NV_SOVER}" + "libnvidia-opencl.so.${NV_SOVER}" + "libnvidia-ptxjitcompiler.so.${NV_SOVER}" + "libvdpau_nvidia.so.${NV_SOVER}" + ) + + if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]]; + then + NV_GLX_LIBRARIES+=( + "libnvidia-egl-wayland.so.1.1.3" + ) + fi + + if use kernel_FreeBSD; then + NV_GLX_LIBRARIES+=( + "libnvidia-tls.so.${NV_SOVER}" + ) + fi + + if use kernel_linux; then + NV_GLX_LIBRARIES+=( + "libnvidia-ml.so.${NV_SOVER}" + "libnvidia-tls.so.${NV_SOVER}" + ) + fi + + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]]; + then + NV_GLX_LIBRARIES+=( + "libnvidia-cbl.so.${NV_SOVER}" + "libnvidia-rtcore.so.${NV_SOVER}" + "libnvoptix.so.${NV_SOVER}" + ) + fi + + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do + donvidia "${nv_libdir}"/${NV_LIB} + done + fi +} + +pkg_preinst() { + if use driver && use kernel_linux; then + linux-mod_pkg_preinst + + local videogroup="$(egetent group video | cut -d ':' -f 3)" + if [ -z "${videogroup}" ]; then + eerror "Failed to determine the video group gid" + die "Failed to determine the video group gid" + else + sed -i \ + -e "s:PACKAGE:${PF}:g" \ + -e "s:VIDEOGID:${videogroup}:" \ + "${D}"/etc/modprobe.d/nvidia.conf || die + fi + fi + + # Clean the dynamic libGL stuff's home to ensure + # we dont have stale libs floating around + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/* + fi + # Make sure we nuke the old nvidia-glx's env.d file + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then + rm -f "${ROOT}"/etc/env.d/09nvidia + fi +} + +pkg_postinst() { + use driver && use kernel_linux && linux-mod_pkg_postinst + + # Switch to the nvidia implementation + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia + + readme.gentoo_print_elog + + if ! use X; then + elog "You have elected to not install the X.org driver. Along with" + elog "this the OpenGL libraries and VDPAU libraries were not" + elog "installed. Additionally, once the driver is loaded your card" + elog "and fan will run at max speed which may not be desirable." + elog "Use the 'nvidia-smi' init script to have your card and fan" + elog "speed scale appropriately." + elog + fi + if ! use tools; then + elog "USE=tools controls whether the nvidia-settings application" + elog "is installed. If you would like to use it, enable that" + elog "flag and re-emerge this ebuild. Optionally you can install" + elog "media-video/nvidia-settings" + elog + fi +} + +pkg_prerm() { + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 +} + +pkg_postrm() { + use driver && use kernel_linux && linux-mod_pkg_postrm + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11 +} |