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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sat May 30 12:30:31 2015 UTC (3 years, 6 months ago) by jer
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +3 -8 lines
Drop emul-linux* dependencies (bug #544876).

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

  ViewVC Help
Powered by ViewVC 1.1.20