/[gentoo-x86]/x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild
Gentoo

Contents of /x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Jul 28 04:43:00 2015 UTC (2 years, 10 months ago) by jer
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -2 lines
Stable for AMD64 x86 too.

(Portage version: 2.2.20/cvs/Linux x86_64, RepoMan options: --ignore-arches, signed Manifest commit with key A792A613)

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

  ViewVC Help
Powered by ViewVC 1.1.20