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