Browse Source

Add older, but stable nvidia-drivers

master
Rafal Kupiec 9 months ago
parent
commit
15361c52c1
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
19 changed files with 792 additions and 0 deletions
  1. +3
    -0
      x11-drivers/nvidia-drivers/Manifest
  2. +1
    -0
      x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist
  3. +2
    -0
      x11-drivers/nvidia-drivers/files/95-nvidia-settings
  4. +2
    -0
      x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1
  5. +14
    -0
      x11-drivers/nvidia-drivers/files/nvidia-169.07
  6. +13
    -0
      x11-drivers/nvidia-drivers/files/nvidia-drivers-440.26-locale.patch
  7. +8
    -0
      x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf
  8. +24
    -0
      x11-drivers/nvidia-drivers/files/nvidia-persistenced.init
  9. +3
    -0
      x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf
  10. +22
    -0
      x11-drivers/nvidia-drivers/files/nvidia-settings-fno-common.patch
  11. +22
    -0
      x11-drivers/nvidia-drivers/files/nvidia-settings-linker.patch
  12. +7
    -0
      x11-drivers/nvidia-drivers/files/nvidia-settings.desktop
  13. +24
    -0
      x11-drivers/nvidia-drivers/files/nvidia-smi.init
  14. +17
    -0
      x11-drivers/nvidia-drivers/files/nvidia-udev.sh
  15. +20
    -0
      x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1
  16. +1
    -0
      x11-drivers/nvidia-drivers/files/nvidia-uvm.udev-rule
  17. +6
    -0
      x11-drivers/nvidia-drivers/files/nvidia.udev-rule
  18. +26
    -0
      x11-drivers/nvidia-drivers/metadata.xml
  19. +577
    -0
      x11-drivers/nvidia-drivers/nvidia-drivers-440.44-r1.ebuild

+ 3
- 0
x11-drivers/nvidia-drivers/Manifest View File

@ -0,0 +1,3 @@
DIST NVIDIA-FreeBSD-x86_64-440.44.tar.gz 82172949 BLAKE2B c276fc42d8bb2c3ea4b84b3f7fc26790d3de526087a01491a9a435b2dde7b8921a01d3fbdbbae8e91f28588093d658a9c3715996b4d8f6e82624823619002dc5 SHA512 c414f368d9b00a71a52e2da4d2b147347966ee17ac2d1142ad368e2211546e29ffa842997350419f17288881879c7c91f069bbdc3192c7e7ce28d1ef45d744a2
DIST NVIDIA-Linux-x86_64-440.44.run 141266881 BLAKE2B bc5ddcf9a6498c14bd9f9421a622bd647e83c8d296953923525680898548012cc9d01d078722a3194b6def5b5a90ed37b2dc08967a9603affabf449dbc87e69d SHA512 c0c0e19cdb82d47575adbcf46e23580977cf7a5097edfb9d76464c2e678a44f556d8c2d0d49515a86b6765f57176460193c6951927e24c278e6a7f411f89f26b
DIST nvidia-settings-440.44.tar.bz2 1128239 BLAKE2B 10c04d6c583b2be7bd40c2b3f90d98476b259d5e40b21a08fd4399771123087933d0a25d0b449096ea4dc54f5a0dde221bb2847742b52e43a2c2db9cd3b9b770 SHA512 e8c87fd260d665588cae707e318e4c7b202c4e41da2e83e58b108e7db6bb5fc907d67390912339c0cc63b8a1c5bc90a9dfa242c9ccaa6270264ac0714dc97622

+ 1
- 0
x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist View File

@ -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*"

+ 2
- 0
x11-drivers/nvidia-drivers/files/95-nvidia-settings View File

@ -0,0 +1,2 @@
#!/bin/sh
/opt/bin/nvidia-settings --load-config-only

+ 2
- 0
x11-drivers/nvidia-drivers/files/95-nvidia-settings-r1 View File

@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/nvidia-settings --load-config-only

+ 14
- 0
x11-drivers/nvidia-drivers/files/nvidia-169.07 View File

@ -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

+ 13
- 0
x11-drivers/nvidia-drivers/files/nvidia-drivers-440.26-locale.patch View File

@ -0,0 +1,13 @@
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -6,6 +6,10 @@
SCRIPTDIR=`dirname $0`
cd $SCRIPTDIR
+# translate_and_compile_header_files() expects the default locale
+# https://bugs.gentoo.org/698238
+export LC_ALL=C
+
CC="$1"
ARCH=$2
ISYSTEM=`$CC -print-file-name=include 2> /dev/null`

+ 8
- 0
x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf View File

@ -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=""

+ 24
- 0
x11-drivers/nvidia-drivers/files/nvidia-persistenced.init View File

@ -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 $?
}

+ 3
- 0
x11-drivers/nvidia-drivers/files/nvidia-rmmod.conf View File

@ -0,0 +1,3 @@
# Nvidia UVM support
remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia

+ 22
- 0
x11-drivers/nvidia-drivers/files/nvidia-settings-fno-common.patch View File

@ -0,0 +1,22 @@
--- a/nvidia-settings-@PV@/src/gtk+-2.x/ctkvdpau.c
+++ b/nvidia-settings-@PV@/src/gtk+-2.x/ctkvdpau.c
@@ -103,6 +103,8 @@
const gchar* __video_mixer_attribute_help =
"This shows the video mixer attributes and any applicable ranges.";
+struct VDPAUDeviceImpl VDPAUDeviceFunctions;
+
static int queryOutputSurface(CtkVDPAU *ctk_vdpau, VdpDevice device,
VdpGetProcAddress *getProcAddress);
--- a/nvidia-settings-@PV@/src/gtk+-2.x/ctkvdpau.h
+++ b/nvidia-settings-@PV@/src/gtk+-2.x/ctkvdpau.h
@@ -46,7 +46,7 @@
(G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_VDPAU, CtkVDPAUClass))
-struct VDPAUDeviceImpl {
+extern struct VDPAUDeviceImpl {
VdpGetErrorString *GetErrorString;
VdpGetProcAddress *GetProcAddress;

+ 22
- 0
x11-drivers/nvidia-drivers/files/nvidia-settings-linker.patch View File

@ -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 \

+ 7
- 0
x11-drivers/nvidia-drivers/files/nvidia-settings.desktop View File

@ -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;

+ 24
- 0
x11-drivers/nvidia-drivers/files/nvidia-smi.init View File

@ -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 $?
}

+ 17
- 0
x11-drivers/nvidia-drivers/files/nvidia-udev.sh View File

@ -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

+ 20
- 0
x11-drivers/nvidia-drivers/files/nvidia-udev.sh-r1 View File

@ -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

+ 1
- 0
x11-drivers/nvidia-drivers/files/nvidia-uvm.udev-rule View File

@ -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'"

+ 6
- 0
x11-drivers/nvidia-drivers/files/nvidia.udev-rule View File

@ -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}"

+ 26
- 0
x11-drivers/nvidia-drivers/metadata.xml View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>jer@gentoo.org</email>
</maintainer>
<longdescription>
Nvidia provides different branches of its drivers for different batches of its
hardware. When maintaining these ebuilds or other ebuilds depending on them,
you will need to keep in mind that the major versions represent these different
branches.
You can use http://www.nvidia.com/Download/Find.aspx to figure out which branch
best matches your hardware.
</longdescription>
<use>
<flag name="X">Install the X.org driver, OpenGL libraries, XvMC libraries, and VDPAU libraries</flag>
<flag name="compat">Install non-GLVND libGL for backwards compatibility</flag>
<flag name="driver">Install the kernel driver module</flag>
<flag name="gtk3">Install nvidia-settings with support for GTK+ 3</flag>
<flag name="kms">Enable support for kernel mode setting (KMS)</flag>
<flag name="libglvnd">Use <pkg>media-libs/libglvnd</pkg> for dispatch</flag>
<flag name="tools">Install additional tools such as nvidia-settings</flag>
<flag name="uvm">Install the Unified Memory kernel module (nvidia-uvm) for sharing memory between CPU and GPU in CUDA programs</flag>
</use>
</pkgmetadata>

+ 577
- 0
x11-drivers/nvidia-drivers/nvidia-drivers-440.44-r1.ebuild View File

@ -0,0 +1,577 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit desktop 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
)
"
EMULTILIB_PKG="true"
KEYWORDS="-* ~amd64"
LICENSE="GPL-2 NVIDIA-r2"
SLOT="0/${PV%.*}"
IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms libglvnd multilib static-libs +tools uvm wayland +X"
REQUIRED_USE="
tools? ( X )
static-libs? ( tools )
"
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? (
!libglvnd? ( >=app-eselect/eselect-opengl-1.0.9 )
libglvnd? (
media-libs/libglvnd[${MULTILIB_USEDEP}]
!app-eselect/eselect-opengl
)
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}/
PATCHES=(
"${FILESDIR}"/${PN}-440.26-locale.patch
)
NV_KV_MAX_PLUS="5.6"
CONFIG_CHECK="!DEBUG_MUTEXES ~!I2C_NVIDIA_GPU ~!LOCKDEP ~MTRR ~SYSVIPC ~ZONE_DMA"
pkg_pretend() {
nvidia-driver_check
}
pkg_setup() {
nvidia-driver_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-fno-common.patch "${WORKDIR}" || die
cp "${FILESDIR}"/nvidia-settings-linker.patch "${WORKDIR}" || die
sed -i \
-e "s:@PV@:${PV}:g" \
"${WORKDIR}"/nvidia-settings-fno-common.patch \
"${WORKDIR}"/nvidia-settings-linker.patch \
|| die
eapply "${WORKDIR}"/nvidia-settings-fno-common.patch
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}
fi
dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so}
}
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
insinto /etc/vulkan/implicit_layer.d
doins nvidia_layers.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)
if use libglvnd; then
local GL_ROOT="/usr/$(get_libdir)"
else
local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
fi
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_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libOpenCL.so.1.0.0 ${CL_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 libglvnd; then
NV_GLX_LIBRARIES+=(
"libEGL.so.$( [[ ${ABI} == "amd64" ]] && usex compat ${NV_SOVER} 1.1.0 || echo 1.1.0) ${GL_ROOT}"
"libGL.so.1.7.0 ${GL_ROOT}"
"libGLESv1_CM.so.1.2.0 ${GL_ROOT}"
"libGLESv2.so.2.1.0 ${GL_ROOT}"
"libGLX.so.0 ${GL_ROOT}"
"libGLdispatch.so.0 ${GL_ROOT}"
"libOpenGL.so.0 ${GL_ROOT}"
)
fi
if use wayland && has_multilib_profile && [[ ${ABI} == "amd64" ]];
then
NV_GLX_LIBRARIES+=(
"libnvidia-egl-wayland.so.1.1.4"
)
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
if ! use libglvnd; then
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
fi
"${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() {
if ! use libglvnd; then
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
fi
}
pkg_postrm() {
use driver && use kernel_linux && linux-mod_pkg_postrm
if ! use libglvnd; then
use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
fi
}

Loading…
Cancel
Save