Gentoo Archives: gentoo-commits

From: "Jeroen Roovers (jer)" <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in x11-drivers/nvidia-drivers: nvidia-drivers-331.49-r2.ebuild ChangeLog nvidia-drivers-334.21-r2.ebuild nvidia-drivers-331.49-r1.ebuild nvidia-drivers-334.21-r1.ebuild
Date: Sat, 29 Mar 2014 16:49:54
Message-Id: 20140329164950.28ED720054@flycatcher.gentoo.org
1 jer 14/03/29 16:49:50
2
3 Modified: ChangeLog
4 Added: nvidia-drivers-331.49-r2.ebuild
5 nvidia-drivers-334.21-r2.ebuild
6 Removed: nvidia-drivers-331.49-r1.ebuild
7 nvidia-drivers-334.21-r1.ebuild
8 Log:
9 Add a modprobe.d script for the UVM driver by Alexander Monakov (bug #506168).
10
11 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key A792A613)
12
13 Revision Changes Path
14 1.541 x11-drivers/nvidia-drivers/ChangeLog
15
16 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog?rev=1.541&view=markup
17 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog?rev=1.541&content-type=text/plain
18 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog?r1=1.540&r2=1.541
19
20 Index: ChangeLog
21 ===================================================================
22 RCS file: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog,v
23 retrieving revision 1.540
24 retrieving revision 1.541
25 diff -u -r1.540 -r1.541
26 --- ChangeLog 20 Mar 2014 16:05:18 -0000 1.540
27 +++ ChangeLog 29 Mar 2014 16:49:49 -0000 1.541
28 @@ -1,6 +1,16 @@
29 # ChangeLog for x11-drivers/nvidia-drivers
30 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
31 -# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog,v 1.540 2014/03/20 16:05:18 jer Exp $
32 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/ChangeLog,v 1.541 2014/03/29 16:49:49 jer Exp $
33 +
34 +*nvidia-drivers-334.21-r2 (29 Mar 2014)
35 +*nvidia-drivers-331.49-r2 (29 Mar 2014)
36 +
37 + 29 Mar 2014; Jeroen Roovers <jer@g.o>
38 + -nvidia-drivers-331.49-r1.ebuild, +nvidia-drivers-331.49-r2.ebuild,
39 + -nvidia-drivers-334.21-r1.ebuild, +nvidia-drivers-334.21-r2.ebuild,
40 + +files/nvidia-uvm.conf:
41 + Add a modprobe.d script for the UVM driver by Alexander Monakov (bug
42 + #506168).
43
44 20 Mar 2014; Jeroen Roovers <jer@g.o> -nvidia-drivers-304.119.ebuild,
45 nvidia-drivers-304.121.ebuild:
46
47
48
49 1.1 x11-drivers/nvidia-drivers/nvidia-drivers-331.49-r2.ebuild
50
51 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-331.49-r2.ebuild?rev=1.1&view=markup
52 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-331.49-r2.ebuild?rev=1.1&content-type=text/plain
53
54 Index: nvidia-drivers-331.49-r2.ebuild
55 ===================================================================
56 # Copyright 1999-2014 Gentoo Foundation
57 # Distributed under the terms of the GNU General Public License v2
58 # $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-331.49-r2.ebuild,v 1.1 2014/03/29 16:49:49 jer Exp $
59
60 EAPI=5
61
62 inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
63 portability toolchain-funcs unpacker user udev
64
65 NV_URI="http://us.download.nvidia.com/XFree86/"
66 X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
67 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
68 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
69 AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
70
71 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
72 HOMEPAGE="http://www.nvidia.com/"
73 SRC_URI="
74 amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
75 amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
76 x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
77 x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
78 "
79
80 LICENSE="GPL-2 NVIDIA-r2"
81 SLOT="0"
82 KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
83 IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
84 RESTRICT="bindist mirror strip"
85 EMULTILIB_PKG="true"
86
87 COMMON="
88 app-admin/eselect-opencl
89 kernel_linux? ( >=sys-libs/glibc-2.6.1 )
90 X? (
91 >=app-admin/eselect-opengl-1.0.9
92 )
93 "
94 DEPEND="
95 ${COMMON}
96 app-arch/xz-utils
97 kernel_linux? ( virtual/linux-sources )
98 "
99 RDEPEND="
100 ${COMMON}
101 acpi? ( sys-power/acpid )
102 tools? (
103 dev-libs/atk
104 dev-libs/glib
105 x11-libs/gdk-pixbuf
106 x11-libs/gtk+:2
107 x11-libs/libX11
108 x11-libs/libXext
109 x11-libs/pango[X]
110 )
111 X? (
112 <x11-base/xorg-server-1.15.99
113 >=x11-libs/libvdpau-0.3-r1
114 multilib? (
115 || (
116 (
117 x11-libs/libX11[abi_x86_32]
118 x11-libs/libXext[abi_x86_32]
119 )
120 app-emulation/emul-linux-x86-xlibs
121 )
122 )
123 )
124 "
125
126 REQUIRED_USE="tools? ( X )"
127
128 QA_PREBUILT="opt/* usr/lib*"
129
130 S=${WORKDIR}/
131
132 pkg_pretend() {
133
134 if use amd64 && has_multilib_profile && \
135 [ "${DEFAULT_ABI}" != "amd64" ]; then
136 eerror "This ebuild doesn't currently support changing your default ABI"
137 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
138 fi
139
140 if use kernel_linux && kernel_is ge 3 14 ; then
141 ewarn "Gentoo supports kernels which are supported by NVIDIA"
142 ewarn "which are limited to the following kernels:"
143 ewarn "<sys-kernel/gentoo-sources-3.14"
144 ewarn "<sys-kernel/vanilla-sources-3.14"
145 ewarn ""
146 ewarn "You are free to utilize epatch_user to provide whatever"
147 ewarn "support you feel is appropriate, but will not receive"
148 ewarn "support as a result of those changes."
149 ewarn ""
150 ewarn "Do not file a bug report about this."
151 fi
152
153 # Since Nvidia ships 3 different series of drivers, we need to give the user
154 # some kind of guidance as to what version they should install. This tries
155 # to point the user in the right direction but can't be perfect. check
156 # nvidia-driver.eclass
157 nvidia-driver-check-warning
158
159 # Kernel features/options to check for
160 CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
161 use x86 && CONFIG_CHECK+=" ~HIGHMEM"
162
163 # Now do the above checks
164 use kernel_linux && check_extra_config
165 }
166
167 pkg_setup() {
168 # try to turn off distcc and ccache for people that have a problem with it
169 export DISTCC_DISABLE=1
170 export CCACHE_DISABLE=1
171
172 if use kernel_linux; then
173 # Because of awkward limitations of linux-mod.eclass, the order in
174 # which the modules are listed somehow affects module dependencies,
175 # so we list nvidia-uvm first and then nvidia.
176 use uvm && MODULE_NAMES="nvidia-uvm(video:${S}/kernel/uvm)"
177 MODULE_NAMES+=" nvidia(video:${S}/kernel)"
178
179 # This needs to run after MODULE_NAMES (so that the eclass checks
180 # whether the kernel supports loadable modules) but before BUILD_PARAMS
181 # is set (so that KV_DIR is populated).
182 linux-mod_pkg_setup
183
184 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
185 SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
186
187 # linux-mod_src_compile calls set_arch_to_kernel, which
188 # sets the ARCH to x86 but NVIDIA's wrapping Makefile
189 # expects x86_64 or i386 and then converts it to x86
190 # later on in the build process
191 BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
192 fi
193
194 # set variables to where files are in the package structure
195 if use kernel_FreeBSD; then
196 use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
197 use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
198 NV_DOC="${S}/doc"
199 NV_OBJ="${S}/obj"
200 NV_SRC="${S}/src"
201 NV_MAN="${S}/x11/man"
202 NV_X11="${S}/obj"
203 NV_SOVER=1
204 elif use kernel_linux; then
205 NV_DOC="${S}"
206 NV_OBJ="${S}"
207 NV_SRC="${S}/kernel"
208 NV_MAN="${S}"
209 NV_X11="${S}"
210 NV_SOVER=${PV}
211 else
212 die "Could not determine proper NVIDIA package"
213 fi
214 }
215
216 src_unpack() {
217 if use kernel_FreeBSD; then
218 unpack ${A}
219 elif use kernel_linux; then
220 cd "${S}"
221 unpack_makeself
222 fi
223 }
224
225 src_prepare() {
226 # Please add a brief description for every added patch
227
228 if use kernel_linux; then
229 if kernel_is lt 2 6 9 ; then
230 eerror "You must build this against 2.6.9 or higher kernels."
231 fi
232
233 # If greater than 2.6.5 use M= instead of SUBDIR=
234 # convert_to_m "${NV_SRC}"/Makefile.kbuild
235 fi
236
237 if use pax_kernel; then
238 ewarn "Using PAX patches is not supported. You will be asked to"
239 ewarn "use a standard kernel should you have issues. Should you"
240 ewarn "need support with these patches, contact the PaX team."
241 epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
242 fi
243
244 # Allow user patches so they can support RC kernels and whatever else
245 epatch_user
246 }
247
248 src_compile() {
249 # This is already the default on Linux, as there's no toplevel Makefile, but
250 # on FreeBSD there's one and triggers the kernel module build, as we install
251 # it by itself, pass this.
252
253 cd "${NV_SRC}"
254 if use kernel_FreeBSD; then
255 MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
256 LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
257 elif use kernel_linux; then
258 linux-mod_src_compile
259 fi
260 }
261
262 # Install nvidia library:
263 # the first parameter is the library to install
264 # the second parameter is the provided soversion
265 # the third parameter is the target directory if its not /usr/lib
266 donvidia() {
267 # Full path to library minus SOVER
268 MY_LIB="$1"
269
270 # SOVER to use
271 MY_SOVER="$2"
272
273 # Where to install
274 MY_DEST="$3"
275
276 if [[ -z "${MY_DEST}" ]]; then
277 MY_DEST="/usr/$(get_libdir)"
278 action="dolib.so"
279 else
280 exeinto ${MY_DEST}
281 action="doexe"
282 fi
283
284 # Get just the library name
285 libname=$(basename $1)
286
287 # Install the library with the correct SOVER
288 ${action} ${MY_LIB}.${MY_SOVER} || \
289 die "failed to install ${libname}"
290
291 # If SOVER wasn't 1, then we need to create a .1 symlink
292 if [[ "${MY_SOVER}" != "1" ]]; then
293 dosym ${libname}.${MY_SOVER} \
294 ${MY_DEST}/${libname}.1 || \
295 die "failed to create ${libname} symlink"
296 fi
297
298 # Always create the symlink from the raw lib to the .1
299 dosym ${libname}.1 \
300 ${MY_DEST}/${libname} || \
301 die "failed to create ${libname} symlink"
302 }
303
304 src_install() {
305 if use kernel_linux; then
306 linux-mod_src_install
307
308 # Add the aliases
309 # This file is tweaked with the appropriate video group in
310 # pkg_preinst, see bug #491414
311 insinto /etc/modprobe.d
312 newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
313 use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
314
315 # Ensures that our device nodes are created when not using X
316 exeinto "$(udev_get_udevdir)"
317 doexe "${FILESDIR}"/nvidia-udev.sh
318 udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
319 elif use kernel_FreeBSD; then
320 if use x86-fbsd; then
321 insinto /boot/modules
322 doins "${S}/src/nvidia.kld"
323 fi
324
325 exeinto /boot/modules
326 doexe "${S}/src/nvidia.ko"
327 fi
328
329 # NVIDIA kernel <-> userspace driver config lib
330 donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
331
332 # NVIDIA framebuffer capture library
333 donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
334
335 # NVIDIA video encode/decode <-> CUDA
336 if use kernel_linux; then
337 donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
338 donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
339 fi
340
341 if use X; then
342 # Xorg DDX driver
343 insinto /usr/$(get_libdir)/xorg/modules/drivers
344 doins ${NV_X11}/nvidia_drv.so
345
346 # Xorg GLX driver
347 donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
348 /usr/$(get_libdir)/opengl/nvidia/extensions
349 fi
350
351 # OpenCL ICD for NVIDIA
352 if use kernel_linux; then
353 insinto /etc/OpenCL/vendors
354 doins ${NV_OBJ}/nvidia.icd
355 fi
356
357 # Documentation
358 dohtml ${NV_DOC}/html/*
359 if use kernel_FreeBSD; then
360 dodoc "${NV_DOC}/README"
361 use X && doman "${NV_MAN}/nvidia-xconfig.1"
362 use tools && doman "${NV_MAN}/nvidia-settings.1"
363 else
364 # Docs
365 newdoc "${NV_DOC}/README.txt" README
366 dodoc "${NV_DOC}/NVIDIA_Changelog"
367 doman "${NV_MAN}/nvidia-smi.1.gz"
368 use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
369 use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
370 doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
371 fi
372
373 # Helper Apps
374 exeinto /opt/bin/
375
376 if use X; then
377 doexe ${NV_OBJ}/nvidia-xconfig
378 fi
379
380 if use kernel_linux ; then
381 doexe ${NV_OBJ}/nvidia-cuda-mps-control
382 doexe ${NV_OBJ}/nvidia-cuda-mps-server
383 doexe ${NV_OBJ}/nvidia-debugdump
384 doexe ${NV_OBJ}/nvidia-persistenced
385 doexe ${NV_OBJ}/nvidia-smi
386
387 # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
388 doexe ${NV_OBJ}/nvidia-modprobe
389 fowners root:video /opt/bin/nvidia-modprobe
390 fperms 4711 /opt/bin/nvidia-modprobe
391 dosym /{opt,usr}/bin/nvidia-modprobe
392
393 doman nvidia-cuda-mps-control.1.gz
394 doman nvidia-modprobe.1.gz
395 doman nvidia-persistenced.1.gz
396 newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
397 fi
398
399 if use tools; then
400 doexe ${NV_OBJ}/nvidia-settings
401 fi
402
403 exeinto /usr/bin/
404 doexe ${NV_OBJ}/nvidia-bug-report.sh
405
406 # Desktop entries for nvidia-settings
407 if use tools ; then
408 # There is no icon in the FreeBSD tarball.
409 use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
410 domenu "${FILESDIR}"/${PN}-settings.desktop
411 exeinto /etc/X11/xinit/xinitrc.d
412 doexe "${FILESDIR}"/95-nvidia-settings
413 fi
414
415 #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
416
417 if has_multilib_profile && use multilib ; then
418 local OABI=${ABI}
419 for ABI in $(get_install_abis) ; do
420 src_install-libs
421 done
422 ABI=${OABI}
423 unset OABI
424 else
425 src_install-libs
426 fi
427
428 is_final_abi || die "failed to iterate through all ABIs"
429
430 readme.gentoo_create_doc
431 }
432
433 src_install-libs() {
434 local inslibdir=$(get_libdir)
435 local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
436 local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
437 local libdir=${NV_OBJ}
438
439 if use kernel_linux && has_multilib_profile && \
440 [[ ${ABI} == "x86" ]] ; then
441 libdir=${NV_OBJ}/32
442 fi
443
444 if use X; then
445 # The GLX libraries
446 donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
447 donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
448 donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
449 if use kernel_FreeBSD; then
450 donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
451 else
452 donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
453 fi
454
455 # VDPAU
456 donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
457 fi
458
459 # NVIDIA monitoring library
460 if use kernel_linux ; then
461 donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
462 fi
463
464 # CUDA & OpenCL
465 if use kernel_linux; then
466 donvidia ${libdir}/libcuda.so ${NV_SOVER}
467 donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
468 donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
469 donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
470 fi
471 }
472
473 pkg_preinst() {
474 if use kernel_linux; then
475 linux-mod_pkg_preinst
476
477 local videogroup="$(egetent group video | cut -d ':' -f 3)"
478 if [ -z "${videogroup}" ]; then
479 eerror "Failed to determine the video group gid"
480 die "Failed to determine the video group gid"
481 else
482 sed -i \
483 -e "s:PACKAGE:${PF}:g" \
484 -e "s:VIDEOGID:${videogroup}:" \
485 "${D}"/etc/modprobe.d/nvidia.conf || die
486 fi
487 fi
488
489 # Clean the dynamic libGL stuff's home to ensure
490 # we dont have stale libs floating around
491 if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
492 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
493 fi
494 # Make sure we nuke the old nvidia-glx's env.d file
495 if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
496 rm -f "${ROOT}"/etc/env.d/09nvidia
497 fi
498 }
499
500 pkg_postinst() {
501 use kernel_linux && linux-mod_pkg_postinst
502
503 # Switch to the nvidia implementation
504 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
505 "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
506
507 readme.gentoo_print_elog
508
509 if ! use X; then
510 elog "You have elected to not install the X.org driver. Along with"
511 elog "this the OpenGL libraries and VDPAU libraries were not"
512 elog "installed. Additionally, once the driver is loaded your card"
513 elog "and fan will run at max speed which may not be desirable."
514 elog "Use the 'nvidia-smi' init script to have your card and fan"
515 elog "speed scale appropriately."
516 elog
517 fi
518 if ! use tools; then
519 elog "USE=tools controls whether the nvidia-settings application"
520 elog "is installed. If you would like to use it, enable that"
521 elog "flag and re-emerge this ebuild. Optionally you can install"
522 elog "media-video/nvidia-settings"
523 elog
524 fi
525 }
526
527 pkg_prerm() {
528 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
529 }
530
531 pkg_postrm() {
532 use kernel_linux && linux-mod_pkg_postrm
533 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
534 }
535
536
537
538 1.1 x11-drivers/nvidia-drivers/nvidia-drivers-334.21-r2.ebuild
539
540 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-334.21-r2.ebuild?rev=1.1&view=markup
541 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-334.21-r2.ebuild?rev=1.1&content-type=text/plain
542
543 Index: nvidia-drivers-334.21-r2.ebuild
544 ===================================================================
545 # Copyright 1999-2014 Gentoo Foundation
546 # Distributed under the terms of the GNU General Public License v2
547 # $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-334.21-r2.ebuild,v 1.1 2014/03/29 16:49:49 jer Exp $
548
549 EAPI=5
550
551 inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
552 portability toolchain-funcs unpacker user udev
553
554 NV_URI="http://us.download.nvidia.com/XFree86/"
555 X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
556 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
557 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
558 AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
559
560 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
561 HOMEPAGE="http://www.nvidia.com/"
562 SRC_URI="
563 amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
564 amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
565 x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
566 x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
567 "
568
569 LICENSE="GPL-2 NVIDIA-r2"
570 SLOT="0"
571 KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
572 IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
573 RESTRICT="bindist mirror strip"
574 EMULTILIB_PKG="true"
575
576 COMMON="
577 app-admin/eselect-opencl
578 kernel_linux? ( >=sys-libs/glibc-2.6.1 )
579 X? (
580 >=app-admin/eselect-opengl-1.0.9
581 )
582 "
583 DEPEND="
584 ${COMMON}
585 app-arch/xz-utils
586 kernel_linux? ( virtual/linux-sources )
587 "
588 RDEPEND="
589 ${COMMON}
590 acpi? ( sys-power/acpid )
591 tools? (
592 dev-libs/atk
593 dev-libs/glib
594 x11-libs/gdk-pixbuf
595 x11-libs/gtk+:2
596 x11-libs/libX11
597 x11-libs/libXext
598 x11-libs/pango[X]
599 )
600 X? (
601 <x11-base/xorg-server-1.15.99
602 >=x11-libs/libvdpau-0.3-r1
603 multilib? (
604 || (
605 (
606 x11-libs/libX11[abi_x86_32]
607 x11-libs/libXext[abi_x86_32]
608 )
609 app-emulation/emul-linux-x86-xlibs
610 )
611 )
612 )
613 "
614
615 REQUIRED_USE="tools? ( X )"
616
617 QA_PREBUILT="opt/* usr/lib*"
618
619 S=${WORKDIR}/
620
621 pkg_pretend() {
622
623 if use amd64 && has_multilib_profile && \
624 [ "${DEFAULT_ABI}" != "amd64" ]; then
625 eerror "This ebuild doesn't currently support changing your default ABI"
626 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
627 fi
628
629 if use kernel_linux && kernel_is ge 3 14 ; then
630 ewarn "Gentoo supports kernels which are supported by NVIDIA"
631 ewarn "which are limited to the following kernels:"
632 ewarn "<sys-kernel/gentoo-sources-3.14"
633 ewarn "<sys-kernel/vanilla-sources-3.14"
634 ewarn ""
635 ewarn "You are free to utilize epatch_user to provide whatever"
636 ewarn "support you feel is appropriate, but will not receive"
637 ewarn "support as a result of those changes."
638 ewarn ""
639 ewarn "Do not file a bug report about this."
640 fi
641
642 # Since Nvidia ships 3 different series of drivers, we need to give the user
643 # some kind of guidance as to what version they should install. This tries
644 # to point the user in the right direction but can't be perfect. check
645 # nvidia-driver.eclass
646 nvidia-driver-check-warning
647
648 # Kernel features/options to check for
649 CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
650 use x86 && CONFIG_CHECK+=" ~HIGHMEM"
651
652 # Now do the above checks
653 use kernel_linux && check_extra_config
654 }
655
656 pkg_setup() {
657 # try to turn off distcc and ccache for people that have a problem with it
658 export DISTCC_DISABLE=1
659 export CCACHE_DISABLE=1
660
661 if use kernel_linux; then
662 # Because of awkward limitations of linux-mod.eclass, the order in
663 # which the modules are listed somehow affects module dependencies,
664 # so we list nvidia-uvm first and then nvidia.
665 use uvm && MODULE_NAMES="nvidia-uvm(video:${S}/kernel/uvm)"
666 MODULE_NAMES+=" nvidia(video:${S}/kernel)"
667
668 # This needs to run after MODULE_NAMES (so that the eclass checks
669 # whether the kernel supports loadable modules) but before BUILD_PARAMS
670 # is set (so that KV_DIR is populated).
671 linux-mod_pkg_setup
672
673 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
674 SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
675
676 # linux-mod_src_compile calls set_arch_to_kernel, which
677 # sets the ARCH to x86 but NVIDIA's wrapping Makefile
678 # expects x86_64 or i386 and then converts it to x86
679 # later on in the build process
680 BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
681 fi
682
683 # set variables to where files are in the package structure
684 if use kernel_FreeBSD; then
685 use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
686 use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
687 NV_DOC="${S}/doc"
688 NV_OBJ="${S}/obj"
689 NV_SRC="${S}/src"
690 NV_MAN="${S}/x11/man"
691 NV_X11="${S}/obj"
692 NV_SOVER=1
693 elif use kernel_linux; then
694 NV_DOC="${S}"
695 NV_OBJ="${S}"
696 NV_SRC="${S}/kernel"
697 NV_MAN="${S}"
698 NV_X11="${S}"
699 NV_SOVER=${PV}
700 else
701 die "Could not determine proper NVIDIA package"
702 fi
703 }
704
705 src_unpack() {
706 if use kernel_FreeBSD; then
707 unpack ${A}
708 elif use kernel_linux; then
709 cd "${S}"
710 unpack_makeself
711 fi
712 }
713
714 src_prepare() {
715 # Please add a brief description for every added patch
716
717 if use kernel_linux; then
718 if kernel_is lt 2 6 9 ; then
719 eerror "You must build this against 2.6.9 or higher kernels."
720 fi
721
722 # If greater than 2.6.5 use M= instead of SUBDIR=
723 # convert_to_m "${NV_SRC}"/Makefile.kbuild
724 fi
725
726 if use pax_kernel; then
727 ewarn "Using PAX patches is not supported. You will be asked to"
728 ewarn "use a standard kernel should you have issues. Should you"
729 ewarn "need support with these patches, contact the PaX team."
730 epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
731 fi
732
733 # Allow user patches so they can support RC kernels and whatever else
734 epatch_user
735 }
736
737 src_compile() {
738 # This is already the default on Linux, as there's no toplevel Makefile, but
739 # on FreeBSD there's one and triggers the kernel module build, as we install
740 # it by itself, pass this.
741
742 cd "${NV_SRC}"
743 if use kernel_FreeBSD; then
744 MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
745 LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
746 elif use kernel_linux; then
747 linux-mod_src_compile
748 fi
749 }
750
751 # Install nvidia library:
752 # the first parameter is the library to install
753 # the second parameter is the provided soversion
754 # the third parameter is the target directory if its not /usr/lib
755 donvidia() {
756 # Full path to library minus SOVER
757 MY_LIB="$1"
758
759 # SOVER to use
760 MY_SOVER="$2"
761
762 # Where to install
763 MY_DEST="$3"
764
765 if [[ -z "${MY_DEST}" ]]; then
766 MY_DEST="/usr/$(get_libdir)"
767 action="dolib.so"
768 else
769 exeinto ${MY_DEST}
770 action="doexe"
771 fi
772
773 # Get just the library name
774 libname=$(basename $1)
775
776 # Install the library with the correct SOVER
777 ${action} ${MY_LIB}.${MY_SOVER} || \
778 die "failed to install ${libname}"
779
780 # If SOVER wasn't 1, then we need to create a .1 symlink
781 if [[ "${MY_SOVER}" != "1" ]]; then
782 dosym ${libname}.${MY_SOVER} \
783 ${MY_DEST}/${libname}.1 || \
784 die "failed to create ${libname} symlink"
785 fi
786
787 # Always create the symlink from the raw lib to the .1
788 dosym ${libname}.1 \
789 ${MY_DEST}/${libname} || \
790 die "failed to create ${libname} symlink"
791 }
792
793 src_install() {
794 if use kernel_linux; then
795 linux-mod_src_install
796
797 # Add the aliases
798 # This file is tweaked with the appropriate video group in
799 # pkg_preinst, see bug #491414
800 insinto /etc/modprobe.d
801 newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
802 use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
803
804 # Ensures that our device nodes are created when not using X
805 exeinto "$(udev_get_udevdir)"
806 doexe "${FILESDIR}"/nvidia-udev.sh
807 udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
808 elif use kernel_FreeBSD; then
809 if use x86-fbsd; then
810 insinto /boot/modules
811 doins "${S}/src/nvidia.kld"
812 fi
813
814 exeinto /boot/modules
815 doexe "${S}/src/nvidia.ko"
816 fi
817
818 # NVIDIA kernel <-> userspace driver config lib
819 donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
820
821 # NVIDIA framebuffer capture library
822 donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
823
824 # NVIDIA video encode/decode <-> CUDA
825 if use kernel_linux; then
826 donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
827 donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
828 fi
829
830 if use X; then
831 # Xorg DDX driver
832 insinto /usr/$(get_libdir)/xorg/modules/drivers
833 doins ${NV_X11}/nvidia_drv.so
834
835 # Xorg GLX driver
836 donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
837 /usr/$(get_libdir)/opengl/nvidia/extensions
838 fi
839
840 # OpenCL ICD for NVIDIA
841 if use kernel_linux; then
842 insinto /etc/OpenCL/vendors
843 doins ${NV_OBJ}/nvidia.icd
844 fi
845
846 # Documentation
847 dohtml ${NV_DOC}/html/*
848 if use kernel_FreeBSD; then
849 dodoc "${NV_DOC}/README"
850 use X && doman "${NV_MAN}/nvidia-xconfig.1"
851 use tools && doman "${NV_MAN}/nvidia-settings.1"
852 else
853 # Docs
854 newdoc "${NV_DOC}/README.txt" README
855 dodoc "${NV_DOC}/NVIDIA_Changelog"
856 doman "${NV_MAN}/nvidia-smi.1.gz"
857 use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
858 use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
859 doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
860 fi
861
862 # Helper Apps
863 exeinto /opt/bin/
864
865 if use X; then
866 doexe ${NV_OBJ}/nvidia-xconfig
867 fi
868
869 if use kernel_linux ; then
870 doexe ${NV_OBJ}/nvidia-cuda-mps-control
871 doexe ${NV_OBJ}/nvidia-cuda-mps-server
872 doexe ${NV_OBJ}/nvidia-debugdump
873 doexe ${NV_OBJ}/nvidia-persistenced
874 doexe ${NV_OBJ}/nvidia-smi
875
876 # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
877 doexe ${NV_OBJ}/nvidia-modprobe
878 fowners root:video /opt/bin/nvidia-modprobe
879 fperms 4710 /opt/bin/nvidia-modprobe
880 dosym /{opt,usr}/bin/nvidia-modprobe
881
882 doman nvidia-cuda-mps-control.1.gz
883 doman nvidia-modprobe.1.gz
884 doman nvidia-persistenced.1.gz
885 newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
886 fi
887
888 if use tools; then
889 doexe ${NV_OBJ}/nvidia-settings
890 fi
891
892 exeinto /usr/bin/
893 doexe ${NV_OBJ}/nvidia-bug-report.sh
894
895 # Desktop entries for nvidia-settings
896 if use tools ; then
897 # There is no icon in the FreeBSD tarball.
898 use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
899 domenu "${FILESDIR}"/${PN}-settings.desktop
900 exeinto /etc/X11/xinit/xinitrc.d
901 doexe "${FILESDIR}"/95-nvidia-settings
902 fi
903
904 #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
905
906 if has_multilib_profile && use multilib ; then
907 local OABI=${ABI}
908 for ABI in $(get_install_abis) ; do
909 src_install-libs
910 done
911 ABI=${OABI}
912 unset OABI
913 else
914 src_install-libs
915 fi
916
917 is_final_abi || die "failed to iterate through all ABIs"
918
919 readme.gentoo_create_doc
920 }
921
922 src_install-libs() {
923 local inslibdir=$(get_libdir)
924 local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
925 local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
926 local libdir=${NV_OBJ}
927
928 if use kernel_linux && has_multilib_profile && \
929 [[ ${ABI} == "x86" ]] ; then
930 libdir=${NV_OBJ}/32
931 fi
932
933 if use X; then
934 # The GLX libraries
935 donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
936 donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
937 donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
938 donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
939 donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
940 donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
941 donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
942 if use kernel_FreeBSD; then
943 donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
944 else
945 donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
946 fi
947
948 # VDPAU
949 donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
950
951 # GLES v2 libraries
952 insinto ${GL_ROOT}
953 doexe ${libdir}/libGLESv2.so.${PV}
954 dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
955 dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
956 fi
957
958 # NVIDIA monitoring library
959 if use kernel_linux ; then
960 donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
961 fi
962
963 # CUDA & OpenCL
964 if use kernel_linux; then
965 donvidia ${libdir}/libcuda.so ${NV_SOVER}
966 donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
967 donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
968 donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
969 fi
970 }
971
972 pkg_preinst() {
973 if use kernel_linux; then
974 linux-mod_pkg_preinst
975
976 local videogroup="$(egetent group video | cut -d ':' -f 3)"
977 if [ -z "${videogroup}" ]; then
978 eerror "Failed to determine the video group gid"
979 die "Failed to determine the video group gid"
980 else
981 sed -i \
982 -e "s:PACKAGE:${PF}:g" \
983 -e "s:VIDEOGID:${videogroup}:" \
984 "${D}"/etc/modprobe.d/nvidia.conf || die
985 fi
986 fi
987
988 # Clean the dynamic libGL stuff's home to ensure
989 # we dont have stale libs floating around
990 if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
991 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
992 fi
993 # Make sure we nuke the old nvidia-glx's env.d file
994 if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
995 rm -f "${ROOT}"/etc/env.d/09nvidia
996 fi
997 }
998
999 pkg_postinst() {
1000 use kernel_linux && linux-mod_pkg_postinst
1001
1002 # Switch to the nvidia implementation
1003 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
1004 "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
1005
1006 readme.gentoo_print_elog
1007
1008 if ! use X; then
1009 elog "You have elected to not install the X.org driver. Along with"
1010 elog "this the OpenGL libraries and VDPAU libraries were not"
1011 elog "installed. Additionally, once the driver is loaded your card"
1012 elog "and fan will run at max speed which may not be desirable."
1013 elog "Use the 'nvidia-smi' init script to have your card and fan"
1014 elog "speed scale appropriately."
1015 elog
1016 fi
1017 if ! use tools; then
1018 elog "USE=tools controls whether the nvidia-settings application"
1019 elog "is installed. If you would like to use it, enable that"
1020 elog "flag and re-emerge this ebuild. Optionally you can install"
1021 elog "media-video/nvidia-settings"
1022 elog
1023 fi
1024 }
1025
1026 pkg_prerm() {
1027 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1028 }
1029
1030 pkg_postrm() {
1031 use kernel_linux && linux-mod_pkg_postrm
1032 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1033 }