Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-drivers/nvidia-drivers/
Date: Fri, 29 Jan 2016 10:54:12
Message-Id: 1454064843.35e21a17988fc792e04092d34fb397dd1dd227c4.jer@gentoo
1 commit: 35e21a17988fc792e04092d34fb397dd1dd227c4
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 29 10:53:16 2016 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 29 10:54:03 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35e21a17
7
8 x11-drivers/nvidia-drivers: Build tools from source (bug #562910 by Christian Strahl).
9
10 Package-Manager: portage-2.2.27
11
12 x11-drivers/nvidia-drivers/Manifest | 1 +
13 .../nvidia-drivers/nvidia-drivers-361.18-r2.ebuild | 535 +++++++++++++++++++++
14 2 files changed, 536 insertions(+)
15
16 diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
17 index 37dde55..119cf58 100644
18 --- a/x11-drivers/nvidia-drivers/Manifest
19 +++ b/x11-drivers/nvidia-drivers/Manifest
20 @@ -32,3 +32,4 @@ DIST NVIDIA-Linux-x86_64-352.79.run 77140528 SHA256 e05a825a5e0027f062b1a1344ff3
21 DIST NVIDIA-Linux-x86_64-355.11.run 76490009 SHA256 a59b425381add9d9058dc2d987bf3087ab59c43224b5eb04c3f273f5886451ed SHA512 bfc7ab7741183408aa0226dc29176c8ffe08566fbea7cebf78f4aa30627dc27ddf90bb82951c99006b34bc481be15712b4f5867ef543a32bfe3fe81a8e6ddeae WHIRLPOOL bb5d3397a855a53c2cd7e48056564085b906550f856207932e4670fef995030a3a7bcc0a9b97fee2e60aaff9b41c4a954afc57585441f5dec92c795358da810a
22 DIST NVIDIA-Linux-x86_64-361.18.run 86447500 SHA256 94cccc3ff10ee9544f60bf1d32d04dddabc5103880b57895ea60e1167b89a155 SHA512 d307b50226b145761de69892c51af3cd4498b91f9c56b5d5bf7b1f4f00cc073af586008cb060a16c036426240853ed30d244e63d3f727eadf39338736a5c0b02 WHIRLPOOL 87e03bfe694f708d57fb548c01d853bbae1335a696bce225ce997000387189b55c27644922a051e9a50dfa94ec917bda14b6ed4b76f345c8adc8d8f54aebff97
23 DIST NVIDIA-Linux-x86_64-96.43.23-pkg2.run 15962375 SHA256 ce8d8253e7dab7da63fbdac449ebf190cd0c10cbfffea0f8d0165515f851bc64 SHA512 04bec1187a6024a2b9839f008ec829281f1f2602dae2e639030bc385943186506bcaa2b46a230b2ab87f9217190841abc62f9e2d6395ab5559623389c31c6563 WHIRLPOOL 0651c44a51a1a06fcff5bfddbf9c3e408977e03263c7fe806cb6c01f9fe92f716dfe4e5190ffe1048bde72fcffdc8bca8267e74dd43ba5c9dfb22b6201fcc2bb
24 +DIST nvidia-settings-361.18.tar.bz2 1570821 SHA256 5e821bf9c92931da7c4ac2cac4c61a83e7f74641902935232cad747511fab363 SHA512 1a19ebb6773b53564a7996c8f963c161df599ed8ca577f505fbed1181f144a5e53fa970e3fee7fceed16909bd012f74f9af74080314ae9de9356894df9b1be4d WHIRLPOOL 23ff413900fca81427d755ecb5889dbb69033e101cf7c2f3edea4971defd03aedee95f5488779f634c690c05bfabe0763baf3dbf6377de950cabe48ad9c72684
25
26 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-361.18-r2.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-361.18-r2.ebuild
27 new file mode 100644
28 index 0000000..e5687ec
29 --- /dev/null
30 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-361.18-r2.ebuild
31 @@ -0,0 +1,535 @@
32 +# Copyright 1999-2015 Gentoo Foundation
33 +# Distributed under the terms of the GNU General Public License v2
34 +# $Id$
35 +
36 +EAPI=5
37 +
38 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
39 + portability toolchain-funcs unpacker user udev
40 +
41 +NV_URI="http://us.download.nvidia.com/XFree86/"
42 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
43 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
44 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
45 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
46 +
47 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
48 +HOMEPAGE="http://www.nvidia.com/"
49 +SRC_URI="
50 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
51 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
52 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
53 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
54 + tools? ( ftp://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-${PV}.tar.bz2 )
55 +"
56 +
57 +LICENSE="GPL-2 NVIDIA-r2"
58 +SLOT="0/${PV%.*}"
59 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
60 +RESTRICT="bindist mirror strip"
61 +EMULTILIB_PKG="true"
62 +
63 +IUSE="acpi +driver gtk2 gtk3 kernel_FreeBSD kernel_linux +kms multilib pax_kernel static-libs +tools uvm +X"
64 +REQUIRED_USE="
65 + tools? ( X || ( gtk2 gtk3 ) )
66 +"
67 +
68 +COMMON="
69 + app-eselect/eselect-opencl
70 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
71 + tools? (
72 + >=x11-libs/libvdpau-1.0
73 + dev-libs/atk
74 + dev-libs/glib:2
75 + dev-libs/jansson
76 + gtk2? ( >=x11-libs/gtk+-2.4:2 )
77 + gtk3? (
78 + x11-libs/cairo
79 + x11-libs/gtk+:3
80 + )
81 + media-libs/mesa
82 + x11-libs/cairo
83 + x11-libs/gdk-pixbuf[X]
84 + x11-libs/gtk+:2
85 + x11-libs/libX11
86 + x11-libs/libXext
87 + x11-libs/libXrandr
88 + x11-libs/libXv
89 + x11-libs/libXxf86vm
90 + x11-libs/pango[X]
91 + )
92 + X? (
93 + >=app-eselect/eselect-opengl-1.0.9
94 + app-misc/pax-utils
95 + )
96 +"
97 +DEPEND="
98 + ${COMMON}
99 + app-arch/xz-utils
100 + kernel_linux? ( virtual/linux-sources )
101 +"
102 +RDEPEND="
103 + ${COMMON}
104 + acpi? ( sys-power/acpid )
105 + tools? ( !media-video/nvidia-settings )
106 + X? (
107 + <x11-base/xorg-server-1.18.99:=
108 + >=x11-libs/libvdpau-0.3-r1
109 + multilib? (
110 + >=x11-libs/libX11-1.6.2[abi_x86_32]
111 + >=x11-libs/libXext-1.3.2[abi_x86_32]
112 + )
113 + )
114 +"
115 +
116 +QA_PREBUILT="opt/* usr/lib*"
117 +
118 +S=${WORKDIR}/
119 +
120 +pkg_pretend() {
121 + if use amd64 && has_multilib_profile && \
122 + [ "${DEFAULT_ABI}" != "amd64" ]; then
123 + eerror "This ebuild doesn't currently support changing your default ABI"
124 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
125 + fi
126 +
127 + if use kernel_linux && kernel_is ge 4 5; then
128 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
129 + ewarn "which are limited to the following kernels:"
130 + ewarn "<sys-kernel/gentoo-sources-4.5"
131 + ewarn "<sys-kernel/vanilla-sources-4.5"
132 + ewarn ""
133 + ewarn "You are free to utilize epatch_user to provide whatever"
134 + ewarn "support you feel is appropriate, but will not receive"
135 + ewarn "support as a result of those changes."
136 + ewarn ""
137 + ewarn "Do not file a bug report about this."
138 + ewarn ""
139 + fi
140 +
141 + # Since Nvidia ships many different series of drivers, we need to give the user
142 + # some kind of guidance as to what version they should install. This tries
143 + # to point the user in the right direction but can't be perfect. check
144 + # nvidia-driver.eclass
145 + nvidia-driver-check-warning
146 +
147 + # Kernel features/options to check for
148 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
149 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
150 +
151 + # Now do the above checks
152 + use kernel_linux && check_extra_config
153 +}
154 +
155 +pkg_setup() {
156 + # try to turn off distcc and ccache for people that have a problem with it
157 + export DISTCC_DISABLE=1
158 + export CCACHE_DISABLE=1
159 +
160 + if use driver && use kernel_linux; then
161 + MODULE_NAMES="nvidia(video:${S}/kernel)"
162 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)"
163 + use kms && MODULE_NAMES+=" nvidia-modeset(video:${S}/kernel)"
164 +
165 + # This needs to run after MODULE_NAMES (so that the eclass checks
166 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
167 + # is set (so that KV_DIR is populated).
168 + linux-mod_pkg_setup
169 +
170 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
171 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
172 +
173 + # linux-mod_src_compile calls set_arch_to_kernel, which
174 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
175 + # expects x86_64 or i386 and then converts it to x86
176 + # later on in the build process
177 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
178 + fi
179 +
180 + if use kernel_linux && kernel_is lt 2 6 9; then
181 + eerror "You must build this against 2.6.9 or higher kernels."
182 + fi
183 +
184 + # set variables to where files are in the package structure
185 + if use kernel_FreeBSD; then
186 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
187 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
188 + NV_DOC="${S}/doc"
189 + NV_OBJ="${S}/obj"
190 + NV_SRC="${S}/src"
191 + NV_MAN="${S}/x11/man"
192 + NV_X11="${S}/obj"
193 + NV_SOVER=1
194 + elif use kernel_linux; then
195 + NV_DOC="${S}"
196 + NV_OBJ="${S}"
197 + NV_SRC="${S}/kernel"
198 + NV_MAN="${S}"
199 + NV_X11="${S}"
200 + NV_SOVER=${PV}
201 + else
202 + die "Could not determine proper NVIDIA package"
203 + fi
204 +}
205 +
206 +src_prepare() {
207 + if use pax_kernel; then
208 + ewarn "Using PAX patches is not supported. You will be asked to"
209 + ewarn "use a standard kernel should you have issues. Should you"
210 + ewarn "need support with these patches, contact the PaX team."
211 + epatch "${FILESDIR}"/${PN}-355.06-pax.patch
212 + fi
213 +
214 + # Allow user patches so they can support RC kernels and whatever else
215 + epatch_user
216 +}
217 +
218 +src_compile() {
219 + # This is already the default on Linux, as there's no toplevel Makefile, but
220 + # on FreeBSD there's one and triggers the kernel module build, as we install
221 + # it by itself, pass this.
222 +
223 + cd "${NV_SRC}"
224 + if use kernel_FreeBSD; then
225 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
226 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
227 + elif use driver && use kernel_linux; then
228 + MAKEOPTS=-j1
229 + linux-mod_src_compile
230 + fi
231 +
232 + if use tools; then
233 + emake -C "${S}"/nvidia-settings-${PV}/src \
234 + AR="$(tc-getAR)" \
235 + CC="$(tc-getCC)" \
236 + LIBDIR="$(get_libdir)" \
237 + RANLIB="$(tc-getRANLIB)" \
238 + build-xnvctrl
239 +
240 + emake -C "${S}"/nvidia-settings-${PV}/src \
241 + CC="$(tc-getCC)" \
242 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
243 + LD="$(tc-getCC)" \
244 + LIBDIR="$(get_libdir)" \
245 + NVML_ENABLED=0 \
246 + NV_USE_BUNDLED_LIBJANSSON=0 \
247 + NV_VERBOSE=1 \
248 + STRIP_CMD=true
249 + fi
250 +}
251 +
252 +# Install nvidia library:
253 +# the first parameter is the library to install
254 +# the second parameter is the provided soversion
255 +# the third parameter is the target directory if it is not /usr/lib
256 +donvidia() {
257 + # Full path to library
258 + nv_LIB="${1}"
259 +
260 + # SOVER to use
261 + nv_SOVER="$(scanelf -qF'%S#F' ${nv_LIB})"
262 +
263 + # Where to install
264 + nv_DEST="${2}"
265 +
266 + # Get just the library name
267 + nv_LIBNAME=$(basename "${nv_LIB}")
268 +
269 + if [[ "${nv_DEST}" ]]; then
270 + exeinto ${nv_DEST}
271 + action="doexe"
272 + else
273 + nv_DEST="/usr/$(get_libdir)"
274 + action="dolib.so"
275 + fi
276 +
277 + # Install the library
278 + ${action} ${nv_LIB} || die "failed to install ${nv_LIBNAME}"
279 +
280 + # If the library has a SONAME and SONAME does not match the library name,
281 + # then we need to create a symlink
282 + if [[ ${nv_SOVER} ]] && ! [[ "${nv_SOVER}" = "${nv_LIBNAME}" ]]; then
283 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_SOVER} \
284 + || die "failed to create ${nv_DEST}/${nv_SOVER} symlink"
285 + fi
286 +
287 + dosym ${nv_LIBNAME} ${nv_DEST}/${nv_LIBNAME/.so*/.so} \
288 + || die "failed to create ${nv_LIBNAME/.so*/.so} symlink"
289 +}
290 +
291 +src_install() {
292 + if use driver && use kernel_linux; then
293 + linux-mod_src_install
294 +
295 + # Add the aliases
296 + # This file is tweaked with the appropriate video group in
297 + # pkg_preinst, see bug #491414
298 + insinto /etc/modprobe.d
299 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
300 + doins "${FILESDIR}"/nvidia-rmmod.conf
301 +
302 + # Ensures that our device nodes are created when not using X
303 + exeinto "$(get_udevdir)"
304 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
305 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
306 + elif use kernel_FreeBSD; then
307 + if use x86-fbsd; then
308 + insinto /boot/modules
309 + doins "${S}/src/nvidia.kld"
310 + fi
311 +
312 + exeinto /boot/modules
313 + doexe "${S}/src/nvidia.ko"
314 + fi
315 +
316 + # NVIDIA kernel <-> userspace driver config lib
317 + donvidia ${NV_OBJ}/libnvidia-cfg.so.${NV_SOVER}
318 +
319 + # NVIDIA framebuffer capture library
320 + donvidia ${NV_OBJ}/libnvidia-fbc.so.${NV_SOVER}
321 +
322 + # NVIDIA video encode/decode <-> CUDA
323 + if use kernel_linux; then
324 + donvidia ${NV_OBJ}/libnvcuvid.so.${NV_SOVER}
325 + donvidia ${NV_OBJ}/libnvidia-encode.so.${NV_SOVER}
326 + fi
327 +
328 + if use X; then
329 + # Xorg DDX driver
330 + insinto /usr/$(get_libdir)/xorg/modules/drivers
331 + doins ${NV_X11}/nvidia_drv.so
332 +
333 + # Xorg GLX driver
334 + donvidia ${NV_X11}/libglx.so.${NV_SOVER} \
335 + /usr/$(get_libdir)/opengl/nvidia/extensions
336 +
337 + # Xorg nvidia.conf
338 + if has_version '>=x11-base/xorg-server-1.16'; then
339 + insinto /usr/share/X11/xorg.conf.d
340 + newins {,50-}nvidia-drm-outputclass.conf
341 + fi
342 + fi
343 +
344 + # OpenCL ICD for NVIDIA
345 + if use kernel_linux; then
346 + insinto /etc/OpenCL/vendors
347 + doins ${NV_OBJ}/nvidia.icd
348 + fi
349 +
350 + # Documentation
351 + dohtml ${NV_DOC}/html/*
352 + if use kernel_FreeBSD; then
353 + dodoc "${NV_DOC}/README"
354 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
355 + use tools && doman "${NV_MAN}/nvidia-settings.1"
356 + else
357 + # Docs
358 + newdoc "${NV_DOC}/README.txt" README
359 + dodoc "${NV_DOC}/NVIDIA_Changelog"
360 + doman "${NV_MAN}/nvidia-smi.1.gz"
361 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
362 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
363 + doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
364 + fi
365 +
366 + # Helper Apps
367 + exeinto /opt/bin/
368 +
369 + if use X; then
370 + doexe ${NV_OBJ}/nvidia-xconfig
371 + fi
372 +
373 + if use kernel_linux; then
374 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
375 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
376 + doexe ${NV_OBJ}/nvidia-debugdump
377 + doexe ${NV_OBJ}/nvidia-persistenced
378 + doexe ${NV_OBJ}/nvidia-smi
379 +
380 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
381 + doexe ${NV_OBJ}/nvidia-modprobe
382 + fowners root:video /opt/bin/nvidia-modprobe
383 + fperms 4710 /opt/bin/nvidia-modprobe
384 + dosym /{opt,usr}/bin/nvidia-modprobe
385 +
386 + doman nvidia-cuda-mps-control.1.gz
387 + doman nvidia-modprobe.1.gz
388 + doman nvidia-persistenced.1.gz
389 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
390 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
391 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
392 + fi
393 +
394 + if use tools; then
395 + emake -C "${S}"/nvidia-settings-${PV}/src/ \
396 + DESTDIR="${D}" \
397 + GTK3_AVAILABLE=$(usex gtk3 1 0) \
398 + LIBDIR="${D}/usr/$(get_libdir)" \
399 + PREFIX=/usr \
400 + NV_USE_BUNDLED_LIBJANSSON=0 \
401 + install
402 +
403 + insinto /usr/share/nvidia/
404 + doins nvidia-application-profiles-${PV}-key-documentation
405 +
406 + insinto /etc/nvidia
407 + newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
408 +
409 + use static-libs && dolib "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/libXNVCtrl.a
410 +
411 + insinto /usr/include/NVCtrl
412 + doins "${S}"/nvidia-settings-${PV}/src/libXNVCtrl/*.h
413 + fi
414 +
415 + dobin ${NV_OBJ}/nvidia-bug-report.sh
416 +
417 + # Desktop entries for nvidia-settings
418 + if use tools; then
419 + # There is no icon in the FreeBSD tarball.
420 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
421 + domenu "${FILESDIR}"/${PN}-settings.desktop
422 + exeinto /etc/X11/xinit/xinitrc.d
423 + doexe "${FILESDIR}"/95-nvidia-settings
424 + fi
425 +
426 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
427 +
428 + if has_multilib_profile && use multilib; then
429 + local OABI=${ABI}
430 + for ABI in $(get_install_abis); do
431 + src_install-libs
432 + done
433 + ABI=${OABI}
434 + unset OABI
435 + else
436 + src_install-libs
437 + fi
438 +
439 + is_final_abi || die "failed to iterate through all ABIs"
440 +
441 + readme.gentoo_create_doc
442 +}
443 +
444 +src_install-libs() {
445 + local inslibdir=$(get_libdir)
446 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
447 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
448 + local libdir=${NV_OBJ}
449 +
450 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
451 + libdir=${NV_OBJ}/32
452 + fi
453 +
454 + if use X; then
455 + NV_GLX_LIBRARIES=(
456 + "libEGL.so.1 ${GL_ROOT}"
457 + "libEGL_nvidia.so.${NV_SOVER} ${GL_ROOT}"
458 + "libGL.so.1 ${GL_ROOT}"
459 + "libGLESv1_CM.so.1 ${GL_ROOT}"
460 + "libGLESv1_CM_nvidia.so.${NV_SOVER} ${GL_ROOT}"
461 + "libGLESv2.so.2 ${GL_ROOT}"
462 + "libGLESv2_nvidia.so.${NV_SOVER} ${GL_ROOT}"
463 + "libGLX.so.0 ${GL_ROOT}"
464 + "libGLX_nvidia.so.${NV_SOVER} ${GL_ROOT}"
465 + "libGLdispatch.so.0 ${GL_ROOT}"
466 + "libOpenCL.so.1.0.0 ${CL_ROOT}"
467 + "libOpenGL.so.0 ${GL_ROOT}"
468 + "libcuda.so.${NV_SOVER}"
469 + "libnvcuvid.so.${NV_SOVER}"
470 + "libnvidia-compiler.so.${NV_SOVER}"
471 + "libnvidia-eglcore.so.${NV_SOVER}"
472 + "libnvidia-encode.so.${NV_SOVER}"
473 + "libnvidia-fatbinaryloader.so.${NV_SOVER}"
474 + "libnvidia-fbc.so.${NV_SOVER}"
475 + "libnvidia-glcore.so.${NV_SOVER}"
476 + "libnvidia-glsi.so.${NV_SOVER}"
477 + "libnvidia-ifr.so.${NV_SOVER}"
478 + "libnvidia-opencl.so.${NV_SOVER}"
479 + "libnvidia-ptxjitcompiler.so.${NV_SOVER}"
480 + "libvdpau_nvidia.so.${NV_SOVER}"
481 + )
482 +
483 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
484 + then
485 + NV_GLX_LIBRARIES+=( "libnvidia-wfb.so.${NV_SOVER}" )
486 + fi
487 +
488 + if use kernel_FreeBSD; then
489 + NV_GLX_LIBRARIES+=( "libnvidia-tls.so.${NV_SOVER}" )
490 + fi
491 +
492 + if use kernel_linux; then
493 + NV_GLX_LIBRARIES+=(
494 + "libnvidia-ml.so.${NV_SOVER}"
495 + "tls/libnvidia-tls.so.${NV_SOVER}"
496 + )
497 + fi
498 +
499 + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
500 + donvidia ${libdir}/${NV_LIB}
501 + done
502 + fi
503 +}
504 +
505 +pkg_preinst() {
506 + if use driver && use kernel_linux; then
507 + linux-mod_pkg_preinst
508 +
509 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
510 + if [ -z "${videogroup}" ]; then
511 + eerror "Failed to determine the video group gid"
512 + die "Failed to determine the video group gid"
513 + else
514 + sed -i \
515 + -e "s:PACKAGE:${PF}:g" \
516 + -e "s:VIDEOGID:${videogroup}:" \
517 + "${D}"/etc/modprobe.d/nvidia.conf || die
518 + fi
519 + fi
520 +
521 + # Clean the dynamic libGL stuff's home to ensure
522 + # we dont have stale libs floating around
523 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then
524 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
525 + fi
526 + # Make sure we nuke the old nvidia-glx's env.d file
527 + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then
528 + rm -f "${ROOT}"/etc/env.d/09nvidia
529 + fi
530 +}
531 +
532 +pkg_postinst() {
533 + use driver && use kernel_linux && linux-mod_pkg_postinst
534 +
535 + # Switch to the nvidia implementation
536 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
537 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
538 +
539 + readme.gentoo_print_elog
540 +
541 + if ! use X; then
542 + elog "You have elected to not install the X.org driver. Along with"
543 + elog "this the OpenGL libraries and VDPAU libraries were not"
544 + elog "installed. Additionally, once the driver is loaded your card"
545 + elog "and fan will run at max speed which may not be desirable."
546 + elog "Use the 'nvidia-smi' init script to have your card and fan"
547 + elog "speed scale appropriately."
548 + elog
549 + fi
550 + if ! use tools; then
551 + elog "USE=tools controls whether the nvidia-settings application"
552 + elog "is installed. If you would like to use it, enable that"
553 + elog "flag and re-emerge this ebuild. Optionally you can install"
554 + elog "media-video/nvidia-settings"
555 + elog
556 + fi
557 +}
558 +
559 +pkg_prerm() {
560 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
561 +}
562 +
563 +pkg_postrm() {
564 + use driver && use kernel_linux && linux-mod_pkg_postrm
565 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
566 +}