nvidia-drivers updated: FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'cpu_tlbstate'

This commit is contained in:
Kolan Sh 2018-01-03 19:14:09 +03:00
parent adac7da1b4
commit 2ebc305ce4
6 changed files with 625 additions and 4 deletions

View File

@ -1,4 +1,10 @@
DIST NVIDIA-FreeBSD-x86-331.113.tar.gz 56371300 SHA256 f3b4b5ddf5977223646d2cdb0617ea8a5f667814ca23b29cb225c5685eacd9d7 SHA512 5c45142807a5b8ecb5e037921e4e449f4710a65358579087429e14ee50124863e6a65fbf8cc73efec22bd8ca85d3eb5a815c7301403dd3236e0bb0b177e5f3e8 WHIRLPOOL 97240066b1c45c887770bfe8539b733a2957fdc1511af5b08de4149b0ce9fedc87b6aa8ee8d243793d225c98c09681e4cca93dd1c5f601389637644e659d7863
DIST NVIDIA-FreeBSD-x86-387.34.tar.gz 64228643 SHA256 b9d7a84f3466142ea55410c95220fe1a3f885e1892a44f219f7e7fd0fac9fb63 SHA512 875648459a149d506b20eb7105e73086e1fb51dddfbd8b484b8cc4793682c088ba16b3d374b0e807738f7aa7489dd9eab2449f70bc9feefeec0bf3a88025b9ef WHIRLPOOL 499dd44f346a582b17082370a3e797cd2029680c88b79b711ed7f419bc33db3f43fe27ddd6f2c0fed3a46decb5edbada7e61858c307ab36829aa9edd7100f8a8
DIST NVIDIA-FreeBSD-x86_64-331.113.tar.gz 47509194 SHA256 c848e187c79064ea3f52406312aa09d06f0aaef5063be7522b2b2319c43c872c SHA512 4e206719afcee47179e0756ac67fc4e61d513efb1cd0264b28726d6de16846feee873a2df362bf645b0527d395b6d82f5b54dbc447bccb74128d7bff37bb7b1b WHIRLPOOL a51b0bd9f7301d9bb76b54ffa44337ad4d875125281c4b9921e66a76d434879832f542df9c6ba436ef83fb3fa0afe5197f3425f1b7aa16274aca5080259f343d
DIST NVIDIA-FreeBSD-x86_64-387.34.tar.gz 63387097 SHA256 6e811eadcf3738847d929f75308b3b0a9a7e39744537feb10aa88086a9cfb68e SHA512 0a905ee72ee6f4e9c941e5dd1f7cddf96bfb20c6da32fd05599258e1bb154f68463d775ba8ff4f67f0d4b8e637e9ed9624fc9a4873a1f2621dc86732f0d6d70d WHIRLPOOL 38b5482a6836587f345a1e47ad34b14b9611a9aaa2402ae4d0d7a4ee9751ed6993cc3130333c3fd31d40a329bcb6f39c708c19ed5a9267b81edc6f6cc28c6b98
DIST NVIDIA-Linux-armv7l-gnueabihf-387.34.run 29406773 SHA256 af07c82e4bb58e26704f61a946feca880fd0ea0dc9ab90f39820ad627d73922a SHA512 cb631dc3b851d84881dfcabee776c68a935853d03f21595acfea84a3efbc85276070f9d0958c0bcced1e66f42f25ecf3fd7d615c715274130ca24426da678c2e WHIRLPOOL eb9bdda770bc68a6140d13c811eb372c874a35eb7206a1e869d4b43207afbca854fe9318f701dadc35d3f9954bcf112b232fbbe5f302ffaf7afd814ec7a00611
DIST NVIDIA-Linux-x86-331.113.run 37300924 SHA256 42535a99ab68452d30d9c3fad2fb162db01d1f6821115a3c1733ed203efd588b SHA512 bc820609e0379cc5805a5428cc364795b8a5d9e5a2a4395a1ddaa1dda85e6acc59368f87f5974a39fb42bd272458627b2c742fbf1f7fedddb17102439883b111 WHIRLPOOL 1d7b5cb8be5bb76dbe1b238aab4e39ccda0e5b07da268f0652966e79d5e0d2192773316d8f22a2d6a551305b17b610242918822e94e43263c9dbfba8a48bf49b
DIST NVIDIA-Linux-x86-387.34.run 47797853 SHA256 b8babd2c7128233d83cc3bae0ee04c80580e9098849864e7b9bc3217609958c1 SHA512 ba9362123a75f85a0a5a9dcc95c06bcb350a8dff2db864db30a73172db44006fa39eee8e23cf959ab2012b61b922d1f0d7ab225329815737819f27d1be300b95 WHIRLPOOL 0a12b975a5e6b104024caf97ce45632d6e6c8f22469bd26d7ceecb7519cbd0db8b46e11c78e508ec7aaa9afea8e1bcdcf0be2e3e0857f943f8ca25837ee76cf8
DIST NVIDIA-Linux-x86_64-331.113.run 60509547 SHA256 e9d5eb4394ef31825f7a86290b19b522851d1b599284095d81bac0f33a996219 SHA512 f71f3d20016bebe4e7f83704a7539f0d53c92a2598a34f9f48ad421e5743ef554aa97315f2a762f132b730b1f37c5811aa617fed3c5a90d3e2e9cc5320e366b7 WHIRLPOOL 2f06c45cb4750eb5c7d6a2ff4e4c3abaf813df135da13691f30238baf89c2fa1477d5694088f268d8681cf719889b9e2644fc1d707785113703cd2e4d7c0b27f
DIST NVIDIA-Linux-x86_64-387.34.run 82784271 SHA256 e48f9368a31204c8125428eaee4f1bb7c2988414689faeccaf1e90050d6f881b SHA512 6742768f1258a028c9ba56ad1d72f27d7eea4b6bfd324ba29c7f057ab5819816bd728aeaf2a8058031dadcd4c51bc6d08f0e0e0e26c68ed57955e90d68ac5a4b WHIRLPOOL 549e67b1a6c3d4e1c747a2b198a2a3d16816e26c11157d0699e29175f4f7915b4c2bd9b07e169eae1a253792422f898efc7a40d10daf80c24b199302455483a7
DIST nvidia-settings-387.34.tar.gz 1267616 SHA256 552df1728811280e97d080f9427676f9d55683a0dd107563409c20858cc3e63e SHA512 559c859c0740575ab93edce013587250b98d7d2cd55198b5103fe97423d31ed9f113d83c240c402404de88074c285a07e46342538610d3d5dade7bed59d60090 WHIRLPOOL cbddf1ff4f50d03211e3964c5d39e7f2e179981527aa28db0dd32a3dfb1a6e45d16dfdf9e1f3d85a1df9411543d8b35fa877f93802982d63b9e5ed9a0cdd025e

View File

@ -0,0 +1,11 @@
--- a/kernel/nvidia/nv-frontend.c
+++ b/kernel/nvidia/nv-frontend.c
@@ -15,7 +15,7 @@
#include "nv-frontend.h"
#if defined(MODULE_LICENSE)
-MODULE_LICENSE("NVIDIA");
+MODULE_LICENSE("GPL");
#endif
#if defined(MODULE_INFO)
MODULE_INFO(supported, "external");

View File

@ -0,0 +1,22 @@
--- a/nvidia-settings-387.34/utils.mk
+++ b/nvidia-settings-387.34/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-387.34/src/libXNVCtrl/utils.mk
+++ b/nvidia-settings-387.34/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 \

View File

@ -1,7 +1,6 @@
#!/sbin/runscript
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init,v 1.2 2014/09/19 22:09:28 jer Exp $
pidfile="/var/run/nvidia-persistenced/nvidia-persistenced.pid"

View File

@ -1,7 +1,6 @@
#!/sbin/runscript
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/nvidia-smi.init,v 1.2 2013/05/09 16:32:00 jer Exp $
pidfile="/run/nvidia-smi.pid"

View File

@ -0,0 +1,584 @@
# Copyright 1999-2017 Gentoo Foundation
# 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
NV_URI="http://http.download.nvidia.com/XFree86/"
X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
ARM_NV_PACKAGE="NVIDIA-Linux-armv7l-gnueabihf-${PV}"
X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
HOMEPAGE="http://www.nvidia.com/ http://www.nvidia.com/Download/Find.aspx"
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 )
arm? ( ${NV_URI}Linux-32bit-ARM/${PV}/${ARM_NV_PACKAGE}.run )
x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
tools? (
https://github.com/NVIDIA/nvidia-settings/archive/${PV}.tar.gz -> nvidia-settings-${PV}.tar.gz
)
"
LICENSE="GPL-2 NVIDIA-r2"
SLOT="0/${PV%.*}"
KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
RESTRICT="bindist mirror"
EMULTILIB_PKG="true"
IUSE="acpi compat +driver gtk3 kernel_FreeBSD kernel_linux +kms multilib pax_kernel 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? (
>=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.19.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 4 15; then
ewarn "Gentoo supports kernels which are supported by NVIDIA"
ewarn "which are limited to the following kernels:"
ewarn "<sys-kernel/gentoo-sources-4.15"
ewarn "<sys-kernel/vanilla-sources-4.15"
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
CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
use x86 && CONFIG_CHECK+=" ~HIGHMEM"
# 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 x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
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_prepare() {
if use pax_kernel; then
ewarn "Using PAX patches is not supported. You will be asked to"
ewarn "use a standard kernel should you have issues. Should you"
ewarn "need support with these patches, contact the PaX team."
eapply "${FILESDIR}"/${PN}-375.20-pax.patch
fi
local man_file
for man_file in "${NV_MAN}"/*1.gz; do
gunzip $man_file || die
done
use tools && eapply "${FILESDIR}"/${P}-linker.patch
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
if use kernel_linux && kernel_is ge 4 14 11; then
eapply "${FILESDIR}"/${P}-gpl.patch
fi
}
src_compile() {
# This is already the default on Linux, as there's no toplevel Makefile, but
# on FreeBSD there's one and triggers the kernel module build, as we install
# it by itself, pass this.
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
MAKEOPTS=-j1 linux-mod_src_compile
fi
if use tools; then
emake -C "${S}"/nvidia-settings-${PV}/src \
AR="$(tc-getAR)" \
CC="$(tc-getCC)" \
DO_STRIP= \
LD="$(tc-getCC)" \
LIBDIR="$(get_libdir)" \
NVLD="$(tc-getLD)" \
NV_VERBOSE=1 \
RANLIB="$(tc-getRANLIB)" \
build-xnvctrl
emake -C "${S}"/nvidia-settings-${PV}/src \
CC="$(tc-getCC)" \
DO_STRIP= \
GTK3_AVAILABLE=$(usex gtk3 1 0) \
LD="$(tc-getCC)" \
LIBDIR="$(get_libdir)" \
NVLD="$(tc-getLD)" \
NVML_ENABLED=0 \
NV_USE_BUNDLED_LIBJANSSON=0 \
NV_VERBOSE=1
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
doins "${FILESDIR}"/nvidia-rmmod.conf
# 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}/libglx.so.${NV_SOVER} \
/usr/$(get_libdir)/opengl/nvidia/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
# 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
docinto html
dodoc -r ${NV_DOC}/html/*
# 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}" \
GTK3_AVAILABLE=$(usex gtk3 1 0) \
LIBDIR="${D}/usr/$(get_libdir)" \
NV_USE_BUNDLED_LIBJANSSON=0 \
NV_VERBOSE=1 \
PREFIX=/usr \
DO_STRIP= \
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"
readme.gentoo_create_doc
}
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.$(usex compat ${NV_SOVER} 1) ${GL_ROOT}"
"libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libGL.so.$(usex compat ${NV_SOVER} 1.0.0) ${GL_ROOT}"
"libGLESv1_CM.so.1 ${GL_ROOT}"
"libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
"libGLESv2.so.2 ${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-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.0.2"
)
fi
if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
then
NV_GLX_LIBRARIES+=(
"libnvidia-wfb.so.${NV_SOVER}"
)
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}"
"tls/libnvidia-tls.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
}