1 |
commit: c893d279fc7c9850d39570c7de0efcd3ce6ac317 |
2 |
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 20 22:34:42 2022 +0000 |
4 |
Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 20 22:35:45 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c893d279 |
7 |
|
8 |
x11-drivers/nvidia-drivers: add 470.62.20:0/vulkan |
9 |
|
10 |
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org> |
11 |
|
12 |
x11-drivers/nvidia-drivers/Manifest | 1 + |
13 |
.../nvidia-drivers/nvidia-drivers-470.62.20.ebuild | 444 +++++++++++++++++++++ |
14 |
2 files changed, 445 insertions(+) |
15 |
|
16 |
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest |
17 |
index 918169ee56b2..aae3934c075d 100644 |
18 |
--- a/x11-drivers/nvidia-drivers/Manifest |
19 |
+++ b/x11-drivers/nvidia-drivers/Manifest |
20 |
@@ -7,6 +7,7 @@ DIST NVIDIA-Linux-x86-390.147.run 49303088 BLAKE2B 5a3a02b88af1ee8699b0c6c3fa222 |
21 |
DIST NVIDIA-Linux-x86_64-390.147.run 85930997 BLAKE2B a8085c9abc1c31251788a8f5abdc2090c9085b3028e364184244bbf24d822dc3266877c88b30f403507fa2dd511c68ec67e1f188d6b0f1f4d7d792881d5253fc SHA512 0d8bda32e916d71da2ea74bc12a4f3cb0a0c2ddda27511cf3c89bbf4aeb28db68f6b7261639d88dd1c0180b91213c09de930d233158268c5d9ab3b223510e964 |
22 |
DIST NVIDIA-Linux-x86_64-460.91.03.run 178201292 BLAKE2B 4d407b7bb3a99ab71c62c3cd18dc3549c98a24e7af28276e6e6a21dd33efcab017fed3f782f6dfb060c4437cd718f19c2f9900de367cc47bf19fa2718a18ad55 SHA512 4ac11130fe5a8f1c26f459e9c19660b3ff6f23011e9f77b09ca948fc42609e523ecea70d3bf6def50a75b4a3079ab280018753fb6e53875d9bb8093a033e3b70 |
23 |
DIST NVIDIA-Linux-x86_64-470.62.16.run 270377842 BLAKE2B 6f6263a8652c07e8da7dfc6663f31125ecb605620cd2da05e0972c0787cd43f49779b5354c38f55dafe468b7adb5ddccbdad1a5a361a599f26175156aca8410f SHA512 bb541d59eb908d6b2a255f11af01257f34fe4d7e6807ba19de957da8f0a3b428854bf5b97c71134d3a705ea27598fe0b940bd1c4055026bd90ffe04c1880ca9b |
24 |
+DIST NVIDIA-Linux-x86_64-470.62.20.run 271563606 BLAKE2B 3e0e75ce866fff218af1f908adc051b964ceb8c64d0c87132dbd7fd1b82eaf34e2ec8624dab1a0f20041012e5bd7e22a1c1fd99f4fb50aa19d47015b025c8b03 SHA512 023d0b352114310caf6b70d863c5593e4a2b16b78bee08c87d27e48d03f70e63b608f9a6b262c8d8b6fc7450bca7729b34c716ec8b196a0ea72e4686654c3508 |
25 |
DIST NVIDIA-Linux-x86_64-470.94.run 272262854 BLAKE2B 23785ec9d434f48793547a3a0d8708c0928b1926f9d8973d872f1745291095cba494310b2fa25a62f3d29bfb4f660fa1ef78d49da651d8a094a23d64ca110e8a SHA512 b70542af04691da623b494d49fcbd58c58b83388fdb1c7ea6dcc779755b595444a324f613840ccbba0d9029456668376fe6049a3e4496c6054efbbf1e0a59c0f |
26 |
DIST NVIDIA-Linux-x86_64-495.44.run 282259831 BLAKE2B ca11406a5b1b25d9691ec61d4125457c22438b8f0af0651043235f72ee75c4b264cfde7b04840bbec15c22bc5eb657a46326b49941e6c776a8990430cf052818 SHA512 bc9054e6028ba172906e6eb9a0b8f5cfc3ae74d57f3e95e0f9057879e3af07a4b19479e80d81e948872bc47bbd674f77f5f81d4debd2e2c3ce45058cd9211802 |
27 |
DIST NVIDIA-Linux-x86_64-495.46.run 280886811 BLAKE2B 156917245f37a5da9121cf570616d6367eec66998a50136f1db0c521fc725e68db27acd5741a9fc3e3d502a2c7e90ccde68a7e56346cb8f5fc65ea419c2f0576 SHA512 859548fa81478acb994b40434fc85824976b1f83bc15846290898854db84ea3c6550586a1d7e89ff3afa248310d2bcf4d2d52d5d8e91cf74e3f7e4108a7002ad |
28 |
|
29 |
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.20.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.20.ebuild |
30 |
new file mode 100644 |
31 |
index 000000000000..831c5ece32fc |
32 |
--- /dev/null |
33 |
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-470.62.20.ebuild |
34 |
@@ -0,0 +1,444 @@ |
35 |
+# Copyright 1999-2022 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=7 |
39 |
+ |
40 |
+MODULES_OPTIONAL_USE="driver" |
41 |
+inherit desktop flag-o-matic linux-mod multilib readme.gentoo-r1 \ |
42 |
+ systemd toolchain-funcs unpacker |
43 |
+ |
44 |
+NV_KERNEL_MAX="5.15" |
45 |
+NV_URI="https://download.nvidia.com/XFree86/" |
46 |
+NV_PIN="470.86" |
47 |
+ |
48 |
+DESCRIPTION="NVIDIA Accelerated Graphics Driver" |
49 |
+HOMEPAGE="https://developer.nvidia.com/vulkan-driver" |
50 |
+SRC_URI=" |
51 |
+ https://developer.nvidia.com/vulkan-beta-${PV//.}-linux -> NVIDIA-Linux-x86_64-${PV}.run |
52 |
+ $(printf "${NV_URI}%s/%s-${NV_PIN}.tar.bz2 " \ |
53 |
+ nvidia-{installer,modprobe,persistenced,settings,xconfig}{,})" |
54 |
+# nvidia-installer is unused but here for GPL-2's "distribute sources" |
55 |
+S="${WORKDIR}" |
56 |
+ |
57 |
+LICENSE="NVIDIA-r2 BSD BSD-2 GPL-2 MIT ZLIB curl openssl" |
58 |
+SLOT="0/vulkan" |
59 |
+KEYWORDS="-* ~amd64" |
60 |
+IUSE="+X abi_x86_32 abi_x86_64 +driver persistenced static-libs +tools wayland" |
61 |
+ |
62 |
+COMMON_DEPEND=" |
63 |
+ acct-group/video |
64 |
+ persistenced? ( |
65 |
+ acct-user/nvpd |
66 |
+ net-libs/libtirpc:= |
67 |
+ ) |
68 |
+ tools? ( |
69 |
+ dev-libs/atk |
70 |
+ dev-libs/glib:2 |
71 |
+ dev-libs/jansson:= |
72 |
+ media-libs/harfbuzz:= |
73 |
+ x11-libs/cairo |
74 |
+ x11-libs/gdk-pixbuf:2 |
75 |
+ x11-libs/gtk+:3 |
76 |
+ x11-libs/libX11 |
77 |
+ x11-libs/libXext |
78 |
+ x11-libs/libXxf86vm |
79 |
+ x11-libs/pango |
80 |
+ )" |
81 |
+RDEPEND=" |
82 |
+ ${COMMON_DEPEND} |
83 |
+ X? ( |
84 |
+ media-libs/libglvnd[X,abi_x86_32(-)?] |
85 |
+ x11-libs/libX11[abi_x86_32(-)?] |
86 |
+ x11-libs/libXext[abi_x86_32(-)?] |
87 |
+ ) |
88 |
+ wayland? ( |
89 |
+ ~gui-libs/egl-wayland-1.1.7 |
90 |
+ media-libs/libglvnd |
91 |
+ )" |
92 |
+DEPEND=" |
93 |
+ ${COMMON_DEPEND} |
94 |
+ static-libs? ( |
95 |
+ x11-libs/libX11 |
96 |
+ x11-libs/libXext |
97 |
+ ) |
98 |
+ tools? ( |
99 |
+ media-libs/libglvnd |
100 |
+ sys-apps/dbus |
101 |
+ x11-base/xorg-proto |
102 |
+ x11-libs/libXrandr |
103 |
+ x11-libs/libXv |
104 |
+ x11-libs/libvdpau |
105 |
+ )" |
106 |
+BDEPEND=" |
107 |
+ sys-devel/m4 |
108 |
+ virtual/pkgconfig" |
109 |
+ |
110 |
+QA_PREBUILT="lib/firmware/* opt/bin/* usr/lib*" |
111 |
+ |
112 |
+PATCHES=( |
113 |
+ "${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch |
114 |
+ "${FILESDIR}"/nvidia-settings-390.144-desktop.patch |
115 |
+ "${FILESDIR}"/nvidia-settings-390.144-no-gtk2.patch |
116 |
+ "${FILESDIR}"/nvidia-settings-390.144-raw-ldflags.patch |
117 |
+) |
118 |
+ |
119 |
+pkg_setup() { |
120 |
+ use driver || return |
121 |
+ |
122 |
+ local CONFIG_CHECK=" |
123 |
+ PROC_FS |
124 |
+ ~DRM_KMS_HELPER |
125 |
+ ~SYSVIPC |
126 |
+ ~!LOCKDEP |
127 |
+ ~!SLUB_DEBUG_ON |
128 |
+ !DEBUG_MUTEXES" |
129 |
+ local ERROR_DRM_KMS_HELPER="CONFIG_DRM_KMS_HELPER: is not set but needed for Xorg auto-detection |
130 |
+ of drivers (no custom config), and for wayland / nvidia-drm.modeset=1. |
131 |
+ Cannot be directly selected in the kernel's menuconfig, and may need |
132 |
+ selection of a DRM device even if unused, e.g. CONFIG_DRM_AMDGPU=m or |
133 |
+ DRM_I915=y, DRM_NOUVEAU=m also acceptable if a module and not built-in." |
134 |
+ |
135 |
+ use amd64 && kernel_is -ge 5 8 && CONFIG_CHECK+=" X86_PAT" #817764 |
136 |
+ |
137 |
+ MODULE_NAMES=" |
138 |
+ nvidia(video:kernel) |
139 |
+ nvidia-drm(video:kernel) |
140 |
+ nvidia-modeset(video:kernel) |
141 |
+ nvidia-peermem(video:kernel) |
142 |
+ nvidia-uvm(video:kernel)" |
143 |
+ |
144 |
+ linux-mod_pkg_setup |
145 |
+ |
146 |
+ [[ ${MERGE_TYPE} == binary ]] && return |
147 |
+ |
148 |
+ BUILD_PARAMS='NV_VERBOSE=1 IGNORE_CC_MISMATCH=yes SYSSRC="${KV_DIR}" SYSOUT="${KV_OUT_DIR}"' |
149 |
+ BUILD_TARGETS="modules" |
150 |
+ |
151 |
+ if linux_chkconfig_present CC_IS_CLANG; then |
152 |
+ ewarn "Warning: building ${PN} with a clang-built kernel is experimental" |
153 |
+ |
154 |
+ BUILD_PARAMS+=' CC=${CHOST}-clang' |
155 |
+ if linux_chkconfig_present LD_IS_LLD; then |
156 |
+ BUILD_PARAMS+=' LD=ld.lld' |
157 |
+ if linux_chkconfig_present LTO_CLANG_THIN; then |
158 |
+ # kernel enables cache by default leading to sandbox violations |
159 |
+ BUILD_PARAMS+=' ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=' |
160 |
+ fi |
161 |
+ fi |
162 |
+ fi |
163 |
+ |
164 |
+ if kernel_is -gt ${NV_KERNEL_MAX/./ }; then |
165 |
+ ewarn "Kernel ${KV_MAJOR}.${KV_MINOR} is either known to break this version of ${PN}" |
166 |
+ ewarn "or was not tested with it. It is recommended to use one of:" |
167 |
+ ewarn " <=sys-kernel/gentoo-kernel-${NV_KERNEL_MAX}.x" |
168 |
+ ewarn " <=sys-kernel/gentoo-sources-${NV_KERNEL_MAX}.x" |
169 |
+ ewarn "You are free to try or use /etc/portage/patches, but support will" |
170 |
+ ewarn "not be given and issues wait until NVIDIA releases a fixed version." |
171 |
+ ewarn |
172 |
+ ewarn "Do _not_ file a bug report if run into issues." |
173 |
+ ewarn |
174 |
+ fi |
175 |
+} |
176 |
+ |
177 |
+src_prepare() { |
178 |
+ # make patches usable across versions |
179 |
+ rm nvidia-modprobe && mv nvidia-modprobe{-${NV_PIN},} || die |
180 |
+ rm nvidia-persistenced && mv nvidia-persistenced{-${NV_PIN},} || die |
181 |
+ rm nvidia-settings && mv nvidia-settings{-${NV_PIN},} || die |
182 |
+ rm nvidia-xconfig && mv nvidia-xconfig{-${NV_PIN},} || die |
183 |
+ |
184 |
+ default |
185 |
+ |
186 |
+ # prevent detection of incomplete kernel DRM support (bug #603818) |
187 |
+ sed 's/defined(CONFIG_DRM/defined(CONFIG_DRM_KMS_HELPER/g' \ |
188 |
+ -i kernel/conftest.sh || die |
189 |
+ |
190 |
+ sed 's/__USER__/nvpd/' \ |
191 |
+ nvidia-persistenced/init/systemd/nvidia-persistenced.service.template \ |
192 |
+ > "${T}"/nvidia-persistenced.service || die |
193 |
+ |
194 |
+ # enable nvidia-drm.modeset=1 by default with USE=wayland |
195 |
+ cp "${FILESDIR}"/nvidia-470.conf "${T}"/nvidia.conf || die |
196 |
+ use !wayland || sed -i '/^#.*modeset=1$/s/^#//' "${T}"/nvidia.conf || die |
197 |
+} |
198 |
+ |
199 |
+src_compile() { |
200 |
+ tc-export AR CC LD OBJCOPY |
201 |
+ |
202 |
+ NV_ARGS=( |
203 |
+ PREFIX="${EPREFIX}"/usr |
204 |
+ HOST_CC="$(tc-getBUILD_CC)" |
205 |
+ HOST_LD="$(tc-getBUILD_LD)" |
206 |
+ NV_USE_BUNDLED_LIBJANSSON=0 |
207 |
+ NV_VERBOSE=1 DO_STRIP= MANPAGE_GZIP= OUTPUTDIR=out |
208 |
+ ) |
209 |
+ |
210 |
+ use driver && linux-mod_src_compile |
211 |
+ |
212 |
+ emake "${NV_ARGS[@]}" -C nvidia-modprobe |
213 |
+ use persistenced && emake "${NV_ARGS[@]}" -C nvidia-persistenced |
214 |
+ use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig |
215 |
+ |
216 |
+ if use tools; then |
217 |
+ # cflags: avoid noisy logs, only use here and set first to let override |
218 |
+ # ldflags: abi currently needed if LD=ld.lld |
219 |
+ CFLAGS="-Wno-deprecated-declarations ${CFLAGS}" \ |
220 |
+ RAW_LDFLAGS="$(get_abi_LDFLAGS) $(raw-ldflags)" \ |
221 |
+ emake "${NV_ARGS[@]}" -C nvidia-settings |
222 |
+ elif use static-libs; then |
223 |
+ emake "${NV_ARGS[@]}" -C nvidia-settings/src out/libXNVCtrl.a |
224 |
+ fi |
225 |
+} |
226 |
+ |
227 |
+src_install() { |
228 |
+ local libdir=$(get_libdir) libdir32=$(ABI=x86 get_libdir) |
229 |
+ |
230 |
+ NV_ARGS+=( DESTDIR="${D}" LIBDIR="${ED}"/usr/${libdir} ) |
231 |
+ |
232 |
+ local -A paths=( |
233 |
+ [APPLICATION_PROFILE]=/usr/share/nvidia |
234 |
+ [CUDA_ICD]=/etc/OpenCL/vendors |
235 |
+ [EGL_EXTERNAL_PLATFORM_JSON]=/usr/share/egl/egl_external_platform.d |
236 |
+ [FIRMWARE]=/lib/firmware/nvidia/${PV} |
237 |
+ [GLVND_EGL_ICD_JSON]=/usr/share/glvnd/egl_vendor.d |
238 |
+ [VULKAN_ICD_JSON]=/usr/share/vulkan |
239 |
+ [WINE_LIB]=/usr/${libdir}/nvidia/wine |
240 |
+ [XORG_OUTPUTCLASS_CONFIG]=/usr/share/X11/xorg.conf.d |
241 |
+ |
242 |
+ [GLX_MODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules/extensions |
243 |
+ [GLX_MODULE_SYMLINK]=/usr/${libdir}/xorg/modules |
244 |
+ [XMODULE_SHARED_LIB]=/usr/${libdir}/xorg/modules |
245 |
+ ) |
246 |
+ |
247 |
+ local skip_files=( |
248 |
+ $(usex X '' ' |
249 |
+ libGLX_nvidia libglxserver_nvidia |
250 |
+ libnvidia-ifr |
251 |
+ nvidia_icd.json nvidia_layers.json') |
252 |
+ $(usex wayland '' 'libnvidia-vulkan-producer') |
253 |
+ libGLX_indirect # non-glvnd unused fallback |
254 |
+ libnvidia-gtk nvidia-{settings,xconfig} # built from source |
255 |
+ libnvidia-egl-wayland 10_nvidia_wayland # gui-libs/egl-wayland |
256 |
+ ) |
257 |
+ local skip_modules=( |
258 |
+ $(usex X '' 'nvfbc vdpau xdriver') |
259 |
+ $(usex driver '' 'gsp') |
260 |
+ installer nvpd # handled separately / built from source |
261 |
+ ) |
262 |
+ local skip_types=( |
263 |
+ GLVND_LIB GLVND_SYMLINK EGL_CLIENT.\* GLX_CLIENT.\* # media-libs/libglvnd |
264 |
+ OPENCL_WRAPPER.\* # virtual/opencl |
265 |
+ DOCUMENTATION DOT_DESKTOP .\*_SRC DKMS_CONF # handled separately / unused |
266 |
+ ) |
267 |
+ |
268 |
+ local DOCS=( |
269 |
+ README.txt NVIDIA_Changelog supported-gpus/supported-gpus.json |
270 |
+ nvidia-settings/doc/{FRAMELOCK,NV-CONTROL-API}.txt |
271 |
+ ) |
272 |
+ local HTML_DOCS=( html/. ) |
273 |
+ einstalldocs |
274 |
+ |
275 |
+ local DISABLE_AUTOFORMATTING=yes |
276 |
+ local DOC_CONTENTS="\ |
277 |
+Trusted users should be in the 'video' group to use NVIDIA devices. |
278 |
+You can add yourself by using: gpasswd -a my-user video\ |
279 |
+$(usex driver " |
280 |
+ |
281 |
+Like all out-of-tree kernel modules, it is necessary to rebuild |
282 |
+${PN} after upgrading or rebuilding the Linux kernel |
283 |
+by for example running \`emerge @module-rebuild\`. Alternatively, |
284 |
+if using a distribution kernel (sys-kernel/gentoo-kernel{,-bin}), |
285 |
+this can be automated by setting USE=dist-kernel globally. |
286 |
+ |
287 |
+Loaded kernel modules also must not mismatch with the installed |
288 |
+${PN} version (excluding -r revision), meaning should |
289 |
+ensure \`eselect kernel list\` points to the kernel that will be |
290 |
+booted before building and preferably reboot after upgrading |
291 |
+${PN} (the ebuild will emit a warning if mismatching). |
292 |
+ |
293 |
+See '${EPREFIX}/etc/modprobe.d/nvidia.conf' for modules options." '')\ |
294 |
+$(use amd64 && usex abi_x86_32 '' " |
295 |
+ |
296 |
+Note that without USE=abi_x86_32 on ${PN}, 32bit applications |
297 |
+(typically using wine / steam) will not be able to use GPU acceleration.") |
298 |
+ |
299 |
+For general information on using ${PN}, please see: |
300 |
+https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers" |
301 |
+ readme.gentoo_create_doc |
302 |
+ |
303 |
+ if use driver; then |
304 |
+ linux-mod_src_install |
305 |
+ |
306 |
+ insinto /etc/modprobe.d |
307 |
+ doins "${T}"/nvidia.conf |
308 |
+ |
309 |
+ # used for gpu verification with binpkgs (not kept, see pkg_preinst) |
310 |
+ insinto /usr/share/nvidia |
311 |
+ doins supported-gpus/supported-gpus.json |
312 |
+ fi |
313 |
+ |
314 |
+ emake "${NV_ARGS[@]}" -C nvidia-modprobe install |
315 |
+ fowners :video /usr/bin/nvidia-modprobe #505092 |
316 |
+ fperms 4710 /usr/bin/nvidia-modprobe |
317 |
+ |
318 |
+ if use persistenced; then |
319 |
+ emake "${NV_ARGS[@]}" -C nvidia-persistenced install |
320 |
+ newconfd "${FILESDIR}"/nvidia-persistenced.confd nvidia-persistenced |
321 |
+ newinitd "${FILESDIR}"/nvidia-persistenced.initd nvidia-persistenced |
322 |
+ systemd_dounit "${T}"/nvidia-persistenced.service |
323 |
+ fi |
324 |
+ |
325 |
+ if use tools; then |
326 |
+ emake "${NV_ARGS[@]}" -C nvidia-settings install |
327 |
+ |
328 |
+ doicon nvidia-settings/doc/nvidia-settings.png |
329 |
+ domenu nvidia-settings/doc/nvidia-settings.desktop |
330 |
+ |
331 |
+ exeinto /etc/X11/xinit/xinitrc.d |
332 |
+ newexe "${FILESDIR}"/95-nvidia-settings-r1 95-nvidia-settings |
333 |
+ fi |
334 |
+ |
335 |
+ if use static-libs; then |
336 |
+ dolib.a nvidia-settings/src/out/libXNVCtrl.a |
337 |
+ |
338 |
+ insinto /usr/include/NVCtrl |
339 |
+ doins nvidia-settings/src/libXNVCtrl/NVCtrl{Lib,}.h |
340 |
+ fi |
341 |
+ |
342 |
+ use X && emake "${NV_ARGS[@]}" -C nvidia-xconfig install |
343 |
+ |
344 |
+ # mimic nvidia-installer by reading .manifest to install files |
345 |
+ # 0:file 1:perms 2:type 3+:subtype/arguments -:module |
346 |
+ local m into |
347 |
+ while IFS=' ' read -ra m; do |
348 |
+ ! [[ ${#m[@]} -ge 2 && ${m[-1]} =~ MODULE: ]] || |
349 |
+ eval '[[ " ${m[0]##*/}" =~ ^(\ '${skip_files[*]/%/.*|\\}' )$ ]]' || |
350 |
+ eval '[[ " ${m[2]}" =~ ^(\ '${skip_types[*]/%/|\\}' )$ ]]' || |
351 |
+ has ${m[-1]#MODULE:} "${skip_modules[@]}" && continue |
352 |
+ |
353 |
+ case ${m[2]} in |
354 |
+ MANPAGE) |
355 |
+ gzip -dc ${m[0]} | newman - ${m[0]%.gz}; assert |
356 |
+ continue |
357 |
+ ;; |
358 |
+ VDPAU_SYMLINK) m[4]=vdpau/; m[5]=${m[5]#vdpau/};; # .so to vdpau/ |
359 |
+ esac |
360 |
+ |
361 |
+ if [[ -v paths[${m[2]}] ]]; then |
362 |
+ into=${paths[${m[2]}]} |
363 |
+ elif [[ ${m[2]} =~ _BINARY$ ]]; then |
364 |
+ into=/opt/bin |
365 |
+ elif [[ ${m[3]} == COMPAT32 ]]; then |
366 |
+ use abi_x86_32 || continue |
367 |
+ into=/usr/${libdir32} |
368 |
+ elif [[ ${m[2]} =~ _LIB$|_SYMLINK$ ]]; then |
369 |
+ into=/usr/${libdir} |
370 |
+ else |
371 |
+ die "No known installation path for ${m[0]}" |
372 |
+ fi |
373 |
+ [[ ${m[3]: -2} == ?/ ]] && into+=/${m[3]%/} |
374 |
+ [[ ${m[4]: -2} == ?/ ]] && into+=/${m[4]%/} |
375 |
+ |
376 |
+ if [[ ${m[2]} =~ _SYMLINK$ ]]; then |
377 |
+ [[ ${m[4]: -1} == / ]] && m[4]=${m[5]} |
378 |
+ dosym ${m[4]} ${into}/${m[0]} |
379 |
+ continue |
380 |
+ fi |
381 |
+ [[ ${m[0]} =~ ^libnvidia-ngx.so ]] && |
382 |
+ dosym ${m[0]} ${into}/${m[0]%.so*}.so.1 # soname not in .manifest |
383 |
+ |
384 |
+ printf -v m[1] %o $((m[1] | 0200)) # 444->644 |
385 |
+ insopts -m${m[1]} |
386 |
+ insinto ${into} |
387 |
+ doins ${m[0]} |
388 |
+ done < .manifest || die |
389 |
+ |
390 |
+ # MODULE:installer non-skipped extras |
391 |
+ exeinto /lib/systemd/system-sleep |
392 |
+ doexe systemd/system-sleep/nvidia |
393 |
+ dobin systemd/nvidia-sleep.sh |
394 |
+ systemd_dounit systemd/system/nvidia-{hibernate,resume,suspend}.service |
395 |
+ |
396 |
+ dobin nvidia-bug-report.sh |
397 |
+} |
398 |
+ |
399 |
+pkg_preinst() { |
400 |
+ has_version "${CATEGORY}/${PN}[abi_x86_32]" && NV_HAD_ABI32= |
401 |
+ has_version "${CATEGORY}/${PN}[wayland]" && NV_HAD_WAYLAND= |
402 |
+ |
403 |
+ use driver || return |
404 |
+ linux-mod_pkg_preinst |
405 |
+ |
406 |
+ # set video group id based on live system (bug #491414) |
407 |
+ local g=$(getent group video | cut -d: -f3) |
408 |
+ [[ ${g} ]] || die "Failed to determine video group id" |
409 |
+ sed -i "s/@VIDEOGID@/${g}/" "${ED}"/etc/modprobe.d/nvidia.conf || die |
410 |
+ |
411 |
+ # try to find driver mismatches using temporary supported-gpus.json |
412 |
+ for g in $(grep -l 0x10de /sys/bus/pci/devices/*/vendor 2>/dev/null); do |
413 |
+ g=$(grep -io "\"devid\":\"$(<${g%vendor}device)\"[^}]*branch\":\"[0-9]*" \ |
414 |
+ "${ED}"/usr/share/nvidia/supported-gpus.json 2>/dev/null) |
415 |
+ if [[ ${g} ]]; then |
416 |
+ g=$((${g##*\"}+1)) |
417 |
+ if ver_test -ge ${g}; then |
418 |
+ NV_LEGACY_MASK=">=${CATEGORY}/${PN}-${g}" |
419 |
+ break |
420 |
+ fi |
421 |
+ fi |
422 |
+ done |
423 |
+ rm "${ED}"/usr/share/nvidia/supported-gpus.json || die |
424 |
+} |
425 |
+ |
426 |
+pkg_postinst() { |
427 |
+ use driver && linux-mod_pkg_postinst |
428 |
+ |
429 |
+ readme.gentoo_print_elog |
430 |
+ |
431 |
+ if [[ -r /proc/driver/nvidia/version && |
432 |
+ $(</proc/driver/nvidia/version) != *" ${PV} "* ]]; then |
433 |
+ ewarn "Currently loaded NVIDIA modules do not match the newly installed" |
434 |
+ ewarn "libraries and may prevent launching GPU-accelerated applications." |
435 |
+ use driver && ewarn "The easiest way to fix this is usually to reboot." |
436 |
+ fi |
437 |
+ |
438 |
+ if [[ $(</proc/cmdline) == *slub_debug=[!-]* ]]; then |
439 |
+ ewarn "Detected that the current kernel command line is using 'slub_debug='," |
440 |
+ ewarn "this may lead to system instability/freezes with this version of" |
441 |
+ ewarn "${PN}. Bug: https://bugs.gentoo.org/796329" |
442 |
+ fi |
443 |
+ |
444 |
+ if [[ -v NV_LEGACY_MASK ]]; then |
445 |
+ ewarn |
446 |
+ ewarn "***WARNING***" |
447 |
+ ewarn |
448 |
+ ewarn "You are installing a version of ${PN} known not to work" |
449 |
+ ewarn "with a GPU of the current system. If unwanted, add the mask:" |
450 |
+ if [[ -d ${EROOT}/etc/portage/package.mask ]]; then |
451 |
+ ewarn " echo '${NV_LEGACY_MASK}' > ${EROOT}/etc/portage/package.mask/${PN}" |
452 |
+ else |
453 |
+ ewarn " echo '${NV_LEGACY_MASK}' >> ${EROOT}/etc/portage/package.mask" |
454 |
+ fi |
455 |
+ ewarn "...then downgrade to a legacy branch if possible. For details, see:" |
456 |
+ ewarn "https://www.nvidia.com/object/IO_32667.html" |
457 |
+ fi |
458 |
+ |
459 |
+ if use !abi_x86_32 && [[ -v NV_HAD_ABI32 ]]; then |
460 |
+ elog |
461 |
+ elog "USE=abi_x86_32 is disabled, 32bit applications will not be able to" |
462 |
+ elog "use nvidia-drivers for acceleration without it (e.g. commonly used" |
463 |
+ elog "with app-emulation/wine-* or steam). Re-enable if needed." |
464 |
+ fi |
465 |
+ |
466 |
+ if use wayland && use driver && [[ ! -v NV_HAD_WAYLAND ]]; then |
467 |
+ elog |
468 |
+ elog "With USE=wayland, this version of ${PN} sets nvidia-drm.modeset=1" |
469 |
+ elog "in '${EROOT}/etc/modprobe.d/nvidia.conf'. This feature is considered" |
470 |
+ elog "experimental but is required for wayland." |
471 |
+ elog |
472 |
+ elog "If you experience issues, either disable wayland or edit nvidia.conf." |
473 |
+ elog "Of note, may possibly cause issues with SLI and Reverse PRIME." |
474 |
+ elog |
475 |
+ elog "This version of ${PN} only supports EGLStream which is only" |
476 |
+ elog "supported by a few wayland compositors (e.g. kwin / mutter, not sway)." |
477 |
+ fi |
478 |
+} |