13 |
13 |
DESCRIPTION="NVIDIA Accelerated Graphics Driver"
|
14 |
14 |
HOMEPAGE="https://www.nvidia.com/download/index.aspx"
|
15 |
15 |
SRC_URI="
|
16 |
|
${NV_URI}Linux-x86_64/${PV}/NVIDIA-Linux-x86_64-${PV}.run
|
|
16 |
amd64? ( ${NV_URI}Linux-x86_64/${PV}/NVIDIA-Linux-x86_64-${PV}.run )
|
|
17 |
arm64? ( ${NV_URI}Linux-aarch64/${PV}/NVIDIA-Linux-aarch64-${PV}.run )
|
17 |
18 |
$(printf "${NV_URI}%s/%s-${PV}.tar.bz2 " \
|
18 |
|
nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})"
|
|
19 |
nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})
|
|
20 |
${NV_URI}NVIDIA-kernel-module-source/NVIDIA-kernel-module-source-${PV}.tar.xz"
|
19 |
21 |
# nvidia-installer is unused but here for GPL-2's "distribute sources"
|
20 |
22 |
S="${WORKDIR}"
|
21 |
23 |
|
22 |
24 |
LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl"
|
23 |
25 |
SLOT="0/${PV%%.*}"
|
24 |
|
KEYWORDS="-* amd64"
|
25 |
|
IUSE="+X abi_x86_32 abi_x86_64 persistenced +static-libs +tools wayland"
|
|
26 |
KEYWORDS="-* amd64 ~arm64"
|
|
27 |
IUSE="+X abi_x86_32 abi_x86_64 kernel-open persistenced +static-libs +tools wayland"
|
|
28 |
REQUIRED_USE="kernel-open? ( modules )"
|
26 |
29 |
|
27 |
30 |
COMMON_DEPEND="
|
28 |
31 |
acct-group/video
|
|
32 |
X? ( x11-libs/libpciaccess )
|
29 |
33 |
persistenced? (
|
30 |
34 |
acct-user/nvpd
|
31 |
35 |
net-libs/libtirpc:=
|
... | ... | |
52 |
56 |
x11-libs/libXext[abi_x86_32(-)?]
|
53 |
57 |
)
|
54 |
58 |
wayland? (
|
55 |
|
~gui-libs/egl-wayland-1.1.7
|
|
59 |
gui-libs/egl-gbm
|
|
60 |
>=gui-libs/egl-wayland-1.1.10
|
56 |
61 |
media-libs/libglvnd
|
57 |
62 |
)"
|
58 |
63 |
DEPEND="
|
... | ... | |
76 |
81 |
QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*"
|
77 |
82 |
|
78 |
83 |
PATCHES=(
|
79 |
|
"${FILESDIR}"/nvidia-drivers-470.141.03-clang15.patch
|
|
84 |
"${FILESDIR}"/nvidia-drivers-525.116.04-clang-unused-option.patch
|
|
85 |
"${FILESDIR}"/nvidia-kernel-module-source-515.86.01-raw-ldflags.patch
|
80 |
86 |
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
|
81 |
87 |
"${FILESDIR}"/nvidia-settings-390.144-desktop.patch
|
82 |
|
"${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch
|
83 |
88 |
"${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch
|
84 |
89 |
)
|
85 |
90 |
|
... | ... | |
90 |
95 |
PROC_FS
|
91 |
96 |
~DRM_KMS_HELPER
|
92 |
97 |
~SYSVIPC
|
93 |
|
~!AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT
|
94 |
98 |
~!LOCKDEP
|
95 |
99 |
~!SLUB_DEBUG_ON
|
96 |
|
~!X86_KERNEL_IBT
|
97 |
100 |
!DEBUG_MUTEXES"
|
98 |
101 |
|
99 |
102 |
local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection
|
... | ... | |
106 |
109 |
this *could* lead to modules load failure with ENDBR errors, or to
|
107 |
110 |
broken CUDA/NVENC. Please ignore if not having issues, but otherwise
|
108 |
111 |
try to unset or pass ibt=off to the kernel's command line." #911142
|
|
112 |
use kernel-open || CONFIG_CHECK+=" ~!X86_KERNEL_IBT"
|
109 |
113 |
|
110 |
114 |
use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764
|
111 |
115 |
|
|
116 |
use kernel-open && CONFIG_CHECK+=" MMU_NOTIFIER" #843827
|
|
117 |
local ERROR_MMU_NOTIFIER="CONFIG_MMU_NOTIFIER: is not set but needed to build with USE=kernel-open.
|
|
118 |
Cannot be directly selected in the kernel's menuconfig, and may need
|
|
119 |
selection of another option that requires it such as CONFIG_KVM."
|
|
120 |
|
112 |
121 |
linux-mod-r1_pkg_setup
|
113 |
122 |
}
|
114 |
123 |
|
... | ... | |
118 |
127 |
rm nvidia-persistenced && mv nvidia-persistenced{-${PV},} || die
|
119 |
128 |
rm nvidia-settings && mv nvidia-settings{-${PV},} || die
|
120 |
129 |
rm nvidia-xconfig && mv nvidia-xconfig{-${PV},} || die
|
|
130 |
mv NVIDIA-kernel-module-source-${PV} kernel-module-source || die
|
121 |
131 |
|
122 |
132 |
default
|
123 |
133 |
|
124 |
134 |
# prevent detection of incomplete kernel DRM support (bug #603818)
|
125 |
135 |
sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \
|
126 |
|
-i kernel/conftest.sh || die
|
|
136 |
-i kernel{,-module-source/kernel-open}/conftest.sh || die
|
127 |
137 |
|
|
138 |
# adjust service files
|
128 |
139 |
sed 's/__USER__/nvpd/' \
|
129 |
140 |
nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \
|
130 |
141 |
> "${T}"/nvidia-persistenced.service || die
|
|
142 |
use !amd64 || sed -i "s|/usr|${EPREFIX}/opt|" systemd/system/nvidia-powerd.service || die
|
131 |
143 |
|
132 |
144 |
# use alternative vulkan icd option if USE=-X (bug #909181)
|
133 |
145 |
use X || sed -i 's/"libGLX/"libEGL/' nvidia_{layers,icd}.json || die
|
... | ... | |
135 |
147 |
# enable nvidia-drm.modeset=1 by default with USE=wayland
|
136 |
148 |
cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die
|
137 |
149 |
use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die
|
|
150 |
|
|
151 |
# makefile attempts to install wayland library even if not built
|
|
152 |
use wayland || sed -i 's/ WAYLAND_LIB_install$//' \
|
|
153 |
nvidia-settings/src/Makefile || die
|
|
154 |
|
|
155 |
# temporary option, nvidia will remove in the future
|
|
156 |
use !kernel-open ||
|
|
157 |
sed -i '/blacklist/a\
|
|
158 |
\
|
|
159 |
# Enable using kernel-open with workstation GPUs (experimental)\
|
|
160 |
options nvidia NVreg_OpenRmEnableUnsupportedGpus=1' "${T}"/nvidia.conf || die
|
138 |
161 |
}
|
139 |
162 |
|
140 |
163 |
src_compile() {
|
... | ... | |
149 |
172 |
PREFIX="${EPREFIX}"/usr
|
150 |
173 |
HOST_CC="$(tc-getBUILD_CC)"
|
151 |
174 |
HOST_LD="$(tc-getBUILD_LD)"
|
|
175 |
BUILD_GTK2LIB=
|
152 |
176 |
NV_USE_BUNDLED_LIBJANSSON=0
|
153 |
177 |
NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out
|
|
178 |
WAYLAND_AVAILABLE=$(usex wayland 1 0)
|
154 |
179 |
XNVCTRL_CFLAGS="${xnvflags}"
|
155 |
180 |
)
|
156 |
181 |
|
157 |
|
local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=video:kernel )
|
158 |
|
local modargs=(
|
159 |
|
IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
|
160 |
|
SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
|
161 |
|
)
|
|
182 |
if use modules; then
|
|
183 |
local o_cflags=${CFLAGS} o_cxxflags=${CXXFLAGS} o_ldflags=${LDFLAGS}
|
162 |
184 |
|
163 |
|
# temporary workaround for bug #914468
|
164 |
|
use modules &&
|
|
185 |
local modlistargs=video:kernel
|
|
186 |
if use kernel-open; then
|
|
187 |
modlistargs+=-module-source:kernel-module-source/kernel-open
|
|
188 |
|
|
189 |
# environment flags are normally unused for modules, but nvidia
|
|
190 |
# uses it for building the "blob" and it is a bit fragile
|
|
191 |
filter-flags -fno-plt #912949
|
|
192 |
filter-lto
|
|
193 |
CC=${KERNEL_CC} CXX=${KERNEL_CXX} strip-unsupported-flags
|
|
194 |
fi
|
|
195 |
|
|
196 |
local modlist=( nvidia{,-drm,-modeset,-peermem,-uvm}=${modlistargs} )
|
|
197 |
local modargs=(
|
|
198 |
IGNORE_CC_MISMATCH=yes NV_VERBOSE=1
|
|
199 |
SYSOUT="${KV_OUT_DIR}" SYSSRC="${KV_DIR}"
|
|
200 |
)
|
|
201 |
|
|
202 |
# temporary workaround for bug #914468
|
165 |
203 |
CPP="${KERNEL_CC} -E" tc-is-clang && addpredict "${KV_OUT_DIR}"
|
166 |
204 |
|
167 |
|
linux-mod-r1_src_compile
|
|
205 |
linux-mod-r1_src_compile
|
|
206 |
CFLAGS=${o_cflags} CXXFLAGS=${o_cxxflags} LDFLAGS=${o_ldflags}
|
|
207 |
fi
|
|
208 |
|
168 |
209 |
emake "${NV_ARGS[@]}" -C nvidia-modprobe
|
169 |
210 |
use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced
|
170 |
211 |
use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig
|
... | ... | |
174 |
215 |
CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \
|
175 |
216 |
emake "${NV_ARGS[@]}" -C nvidia-settings
|
176 |
217 |
elif use static-libs; then
|
177 |
|
emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a
|
|
218 |
# pretend GTK+3 is available, not actually used (bug #880879)
|
|
219 |
emake "${NV_ARGS[@]}" BUILD_GTK3LIB=1 \
|
|
220 |
-C nvidia-settings/src out/libXNVCtrl.a
|
178 |
221 |
fi
|
179 |
222 |
}
|
180 |
223 |
|
... | ... | |
188 |
231 |
[CUDA_ICD]=/etc/OpenCL/vendors
|
189 |
232 |
[EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d
|
190 |
233 |
[FIRMWARE]=/lib/firmware/nvidia/${PV}
|
|
234 |
[GBM_BACKEND_LIB_SYMLINK]=/usr/${libdir}/gbm
|
191 |
235 |
[GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d
|
192 |
236 |
[VULKAN_ICD_JSON]=/usr/share/vulkan
|
193 |
237 |
[WINE_LIB]=/usr/${libdir}/nvidia/wine
|
... | ... | |
199 |
243 |
)
|
200 |
244 |
|
201 |
245 |
local skip_files=(
|
202 |
|
$(usev !X "libGLX_nvidia libglxserver_nvidia libnvidia-ifr")
|
|
246 |
$(usev !X "libGLX_nvidia libglxserver_nvidia")
|
203 |
247 |
$(usev !wayland libnvidia-vulkan-producer)
|
204 |
248 |
libGLX_indirect # non-glvnd unused fallback
|
205 |
|
libnvidia-gtk nvidia-{settings,xconfig} # built from source
|
|
249 |
libnvidia-{gtk,wayland-client} nvidia-{settings,xconfig} # from source
|
|
250 |
libnvidia-egl-gbm 15_nvidia_gbm # gui-libs/egl-gbm
|
206 |
251 |
libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland
|
207 |
252 |
)
|
208 |
253 |
local skip_modules=(
|
... | ... | |
213 |
258 |
local skip_types=(
|
214 |
259 |
GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd
|
215 |
260 |
OPENCL_WRAPPER.\* # virtual/opencl
|
216 |
|
DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused
|
|
261 |
DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF SYSTEMD_UNIT # handled separately / unused
|
217 |
262 |
)
|
218 |
263 |
|
219 |
264 |
local DOCS=(
|
... | ... | |
307 |
352 |
gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert
|
308 |
353 |
continue
|
309 |
354 |
;;
|
|
355 |
GBM_BACKEND_LIB_SYMLINK) m[4]=../${m[4]};; # missing ../
|
310 |
356 |
VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/
|
311 |
357 |
esac
|
312 |
358 |
|
... | ... | |
330 |
376 |
dosym ${m[4]} ${into}/${m[0]}
|
331 |
377 |
continue
|
332 |
378 |
fi
|
333 |
|
[[ ${m[0]} =~ ^libnvidia-ngx.so ]] &&
|
|
379 |
[[ ${m[0]} =~ ^libnvidia-ngx.so|^libnvidia-egl-gbm.so ]] &&
|
334 |
380 |
dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest
|
335 |
381 |
|
336 |
382 |
printf -v m[1] %o $((m[1] | 0200)) # 444->644
|
... | ... | |
349 |
395 |
|
350 |
396 |
dobin nvidia-bug-report.sh
|
351 |
397 |
|
|
398 |
# MODULE:powerd extras
|
|
399 |
if use amd64; then
|
|
400 |
systemd_dounit systemd/system/nvidia-powerd.service
|
|
401 |
|
|
402 |
insinto /usr/share/dbus-1/system.d
|
|
403 |
doins nvidia-dbus.conf
|
|
404 |
fi
|
|
405 |
|
352 |
406 |
# symlink non-versioned so nvidia-settings can use it even if misdetected
|
353 |
407 |
dosym nvidia-application-profiles-${PV}-key-documentation \
|
354 |
408 |
${paths[APPLICATION_PROFILE]}/nvidia-application-profiles-key-documentation
|
... | ... | |
429 |
483 |
ewarn "[2] https://wiki.gentoo.org/wiki/Nouveau"
|
430 |
484 |
fi
|
431 |
485 |
|
|
486 |
if use kernel-open; then
|
|
487 |
ewarn
|
|
488 |
ewarn "Open source variant of ${PN} was selected, be warned it is experimental"
|
|
489 |
ewarn "and only for modern GPUs (e.g. GTX 1650+). Try to disable if run into issues."
|
|
490 |
ewarn "Please also see: ${EROOT}/usr/share/doc/${PF}/html/kernel_open.html"
|
|
491 |
fi
|
|
492 |
|
432 |
493 |
if use wayland && use modules && [[ ! -v NV_HAD_WAYLAND ]]; then
|
433 |
494 |
elog
|
434 |
495 |
elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1"
|
... | ... | |
437 |
498 |
elog
|
438 |
499 |
elog "If you experience issues, either disable wayland or edit nvidia.conf."
|
439 |
500 |
elog "Of note, may possibly cause issues with SLI and Reverse PRIME."
|
440 |
|
elog
|
441 |
|
elog "This version of ${PN} only supports EGLStream which is only"
|
442 |
|
elog "supported by a few wayland compositors (e.g. kwin / mutter, not sway),"
|
443 |
|
elog "and is barely tested (X11 is recommended for this legacy branch)."
|
444 |
501 |
fi
|
445 |
502 |
}
|