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: Wed, 23 Sep 2015 05:45:42
Message-Id: 1442987130.ee4f3b7df7907bd794779ca48709e917cd5b508c.jer@gentoo
1 commit: ee4f3b7df7907bd794779ca48709e917cd5b508c
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 23 05:43:24 2015 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 23 05:45:30 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee4f3b7d
7
8 x11-drivers/nvidia-drivers: Add sub-SLOTS for all branches (bug #560486). Use the newer nvidia-udev.sh (bug #454740).
9
10 Package-Manager: portage-2.2.20.1
11
12 x11-drivers/nvidia-drivers/metadata.xml | 6 +
13 .../nvidia-drivers-173.14.39-r1.ebuild | 546 +++++++++++++++++++++
14 .../nvidia-drivers-304.128-r1.ebuild | 457 +++++++++++++++++
15 .../nvidia-drivers/nvidia-drivers-340.93-r1.ebuild | 479 ++++++++++++++++++
16 .../nvidia-drivers/nvidia-drivers-346.96-r1.ebuild | 489 ++++++++++++++++++
17 .../nvidia-drivers/nvidia-drivers-352.41-r1.ebuild | 489 ++++++++++++++++++
18 .../nvidia-drivers/nvidia-drivers-355.11-r2.ebuild | 500 +++++++++++++++++++
19 .../nvidia-drivers-96.43.23-r1.ebuild | 519 ++++++++++++++++++++
20 8 files changed, 3485 insertions(+)
21
22 diff --git a/x11-drivers/nvidia-drivers/metadata.xml b/x11-drivers/nvidia-drivers/metadata.xml
23 index d4fc775..f65392e 100644
24 --- a/x11-drivers/nvidia-drivers/metadata.xml
25 +++ b/x11-drivers/nvidia-drivers/metadata.xml
26 @@ -4,6 +4,12 @@
27 <maintainer>
28 <email>jer@g.o</email>
29 </maintainer>
30 +<longdescription>
31 +Nvidia provides different branches of its drivers for different batches of its
32 +hardware. When maintaining these ebuilds or other ebuilds depending on them,
33 +you will need to keep in mind that the major versions represent these different
34 +branches.
35 +</longdescription>
36 <use>
37 <flag name='X'>Install the X.org driver, OpenGL libraries, XvMC libraries, and VDPAU libraries</flag>
38 <flag name='gtk2'>Install nvidia-settings with support for GTK+ 2</flag>
39
40 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39-r1.ebuild
41 new file mode 100644
42 index 0000000..5f5b3bd
43 --- /dev/null
44 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39-r1.ebuild
45 @@ -0,0 +1,546 @@
46 +# Copyright 1999-2015 Gentoo Foundation
47 +# Distributed under the terms of the GNU General Public License v2
48 +# $Id$
49 +
50 +EAPI=5
51 +
52 +inherit eutils flag-o-matic linux-mod multilib nvidia-driver portability \
53 + unpacker user versionator
54 +
55 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
56 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
57 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
58 +
59 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
60 +HOMEPAGE="http://www.nvidia.com/"
61 +SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
62 + amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
63 + x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
64 +
65 +LICENSE="GPL-2 NVIDIA-r1"
66 +SLOT="0/173"
67 +KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
68 +IUSE="acpi multilib kernel_linux tools"
69 +RESTRICT="bindist mirror strip"
70 +EMULTILIB_PKG="true"
71 +
72 +COMMON="
73 + >=app-eselect/eselect-opengl-1.0.9
74 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
75 +"
76 +DEPEND="
77 + ${COMMON}
78 + kernel_linux? ( virtual/linux-sources )
79 +"
80 +RDEPEND="
81 + ${COMMON}
82 + <x11-base/xorg-server-1.15.99:=
83 + acpi? ( sys-power/acpid )
84 + multilib? (
85 + >=x11-libs/libX11-1.6.2[abi_x86_32]
86 + >=x11-libs/libXext-1.3.2[abi_x86_32]
87 + )
88 + tools? (
89 + dev-libs/atk
90 + dev-libs/glib:2
91 + x11-libs/gdk-pixbuf
92 + x11-libs/gtk+:2
93 + x11-libs/libX11
94 + x11-libs/libXext
95 + x11-libs/pango[X]
96 + )
97 +"
98 +
99 +QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
100 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
101 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
102 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
103 + usr/lib/xorg/modules/drivers/nvidia_drv.so
104 + usr/lib/libcuda.so.${PV}
105 + usr/lib/libnvidia-cfg.so.${PV}
106 + usr/lib/libvdpau_nvidia.so.${PV}
107 + usr/lib/libXvMCNVIDIA.so.${PV}"
108 +
109 +QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
110 + usr/lib/opengl/nvidia/lib/libGL.so.1
111 + usr/lib/opengl/nvidia/lib/libGLcore.so.1
112 + usr/lib/libnvidia-cfg.so.1
113 + usr/lib/opengl/nvidia/extensions/libglx.so.1
114 + usr/lib/xorg/modules/drivers/nvidia_drv.so"
115 +
116 +QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
117 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
118 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
119 + usr/lib32/libcuda.so.${PV}
120 + usr/lib32/libvdpau_nvidia.so.${PV}"
121 +
122 +QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
123 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
124 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
125 + usr/lib/xorg/modules/drivers/nvidia_drv.so
126 + usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
127 +
128 +QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
129 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
130 + usr/lib64/libnvcompiler.so.${PV}
131 + usr/lib64/libXvMCNVIDIA.so.${PV}
132 + usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
133 + usr/lib64/libnvidia-cfg.so.${PV}
134 + usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
135 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
136 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
137 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
138 + usr/lib64/xorg/modules/drivers/nvidia_drv.so
139 + opt/bin/nvidia-settings
140 + opt/bin/nvidia-smi
141 + opt/bin/nvidia-xconfig"
142 +
143 +QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
144 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
145 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
146 + usr/lib/libXvMCNVIDIA.a"
147 +
148 +QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
149 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
150 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
151 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
152 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
153 +
154 +QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
155 +
156 +QA_FLAGS_IGNORED_amd64="usr/lib32/libcuda.so.${PV}
157 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
158 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
159 + usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
160 + usr/lib32/libvdpau_nvidia.so.${PV}
161 + usr/lib64/libXvMCNVIDIA.so.${PV}
162 + usr/lib64/libcuda.so.${PV}
163 + usr/lib64/libnvidia-cfg.so.${PV}
164 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
165 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
166 + usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
167 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
168 + usr/lib64/xorg/modules/drivers/nvidia_drv.so
169 + usr/lib64/libvdpau_nvidia.so.${PV}
170 + opt/bin/nvidia-settings
171 + opt/bin/nvidia-smi
172 + opt/bin/nvidia-xconfig"
173 +
174 +QA_FLAGS_IGNORED_x86="usr/lib/libcuda.so.${PV}
175 + usr/lib/libnvidia-cfg.so.${PV}
176 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
177 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
178 + usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
179 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
180 + usr/lib/xorg/modules/drivers/nvidia_drv.so
181 + usr/lib/libXvMCNVIDIA.so.${PV}
182 + usr/lib/libvdpau_nvidia.so.${PV}
183 + opt/bin/nvidia-settings
184 + opt/bin/nvidia-smi
185 + opt/bin/nvidia-xconfig"
186 +
187 +S="${WORKDIR}/"
188 +
189 +mtrr_check() {
190 + ebegin "Checking for MTRR support"
191 + linux_chkconfig_present MTRR
192 + eend $?
193 +
194 + if [[ $? -ne 0 ]] ; then
195 + eerror "Please enable MTRR support in your kernel config, found at:"
196 + eerror
197 + eerror " Processor type and features"
198 + eerror " [*] MTRR (Memory Type Range Register) support"
199 + eerror
200 + eerror "and recompile your kernel ..."
201 + die "MTRR support not detected!"
202 + fi
203 +}
204 +
205 +lockdep_check() {
206 + if linux_chkconfig_present LOCKDEP; then
207 + eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
208 + eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
209 + eerror "which will prevent ${P} from compiling."
210 + eerror "Please make sure the following options have been unset:"
211 + eerror " Kernel hacking --->"
212 + eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
213 + eerror " [ ] Lock debugging: prove locking correctness"
214 + eerror " [ ] Lock usage statistics"
215 + eerror "in 'menuconfig'"
216 + die "LOCKDEP enabled"
217 + fi
218 +}
219 +
220 +pkg_setup() {
221 + # try to turn off distcc and ccache for people that have a problem with it
222 + export DISTCC_DISABLE=1
223 + export CCACHE_DISABLE=1
224 +
225 + if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
226 + eerror "This ebuild doesn't currently support changing your default abi."
227 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
228 + fi
229 +
230 + if use kernel_linux; then
231 + linux-mod_pkg_setup
232 + MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
233 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
234 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
235 + # linux-mod_src_compile calls set_arch_to_kernel, which
236 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
237 + # expects x86_64 or i386 and then converts it to x86
238 + # later on in the build process
239 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
240 + mtrr_check
241 + lockdep_check
242 + fi
243 +
244 + # On BSD userland it wants real make command
245 + use userland_BSD && MAKE="$(get_bmake)"
246 +
247 + export _POSIX2_VERSION="199209"
248 +
249 + if use kernel_linux && kernel_is ge 3 13 ; then
250 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
251 + ewarn "which are limited to the following kernels:"
252 + ewarn "<sys-kernel/gentoo-sources-3.13"
253 + ewarn "<sys-kernel/vanilla-sources-3.13"
254 + ewarn ""
255 + ewarn "You are free to utilize epatch_user to provide whatever"
256 + ewarn "support you feel is appropriate, but will not receive"
257 + ewarn "support as a result of those changes."
258 + ewarn ""
259 + ewarn "Do not file a bug report about this."
260 + fi
261 +
262 + # Since Nvidia ships 3 different series of drivers, we need to give the user
263 + # some kind of guidance as to what version they should install. This tries
264 + # to point the user in the right direction but can't be perfect. check
265 + # nvidia-driver.eclass
266 + nvidia-driver-check-warning
267 +
268 + # set variables to where files are in the package structure
269 + if use kernel_FreeBSD; then
270 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
271 + NV_DOC="${S}/doc"
272 + NV_EXEC="${S}/obj"
273 + NV_LIB="${S}/obj"
274 + NV_SRC="${S}/src"
275 + NV_MAN="${S}/x11/man"
276 + NV_X11="${S}/obj"
277 + NV_X11_DRV="${NV_X11}"
278 + NV_X11_EXT="${NV_X11}"
279 + NV_SOVER=1
280 + elif use kernel_linux; then
281 + NV_DOC="${S}/usr/share/doc"
282 + NV_EXEC="${S}/usr/bin"
283 + NV_LIB="${S}/usr/lib"
284 + NV_SRC="${S}/usr/src/nv"
285 + NV_MAN="${S}/usr/share/man/man1"
286 + NV_X11="${S}/usr/X11R6/lib"
287 + NV_X11_DRV="${NV_X11}/modules/drivers"
288 + NV_X11_EXT="${NV_X11}/modules/extensions"
289 + NV_SOVER=${PV}
290 + else
291 + die "Could not determine proper NVIDIA package"
292 + fi
293 +}
294 +
295 +src_unpack() {
296 + if use kernel_linux && kernel_is lt 2 6 7; then
297 + echo
298 + ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
299 + ewarn "This is not officially supported for ${P}. It is likely you"
300 + ewarn "will not be able to compile or use the kernel module."
301 + ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
302 + echo
303 + ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
304 + fi
305 +
306 + if ! use x86-fbsd; then
307 + mkdir "${S}"
308 + cd "${S}"
309 + unpack_makeself
310 + else
311 + unpack ${A}
312 + fi
313 +}
314 +
315 +src_prepare() {
316 + # Please add a brief description for every added patch
317 + use x86-fbsd && cd doc
318 +
319 + # Use the correct defines to make gtkglext build work
320 + epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
321 + # Use some more sensible gl headers and make way for new glext.h
322 + epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
323 +
324 + if use kernel_linux; then
325 + # Quiet down warnings the user does not need to see
326 + sed -i \
327 + -e 's:-Wpointer-arith::g' \
328 + -e 's:-Wsign-compare::g' \
329 + "${NV_SRC}"/Makefile.kbuild
330 +
331 + # If greater than 2.6.5 use M= instead of SUBDIR=
332 + convert_to_m "${NV_SRC}"/Makefile.kbuild
333 + fi
334 +
335 + epatch_user
336 +}
337 +
338 +src_compile() {
339 + # This is already the default on Linux, as there's no toplevel Makefile, but
340 + # on FreeBSD there's one and triggers the kernel module build, as we install
341 + # it by itself, pass this.
342 +
343 + cd "${NV_SRC}"
344 + if use x86-fbsd; then
345 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
346 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)"
347 + elif use kernel_linux; then
348 + linux-mod_src_compile
349 + fi
350 +}
351 +
352 +src_install() {
353 + if use kernel_linux; then
354 + linux-mod_src_install
355 +
356 + # Add the aliases
357 + # This file is tweaked with the appropriate video group in
358 + # pkg_preinst, see bug #491414
359 + insinto /etc/modprobe.d
360 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
361 + elif use kernel_FreeBSD; then
362 + insinto /boot/modules
363 + doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld"
364 +
365 + exeinto /boot/modules
366 + doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko"
367 + fi
368 +
369 + # NVIDIA kernel <-> userspace driver config lib
370 + dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
371 + die "failed to install libnvidia-cfg"
372 + dosym libnvidia-cfg.so.${NV_SOVER} \
373 + /usr/$(get_libdir)/libnvidia-cfg.so.1 || \
374 + die "failed to create libnvidia-cfg.so.1 symlink"
375 + dosym libnvidia-cfg.so.1 \
376 + /usr/$(get_libdir)/libnvidia-cfg.so || \
377 + die "failed to create libnvidia-cfg.so symlink"
378 +
379 + # Xorg DDX driver
380 + insinto /usr/$(get_libdir)/xorg/modules/drivers
381 + doins ${NV_X11_DRV}/nvidia_drv.so
382 +
383 + # Xorg GLX driver
384 + insinto /usr/$(get_libdir)/opengl/nvidia/extensions
385 + doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
386 + die "failed to install libglx.so"
387 + dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
388 + /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
389 + die "failed to create libglx.so symlink"
390 +
391 + # XvMC driver
392 + dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
393 + die "failed to install libXvMCNVIDIA.so"
394 + dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
395 + die "failed to install libXvMCNVIDIA.so"
396 + dosym libXvMCNVIDIA.so.${NV_SOVER} \
397 + /usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
398 + die "failed to create libXvMCNVIDIA.so.1 symlink"
399 + dosym libXvMCNVIDIA.so.1 \
400 + /usr/$(get_libdir)/libXvMCNVIDIA.so || \
401 + die "failed to create libXvMCNVIDIA.so symlink"
402 + dosym libXvMCNVIDIA.so.${NV_SOVER} \
403 + /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
404 + die "failed to create libXvMCNVIDIA_dynamic.so.1 symlink"
405 +
406 + # CUDA headers (driver to come)
407 + if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
408 + dodir /usr/include/cuda
409 + insinto /usr/include/cuda
410 + doins usr/include/cuda/*.h
411 + fi
412 +
413 + # OpenCL headers (driver to come)
414 + if [[ -d ${S}/usr/include/CL ]]; then
415 + dodir /usr/include/CL
416 + insinto /usr/include/CL
417 + doins usr/include/CL/*.h
418 + fi
419 +
420 + # Documentation
421 + dodoc ${NV_DOC}/XF86Config.sample
422 + dohtml ${NV_DOC}/html/*
423 + if use x86-fbsd; then
424 + dodoc "${NV_DOC}/README"
425 + doman "${NV_MAN}/nvidia-xconfig.1"
426 + doman "${NV_MAN}/nvidia-settings.1"
427 + else
428 + # Docs
429 + newdoc "${NV_DOC}/README.txt" README
430 + dodoc "${NV_DOC}/NVIDIA_Changelog"
431 + doman "${NV_MAN}/nvidia-xconfig.1.gz"
432 + doman "${NV_MAN}/nvidia-settings.1.gz"
433 + fi
434 +
435 + # Helper Apps
436 + exeinto /opt/bin/
437 + doexe ${NV_EXEC}/nvidia-xconfig
438 + doexe ${NV_EXEC}/nvidia-bug-report.sh
439 + if use tools; then
440 + doexe usr/bin/nvidia-settings
441 + fi
442 + if use kernel_linux; then
443 + doexe ${NV_EXEC}/nvidia-smi
444 + fi
445 +
446 + # Desktop entry for nvidia-settings
447 + if use tools && use kernel_linux; then
448 + sed -e 's:__UTILS_PATH__:/opt/bin:' \
449 + -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' \
450 + -e '/^Categories/s|Application;||g' \
451 + -i "${S}"/usr/share/applications//nvidia-settings.desktop
452 + newmenu "${S}"/usr/share/applications/nvidia-settings.desktop \
453 + nvidia-settings-opt.desktop
454 + fi
455 +
456 + if has_multilib_profile ; then
457 + local OABI=${ABI}
458 + for ABI in $(get_install_abis) ; do
459 + src_install-libs
460 + done
461 + ABI=${OABI}
462 + unset OABI
463 + else
464 + src_install-libs
465 + fi
466 +
467 + is_final_abi || die "failed to iterate through all ABIs"
468 +
469 + readme.gentoo_create_doc
470 +}
471 +
472 +# Install nvidia library:
473 +# the first parameter is the place where to install it
474 +# the second parameter is the base name of the library
475 +# the third parameter is the provided soversion
476 +donvidia() {
477 + dodir $1
478 + exeinto $1
479 +
480 + libname=$(basename $2)
481 +
482 + doexe $2.$3
483 + dosym ${libname}.$3 $1/${libname}
484 + [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
485 +}
486 +
487 +src_install-libs() {
488 + local inslibdir=$(get_libdir)
489 + local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
490 + local libdir= sover=
491 +
492 + if use kernel_linux; then
493 + if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
494 + libdir=usr/lib32
495 + else
496 + libdir=usr/lib
497 + fi
498 + sover=${PV}
499 + else
500 + libdir=obj
501 + # on FreeBSD it has just .1 suffix
502 + sover=1
503 + fi
504 +
505 + # The GLX libraries
506 + donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
507 + donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
508 + if use x86-fbsd; then
509 + donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
510 + else
511 + donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
512 + fi
513 +
514 + #cuda
515 + if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
516 + dolib.so ${libdir}/libcuda.so.${sover}
517 + [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
518 + dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
519 + fi
520 +
521 + #vdpau
522 + if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
523 + dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
524 + dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
525 + fi
526 +
527 + # OpenCL
528 + # NOTE: This isn't currently available in the publicly released drivers.
529 + if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
530 +
531 + dolib.so ${libdir}/libnvcompiler.so.${sover}
532 + [[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
533 + dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
534 +
535 + dolib.so ${libdir}/libOpenCL.so.1.0.0
536 + dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
537 + dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
538 + fi
539 +}
540 +
541 +pkg_preinst() {
542 + if use kernel_linux; then
543 + linux-mod_pkg_preinst
544 +
545 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
546 + if [ -z "${videogroup}" ]; then
547 + eerror "Failed to determine the video group gid"
548 + die "Failed to determine the video group gid"
549 + else
550 + sed -i \
551 + -e "s:PACKAGE:${PF}:g" \
552 + -e "s:VIDEOGID:${videogroup}:" \
553 + "${D}"/etc/modprobe.d/nvidia.conf || die
554 + fi
555 + fi
556 +
557 + # Clean the dynamic libGL stuff's home to ensure
558 + # we dont have stale libs floating around
559 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
560 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
561 + fi
562 + # Make sure we nuke the old nvidia-glx's env.d file
563 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
564 + rm -f "${ROOT}"/etc/env.d/09nvidia
565 + fi
566 +}
567 +
568 +pkg_postinst() {
569 + use kernel_linux && linux-mod_pkg_postinst
570 +
571 + # Switch to the nvidia implementation
572 + "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
573 +
574 + readme.gentoo_print_elog
575 +
576 + if ! use tools; then
577 + elog "USE=tools controls whether the nvidia-settings application"
578 + elog "is installed. If you would like to use it, enable that"
579 + elog "flag and re-emerge this ebuild. Optionally you can install"
580 + elog "media-video/nvidia-settings"
581 + fi
582 +}
583 +
584 +pkg_prerm() {
585 + "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
586 +}
587 +
588 +pkg_postrm() {
589 + use kernel_linux && linux-mod_pkg_postrm
590 + "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
591 +}
592
593 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.128-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.128-r1.ebuild
594 new file mode 100644
595 index 0000000..84076d5
596 --- /dev/null
597 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.128-r1.ebuild
598 @@ -0,0 +1,457 @@
599 +# Copyright 1999-2015 Gentoo Foundation
600 +# Distributed under the terms of the GNU General Public License v2
601 +# $Id$
602 +
603 +EAPI=5
604 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
605 + portability toolchain-funcs unpacker user versionator udev
606 +
607 +NV_URI="http://us.download.nvidia.com/XFree86/"
608 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
609 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
610 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
611 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
612 +
613 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
614 +HOMEPAGE="http://www.nvidia.com/"
615 +SRC_URI="
616 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
617 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
618 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
619 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
620 +"
621 +
622 +LICENSE="GPL-2 NVIDIA-r1"
623 +SLOT="0/304"
624 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
625 +IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X"
626 +RESTRICT="bindist mirror strip"
627 +EMULTILIB_PKG="true"
628 +
629 +COMMON="app-eselect/eselect-opencl
630 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
631 + X? (
632 + >=app-eselect/eselect-opengl-1.0.9
633 + )"
634 +DEPEND="${COMMON}
635 + kernel_linux? (
636 + virtual/linux-sources
637 + virtual/pkgconfig
638 + )"
639 +RDEPEND="${COMMON}
640 + acpi? ( sys-power/acpid )
641 + tools? (
642 + dev-libs/atk
643 + dev-libs/glib:2
644 + x11-libs/gdk-pixbuf
645 + x11-libs/gtk+:2
646 + x11-libs/libX11
647 + x11-libs/libXext
648 + x11-libs/pango[X]
649 + x11-libs/pangox-compat
650 + )
651 + X? (
652 + <x11-base/xorg-server-1.17.99:=
653 + x11-libs/libXvMC
654 + multilib? (
655 + >=x11-libs/libX11-1.6.2[abi_x86_32]
656 + >=x11-libs/libXext-1.3.2[abi_x86_32]
657 + )
658 + )
659 +"
660 +PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
661 +
662 +REQUIRED_USE="tools? ( X )"
663 +
664 +QA_PREBUILT="opt/* usr/lib*"
665 +
666 +S=${WORKDIR}/
667 +
668 +pkg_pretend() {
669 +
670 + if use amd64 && has_multilib_profile && \
671 + [ "${DEFAULT_ABI}" != "amd64" ]; then
672 + eerror "This ebuild doesn't currently support changing your default ABI"
673 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
674 + fi
675 +
676 + if use kernel_linux && kernel_is ge 4 3; then
677 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
678 + ewarn "which are limited to the following kernels:"
679 + ewarn "<sys-kernel/gentoo-sources-4.3"
680 + ewarn "<sys-kernel/vanilla-sources-4.3"
681 + ewarn ""
682 + ewarn "You are free to utilize epatch_user to provide whatever"
683 + ewarn "support you feel is appropriate, but will not receive"
684 + ewarn "support as a result of those changes."
685 + ewarn ""
686 + ewarn "Do not file a bug report about this."
687 + fi
688 +
689 + # Since Nvidia ships 3 different series of drivers, we need to give the user
690 + # some kind of guidance as to what version they should install. This tries
691 + # to point the user in the right direction but can't be perfect. check
692 + # nvidia-driver.eclass
693 + nvidia-driver-check-warning
694 +
695 + # Kernel features/options to check for
696 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
697 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
698 +
699 + # Now do the above checks
700 + use kernel_linux && check_extra_config
701 +}
702 +
703 +pkg_setup() {
704 + # try to turn off distcc and ccache for people that have a problem with it
705 + export DISTCC_DISABLE=1
706 + export CCACHE_DISABLE=1
707 +
708 + if use kernel_linux; then
709 + linux-mod_pkg_setup
710 + MODULE_NAMES="nvidia(video:${S}/kernel)"
711 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
712 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
713 + # linux-mod_src_compile calls set_arch_to_kernel, which
714 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
715 + # expects x86_64 or i386 and then converts it to x86
716 + # later on in the build process
717 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
718 + fi
719 +
720 + # set variables to where files are in the package structure
721 + if use kernel_FreeBSD; then
722 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
723 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
724 + NV_DOC="${S}/doc"
725 + NV_OBJ="${S}/obj"
726 + NV_SRC="${S}/src"
727 + NV_MAN="${S}/x11/man"
728 + NV_X11="${S}/obj"
729 + NV_SOVER=1
730 + elif use kernel_linux; then
731 + NV_DOC="${S}"
732 + NV_OBJ="${S}"
733 + NV_SRC="${S}/kernel"
734 + NV_MAN="${S}"
735 + NV_X11="${S}"
736 + NV_SOVER=${PV}
737 + else
738 + die "Could not determine proper NVIDIA package"
739 + fi
740 +}
741 +
742 +src_unpack() {
743 + if ! use kernel_FreeBSD; then
744 + cd "${S}"
745 + unpack_makeself
746 + else
747 + unpack ${A}
748 + fi
749 +}
750 +
751 +src_prepare() {
752 + # Please add a brief description for every added patch
753 +
754 + if use kernel_linux; then
755 + if kernel_is lt 2 6 9 ; then
756 + eerror "You must build this against 2.6.9 or higher kernels."
757 + fi
758 +
759 + # If greater than 2.6.5 use M= instead of SUBDIR=
760 + convert_to_m "${NV_SRC}"/Makefile.kbuild
761 + fi
762 +
763 + if use pax_kernel; then
764 + ewarn "Using PAX patches is not supported. You will be asked to"
765 + ewarn "use a standard kernel should you have issues. Should you"
766 + ewarn "need support with these patches, contact the PaX team."
767 + epatch "${FILESDIR}"/${PN}-pax-const.patch
768 + epatch "${FILESDIR}"/${PN}-pax-usercopy.patch
769 + fi
770 +
771 + cat <<- EOF > "${S}"/nvidia.icd
772 + /usr/$(get_libdir)/libnvidia-opencl.so
773 + EOF
774 +
775 + # Allow user patches so they can support RC kernels and whatever else
776 + epatch_user
777 +}
778 +
779 +src_compile() {
780 + # This is already the default on Linux, as there's no toplevel Makefile, but
781 + # on FreeBSD there's one and triggers the kernel module build, as we install
782 + # it by itself, pass this.
783 +
784 + cd "${NV_SRC}"
785 + if use kernel_FreeBSD; then
786 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
787 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
788 + elif use kernel_linux; then
789 + MAKEOPTS=-j1 linux-mod_src_compile
790 + fi
791 +}
792 +
793 +# Install nvidia library:
794 +# the first parameter is the library to install
795 +# the second parameter is the provided soversion
796 +# the third parameter is the target directory if its not /usr/lib
797 +donvidia() {
798 + # Full path to library minus SOVER
799 + MY_LIB="$1"
800 +
801 + # SOVER to use
802 + MY_SOVER="$2"
803 +
804 + # Where to install
805 + MY_DEST="$3"
806 +
807 + if [[ -z "${MY_DEST}" ]]; then
808 + MY_DEST="/usr/$(get_libdir)"
809 + action="dolib.so"
810 + else
811 + exeinto ${MY_DEST}
812 + action="doexe"
813 + fi
814 +
815 + # Get just the library name
816 + libname=$(basename $1)
817 +
818 + # Install the library with the correct SOVER
819 + ${action} ${MY_LIB}.${MY_SOVER} || \
820 + die "failed to install ${libname}"
821 +
822 + # If SOVER wasn't 1, then we need to create a .1 symlink
823 + if [[ "${MY_SOVER}" != "1" ]]; then
824 + dosym ${libname}.${MY_SOVER} \
825 + ${MY_DEST}/${libname}.1 || \
826 + die "failed to create ${libname} symlink"
827 + fi
828 +
829 + # Always create the symlink from the raw lib to the .1
830 + dosym ${libname}.1 \
831 + ${MY_DEST}/${libname} || \
832 + die "failed to create ${libname} symlink"
833 +}
834 +
835 +src_install() {
836 + if use kernel_linux; then
837 + linux-mod_src_install
838 +
839 + # Add the aliases
840 + # This file is tweaked with the appropriate video group in
841 + # pkg_preinst, see bug #491414
842 + insinto /etc/modprobe.d
843 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
844 +
845 + # Ensures that our device nodes are created when not using X
846 + exeinto "$(get_udevdir)"
847 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
848 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
849 + elif use kernel_FreeBSD; then
850 + if use x86-fbsd; then
851 + insinto /boot/modules
852 + doins "${S}/src/nvidia.kld"
853 + fi
854 +
855 + exeinto /boot/modules
856 + doexe "${S}/src/nvidia.ko"
857 + fi
858 +
859 + # NVIDIA kernel <-> userspace driver config lib
860 + donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
861 +
862 + if use kernel_linux; then
863 + # NVIDIA video decode <-> CUDA
864 + donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
865 + fi
866 +
867 + if use X; then
868 + # Xorg DDX driver
869 + insinto /usr/$(get_libdir)/xorg/modules/drivers
870 + doins ${NV_X11}/nvidia_drv.so
871 +
872 + # Xorg GLX driver
873 + donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
874 + /usr/$(get_libdir)/opengl/nvidia/extensions
875 +
876 + # XvMC driver
877 + dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
878 + die "failed to install libXvMCNVIDIA.so"
879 + donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
880 + dosym libXvMCNVIDIA.so.${NV_SOVER} \
881 + /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
882 + die "failed to create libXvMCNVIDIA_dynamic.so symlink"
883 + fi
884 +
885 + # OpenCL ICD for NVIDIA
886 + if use kernel_linux; then
887 + insinto /etc/OpenCL/vendors
888 + doins nvidia.icd
889 + donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER}
890 + fi
891 +
892 + # Documentation
893 + dohtml ${NV_DOC}/html/*
894 + if use kernel_FreeBSD; then
895 + dodoc "${NV_DOC}/README"
896 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
897 + use tools && doman "${NV_MAN}/nvidia-settings.1"
898 + else
899 + # Docs
900 + newdoc "${NV_DOC}/README.txt" README
901 + dodoc "${NV_DOC}/NVIDIA_Changelog"
902 + doman "${NV_MAN}/nvidia-smi.1.gz"
903 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
904 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
905 + doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
906 + fi
907 +
908 + # Helper Apps
909 + exeinto /opt/bin/
910 +
911 + if use X; then
912 + doexe ${NV_OBJ}/nvidia-xconfig
913 + fi
914 +
915 + if use kernel_linux ; then
916 + doexe ${NV_OBJ}/nvidia-debugdump
917 + doexe ${NV_OBJ}/nvidia-cuda-proxy-control
918 + doexe ${NV_OBJ}/nvidia-cuda-proxy-server
919 + doexe ${NV_OBJ}/nvidia-smi
920 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
921 + fi
922 +
923 + if use tools; then
924 + doexe ${NV_OBJ}/nvidia-settings
925 + fi
926 +
927 + dobin ${NV_OBJ}/nvidia-bug-report.sh
928 +
929 + # Desktop entries for nvidia-settings
930 + if use tools ; then
931 + # There is no icon in the FreeBSD tarball.
932 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
933 + domenu "${FILESDIR}"/${PN}-settings.desktop
934 + exeinto /etc/X11/xinit/xinitrc.d
935 + doexe "${FILESDIR}"/95-nvidia-settings
936 + fi
937 +
938 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
939 +
940 + if has_multilib_profile && use multilib ; then
941 + local OABI=${ABI}
942 + for ABI in $(get_install_abis) ; do
943 + src_install-libs
944 + done
945 + ABI=${OABI}
946 + unset OABI
947 + else
948 + src_install-libs
949 + fi
950 +
951 + is_final_abi || die "failed to iterate through all ABIs"
952 +
953 + readme.gentoo_create_doc
954 +}
955 +
956 +src_install-libs() {
957 + local inslibdir=$(get_libdir)
958 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
959 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
960 + local libdir=${NV_OBJ}
961 +
962 + if use kernel_linux && has_multilib_profile && \
963 + [[ ${ABI} == "x86" ]] ; then
964 + libdir=${NV_OBJ}/32
965 + fi
966 +
967 + if use X; then
968 + # The GLX libraries
969 + donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
970 + donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
971 + if use kernel_FreeBSD; then
972 + donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
973 + else
974 + donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
975 + fi
976 +
977 + # VDPAU
978 + donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
979 + fi
980 +
981 + # NVIDIA monitoring library
982 + if use kernel_linux ; then
983 + donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
984 + fi
985 +
986 + # CUDA & OpenCL
987 + if use kernel_linux; then
988 + donvidia ${libdir}/libcuda.so ${NV_SOVER}
989 + donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
990 + donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
991 + fi
992 +}
993 +
994 +pkg_preinst() {
995 + if use kernel_linux; then
996 + linux-mod_pkg_preinst
997 +
998 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
999 + if [ -z "${videogroup}" ]; then
1000 + eerror "Failed to determine the video group gid"
1001 + die "Failed to determine the video group gid"
1002 + else
1003 + sed -i \
1004 + -e "s:PACKAGE:${PF}:g" \
1005 + -e "s:VIDEOGID:${videogroup}:" \
1006 + "${D}"/etc/modprobe.d/nvidia.conf || die
1007 + fi
1008 + fi
1009 +
1010 + # Clean the dynamic libGL stuff's home to ensure
1011 + # we dont have stale libs floating around
1012 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
1013 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
1014 + fi
1015 + # Make sure we nuke the old nvidia-glx's env.d file
1016 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
1017 + rm -f "${ROOT}"/etc/env.d/09nvidia
1018 + fi
1019 +}
1020 +
1021 +pkg_postinst() {
1022 + use kernel_linux && linux-mod_pkg_postinst
1023 +
1024 + # Switch to the nvidia implementation
1025 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
1026 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
1027 +
1028 + readme.gentoo_print_elog
1029 +
1030 + if ! use X; then
1031 + elog "You have elected to not install the X.org driver. Along with"
1032 + elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
1033 + elog "installed. Additionally, once the driver is loaded your card"
1034 + elog "and fan will run at max speed which may not be desirable."
1035 + elog "Use the 'nvidia-smi' init script to have your card and fan"
1036 + elog "speed scale appropriately."
1037 + elog
1038 + fi
1039 + if ! use tools; then
1040 + elog "USE=tools controls whether the nvidia-settings application"
1041 + elog "is installed. If you would like to use it, enable that"
1042 + elog "flag and re-emerge this ebuild. Optionally you can install"
1043 + elog "media-video/nvidia-settings"
1044 + elog
1045 + fi
1046 +}
1047 +
1048 +pkg_prerm() {
1049 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1050 +}
1051 +
1052 +pkg_postrm() {
1053 + use kernel_linux && linux-mod_pkg_postrm
1054 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1055 +}
1056
1057 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-340.93-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-340.93-r1.ebuild
1058 new file mode 100644
1059 index 0000000..e2be11a
1060 --- /dev/null
1061 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-340.93-r1.ebuild
1062 @@ -0,0 +1,479 @@
1063 +# Copyright 1999-2015 Gentoo Foundation
1064 +# Distributed under the terms of the GNU General Public License v2
1065 +# $Id$
1066 +
1067 +EAPI=5
1068 +
1069 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
1070 + portability toolchain-funcs unpacker user udev
1071 +
1072 +NV_URI="http://us.download.nvidia.com/XFree86/"
1073 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
1074 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
1075 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
1076 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
1077 +
1078 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
1079 +HOMEPAGE="http://www.nvidia.com/"
1080 +SRC_URI="
1081 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
1082 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
1083 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
1084 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
1085 +"
1086 +
1087 +LICENSE="GPL-2 NVIDIA-r2"
1088 +SLOT="0/340"
1089 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
1090 +IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
1091 +RESTRICT="bindist mirror strip"
1092 +EMULTILIB_PKG="true"
1093 +
1094 +COMMON="
1095 + app-eselect/eselect-opencl
1096 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
1097 + X? (
1098 + >=app-eselect/eselect-opengl-1.0.9
1099 + )
1100 +"
1101 +DEPEND="
1102 + ${COMMON}
1103 + app-arch/xz-utils
1104 + kernel_linux? ( virtual/linux-sources )
1105 +"
1106 +RDEPEND="
1107 + ${COMMON}
1108 + acpi? ( sys-power/acpid )
1109 + tools? (
1110 + dev-libs/atk
1111 + dev-libs/glib:2
1112 + x11-libs/gdk-pixbuf
1113 + >=x11-libs/gtk+-2.4:2
1114 + x11-libs/libX11
1115 + x11-libs/libXext
1116 + x11-libs/pango[X]
1117 + )
1118 + X? (
1119 + <x11-base/xorg-server-1.17.99:=
1120 + >=x11-libs/libvdpau-0.3-r1
1121 + multilib? (
1122 + >=x11-libs/libX11-1.6.2[abi_x86_32]
1123 + >=x11-libs/libXext-1.3.2[abi_x86_32]
1124 + )
1125 + )
1126 +"
1127 +
1128 +REQUIRED_USE="tools? ( X )"
1129 +
1130 +QA_PREBUILT="opt/* usr/lib*"
1131 +
1132 +S=${WORKDIR}/
1133 +
1134 +pkg_pretend() {
1135 +
1136 + if use amd64 && has_multilib_profile && \
1137 + [ "${DEFAULT_ABI}" != "amd64" ]; then
1138 + eerror "This ebuild doesn't currently support changing your default ABI"
1139 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
1140 + fi
1141 +
1142 + if use kernel_linux && kernel_is ge 4 3; then
1143 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
1144 + ewarn "which are limited to the following kernels:"
1145 + ewarn "<sys-kernel/gentoo-sources-4.3"
1146 + ewarn "<sys-kernel/vanilla-sources-4.3"
1147 + ewarn ""
1148 + ewarn "You are free to utilize epatch_user to provide whatever"
1149 + ewarn "support you feel is appropriate, but will not receive"
1150 + ewarn "support as a result of those changes."
1151 + ewarn ""
1152 + ewarn "Do not file a bug report about this."
1153 + fi
1154 +
1155 + # Since Nvidia ships 3 different series of drivers, we need to give the user
1156 + # some kind of guidance as to what version they should install. This tries
1157 + # to point the user in the right direction but can't be perfect. check
1158 + # nvidia-driver.eclass
1159 + nvidia-driver-check-warning
1160 +
1161 + # Kernel features/options to check for
1162 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
1163 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
1164 +
1165 + # Now do the above checks
1166 + use kernel_linux && check_extra_config
1167 +}
1168 +
1169 +pkg_setup() {
1170 + # try to turn off distcc and ccache for people that have a problem with it
1171 + export DISTCC_DISABLE=1
1172 + export CCACHE_DISABLE=1
1173 +
1174 + if use kernel_linux; then
1175 + MODULE_NAMES="nvidia(video:${S}/kernel)"
1176 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
1177 +
1178 + # This needs to run after MODULE_NAMES (so that the eclass checks
1179 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
1180 + # is set (so that KV_DIR is populated).
1181 + linux-mod_pkg_setup
1182 +
1183 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
1184 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
1185 +
1186 + # linux-mod_src_compile calls set_arch_to_kernel, which
1187 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
1188 + # expects x86_64 or i386 and then converts it to x86
1189 + # later on in the build process
1190 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
1191 + fi
1192 +
1193 + # set variables to where files are in the package structure
1194 + if use kernel_FreeBSD; then
1195 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
1196 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
1197 + NV_DOC="${S}/doc"
1198 + NV_OBJ="${S}/obj"
1199 + NV_SRC="${S}/src"
1200 + NV_MAN="${S}/x11/man"
1201 + NV_X11="${S}/obj"
1202 + NV_SOVER=1
1203 + elif use kernel_linux; then
1204 + NV_DOC="${S}"
1205 + NV_OBJ="${S}"
1206 + NV_SRC="${S}/kernel"
1207 + NV_MAN="${S}"
1208 + NV_X11="${S}"
1209 + NV_SOVER=${PV}
1210 + else
1211 + die "Could not determine proper NVIDIA package"
1212 + fi
1213 +}
1214 +
1215 +src_prepare() {
1216 + # Please add a brief description for every added patch
1217 +
1218 + if use kernel_linux; then
1219 + if kernel_is lt 2 6 9 ; then
1220 + eerror "You must build this against 2.6.9 or higher kernels."
1221 + fi
1222 +
1223 + # If greater than 2.6.5 use M= instead of SUBDIR=
1224 +# convert_to_m "${NV_SRC}"/Makefile.kbuild
1225 + fi
1226 +
1227 + if use pax_kernel; then
1228 + ewarn "Using PAX patches is not supported. You will be asked to"
1229 + ewarn "use a standard kernel should you have issues. Should you"
1230 + ewarn "need support with these patches, contact the PaX team."
1231 + epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
1232 + epatch "${FILESDIR}"/${PN}-337.12-pax-constify.patch
1233 + fi
1234 +
1235 + # Allow user patches so they can support RC kernels and whatever else
1236 + epatch_user
1237 +}
1238 +
1239 +src_compile() {
1240 + # This is already the default on Linux, as there's no toplevel Makefile, but
1241 + # on FreeBSD there's one and triggers the kernel module build, as we install
1242 + # it by itself, pass this.
1243 +
1244 + cd "${NV_SRC}"
1245 + if use kernel_FreeBSD; then
1246 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
1247 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
1248 + elif use kernel_linux; then
1249 + use uvm && MAKEOPTS=-j1
1250 + linux-mod_src_compile
1251 + fi
1252 +}
1253 +
1254 +# Install nvidia library:
1255 +# the first parameter is the library to install
1256 +# the second parameter is the provided soversion
1257 +# the third parameter is the target directory if its not /usr/lib
1258 +donvidia() {
1259 + # Full path to library minus SOVER
1260 + MY_LIB="$1"
1261 +
1262 + # SOVER to use
1263 + MY_SOVER="$2"
1264 +
1265 + # Where to install
1266 + MY_DEST="$3"
1267 +
1268 + if [[ -z "${MY_DEST}" ]]; then
1269 + MY_DEST="/usr/$(get_libdir)"
1270 + action="dolib.so"
1271 + else
1272 + exeinto ${MY_DEST}
1273 + action="doexe"
1274 + fi
1275 +
1276 + # Get just the library name
1277 + libname=$(basename $1)
1278 +
1279 + # Install the library with the correct SOVER
1280 + ${action} ${MY_LIB}.${MY_SOVER} || \
1281 + die "failed to install ${libname}"
1282 +
1283 + # If SOVER wasn't 1, then we need to create a .1 symlink
1284 + if [[ "${MY_SOVER}" != "1" ]]; then
1285 + dosym ${libname}.${MY_SOVER} \
1286 + ${MY_DEST}/${libname}.1 || \
1287 + die "failed to create ${libname} symlink"
1288 + fi
1289 +
1290 + # Always create the symlink from the raw lib to the .1
1291 + dosym ${libname}.1 \
1292 + ${MY_DEST}/${libname} || \
1293 + die "failed to create ${libname} symlink"
1294 +}
1295 +
1296 +src_install() {
1297 + if use kernel_linux; then
1298 + linux-mod_src_install
1299 +
1300 + # Add the aliases
1301 + # This file is tweaked with the appropriate video group in
1302 + # pkg_preinst, see bug #491414
1303 + insinto /etc/modprobe.d
1304 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
1305 + use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
1306 +
1307 + # Ensures that our device nodes are created when not using X
1308 + exeinto "$(get_udevdir)"
1309 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
1310 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
1311 + elif use kernel_FreeBSD; then
1312 + if use x86-fbsd; then
1313 + insinto /boot/modules
1314 + doins "${S}/src/nvidia.kld"
1315 + fi
1316 +
1317 + exeinto /boot/modules
1318 + doexe "${S}/src/nvidia.ko"
1319 + fi
1320 +
1321 + # NVIDIA kernel <-> userspace driver config lib
1322 + donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
1323 +
1324 + # NVIDIA framebuffer capture library
1325 + donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
1326 +
1327 + # NVIDIA video encode/decode <-> CUDA
1328 + if use kernel_linux; then
1329 + donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
1330 + donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
1331 + fi
1332 +
1333 + if use X; then
1334 + # Xorg DDX driver
1335 + insinto /usr/$(get_libdir)/xorg/modules/drivers
1336 + doins ${NV_X11}/nvidia_drv.so
1337 +
1338 + # Xorg GLX driver
1339 + donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
1340 + /usr/$(get_libdir)/opengl/nvidia/extensions
1341 + fi
1342 +
1343 + # OpenCL ICD for NVIDIA
1344 + if use kernel_linux; then
1345 + insinto /etc/OpenCL/vendors
1346 + doins ${NV_OBJ}/nvidia.icd
1347 + fi
1348 +
1349 + # Documentation
1350 + dohtml ${NV_DOC}/html/*
1351 + if use kernel_FreeBSD; then
1352 + dodoc "${NV_DOC}/README"
1353 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
1354 + use tools && doman "${NV_MAN}/nvidia-settings.1"
1355 + else
1356 + # Docs
1357 + newdoc "${NV_DOC}/README.txt" README
1358 + dodoc "${NV_DOC}/NVIDIA_Changelog"
1359 + doman "${NV_MAN}/nvidia-smi.1.gz"
1360 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
1361 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
1362 + doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
1363 + fi
1364 +
1365 + # Helper Apps
1366 + exeinto /opt/bin/
1367 +
1368 + if use X; then
1369 + doexe ${NV_OBJ}/nvidia-xconfig
1370 + fi
1371 +
1372 + if use kernel_linux ; then
1373 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
1374 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
1375 + doexe ${NV_OBJ}/nvidia-debugdump
1376 + doexe ${NV_OBJ}/nvidia-persistenced
1377 + doexe ${NV_OBJ}/nvidia-smi
1378 +
1379 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
1380 + doexe ${NV_OBJ}/nvidia-modprobe
1381 + fowners root:video /opt/bin/nvidia-modprobe
1382 + fperms 4710 /opt/bin/nvidia-modprobe
1383 + dosym /{opt,usr}/bin/nvidia-modprobe
1384 +
1385 + doman nvidia-cuda-mps-control.1.gz
1386 + doman nvidia-modprobe.1.gz
1387 + doman nvidia-persistenced.1.gz
1388 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
1389 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
1390 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
1391 + fi
1392 +
1393 + if use tools; then
1394 + doexe ${NV_OBJ}/nvidia-settings
1395 + insinto /usr/share/nvidia/
1396 + doins nvidia-application-profiles-${PV}-key-documentation
1397 + insinto /etc/nvidia
1398 + newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
1399 + fi
1400 +
1401 + dobin ${NV_OBJ}/nvidia-bug-report.sh
1402 +
1403 + # Desktop entries for nvidia-settings
1404 + if use tools ; then
1405 + # There is no icon in the FreeBSD tarball.
1406 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
1407 + domenu "${FILESDIR}"/${PN}-settings.desktop
1408 + exeinto /etc/X11/xinit/xinitrc.d
1409 + doexe "${FILESDIR}"/95-nvidia-settings
1410 + fi
1411 +
1412 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
1413 +
1414 + if has_multilib_profile && use multilib ; then
1415 + local OABI=${ABI}
1416 + for ABI in $(get_install_abis) ; do
1417 + src_install-libs
1418 + done
1419 + ABI=${OABI}
1420 + unset OABI
1421 + else
1422 + src_install-libs
1423 + fi
1424 +
1425 + is_final_abi || die "failed to iterate through all ABIs"
1426 +
1427 + readme.gentoo_create_doc
1428 +}
1429 +
1430 +src_install-libs() {
1431 + local inslibdir=$(get_libdir)
1432 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
1433 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
1434 + local libdir=${NV_OBJ}
1435 +
1436 + if use kernel_linux && has_multilib_profile && \
1437 + [[ ${ABI} == "x86" ]] ; then
1438 + libdir=${NV_OBJ}/32
1439 + fi
1440 +
1441 + if use X; then
1442 + # The GLX libraries
1443 + donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
1444 + donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
1445 + donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
1446 + donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
1447 + donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
1448 + donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
1449 + donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
1450 + if use kernel_FreeBSD; then
1451 + donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
1452 + else
1453 + donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
1454 + fi
1455 +
1456 + # VDPAU
1457 + donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
1458 +
1459 + # GLES v2 libraries
1460 + insinto ${GL_ROOT}
1461 + doexe ${libdir}/libGLESv2.so.${PV}
1462 + dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
1463 + dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
1464 + fi
1465 +
1466 + # NVIDIA monitoring library
1467 + if use kernel_linux ; then
1468 + donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
1469 + fi
1470 +
1471 + # CUDA & OpenCL
1472 + if use kernel_linux; then
1473 + donvidia ${libdir}/libcuda.so ${NV_SOVER}
1474 + donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
1475 + donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
1476 + donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
1477 + fi
1478 +}
1479 +
1480 +pkg_preinst() {
1481 + if use kernel_linux; then
1482 + linux-mod_pkg_preinst
1483 +
1484 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
1485 + if [ -z "${videogroup}" ]; then
1486 + eerror "Failed to determine the video group gid"
1487 + die "Failed to determine the video group gid"
1488 + else
1489 + sed -i \
1490 + -e "s:PACKAGE:${PF}:g" \
1491 + -e "s:VIDEOGID:${videogroup}:" \
1492 + "${D}"/etc/modprobe.d/nvidia.conf || die
1493 + fi
1494 + fi
1495 +
1496 + # Clean the dynamic libGL stuff's home to ensure
1497 + # we dont have stale libs floating around
1498 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
1499 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
1500 + fi
1501 + # Make sure we nuke the old nvidia-glx's env.d file
1502 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
1503 + rm -f "${ROOT}"/etc/env.d/09nvidia
1504 + fi
1505 +}
1506 +
1507 +pkg_postinst() {
1508 + use kernel_linux && linux-mod_pkg_postinst
1509 +
1510 + # Switch to the nvidia implementation
1511 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
1512 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
1513 +
1514 + readme.gentoo_print_elog
1515 +
1516 + if ! use X; then
1517 + elog "You have elected to not install the X.org driver. Along with"
1518 + elog "this the OpenGL libraries and VDPAU libraries were not"
1519 + elog "installed. Additionally, once the driver is loaded your card"
1520 + elog "and fan will run at max speed which may not be desirable."
1521 + elog "Use the 'nvidia-smi' init script to have your card and fan"
1522 + elog "speed scale appropriately."
1523 + elog
1524 + fi
1525 + if ! use tools; then
1526 + elog "USE=tools controls whether the nvidia-settings application"
1527 + elog "is installed. If you would like to use it, enable that"
1528 + elog "flag and re-emerge this ebuild. Optionally you can install"
1529 + elog "media-video/nvidia-settings"
1530 + elog
1531 + fi
1532 +}
1533 +
1534 +pkg_prerm() {
1535 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1536 +}
1537 +
1538 +pkg_postrm() {
1539 + use kernel_linux && linux-mod_pkg_postrm
1540 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
1541 +}
1542
1543 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-346.96-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-346.96-r1.ebuild
1544 new file mode 100644
1545 index 0000000..cd42a7c
1546 --- /dev/null
1547 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-346.96-r1.ebuild
1548 @@ -0,0 +1,489 @@
1549 +# Copyright 1999-2015 Gentoo Foundation
1550 +# Distributed under the terms of the GNU General Public License v2
1551 +# $Id$
1552 +
1553 +EAPI=5
1554 +
1555 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
1556 + portability toolchain-funcs unpacker user udev
1557 +
1558 +NV_URI="http://us.download.nvidia.com/XFree86/"
1559 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
1560 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
1561 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
1562 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
1563 +
1564 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
1565 +HOMEPAGE="http://www.nvidia.com/"
1566 +SRC_URI="
1567 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
1568 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
1569 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
1570 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
1571 +"
1572 +
1573 +LICENSE="GPL-2 NVIDIA-r2"
1574 +SLOT="0/346"
1575 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
1576 +RESTRICT="bindist mirror strip"
1577 +EMULTILIB_PKG="true"
1578 +
1579 +IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
1580 +REQUIRED_USE="
1581 + tools? ( X || ( gtk2 gtk3 ) )
1582 +"
1583 +
1584 +COMMON="
1585 + app-eselect/eselect-opencl
1586 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
1587 + X? (
1588 + >=app-eselect/eselect-opengl-1.0.9
1589 + )
1590 +"
1591 +DEPEND="
1592 + ${COMMON}
1593 + app-arch/xz-utils
1594 + kernel_linux? ( virtual/linux-sources )
1595 +"
1596 +RDEPEND="
1597 + ${COMMON}
1598 + acpi? ( sys-power/acpid )
1599 + tools? (
1600 + dev-libs/atk
1601 + dev-libs/glib:2
1602 + x11-libs/gdk-pixbuf
1603 + gtk2? ( >=x11-libs/gtk+-2.4:2 )
1604 + gtk3? ( x11-libs/gtk+:3 )
1605 + x11-libs/libX11
1606 + x11-libs/libXext
1607 + x11-libs/pango[X]
1608 + )
1609 + X? (
1610 + <x11-base/xorg-server-1.17.99:=
1611 + >=x11-libs/libvdpau-0.3-r1
1612 + multilib? (
1613 + >=x11-libs/libX11-1.6.2[abi_x86_32]
1614 + >=x11-libs/libXext-1.3.2[abi_x86_32]
1615 + )
1616 + )
1617 +"
1618 +
1619 +QA_PREBUILT="opt/* usr/lib*"
1620 +
1621 +S=${WORKDIR}/
1622 +
1623 +pkg_pretend() {
1624 + if use amd64 && has_multilib_profile && \
1625 + [ "${DEFAULT_ABI}" != "amd64" ]; then
1626 + eerror "This ebuild doesn't currently support changing your default ABI"
1627 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
1628 + fi
1629 +
1630 + if use kernel_linux && kernel_is ge 4 3; then
1631 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
1632 + ewarn "which are limited to the following kernels:"
1633 + ewarn "<sys-kernel/gentoo-sources-4.3"
1634 + ewarn "<sys-kernel/vanilla-sources-4.3"
1635 + ewarn ""
1636 + ewarn "You are free to utilize epatch_user to provide whatever"
1637 + ewarn "support you feel is appropriate, but will not receive"
1638 + ewarn "support as a result of those changes."
1639 + ewarn ""
1640 + ewarn "Do not file a bug report about this."
1641 + fi
1642 +
1643 + # Since Nvidia ships 3 different series of drivers, we need to give the user
1644 + # some kind of guidance as to what version they should install. This tries
1645 + # to point the user in the right direction but can't be perfect. check
1646 + # nvidia-driver.eclass
1647 + nvidia-driver-check-warning
1648 +
1649 + # Kernel features/options to check for
1650 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
1651 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
1652 +
1653 + # Now do the above checks
1654 + use kernel_linux && check_extra_config
1655 +}
1656 +
1657 +pkg_setup() {
1658 + # try to turn off distcc and ccache for people that have a problem with it
1659 + export DISTCC_DISABLE=1
1660 + export CCACHE_DISABLE=1
1661 +
1662 + if use kernel_linux; then
1663 + MODULE_NAMES="nvidia(video:${S}/kernel)"
1664 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
1665 +
1666 + # This needs to run after MODULE_NAMES (so that the eclass checks
1667 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
1668 + # is set (so that KV_DIR is populated).
1669 + linux-mod_pkg_setup
1670 +
1671 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
1672 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
1673 +
1674 + # linux-mod_src_compile calls set_arch_to_kernel, which
1675 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
1676 + # expects x86_64 or i386 and then converts it to x86
1677 + # later on in the build process
1678 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
1679 + fi
1680 +
1681 + # set variables to where files are in the package structure
1682 + if use kernel_FreeBSD; then
1683 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
1684 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
1685 + NV_DOC="${S}/doc"
1686 + NV_OBJ="${S}/obj"
1687 + NV_SRC="${S}/src"
1688 + NV_MAN="${S}/x11/man"
1689 + NV_X11="${S}/obj"
1690 + NV_SOVER=1
1691 + elif use kernel_linux; then
1692 + NV_DOC="${S}"
1693 + NV_OBJ="${S}"
1694 + NV_SRC="${S}/kernel"
1695 + NV_MAN="${S}"
1696 + NV_X11="${S}"
1697 + NV_SOVER=${PV}
1698 + else
1699 + die "Could not determine proper NVIDIA package"
1700 + fi
1701 +}
1702 +
1703 +src_prepare() {
1704 + # Please add a brief description for every added patch
1705 +
1706 + if use kernel_linux; then
1707 + if kernel_is lt 2 6 9 ; then
1708 + eerror "You must build this against 2.6.9 or higher kernels."
1709 + fi
1710 +
1711 + # If greater than 2.6.5 use M= instead of SUBDIR=
1712 +# convert_to_m "${NV_SRC}"/Makefile.kbuild
1713 + fi
1714 +
1715 + if use pax_kernel; then
1716 + ewarn "Using PAX patches is not supported. You will be asked to"
1717 + ewarn "use a standard kernel should you have issues. Should you"
1718 + ewarn "need support with these patches, contact the PaX team."
1719 + epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
1720 + epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
1721 + fi
1722 +
1723 + # Allow user patches so they can support RC kernels and whatever else
1724 + epatch_user
1725 +}
1726 +
1727 +src_compile() {
1728 + # This is already the default on Linux, as there's no toplevel Makefile, but
1729 + # on FreeBSD there's one and triggers the kernel module build, as we install
1730 + # it by itself, pass this.
1731 +
1732 + cd "${NV_SRC}"
1733 + if use kernel_FreeBSD; then
1734 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
1735 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
1736 + elif use kernel_linux; then
1737 + MAKEOPTS=-j1
1738 + linux-mod_src_compile
1739 + fi
1740 +}
1741 +
1742 +# Install nvidia library:
1743 +# the first parameter is the library to install
1744 +# the second parameter is the provided soversion
1745 +# the third parameter is the target directory if its not /usr/lib
1746 +donvidia() {
1747 + # Full path to library minus SOVER
1748 + MY_LIB="$1"
1749 +
1750 + # SOVER to use
1751 + MY_SOVER="$2"
1752 +
1753 + # Where to install
1754 + MY_DEST="$3"
1755 +
1756 + if [[ -z "${MY_DEST}" ]]; then
1757 + MY_DEST="/usr/$(get_libdir)"
1758 + action="dolib.so"
1759 + else
1760 + exeinto ${MY_DEST}
1761 + action="doexe"
1762 + fi
1763 +
1764 + # Get just the library name
1765 + libname=$(basename $1)
1766 +
1767 + # Install the library with the correct SOVER
1768 + ${action} ${MY_LIB}.${MY_SOVER} || \
1769 + die "failed to install ${libname}"
1770 +
1771 + # If SOVER wasn't 1, then we need to create a .1 symlink
1772 + if [[ "${MY_SOVER}" != "1" ]]; then
1773 + dosym ${libname}.${MY_SOVER} \
1774 + ${MY_DEST}/${libname}.1 || \
1775 + die "failed to create ${libname} symlink"
1776 + fi
1777 +
1778 + # Always create the symlink from the raw lib to the .1
1779 + dosym ${libname}.1 \
1780 + ${MY_DEST}/${libname} || \
1781 + die "failed to create ${libname} symlink"
1782 +}
1783 +
1784 +src_install() {
1785 + if use kernel_linux; then
1786 + linux-mod_src_install
1787 +
1788 + # Add the aliases
1789 + # This file is tweaked with the appropriate video group in
1790 + # pkg_preinst, see bug #491414
1791 + insinto /etc/modprobe.d
1792 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
1793 + use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
1794 +
1795 + # Ensures that our device nodes are created when not using X
1796 + exeinto "$(get_udevdir)"
1797 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
1798 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
1799 + elif use kernel_FreeBSD; then
1800 + if use x86-fbsd; then
1801 + insinto /boot/modules
1802 + doins "${S}/src/nvidia.kld"
1803 + fi
1804 +
1805 + exeinto /boot/modules
1806 + doexe "${S}/src/nvidia.ko"
1807 + fi
1808 +
1809 + # NVIDIA kernel <-> userspace driver config lib
1810 + donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
1811 +
1812 + # NVIDIA framebuffer capture library
1813 + donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
1814 +
1815 + # NVIDIA video encode/decode <-> CUDA
1816 + if use kernel_linux; then
1817 + donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
1818 + donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
1819 + fi
1820 +
1821 + if use X; then
1822 + # Xorg DDX driver
1823 + insinto /usr/$(get_libdir)/xorg/modules/drivers
1824 + doins ${NV_X11}/nvidia_drv.so
1825 +
1826 + # Xorg GLX driver
1827 + donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
1828 + /usr/$(get_libdir)/opengl/nvidia/extensions
1829 +
1830 + # Xorg nvidia.conf
1831 + if has_version '>=x11-base/xorg-server-1.16'; then
1832 + insinto /usr/share/X11/xorg.conf.d
1833 + newins {,50-}nvidia-drm-outputclass.conf
1834 + fi
1835 + fi
1836 +
1837 + # OpenCL ICD for NVIDIA
1838 + if use kernel_linux; then
1839 + insinto /etc/OpenCL/vendors
1840 + doins ${NV_OBJ}/nvidia.icd
1841 + fi
1842 +
1843 + # Documentation
1844 + dohtml ${NV_DOC}/html/*
1845 + if use kernel_FreeBSD; then
1846 + dodoc "${NV_DOC}/README"
1847 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
1848 + use tools && doman "${NV_MAN}/nvidia-settings.1"
1849 + else
1850 + # Docs
1851 + newdoc "${NV_DOC}/README.txt" README
1852 + dodoc "${NV_DOC}/NVIDIA_Changelog"
1853 + doman "${NV_MAN}/nvidia-smi.1.gz"
1854 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
1855 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
1856 + doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
1857 + fi
1858 +
1859 + # Helper Apps
1860 + exeinto /opt/bin/
1861 +
1862 + if use X; then
1863 + doexe ${NV_OBJ}/nvidia-xconfig
1864 + fi
1865 +
1866 + if use kernel_linux ; then
1867 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
1868 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
1869 + doexe ${NV_OBJ}/nvidia-debugdump
1870 + doexe ${NV_OBJ}/nvidia-persistenced
1871 + doexe ${NV_OBJ}/nvidia-smi
1872 +
1873 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
1874 + doexe ${NV_OBJ}/nvidia-modprobe
1875 + fowners root:video /opt/bin/nvidia-modprobe
1876 + fperms 4710 /opt/bin/nvidia-modprobe
1877 + dosym /{opt,usr}/bin/nvidia-modprobe
1878 +
1879 + doman nvidia-cuda-mps-control.1.gz
1880 + doman nvidia-modprobe.1.gz
1881 + doman nvidia-persistenced.1.gz
1882 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
1883 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
1884 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
1885 + fi
1886 +
1887 + if use tools; then
1888 + doexe ${NV_OBJ}/nvidia-settings
1889 + use gtk2 && donvidia libnvidia-gtk2.so ${PV}
1890 + use gtk3 && donvidia libnvidia-gtk3.so ${PV}
1891 + insinto /usr/share/nvidia/
1892 + doins nvidia-application-profiles-${PV}-key-documentation
1893 + insinto /etc/nvidia
1894 + newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
1895 + fi
1896 +
1897 + dobin ${NV_OBJ}/nvidia-bug-report.sh
1898 +
1899 + # Desktop entries for nvidia-settings
1900 + if use tools ; then
1901 + # There is no icon in the FreeBSD tarball.
1902 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
1903 + domenu "${FILESDIR}"/${PN}-settings.desktop
1904 + exeinto /etc/X11/xinit/xinitrc.d
1905 + doexe "${FILESDIR}"/95-nvidia-settings
1906 + fi
1907 +
1908 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
1909 +
1910 + if has_multilib_profile && use multilib ; then
1911 + local OABI=${ABI}
1912 + for ABI in $(get_install_abis) ; do
1913 + src_install-libs
1914 + done
1915 + ABI=${OABI}
1916 + unset OABI
1917 + else
1918 + src_install-libs
1919 + fi
1920 +
1921 + is_final_abi || die "failed to iterate through all ABIs"
1922 +
1923 + readme.gentoo_create_doc
1924 +}
1925 +
1926 +src_install-libs() {
1927 + local inslibdir=$(get_libdir)
1928 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
1929 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
1930 + local libdir=${NV_OBJ}
1931 +
1932 + if use kernel_linux && has_multilib_profile && \
1933 + [[ ${ABI} == "x86" ]] ; then
1934 + libdir=${NV_OBJ}/32
1935 + fi
1936 +
1937 + if use X; then
1938 + # The GLX libraries
1939 + donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
1940 + donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
1941 + donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
1942 + donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
1943 + donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
1944 + donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
1945 + donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
1946 + if use kernel_FreeBSD; then
1947 + donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
1948 + else
1949 + donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
1950 + fi
1951 +
1952 + # VDPAU
1953 + donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
1954 +
1955 + # GLES v2 libraries
1956 + insinto ${GL_ROOT}
1957 + doexe ${libdir}/libGLESv2.so.${PV}
1958 + dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
1959 + dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
1960 + fi
1961 +
1962 + # NVIDIA monitoring library
1963 + if use kernel_linux ; then
1964 + donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
1965 + fi
1966 +
1967 + # CUDA & OpenCL
1968 + if use kernel_linux; then
1969 + donvidia ${libdir}/libcuda.so ${NV_SOVER}
1970 + donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
1971 + donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
1972 + donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
1973 + fi
1974 +}
1975 +
1976 +pkg_preinst() {
1977 + if use kernel_linux; then
1978 + linux-mod_pkg_preinst
1979 +
1980 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
1981 + if [ -z "${videogroup}" ]; then
1982 + eerror "Failed to determine the video group gid"
1983 + die "Failed to determine the video group gid"
1984 + else
1985 + sed -i \
1986 + -e "s:PACKAGE:${PF}:g" \
1987 + -e "s:VIDEOGID:${videogroup}:" \
1988 + "${D}"/etc/modprobe.d/nvidia.conf || die
1989 + fi
1990 + fi
1991 +
1992 + # Clean the dynamic libGL stuff's home to ensure
1993 + # we dont have stale libs floating around
1994 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
1995 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
1996 + fi
1997 + # Make sure we nuke the old nvidia-glx's env.d file
1998 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
1999 + rm -f "${ROOT}"/etc/env.d/09nvidia
2000 + fi
2001 +}
2002 +
2003 +pkg_postinst() {
2004 + use kernel_linux && linux-mod_pkg_postinst
2005 +
2006 + # Switch to the nvidia implementation
2007 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
2008 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
2009 +
2010 + readme.gentoo_print_elog
2011 +
2012 + if ! use X; then
2013 + elog "You have elected to not install the X.org driver. Along with"
2014 + elog "this the OpenGL libraries and VDPAU libraries were not"
2015 + elog "installed. Additionally, once the driver is loaded your card"
2016 + elog "and fan will run at max speed which may not be desirable."
2017 + elog "Use the 'nvidia-smi' init script to have your card and fan"
2018 + elog "speed scale appropriately."
2019 + elog
2020 + fi
2021 + if ! use tools; then
2022 + elog "USE=tools controls whether the nvidia-settings application"
2023 + elog "is installed. If you would like to use it, enable that"
2024 + elog "flag and re-emerge this ebuild. Optionally you can install"
2025 + elog "media-video/nvidia-settings"
2026 + elog
2027 + fi
2028 +}
2029 +
2030 +pkg_prerm() {
2031 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
2032 +}
2033 +
2034 +pkg_postrm() {
2035 + use kernel_linux && linux-mod_pkg_postrm
2036 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
2037 +}
2038
2039 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-352.41-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-352.41-r1.ebuild
2040 new file mode 100644
2041 index 0000000..c2a0375
2042 --- /dev/null
2043 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-352.41-r1.ebuild
2044 @@ -0,0 +1,489 @@
2045 +# Copyright 1999-2015 Gentoo Foundation
2046 +# Distributed under the terms of the GNU General Public License v2
2047 +# $Id$
2048 +
2049 +EAPI=5
2050 +
2051 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
2052 + portability toolchain-funcs unpacker user udev
2053 +
2054 +NV_URI="http://us.download.nvidia.com/XFree86/"
2055 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
2056 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
2057 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
2058 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
2059 +
2060 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
2061 +HOMEPAGE="http://www.nvidia.com/"
2062 +SRC_URI="
2063 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
2064 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
2065 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
2066 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
2067 +"
2068 +
2069 +LICENSE="GPL-2 NVIDIA-r2"
2070 +SLOT="0/352"
2071 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
2072 +RESTRICT="bindist mirror strip"
2073 +EMULTILIB_PKG="true"
2074 +
2075 +IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
2076 +REQUIRED_USE="
2077 + tools? ( X || ( gtk2 gtk3 ) )
2078 +"
2079 +
2080 +COMMON="
2081 + app-eselect/eselect-opencl
2082 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
2083 + X? (
2084 + >=app-eselect/eselect-opengl-1.0.9
2085 + )
2086 +"
2087 +DEPEND="
2088 + ${COMMON}
2089 + app-arch/xz-utils
2090 + kernel_linux? ( virtual/linux-sources )
2091 +"
2092 +RDEPEND="
2093 + ${COMMON}
2094 + acpi? ( sys-power/acpid )
2095 + tools? (
2096 + dev-libs/atk
2097 + dev-libs/glib:2
2098 + x11-libs/gdk-pixbuf
2099 + gtk2? ( >=x11-libs/gtk+-2.4:2 )
2100 + gtk3? ( x11-libs/gtk+:3 )
2101 + x11-libs/libX11
2102 + x11-libs/libXext
2103 + x11-libs/pango[X]
2104 + )
2105 + X? (
2106 + <x11-base/xorg-server-1.17.99:=
2107 + >=x11-libs/libvdpau-0.3-r1
2108 + multilib? (
2109 + >=x11-libs/libX11-1.6.2[abi_x86_32]
2110 + >=x11-libs/libXext-1.3.2[abi_x86_32]
2111 + )
2112 + )
2113 +"
2114 +
2115 +QA_PREBUILT="opt/* usr/lib*"
2116 +
2117 +S=${WORKDIR}/
2118 +
2119 +pkg_pretend() {
2120 + if use amd64 && has_multilib_profile && \
2121 + [ "${DEFAULT_ABI}" != "amd64" ]; then
2122 + eerror "This ebuild doesn't currently support changing your default ABI"
2123 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
2124 + fi
2125 +
2126 + if use kernel_linux && kernel_is ge 4 3; then
2127 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
2128 + ewarn "which are limited to the following kernels:"
2129 + ewarn "<sys-kernel/gentoo-sources-4.3"
2130 + ewarn "<sys-kernel/vanilla-sources-4.3"
2131 + ewarn ""
2132 + ewarn "You are free to utilize epatch_user to provide whatever"
2133 + ewarn "support you feel is appropriate, but will not receive"
2134 + ewarn "support as a result of those changes."
2135 + ewarn ""
2136 + ewarn "Do not file a bug report about this."
2137 + fi
2138 +
2139 + # Since Nvidia ships 3 different series of drivers, we need to give the user
2140 + # some kind of guidance as to what version they should install. This tries
2141 + # to point the user in the right direction but can't be perfect. check
2142 + # nvidia-driver.eclass
2143 + nvidia-driver-check-warning
2144 +
2145 + # Kernel features/options to check for
2146 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
2147 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
2148 +
2149 + # Now do the above checks
2150 + use kernel_linux && check_extra_config
2151 +}
2152 +
2153 +pkg_setup() {
2154 + # try to turn off distcc and ccache for people that have a problem with it
2155 + export DISTCC_DISABLE=1
2156 + export CCACHE_DISABLE=1
2157 +
2158 + if use kernel_linux; then
2159 + MODULE_NAMES="nvidia(video:${S}/kernel)"
2160 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
2161 +
2162 + # This needs to run after MODULE_NAMES (so that the eclass checks
2163 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
2164 + # is set (so that KV_DIR is populated).
2165 + linux-mod_pkg_setup
2166 +
2167 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
2168 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
2169 +
2170 + # linux-mod_src_compile calls set_arch_to_kernel, which
2171 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
2172 + # expects x86_64 or i386 and then converts it to x86
2173 + # later on in the build process
2174 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
2175 + fi
2176 +
2177 + # set variables to where files are in the package structure
2178 + if use kernel_FreeBSD; then
2179 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
2180 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
2181 + NV_DOC="${S}/doc"
2182 + NV_OBJ="${S}/obj"
2183 + NV_SRC="${S}/src"
2184 + NV_MAN="${S}/x11/man"
2185 + NV_X11="${S}/obj"
2186 + NV_SOVER=1
2187 + elif use kernel_linux; then
2188 + NV_DOC="${S}"
2189 + NV_OBJ="${S}"
2190 + NV_SRC="${S}/kernel"
2191 + NV_MAN="${S}"
2192 + NV_X11="${S}"
2193 + NV_SOVER=${PV}
2194 + else
2195 + die "Could not determine proper NVIDIA package"
2196 + fi
2197 +}
2198 +
2199 +src_prepare() {
2200 + # Please add a brief description for every added patch
2201 +
2202 + if use kernel_linux; then
2203 + if kernel_is lt 2 6 9 ; then
2204 + eerror "You must build this against 2.6.9 or higher kernels."
2205 + fi
2206 +
2207 + # If greater than 2.6.5 use M= instead of SUBDIR=
2208 +# convert_to_m "${NV_SRC}"/Makefile.kbuild
2209 + fi
2210 +
2211 + if use pax_kernel; then
2212 + ewarn "Using PAX patches is not supported. You will be asked to"
2213 + ewarn "use a standard kernel should you have issues. Should you"
2214 + ewarn "need support with these patches, contact the PaX team."
2215 + epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
2216 + epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
2217 + fi
2218 +
2219 + # Allow user patches so they can support RC kernels and whatever else
2220 + epatch_user
2221 +}
2222 +
2223 +src_compile() {
2224 + # This is already the default on Linux, as there's no toplevel Makefile, but
2225 + # on FreeBSD there's one and triggers the kernel module build, as we install
2226 + # it by itself, pass this.
2227 +
2228 + cd "${NV_SRC}"
2229 + if use kernel_FreeBSD; then
2230 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
2231 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
2232 + elif use kernel_linux; then
2233 + MAKEOPTS=-j1
2234 + linux-mod_src_compile
2235 + fi
2236 +}
2237 +
2238 +# Install nvidia library:
2239 +# the first parameter is the library to install
2240 +# the second parameter is the provided soversion
2241 +# the third parameter is the target directory if its not /usr/lib
2242 +donvidia() {
2243 + # Full path to library minus SOVER
2244 + MY_LIB="$1"
2245 +
2246 + # SOVER to use
2247 + MY_SOVER="$2"
2248 +
2249 + # Where to install
2250 + MY_DEST="$3"
2251 +
2252 + if [[ -z "${MY_DEST}" ]]; then
2253 + MY_DEST="/usr/$(get_libdir)"
2254 + action="dolib.so"
2255 + else
2256 + exeinto ${MY_DEST}
2257 + action="doexe"
2258 + fi
2259 +
2260 + # Get just the library name
2261 + libname=$(basename $1)
2262 +
2263 + # Install the library with the correct SOVER
2264 + ${action} ${MY_LIB}.${MY_SOVER} || \
2265 + die "failed to install ${libname}"
2266 +
2267 + # If SOVER wasn't 1, then we need to create a .1 symlink
2268 + if [[ "${MY_SOVER}" != "1" ]]; then
2269 + dosym ${libname}.${MY_SOVER} \
2270 + ${MY_DEST}/${libname}.1 || \
2271 + die "failed to create ${libname} symlink"
2272 + fi
2273 +
2274 + # Always create the symlink from the raw lib to the .1
2275 + dosym ${libname}.1 \
2276 + ${MY_DEST}/${libname} || \
2277 + die "failed to create ${libname} symlink"
2278 +}
2279 +
2280 +src_install() {
2281 + if use kernel_linux; then
2282 + linux-mod_src_install
2283 +
2284 + # Add the aliases
2285 + # This file is tweaked with the appropriate video group in
2286 + # pkg_preinst, see bug #491414
2287 + insinto /etc/modprobe.d
2288 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
2289 + use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
2290 +
2291 + # Ensures that our device nodes are created when not using X
2292 + exeinto "$(get_udevdir)"
2293 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
2294 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
2295 + elif use kernel_FreeBSD; then
2296 + if use x86-fbsd; then
2297 + insinto /boot/modules
2298 + doins "${S}/src/nvidia.kld"
2299 + fi
2300 +
2301 + exeinto /boot/modules
2302 + doexe "${S}/src/nvidia.ko"
2303 + fi
2304 +
2305 + # NVIDIA kernel <-> userspace driver config lib
2306 + donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
2307 +
2308 + # NVIDIA framebuffer capture library
2309 + donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
2310 +
2311 + # NVIDIA video encode/decode <-> CUDA
2312 + if use kernel_linux; then
2313 + donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
2314 + donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
2315 + fi
2316 +
2317 + if use X; then
2318 + # Xorg DDX driver
2319 + insinto /usr/$(get_libdir)/xorg/modules/drivers
2320 + doins ${NV_X11}/nvidia_drv.so
2321 +
2322 + # Xorg GLX driver
2323 + donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
2324 + /usr/$(get_libdir)/opengl/nvidia/extensions
2325 +
2326 + # Xorg nvidia.conf
2327 + if has_version '>=x11-base/xorg-server-1.16'; then
2328 + insinto /usr/share/X11/xorg.conf.d
2329 + newins {,50-}nvidia-drm-outputclass.conf
2330 + fi
2331 + fi
2332 +
2333 + # OpenCL ICD for NVIDIA
2334 + if use kernel_linux; then
2335 + insinto /etc/OpenCL/vendors
2336 + doins ${NV_OBJ}/nvidia.icd
2337 + fi
2338 +
2339 + # Documentation
2340 + dohtml ${NV_DOC}/html/*
2341 + if use kernel_FreeBSD; then
2342 + dodoc "${NV_DOC}/README"
2343 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
2344 + use tools && doman "${NV_MAN}/nvidia-settings.1"
2345 + else
2346 + # Docs
2347 + newdoc "${NV_DOC}/README.txt" README
2348 + dodoc "${NV_DOC}/NVIDIA_Changelog"
2349 + doman "${NV_MAN}/nvidia-smi.1.gz"
2350 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
2351 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
2352 + doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
2353 + fi
2354 +
2355 + # Helper Apps
2356 + exeinto /opt/bin/
2357 +
2358 + if use X; then
2359 + doexe ${NV_OBJ}/nvidia-xconfig
2360 + fi
2361 +
2362 + if use kernel_linux ; then
2363 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
2364 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
2365 + doexe ${NV_OBJ}/nvidia-debugdump
2366 + doexe ${NV_OBJ}/nvidia-persistenced
2367 + doexe ${NV_OBJ}/nvidia-smi
2368 +
2369 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
2370 + doexe ${NV_OBJ}/nvidia-modprobe
2371 + fowners root:video /opt/bin/nvidia-modprobe
2372 + fperms 4710 /opt/bin/nvidia-modprobe
2373 + dosym /{opt,usr}/bin/nvidia-modprobe
2374 +
2375 + doman nvidia-cuda-mps-control.1.gz
2376 + doman nvidia-modprobe.1.gz
2377 + doman nvidia-persistenced.1.gz
2378 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
2379 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
2380 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
2381 + fi
2382 +
2383 + if use tools; then
2384 + doexe ${NV_OBJ}/nvidia-settings
2385 + use gtk2 && donvidia libnvidia-gtk2.so ${PV}
2386 + use gtk3 && donvidia libnvidia-gtk3.so ${PV}
2387 + insinto /usr/share/nvidia/
2388 + doins nvidia-application-profiles-${PV}-key-documentation
2389 + insinto /etc/nvidia
2390 + newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
2391 + fi
2392 +
2393 + dobin ${NV_OBJ}/nvidia-bug-report.sh
2394 +
2395 + # Desktop entries for nvidia-settings
2396 + if use tools ; then
2397 + # There is no icon in the FreeBSD tarball.
2398 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
2399 + domenu "${FILESDIR}"/${PN}-settings.desktop
2400 + exeinto /etc/X11/xinit/xinitrc.d
2401 + doexe "${FILESDIR}"/95-nvidia-settings
2402 + fi
2403 +
2404 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
2405 +
2406 + if has_multilib_profile && use multilib ; then
2407 + local OABI=${ABI}
2408 + for ABI in $(get_install_abis) ; do
2409 + src_install-libs
2410 + done
2411 + ABI=${OABI}
2412 + unset OABI
2413 + else
2414 + src_install-libs
2415 + fi
2416 +
2417 + is_final_abi || die "failed to iterate through all ABIs"
2418 +
2419 + readme.gentoo_create_doc
2420 +}
2421 +
2422 +src_install-libs() {
2423 + local inslibdir=$(get_libdir)
2424 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
2425 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
2426 + local libdir=${NV_OBJ}
2427 +
2428 + if use kernel_linux && has_multilib_profile && \
2429 + [[ ${ABI} == "x86" ]] ; then
2430 + libdir=${NV_OBJ}/32
2431 + fi
2432 +
2433 + if use X; then
2434 + # The GLX libraries
2435 + donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
2436 + donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
2437 + donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
2438 + donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
2439 + donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
2440 + donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
2441 + donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
2442 + if use kernel_FreeBSD; then
2443 + donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
2444 + else
2445 + donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
2446 + fi
2447 +
2448 + # VDPAU
2449 + donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
2450 +
2451 + # GLES v2 libraries
2452 + insinto ${GL_ROOT}
2453 + doexe ${libdir}/libGLESv2.so.${PV}
2454 + dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
2455 + dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
2456 + fi
2457 +
2458 + # NVIDIA monitoring library
2459 + if use kernel_linux ; then
2460 + donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
2461 + fi
2462 +
2463 + # CUDA & OpenCL
2464 + if use kernel_linux; then
2465 + donvidia ${libdir}/libcuda.so ${NV_SOVER}
2466 + donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
2467 + donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
2468 + donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
2469 + fi
2470 +}
2471 +
2472 +pkg_preinst() {
2473 + if use kernel_linux; then
2474 + linux-mod_pkg_preinst
2475 +
2476 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
2477 + if [ -z "${videogroup}" ]; then
2478 + eerror "Failed to determine the video group gid"
2479 + die "Failed to determine the video group gid"
2480 + else
2481 + sed -i \
2482 + -e "s:PACKAGE:${PF}:g" \
2483 + -e "s:VIDEOGID:${videogroup}:" \
2484 + "${D}"/etc/modprobe.d/nvidia.conf || die
2485 + fi
2486 + fi
2487 +
2488 + # Clean the dynamic libGL stuff's home to ensure
2489 + # we dont have stale libs floating around
2490 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
2491 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
2492 + fi
2493 + # Make sure we nuke the old nvidia-glx's env.d file
2494 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
2495 + rm -f "${ROOT}"/etc/env.d/09nvidia
2496 + fi
2497 +}
2498 +
2499 +pkg_postinst() {
2500 + use kernel_linux && linux-mod_pkg_postinst
2501 +
2502 + # Switch to the nvidia implementation
2503 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
2504 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
2505 +
2506 + readme.gentoo_print_elog
2507 +
2508 + if ! use X; then
2509 + elog "You have elected to not install the X.org driver. Along with"
2510 + elog "this the OpenGL libraries and VDPAU libraries were not"
2511 + elog "installed. Additionally, once the driver is loaded your card"
2512 + elog "and fan will run at max speed which may not be desirable."
2513 + elog "Use the 'nvidia-smi' init script to have your card and fan"
2514 + elog "speed scale appropriately."
2515 + elog
2516 + fi
2517 + if ! use tools; then
2518 + elog "USE=tools controls whether the nvidia-settings application"
2519 + elog "is installed. If you would like to use it, enable that"
2520 + elog "flag and re-emerge this ebuild. Optionally you can install"
2521 + elog "media-video/nvidia-settings"
2522 + elog
2523 + fi
2524 +}
2525 +
2526 +pkg_prerm() {
2527 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
2528 +}
2529 +
2530 +pkg_postrm() {
2531 + use kernel_linux && linux-mod_pkg_postrm
2532 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
2533 +}
2534
2535 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-355.11-r2.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-355.11-r2.ebuild
2536 new file mode 100644
2537 index 0000000..8ff831a
2538 --- /dev/null
2539 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-355.11-r2.ebuild
2540 @@ -0,0 +1,500 @@
2541 +# Copyright 1999-2015 Gentoo Foundation
2542 +# Distributed under the terms of the GNU General Public License v2
2543 +# $Id$
2544 +
2545 +EAPI=5
2546 +
2547 +inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
2548 + portability toolchain-funcs unpacker user udev
2549 +
2550 +NV_URI="http://us.download.nvidia.com/XFree86/"
2551 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
2552 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
2553 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
2554 +AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
2555 +
2556 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
2557 +HOMEPAGE="http://www.nvidia.com/"
2558 +SRC_URI="
2559 + amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
2560 + amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
2561 + x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
2562 + x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
2563 +"
2564 +
2565 +LICENSE="GPL-2 NVIDIA-r2"
2566 +SLOT="0/355"
2567 +KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
2568 +RESTRICT="bindist mirror strip"
2569 +EMULTILIB_PKG="true"
2570 +
2571 +IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
2572 +REQUIRED_USE="
2573 + tools? ( X || ( gtk2 gtk3 ) )
2574 +"
2575 +
2576 +COMMON="
2577 + app-eselect/eselect-opencl
2578 + gtk3? ( x11-libs/cairo )
2579 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
2580 + X? (
2581 + >=app-eselect/eselect-opengl-1.0.9
2582 + )
2583 +"
2584 +DEPEND="
2585 + ${COMMON}
2586 + app-arch/xz-utils
2587 + kernel_linux? ( virtual/linux-sources )
2588 +"
2589 +RDEPEND="
2590 + ${COMMON}
2591 + acpi? ( sys-power/acpid )
2592 + tools? (
2593 + dev-libs/atk
2594 + dev-libs/glib:2
2595 + x11-libs/gdk-pixbuf
2596 + gtk2? ( >=x11-libs/gtk+-2.4:2 )
2597 + gtk3? ( x11-libs/gtk+:3 )
2598 + x11-libs/libX11
2599 + x11-libs/libXext
2600 + x11-libs/pango[X]
2601 + )
2602 + X? (
2603 + <x11-base/xorg-server-1.17.99:=
2604 + >=x11-libs/libvdpau-0.3-r1
2605 + multilib? (
2606 + >=x11-libs/libX11-1.6.2[abi_x86_32]
2607 + >=x11-libs/libXext-1.3.2[abi_x86_32]
2608 + )
2609 + )
2610 +"
2611 +
2612 +QA_PREBUILT="opt/* usr/lib*"
2613 +
2614 +S=${WORKDIR}/
2615 +
2616 +pkg_pretend() {
2617 + if use amd64 && has_multilib_profile && \
2618 + [ "${DEFAULT_ABI}" != "amd64" ]; then
2619 + eerror "This ebuild doesn't currently support changing your default ABI"
2620 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
2621 + fi
2622 +
2623 + if use kernel_linux && kernel_is ge 4 3; then
2624 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
2625 + ewarn "which are limited to the following kernels:"
2626 + ewarn "<sys-kernel/gentoo-sources-4.3"
2627 + ewarn "<sys-kernel/vanilla-sources-4.3"
2628 + ewarn ""
2629 + ewarn "You are free to utilize epatch_user to provide whatever"
2630 + ewarn "support you feel is appropriate, but will not receive"
2631 + ewarn "support as a result of those changes."
2632 + ewarn ""
2633 + ewarn "Do not file a bug report about this."
2634 + fi
2635 +
2636 + # Since Nvidia ships 3 different series of drivers, we need to give the user
2637 + # some kind of guidance as to what version they should install. This tries
2638 + # to point the user in the right direction but can't be perfect. check
2639 + # nvidia-driver.eclass
2640 + nvidia-driver-check-warning
2641 +
2642 + # Kernel features/options to check for
2643 + CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
2644 + use x86 && CONFIG_CHECK+=" ~HIGHMEM"
2645 +
2646 + # Now do the above checks
2647 + use kernel_linux && check_extra_config
2648 +}
2649 +
2650 +pkg_setup() {
2651 + # try to turn off distcc and ccache for people that have a problem with it
2652 + export DISTCC_DISABLE=1
2653 + export CCACHE_DISABLE=1
2654 +
2655 + if use kernel_linux; then
2656 + MODULE_NAMES="nvidia(video:${S}/kernel)"
2657 + use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel)"
2658 +
2659 + # This needs to run after MODULE_NAMES (so that the eclass checks
2660 + # whether the kernel supports loadable modules) but before BUILD_PARAMS
2661 + # is set (so that KV_DIR is populated).
2662 + linux-mod_pkg_setup
2663 +
2664 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
2665 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
2666 +
2667 + # linux-mod_src_compile calls set_arch_to_kernel, which
2668 + # sets the ARCH to x86 but NVIDIA's wrapping Makefile
2669 + # expects x86_64 or i386 and then converts it to x86
2670 + # later on in the build process
2671 + BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
2672 + fi
2673 +
2674 + # set variables to where files are in the package structure
2675 + if use kernel_FreeBSD; then
2676 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
2677 + use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
2678 + NV_DOC="${S}/doc"
2679 + NV_OBJ="${S}/obj"
2680 + NV_SRC="${S}/src"
2681 + NV_MAN="${S}/x11/man"
2682 + NV_X11="${S}/obj"
2683 + NV_SOVER=1
2684 + elif use kernel_linux; then
2685 + NV_DOC="${S}"
2686 + NV_OBJ="${S}"
2687 + NV_SRC="${S}/kernel"
2688 + NV_MAN="${S}"
2689 + NV_X11="${S}"
2690 + NV_SOVER=${PV}
2691 + else
2692 + die "Could not determine proper NVIDIA package"
2693 + fi
2694 +}
2695 +
2696 +src_prepare() {
2697 + # Please add a brief description for every added patch
2698 +
2699 + if use kernel_linux; then
2700 + if kernel_is lt 2 6 9; then
2701 + eerror "You must build this against 2.6.9 or higher kernels."
2702 + fi
2703 +
2704 + # If greater than 2.6.5 use M= instead of SUBDIR=
2705 +# convert_to_m "${NV_SRC}"/Makefile.kbuild
2706 + fi
2707 +
2708 + if use pax_kernel; then
2709 + ewarn "Using PAX patches is not supported. You will be asked to"
2710 + ewarn "use a standard kernel should you have issues. Should you"
2711 + ewarn "need support with these patches, contact the PaX team."
2712 + epatch "${FILESDIR}"/${PN}-355.06-pax.patch
2713 + fi
2714 +
2715 + # Allow user patches so they can support RC kernels and whatever else
2716 + epatch_user
2717 +}
2718 +
2719 +src_compile() {
2720 + # This is already the default on Linux, as there's no toplevel Makefile, but
2721 + # on FreeBSD there's one and triggers the kernel module build, as we install
2722 + # it by itself, pass this.
2723 +
2724 + cd "${NV_SRC}"
2725 + if use kernel_FreeBSD; then
2726 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
2727 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
2728 + elif use kernel_linux; then
2729 + MAKEOPTS=-j1
2730 + linux-mod_src_compile
2731 + fi
2732 +}
2733 +
2734 +# Install nvidia library:
2735 +# the first parameter is the library to install
2736 +# the second parameter is the provided soversion
2737 +# the third parameter is the target directory if it is not /usr/lib
2738 +donvidia() {
2739 + # Full path to library minus SOVER
2740 + MY_LIB="$1"
2741 +
2742 + # SOVER to use
2743 + MY_SOVER="$2"
2744 +
2745 + # Where to install
2746 + MY_DEST="$3"
2747 +
2748 + if [[ -z "${MY_DEST}" ]]; then
2749 + MY_DEST="/usr/$(get_libdir)"
2750 + action="dolib.so"
2751 + else
2752 + exeinto ${MY_DEST}
2753 + action="doexe"
2754 + fi
2755 +
2756 + # Get just the library name
2757 + libname=$(basename $1)
2758 +
2759 + # Install the library with the correct SOVER
2760 + ${action} ${MY_LIB}.${MY_SOVER} || \
2761 + die "failed to install ${libname}"
2762 +
2763 + # If SOVER wasn't 1, then we need to create a .1 symlink
2764 + if [[ "${MY_SOVER}" != "1" ]]; then
2765 + dosym ${libname}.${MY_SOVER} \
2766 + ${MY_DEST}/${libname}.1 || \
2767 + die "failed to create ${libname} symlink"
2768 + fi
2769 +
2770 + # Always create the symlink from the raw lib to the .1
2771 + dosym ${libname}.1 \
2772 + ${MY_DEST}/${libname} || \
2773 + die "failed to create ${libname} symlink"
2774 +}
2775 +
2776 +src_install() {
2777 + if use kernel_linux; then
2778 + linux-mod_src_install
2779 +
2780 + # Add the aliases
2781 + # This file is tweaked with the appropriate video group in
2782 + # pkg_preinst, see bug #491414
2783 + insinto /etc/modprobe.d
2784 + newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
2785 + use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
2786 +
2787 + # Ensures that our device nodes are created when not using X
2788 + exeinto "$(get_udevdir)"
2789 + newexe "${FILESDIR}"/nvidia-udev.sh-r1 nvidia-udev.sh
2790 + udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
2791 + elif use kernel_FreeBSD; then
2792 + if use x86-fbsd; then
2793 + insinto /boot/modules
2794 + doins "${S}/src/nvidia.kld"
2795 + fi
2796 +
2797 + exeinto /boot/modules
2798 + doexe "${S}/src/nvidia.ko"
2799 + fi
2800 +
2801 + # NVIDIA kernel <-> userspace driver config lib
2802 + donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
2803 +
2804 + # NVIDIA framebuffer capture library
2805 + donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
2806 +
2807 + # NVIDIA video encode/decode <-> CUDA
2808 + if use kernel_linux; then
2809 + donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
2810 + donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
2811 + fi
2812 +
2813 + if use X; then
2814 + # Xorg DDX driver
2815 + insinto /usr/$(get_libdir)/xorg/modules/drivers
2816 + doins ${NV_X11}/nvidia_drv.so
2817 +
2818 + # Xorg GLX driver
2819 + donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
2820 + /usr/$(get_libdir)/opengl/nvidia/extensions
2821 +
2822 + # Xorg nvidia.conf
2823 + if has_version '>=x11-base/xorg-server-1.16'; then
2824 + insinto /usr/share/X11/xorg.conf.d
2825 + newins {,50-}nvidia-drm-outputclass.conf
2826 + fi
2827 + fi
2828 +
2829 + # OpenCL ICD for NVIDIA
2830 + if use kernel_linux; then
2831 + insinto /etc/OpenCL/vendors
2832 + doins ${NV_OBJ}/nvidia.icd
2833 + fi
2834 +
2835 + # Documentation
2836 + dohtml ${NV_DOC}/html/*
2837 + if use kernel_FreeBSD; then
2838 + dodoc "${NV_DOC}/README"
2839 + use X && doman "${NV_MAN}/nvidia-xconfig.1"
2840 + use tools && doman "${NV_MAN}/nvidia-settings.1"
2841 + else
2842 + # Docs
2843 + newdoc "${NV_DOC}/README.txt" README
2844 + dodoc "${NV_DOC}/NVIDIA_Changelog"
2845 + doman "${NV_MAN}/nvidia-smi.1.gz"
2846 + use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
2847 + use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
2848 + doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
2849 + fi
2850 +
2851 + # Helper Apps
2852 + exeinto /opt/bin/
2853 +
2854 + if use X; then
2855 + doexe ${NV_OBJ}/nvidia-xconfig
2856 + fi
2857 +
2858 + if use kernel_linux; then
2859 + doexe ${NV_OBJ}/nvidia-cuda-mps-control
2860 + doexe ${NV_OBJ}/nvidia-cuda-mps-server
2861 + doexe ${NV_OBJ}/nvidia-debugdump
2862 + doexe ${NV_OBJ}/nvidia-persistenced
2863 + doexe ${NV_OBJ}/nvidia-smi
2864 +
2865 + # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
2866 + doexe ${NV_OBJ}/nvidia-modprobe
2867 + fowners root:video /opt/bin/nvidia-modprobe
2868 + fperms 4710 /opt/bin/nvidia-modprobe
2869 + dosym /{opt,usr}/bin/nvidia-modprobe
2870 +
2871 + doman nvidia-cuda-mps-control.1.gz
2872 + doman nvidia-modprobe.1.gz
2873 + doman nvidia-persistenced.1.gz
2874 + newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
2875 + newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
2876 + newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
2877 + fi
2878 +
2879 + if use tools; then
2880 + doexe ${NV_OBJ}/nvidia-settings
2881 + use gtk2 && donvidia libnvidia-gtk2.so ${PV}
2882 + use gtk3 && donvidia libnvidia-gtk3.so ${PV}
2883 + insinto /usr/share/nvidia/
2884 + doins nvidia-application-profiles-${PV}-key-documentation
2885 + insinto /etc/nvidia
2886 + newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
2887 + fi
2888 +
2889 + dobin ${NV_OBJ}/nvidia-bug-report.sh
2890 +
2891 + # Desktop entries for nvidia-settings
2892 + if use tools; then
2893 + # There is no icon in the FreeBSD tarball.
2894 + use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
2895 + domenu "${FILESDIR}"/${PN}-settings.desktop
2896 + exeinto /etc/X11/xinit/xinitrc.d
2897 + doexe "${FILESDIR}"/95-nvidia-settings
2898 + fi
2899 +
2900 + #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
2901 +
2902 + if has_multilib_profile && use multilib; then
2903 + local OABI=${ABI}
2904 + for ABI in $(get_install_abis); do
2905 + src_install-libs
2906 + done
2907 + ABI=${OABI}
2908 + unset OABI
2909 + else
2910 + src_install-libs
2911 + fi
2912 +
2913 + is_final_abi || die "failed to iterate through all ABIs"
2914 +
2915 + readme.gentoo_create_doc
2916 +}
2917 +
2918 +src_install-libs() {
2919 + local inslibdir=$(get_libdir)
2920 + local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
2921 + local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
2922 + local libdir=${NV_OBJ}
2923 +
2924 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
2925 + libdir=${NV_OBJ}/32
2926 + fi
2927 +
2928 + if use X; then
2929 + NV_GLX_LIBRARIES=(
2930 + "libEGL.so 1 ${GL_ROOT}"
2931 + "libEGL_nvidia.so 0 ${GL_ROOT}"
2932 + "libGL.so ${NV_SOVER} ${GL_ROOT}"
2933 + "libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}"
2934 + "libGLdispatch.so 0 ${GL_ROOT}"
2935 + "libOpenCL.so 1.0.0 ${CL_ROOT}"
2936 + "libOpenGL.so 0 ${GL_ROOT}"
2937 + "libcuda.so ${NV_SOVER}"
2938 + "libnvcuvid.so ${NV_SOVER}"
2939 + "libnvidia-compiler.so ${NV_SOVER}"
2940 + "libnvidia-eglcore.so ${NV_SOVER}"
2941 + "libnvidia-encode.so ${NV_SOVER}"
2942 + "libnvidia-fbc.so ${NV_SOVER}"
2943 + "libnvidia-glcore.so ${NV_SOVER}"
2944 + "libnvidia-glsi.so ${NV_SOVER}"
2945 + "libnvidia-ifr.so ${NV_SOVER}"
2946 + "libnvidia-opencl.so ${NV_SOVER}"
2947 + "libvdpau.so ${NV_SOVER} ${GL_ROOT}"
2948 + "libvdpau_nvidia.so ${NV_SOVER}"
2949 + "libvdpau_trace.so ${NV_SOVER} ${GL_ROOT}"
2950 + )
2951 + if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
2952 + then
2953 + NV_GLX_LIBRARIES+=( "libnvidia-wfb.so ${NV_SOVER}" )
2954 + fi
2955 +
2956 + if use kernel_FreeBSD; then
2957 + NV_GLX_LIBRARIES+=( "libnvidia-tls.so ${NV_SOVER}" )
2958 + fi
2959 +
2960 + if use kernel_linux; then
2961 + NV_GLX_LIBRARIES+=(
2962 + "libnvidia-ml.so ${NV_SOVER}"
2963 + "tls/libnvidia-tls.so ${NV_SOVER}"
2964 + )
2965 + fi
2966 +
2967 + for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
2968 + donvidia ${libdir}/${NV_LIB}
2969 + done
2970 +
2971 + # GLES v2 library is special
2972 + insinto ${GL_ROOT}
2973 + doexe ${libdir}/libGLESv2.so.${PV}
2974 + dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
2975 + dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
2976 + fi
2977 +}
2978 +
2979 +pkg_preinst() {
2980 + if use kernel_linux; then
2981 + linux-mod_pkg_preinst
2982 +
2983 + local videogroup="$(egetent group video | cut -d ':' -f 3)"
2984 + if [ -z "${videogroup}" ]; then
2985 + eerror "Failed to determine the video group gid"
2986 + die "Failed to determine the video group gid"
2987 + else
2988 + sed -i \
2989 + -e "s:PACKAGE:${PF}:g" \
2990 + -e "s:VIDEOGID:${videogroup}:" \
2991 + "${D}"/etc/modprobe.d/nvidia.conf || die
2992 + fi
2993 + fi
2994 +
2995 + # Clean the dynamic libGL stuff's home to ensure
2996 + # we dont have stale libs floating around
2997 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then
2998 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
2999 + fi
3000 + # Make sure we nuke the old nvidia-glx's env.d file
3001 + if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then
3002 + rm -f "${ROOT}"/etc/env.d/09nvidia
3003 + fi
3004 +}
3005 +
3006 +pkg_postinst() {
3007 + use kernel_linux && linux-mod_pkg_postinst
3008 +
3009 + # Switch to the nvidia implementation
3010 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
3011 + "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
3012 +
3013 + readme.gentoo_print_elog
3014 +
3015 + if ! use X; then
3016 + elog "You have elected to not install the X.org driver. Along with"
3017 + elog "this the OpenGL libraries and VDPAU libraries were not"
3018 + elog "installed. Additionally, once the driver is loaded your card"
3019 + elog "and fan will run at max speed which may not be desirable."
3020 + elog "Use the 'nvidia-smi' init script to have your card and fan"
3021 + elog "speed scale appropriately."
3022 + elog
3023 + fi
3024 + if ! use tools; then
3025 + elog "USE=tools controls whether the nvidia-settings application"
3026 + elog "is installed. If you would like to use it, enable that"
3027 + elog "flag and re-emerge this ebuild. Optionally you can install"
3028 + elog "media-video/nvidia-settings"
3029 + elog
3030 + fi
3031 +}
3032 +
3033 +pkg_prerm() {
3034 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
3035 +}
3036 +
3037 +pkg_postrm() {
3038 + use kernel_linux && linux-mod_pkg_postrm
3039 + use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
3040 +}
3041
3042 diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23-r1.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23-r1.ebuild
3043 new file mode 100644
3044 index 0000000..72c8ce2
3045 --- /dev/null
3046 +++ b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23-r1.ebuild
3047 @@ -0,0 +1,519 @@
3048 +# Copyright 1999-2015 Gentoo Foundation
3049 +# Distributed under the terms of the GNU General Public License v2
3050 +# $Id$
3051 +
3052 +EAPI=5
3053 +inherit eutils flag-o-matic linux-mod multilib nvidia-driver portability unpacker user versionator
3054 +
3055 +X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
3056 +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
3057 +X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
3058 +
3059 +DESCRIPTION="NVIDIA Accelerated Graphics Driver"
3060 +HOMEPAGE="http://www.nvidia.com/"
3061 +SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
3062 + amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
3063 + x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
3064 +
3065 +LICENSE="GPL-2 NVIDIA-r1"
3066 +SLOT="0/96"
3067 +KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
3068 +IUSE="acpi custom-cflags gtk multilib kernel_linux"
3069 +RESTRICT="bindist mirror strip"
3070 +EMULTILIB_PKG="true"
3071 +
3072 +COMMON="
3073 + kernel_linux? ( >=sys-libs/glibc-2.6.1 )
3074 + >=app-eselect/eselect-opengl-1.0.9
3075 +"
3076 +DEPEND="${COMMON}
3077 + kernel_linux? ( virtual/linux-sources )
3078 +"
3079 +RDEPEND="${COMMON}
3080 + <x11-base/xorg-server-1.12.99:=
3081 + acpi? ( sys-power/acpid )
3082 + gtk? (
3083 + !media-video/nvidia-settings
3084 + dev-libs/atk
3085 + dev-libs/glib:2
3086 + x11-libs/gdk-pixbuf
3087 + x11-libs/gtk+:2
3088 + x11-libs/libX11
3089 + x11-libs/libXext
3090 + x11-libs/pango[X]
3091 + x11-libs/pangox-compat
3092 + )
3093 + multilib? (
3094 + >=x11-libs/libX11-1.6.2[abi_x86_32]
3095 + >=x11-libs/libXext-1.3.2[abi_x86_32]
3096 + )
3097 +"
3098 +
3099 +QA_TEXTRELS_x86="
3100 + usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3101 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
3102 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
3103 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
3104 + usr/lib/xorg/modules/drivers/nvidia_drv.so
3105 + usr/lib/libcuda.so.${PV}
3106 + usr/lib/libnvidia-cfg.so.${PV}
3107 + usr/lib/libvdpau_nvidia.so.${PV}
3108 + usr/lib/libXvMCNVIDIA.so.${PV}
3109 +"
3110 +
3111 +QA_TEXTRELS_x86_fbsd="
3112 + boot/modules/nvidia.ko
3113 + usr/lib/opengl/nvidia/lib/libGL.so.1
3114 + usr/lib/opengl/nvidia/lib/libGLcore.so.1
3115 + usr/lib/libnvidia-cfg.so.1
3116 + usr/lib/opengl/nvidia/extensions/libglx.so.1
3117 + usr/lib/xorg/modules/drivers/nvidia_drv.so
3118 +"
3119 +
3120 +QA_TEXTRELS_amd64="
3121 + usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3122 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
3123 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
3124 + usr/lib32/libcuda.so.${PV}
3125 + usr/lib32/libvdpau_nvidia.so.${PV}
3126 +"
3127 +
3128 +QA_EXECSTACK_x86="
3129 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
3130 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
3131 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
3132 + usr/lib/xorg/modules/drivers/nvidia_drv.so
3133 + usr/lib/libXvMCNVIDIA.a:NVXVMC.o
3134 +"
3135 +
3136 +QA_EXECSTACK_amd64="
3137 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
3138 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
3139 + usr/lib64/libnvcompiler.so.${PV}
3140 + usr/lib64/libXvMCNVIDIA.so.${PV}
3141 + usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
3142 + usr/lib64/libnvidia-cfg.so.${PV}
3143 + usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3144 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
3145 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
3146 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
3147 + usr/lib64/xorg/modules/drivers/nvidia_drv.so
3148 + usr/bin/nvidia-settings
3149 + usr/bin/nvidia-smi
3150 + usr/bin/nvidia-xconfig
3151 +"
3152 +
3153 +QA_WX_LOAD_x86="
3154 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
3155 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
3156 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
3157 + usr/lib/libXvMCNVIDIA.a
3158 +"
3159 +
3160 +QA_WX_LOAD_amd64="
3161 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
3162 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
3163 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
3164 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
3165 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
3166 +"
3167 +
3168 +QA_SONAME_amd64="
3169 + usr/lib64/libnvcompiler.so.${PV}
3170 +"
3171 +
3172 +QA_FLAGS_IGNORED_amd64="
3173 + usr/lib32/libcuda.so.${PV}
3174 + usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
3175 + usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
3176 + usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3177 + usr/lib32/libvdpau_nvidia.so.${PV}
3178 + usr/lib64/libXvMCNVIDIA.so.${PV}
3179 + usr/lib64/libcuda.so.${PV}
3180 + usr/lib64/libnvidia-cfg.so.${PV}
3181 + usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
3182 + usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
3183 + usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3184 + usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
3185 + usr/lib64/xorg/modules/drivers/nvidia_drv.so
3186 + usr/lib64/libvdpau_nvidia.so.${PV}
3187 + usr/bin/nvidia-settings
3188 + usr/bin/nvidia-smi
3189 + usr/bin/nvidia-xconfig
3190 +"
3191 +
3192 +QA_FLAGS_IGNORED_x86="
3193 + usr/lib/libcuda.so.${PV}
3194 + usr/lib/libnvidia-cfg.so.${PV}
3195 + usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
3196 + usr/lib/opengl/nvidia/lib/libGL.so.${PV}
3197 + usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
3198 + usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
3199 + usr/lib/xorg/modules/drivers/nvidia_drv.so
3200 + usr/lib/libXvMCNVIDIA.so.${PV}
3201 + usr/lib/libvdpau_nvidia.so.${PV}
3202 + usr/bin/nvidia-settings
3203 + usr/bin/nvidia-smi
3204 + usr/bin/nvidia-xconfig
3205 +"
3206 +
3207 +S="${WORKDIR}/"
3208 +
3209 +mtrr_check() {
3210 + ebegin "Checking for MTRR support"
3211 + linux_chkconfig_present MTRR
3212 + eend $?
3213 +
3214 + if [[ $? -ne 0 ]] ; then
3215 + eerror "Please enable MTRR support in your kernel config, found at:"
3216 + eerror
3217 + eerror " Processor type and features"
3218 + eerror " [*] MTRR (Memory Type Range Register) support"
3219 + eerror
3220 + eerror "and recompile your kernel ..."
3221 + die "MTRR support not detected!"
3222 + fi
3223 +}
3224 +
3225 +lockdep_check() {
3226 + if linux_chkconfig_present LOCKDEP; then
3227 + eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
3228 + eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
3229 + eerror "which will prevent ${P} from compiling."
3230 + eerror "Please make sure the following options have been unset:"
3231 + eerror " Kernel hacking --->"
3232 + eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
3233 + eerror " [ ] Lock debugging: prove locking correctness"
3234 + eerror " [ ] Lock usage statistics"
3235 + eerror "in 'menuconfig'"
3236 + die "LOCKDEP enabled"
3237 + fi
3238 +}
3239 +
3240 +pkg_setup() {
3241 + # try to turn off distcc and ccache for people that have a problem with it
3242 + export DISTCC_DISABLE=1
3243 + export CCACHE_DISABLE=1
3244 +
3245 + if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
3246 + eerror "This ebuild doesn't currently support changing your default abi."
3247 + die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
3248 + fi
3249 +
3250 + if use kernel_linux; then
3251 + linux-mod_pkg_setup
3252 + MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
3253 + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
3254 + SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
3255 + mtrr_check
3256 + lockdep_check
3257 + fi
3258 +
3259 + # On BSD userland it wants real make command
3260 + use userland_BSD && MAKE="$(get_bmake)"
3261 +
3262 + export _POSIX2_VERSION="199209"
3263 +
3264 + if use kernel_linux && kernel_is ge 3 7 ; then
3265 + ewarn "Gentoo supports kernels which are supported by NVIDIA"
3266 + ewarn "which are limited to the following kernels:"
3267 + ewarn "<sys-kernel/gentoo-sources-3.7"
3268 + ewarn "<sys-kernel/vanilla-sources-3.7"
3269 + ewarn ""
3270 + ewarn "You are free to utilize epatch_user to provide whatever"
3271 + ewarn "support you feel is appropriate, but will not receive"
3272 + ewarn "support as a result of those changes."
3273 + ewarn ""
3274 + ewarn "Do not file a bug report about this."
3275 + fi
3276 +
3277 + # Since Nvidia ships 3 different series of drivers, we need to give the user
3278 + # some kind of guidance as to what version they should install. This tries
3279 + # to point the user in the right direction but can't be perfect. check
3280 + # nvidia-driver.eclass
3281 + nvidia-driver-check-warning
3282 +
3283 + # set variables to where files are in the package structure
3284 + if use kernel_FreeBSD; then
3285 + use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
3286 + NV_DOC="${S}/doc"
3287 + NV_EXEC="${S}/obj"
3288 + NV_LIB="${S}/obj"
3289 + NV_SRC="${S}/src"
3290 + NV_MAN="${S}/x11/man"
3291 + NV_X11="${S}/obj"
3292 + NV_X11_DRV="${NV_X11}"
3293 + NV_X11_EXT="${NV_X11}"
3294 + NV_SOVER=1
3295 + elif use kernel_linux; then
3296 + NV_DOC="${S}/usr/share/doc"
3297 + NV_EXEC="${S}/usr/bin"
3298 + NV_LIB="${S}/usr/lib"
3299 + NV_SRC="${S}/usr/src/nv"
3300 + NV_MAN="${S}/usr/share/man/man1"
3301 + NV_X11="${S}/usr/X11R6/lib"
3302 + NV_X11_DRV="${NV_X11}/modules/drivers"
3303 + NV_X11_EXT="${NV_X11}/modules/extensions"
3304 + NV_SOVER=${PV}
3305 + else
3306 + die "Could not determine proper NVIDIA package"
3307 + fi
3308 +}
3309 +
3310 +src_unpack() {
3311 + if use kernel_linux && kernel_is lt 2 6 7; then
3312 + echo
3313 + ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
3314 + ewarn "This is not officially supported for ${P}. It is likely you"
3315 + ewarn "will not be able to compile or use the kernel module."
3316 + ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
3317 + echo
3318 + ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
3319 + fi
3320 +
3321 + if ! use x86-fbsd; then
3322 + mkdir "${S}"
3323 + cd "${S}"
3324 + unpack_makeself
3325 + else
3326 + unpack ${A}
3327 + fi
3328 +}
3329 +
3330 +src_prepare() {
3331 + # Please add a brief description for every added patch
3332 + use x86-fbsd && cd doc
3333 +
3334 + # Use the correct defines to make gtkglext build work
3335 + epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
3336 + # Use some more sensible gl headers and make way for new glext.h
3337 + epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
3338 +
3339 + if use kernel_linux; then
3340 + # Quiet down warnings the user does not need to see
3341 + sed -i \
3342 + -e 's:-Wpointer-arith::g' \
3343 + -e 's:-Wsign-compare::g' \
3344 + "${NV_SRC}"/Makefile.kbuild
3345 +
3346 + # If you set this then it's your own fault when stuff breaks :)
3347 + use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
3348 +
3349 + # If greater than 2.6.5 use M= instead of SUBDIR=
3350 + convert_to_m "${NV_SRC}"/Makefile.kbuild
3351 + fi
3352 +}
3353 +
3354 +src_compile() {
3355 + # This is already the default on Linux, as there's no toplevel Makefile, but
3356 + # on FreeBSD there's one and triggers the kernel module build, as we install
3357 + # it by itself, pass this.
3358 +
3359 + cd "${NV_SRC}"
3360 + if use x86-fbsd; then
3361 + MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
3362 + LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
3363 + elif use kernel_linux; then
3364 + BUILD_PARAMS+=" PATCHLEVEL=not4"
3365 + linux-mod_src_compile
3366 + fi
3367 +}
3368 +
3369 +src_install() {
3370 + if use kernel_linux; then
3371 + linux-mod_src_install
3372 +
3373 + VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
3374 + if [ -z "$VIDEOGROUP" ]; then
3375 + eerror "Failed to determine the video group gid."
3376 + die "Failed to determine the video group gid."
3377 + fi
3378 +
3379 + # Add the aliases
3380 + sed -e 's:PACKAGE:'${PF}':g' \
3381 + -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
3382 + "${WORKDIR}"/nvidia || die
3383 + insinto /etc/modprobe.d
3384 + newins "${WORKDIR}"/nvidia nvidia.conf
3385 + elif use x86-fbsd; then
3386 + insinto /boot/modules
3387 + doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld"
3388 +
3389 + exeinto /boot/modules
3390 + doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko"
3391 + fi
3392 +
3393 + # NVIDIA kernel <-> userspace driver config lib
3394 + dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER}
3395 +
3396 + # Xorg DDX driver
3397 + insinto /usr/$(get_libdir)/xorg/modules/drivers
3398 + doins ${NV_X11_DRV}/nvidia_drv.so
3399 +
3400 + # Xorg GLX driver
3401 + insinto /usr/$(get_libdir)/opengl/nvidia/extensions
3402 + doins ${NV_X11_EXT}/libglx.so.${NV_SOVER}
3403 + dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
3404 + /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so
3405 +
3406 + # XvMC driver
3407 + dolib.a ${NV_X11}/libXvMCNVIDIA.a
3408 + dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER}
3409 + dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so
3410 +
3411 + # CUDA headers (driver to come)
3412 + if [[ -d ${S}/usr/include/cuda ]]; then
3413 + dodir /usr/include/cuda
3414 + insinto /usr/include/cuda
3415 + doins usr/include/cuda/*.h
3416 + fi
3417 +
3418 + # OpenCL headers (driver to come)
3419 + if [[ -d ${S}/usr/include/CL ]]; then
3420 + dodir /usr/include/CL
3421 + insinto /usr/include/CL
3422 + doins usr/include/CL/*.h
3423 + fi
3424 +
3425 + # Documentation
3426 + dodoc ${NV_DOC}/XF86Config.sample
3427 + dohtml ${NV_DOC}/html/*
3428 + if use x86-fbsd; then
3429 + dodoc "${NV_DOC}/README"
3430 + doman "${NV_MAN}/nvidia-xconfig.1"
3431 + else
3432 + # Docs
3433 + newdoc "${NV_DOC}/README.txt" README
3434 + dodoc "${NV_DOC}/NVIDIA_Changelog"
3435 +# doman "${NV_MAN}/nvidia-smi.1.gz"
3436 + doman "${NV_MAN}/nvidia-xconfig.1.gz"
3437 + fi
3438 +
3439 + # Helper Apps
3440 + dobin ${NV_EXEC}/nvidia-xconfig
3441 + dobin ${NV_EXEC}/nvidia-bug-report.sh
3442 + if use gtk; then
3443 + dobin usr/bin/nvidia-settings
3444 + fi
3445 +# if use kernel_linux; then
3446 +# dobin ${NV_EXEC}/nvidia-smi || die
3447 +# fi
3448 +
3449 + if has_multilib_profile ; then
3450 + local OABI=${ABI}
3451 + for ABI in $(get_install_abis) ; do
3452 + src_install-libs
3453 + done
3454 + ABI=${OABI}
3455 + unset OABI
3456 + else
3457 + src_install-libs
3458 + fi
3459 +
3460 + is_final_abi || die "failed to iterate through all ABIs"
3461 +
3462 + readme.gentoo_create_doc
3463 +}
3464 +
3465 +# Install nvidia library:
3466 +# the first parameter is the place where to install it
3467 +# the second parameter is the base name of the library
3468 +# the third parameter is the provided soversion
3469 +donvidia() {
3470 + dodir $1
3471 + exeinto $1
3472 +
3473 + libname=$(basename $2)
3474 +
3475 + doexe $2.$3
3476 + dosym ${libname}.$3 $1/${libname}
3477 + [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
3478 +}
3479 +
3480 +src_install-libs() {
3481 + local inslibdir=$(get_libdir)
3482 + local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
3483 + local libdir= sover=
3484 +
3485 + if use kernel_linux; then
3486 + if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
3487 + libdir=usr/lib32
3488 + else
3489 + libdir=usr/lib
3490 + fi
3491 + sover=${PV}
3492 + else
3493 + libdir=obj
3494 + # on FreeBSD it has just .1 suffix
3495 + sover=1
3496 + fi
3497 +
3498 + # The GLX libraries
3499 + donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
3500 + donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
3501 + if use x86-fbsd; then
3502 + donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
3503 + else
3504 + donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
3505 + fi
3506 +
3507 + #cuda
3508 + if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
3509 + dolib.so ${libdir}/libcuda.so.${sover}
3510 + [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
3511 + dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
3512 + fi
3513 +
3514 + #vdpau
3515 + if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
3516 + dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
3517 + dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
3518 + fi
3519 +
3520 + # OpenCL
3521 + # NOTE: This isn't currently available in the publicly released drivers.
3522 + if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
3523 +
3524 + dolib.so ${libdir}/libnvcompiler.so.${sover}
3525 + [[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
3526 + dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
3527 +
3528 + dolib.so ${libdir}/libOpenCL.so.1.0.0
3529 + dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
3530 + dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
3531 + fi
3532 +}
3533 +
3534 +pkg_preinst() {
3535 + if use kernel_linux; then
3536 + linux-mod_pkg_postinst
3537 + fi
3538 +
3539 + # Clean the dynamic libGL stuff's home to ensure
3540 + # we dont have stale libs floating around
3541 + if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
3542 + rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
3543 + fi
3544 + # Make sure we nuke the old nvidia-glx's env.d file
3545 + if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
3546 + rm -f "${ROOT}"/etc/env.d/09nvidia
3547 + fi
3548 +}
3549 +
3550 +pkg_postinst() {
3551 + if use kernel_linux; then
3552 + linux-mod_pkg_postinst
3553 + fi
3554 +
3555 + # Switch to the nvidia implementation
3556 + eselect opengl set --use-old nvidia
3557 +
3558 + readme.gentoo_print_elog
3559 +}
3560 +
3561 +pkg_postrm() {
3562 + if use kernel_linux; then
3563 + linux-mod_pkg_postrm
3564 + fi
3565 + eselect opengl set --use-old xorg-x11
3566 +}