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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Mon Nov 19 15:11:44 2012 UTC (19 months, 2 weeks ago) by jer
Branch: MAIN
Changes since 1.4: +2 -2 lines
Lower x11-base/xorg-server dependency (bug #443926).

(Portage version: 2.2.0_alpha142/cvs/Linux x86_64, signed Manifest commit with key A792A613)

1 # Copyright 1999-2012 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-96.43.23.ebuild,v 1.4 2012/11/18 11:18:17 ago Exp $
4
5 EAPI="2"
6
7 inherit eutils flag-o-matic linux-mod multilib nvidia-driver portability \
8 unpacker user versionator
9
10 X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
11 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
12 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
13
14 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
15 HOMEPAGE="http://www.nvidia.com/"
16 SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
17 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
18 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
19
20 LICENSE="NVIDIA"
21 SLOT="0"
22 KEYWORDS="-* amd64 x86 ~x86-fbsd"
23 IUSE="acpi custom-cflags gtk multilib kernel_linux"
24 RESTRICT="strip"
25 EMULTILIB_PKG="true"
26
27 COMMON="<x11-base/xorg-server-1.12.99
28 gtk? (
29 !media-video/nvidia-settings
30 dev-libs/atk
31 dev-libs/glib
32 x11-libs/gdk-pixbuf
33 x11-libs/gtk+:2
34 x11-libs/libX11
35 x11-libs/libXext
36 x11-libs/pango[X]
37 )
38 kernel_linux? ( >=sys-libs/glibc-2.6.1 )
39 multilib? ( app-emulation/emul-linux-x86-opengl )
40 >=app-admin/eselect-opengl-1.0.9"
41 DEPEND="${COMMON}
42 kernel_linux? ( virtual/linux-sources )"
43 RDEPEND="${COMMON}
44 acpi? ( sys-power/acpid )"
45
46 QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
47 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
48 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
49 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
50 usr/lib/xorg/modules/drivers/nvidia_drv.so
51 usr/lib/libcuda.so.${PV}
52 usr/lib/libnvidia-cfg.so.${PV}
53 usr/lib/libvdpau_nvidia.so.${PV}
54 usr/lib/libXvMCNVIDIA.so.${PV}"
55
56 QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
57 usr/lib/opengl/nvidia/lib/libGL.so.1
58 usr/lib/opengl/nvidia/lib/libGLcore.so.1
59 usr/lib/libnvidia-cfg.so.1
60 usr/lib/opengl/nvidia/extensions/libglx.so.1
61 usr/lib/xorg/modules/drivers/nvidia_drv.so"
62
63 QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
64 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
65 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
66 usr/lib32/libcuda.so.${PV}
67 usr/lib32/libvdpau_nvidia.so.${PV}"
68
69 QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
70 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
71 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
72 usr/lib/xorg/modules/drivers/nvidia_drv.so
73 usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
74
75 QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
76 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
77 usr/lib64/libnvcompiler.so.${PV}
78 usr/lib64/libXvMCNVIDIA.so.${PV}
79 usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
80 usr/lib64/libnvidia-cfg.so.${PV}
81 usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
82 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
83 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
84 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
85 usr/lib64/xorg/modules/drivers/nvidia_drv.so
86 usr/bin/nvidia-settings
87 usr/bin/nvidia-smi
88 usr/bin/nvidia-xconfig"
89
90 QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
91 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
92 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
93 usr/lib/libXvMCNVIDIA.a"
94
95 QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
96 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
97 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
98 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
99 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
100
101 QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
102
103 QA_FLAGS_IGNORED_amd64="usr/lib32/libcuda.so.${PV}
104 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
105 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
106 usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
107 usr/lib32/libvdpau_nvidia.so.${PV}
108 usr/lib64/libXvMCNVIDIA.so.${PV}
109 usr/lib64/libcuda.so.${PV}
110 usr/lib64/libnvidia-cfg.so.${PV}
111 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
112 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
113 usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
114 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
115 usr/lib64/xorg/modules/drivers/nvidia_drv.so
116 usr/lib64/libvdpau_nvidia.so.${PV}
117 usr/bin/nvidia-settings
118 usr/bin/nvidia-smi
119 usr/bin/nvidia-xconfig"
120
121 QA_FLAGS_IGNORED_x86="usr/lib/libcuda.so.${PV}
122 usr/lib/libnvidia-cfg.so.${PV}
123 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
124 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
125 usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
126 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
127 usr/lib/xorg/modules/drivers/nvidia_drv.so
128 usr/lib/libXvMCNVIDIA.so.${PV}
129 usr/lib/libvdpau_nvidia.so.${PV}
130 usr/bin/nvidia-settings
131 usr/bin/nvidia-smi
132 usr/bin/nvidia-xconfig"
133
134 S="${WORKDIR}/"
135
136 mtrr_check() {
137 ebegin "Checking for MTRR support"
138 linux_chkconfig_present MTRR
139 eend $?
140
141 if [[ $? -ne 0 ]] ; then
142 eerror "Please enable MTRR support in your kernel config, found at:"
143 eerror
144 eerror " Processor type and features"
145 eerror " [*] MTRR (Memory Type Range Register) support"
146 eerror
147 eerror "and recompile your kernel ..."
148 die "MTRR support not detected!"
149 fi
150 }
151
152 lockdep_check() {
153 if linux_chkconfig_present LOCKDEP; then
154 eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
155 eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
156 eerror "which will prevent ${P} from compiling."
157 eerror "Please make sure the following options have been unset:"
158 eerror " Kernel hacking --->"
159 eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
160 eerror " [ ] Lock debugging: prove locking correctness"
161 eerror " [ ] Lock usage statistics"
162 eerror "in 'menuconfig'"
163 die "LOCKDEP enabled"
164 fi
165 }
166
167 pkg_setup() {
168 # try to turn off distcc and ccache for people that have a problem with it
169 export DISTCC_DISABLE=1
170 export CCACHE_DISABLE=1
171
172 if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
173 eerror "This ebuild doesn't currently support changing your default abi."
174 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
175 fi
176
177 if use kernel_linux; then
178 linux-mod_pkg_setup
179 MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
180 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
181 SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
182 mtrr_check
183 lockdep_check
184 fi
185
186 # On BSD userland it wants real make command
187 use userland_BSD && MAKE="$(get_bmake)"
188
189 export _POSIX2_VERSION="199209"
190
191 # Since Nvidia ships 3 different series of drivers, we need to give the user
192 # some kind of guidance as to what version they should install. This tries
193 # to point the user in the right direction but can't be perfect. check
194 # nvidia-driver.eclass
195 nvidia-driver-check-warning
196
197 # set variables to where files are in the package structure
198 if use kernel_FreeBSD; then
199 use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
200 NV_DOC="${S}/doc"
201 NV_EXEC="${S}/obj"
202 NV_LIB="${S}/obj"
203 NV_SRC="${S}/src"
204 NV_MAN="${S}/x11/man"
205 NV_X11="${S}/obj"
206 NV_X11_DRV="${NV_X11}"
207 NV_X11_EXT="${NV_X11}"
208 NV_SOVER=1
209 elif use kernel_linux; then
210 NV_DOC="${S}/usr/share/doc"
211 NV_EXEC="${S}/usr/bin"
212 NV_LIB="${S}/usr/lib"
213 NV_SRC="${S}/usr/src/nv"
214 NV_MAN="${S}/usr/share/man/man1"
215 NV_X11="${S}/usr/X11R6/lib"
216 NV_X11_DRV="${NV_X11}/modules/drivers"
217 NV_X11_EXT="${NV_X11}/modules/extensions"
218 NV_SOVER=${PV}
219 else
220 die "Could not determine proper NVIDIA package"
221 fi
222 }
223
224 src_unpack() {
225 if use kernel_linux && kernel_is lt 2 6 7; then
226 echo
227 ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
228 ewarn "This is not officially supported for ${P}. It is likely you"
229 ewarn "will not be able to compile or use the kernel module."
230 ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
231 echo
232 ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
233 fi
234
235 if ! use x86-fbsd; then
236 mkdir "${S}"
237 cd "${S}"
238 unpack_makeself
239 else
240 unpack ${A}
241 fi
242 }
243
244 src_prepare() {
245 # Please add a brief description for every added patch
246 use x86-fbsd && cd doc
247
248 # Use the correct defines to make gtkglext build work
249 epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
250 # Use some more sensible gl headers and make way for new glext.h
251 epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
252
253 if use kernel_linux; then
254 # Quiet down warnings the user does not need to see
255 sed -i \
256 -e 's:-Wpointer-arith::g' \
257 -e 's:-Wsign-compare::g' \
258 "${NV_SRC}"/Makefile.kbuild
259
260 # If you set this then it's your own fault when stuff breaks :)
261 use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
262
263 # If greater than 2.6.5 use M= instead of SUBDIR=
264 convert_to_m "${NV_SRC}"/Makefile.kbuild
265 fi
266 }
267
268 src_compile() {
269 # This is already the default on Linux, as there's no toplevel Makefile, but
270 # on FreeBSD there's one and triggers the kernel module build, as we install
271 # it by itself, pass this.
272
273 cd "${NV_SRC}"
274 if use x86-fbsd; then
275 MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
276 LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
277 elif use kernel_linux; then
278 linux-mod_src_compile
279 fi
280 }
281
282 src_install() {
283 if use kernel_linux; then
284 linux-mod_src_install
285
286 VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
287 if [ -z "$VIDEOGROUP" ]; then
288 eerror "Failed to determine the video group gid."
289 die "Failed to determine the video group gid."
290 fi
291
292 # Add the aliases
293 [ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
294 sed -e 's:PACKAGE:'${PF}':g' \
295 -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
296 "${WORKDIR}"/nvidia
297 insinto /etc/modprobe.d
298 newins "${WORKDIR}"/nvidia nvidia.conf || die
299 elif use x86-fbsd; then
300 insinto /boot/modules
301 doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
302
303 exeinto /boot/modules
304 doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
305 fi
306
307 # NVIDIA kernel <-> userspace driver config lib
308 dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
309 die "failed to install libnvidia-cfg"
310
311 # Xorg DDX driver
312 insinto /usr/$(get_libdir)/xorg/modules/drivers
313 doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
314
315 # Xorg GLX driver
316 insinto /usr/$(get_libdir)/opengl/nvidia/extensions
317 doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
318 die "failed to install libglx.so"
319 dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
320 /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
321 die "failed to create libglx.so symlink"
322
323 # XvMC driver
324 dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
325 die "failed to install libXvMCNVIDIA.so"
326 dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
327 die "failed to install libXvMCNVIDIA.so"
328 dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
329 die "failed to create libXvMCNVIDIA.so symlink"
330
331 # CUDA headers (driver to come)
332 if [[ -d ${S}/usr/include/cuda ]]; then
333 dodir /usr/include/cuda
334 insinto /usr/include/cuda
335 doins usr/include/cuda/*.h || die "failed to install cuda headers"
336 fi
337
338 # OpenCL headers (driver to come)
339 if [[ -d ${S}/usr/include/CL ]]; then
340 dodir /usr/include/CL
341 insinto /usr/include/CL
342 doins usr/include/CL/*.h || die "failed to install OpenCL headers"
343 fi
344
345 # Documentation
346 dodoc ${NV_DOC}/XF86Config.sample
347 dohtml ${NV_DOC}/html/*
348 if use x86-fbsd; then
349 dodoc "${NV_DOC}/README"
350 doman "${NV_MAN}/nvidia-xconfig.1"
351 else
352 # Docs
353 newdoc "${NV_DOC}/README.txt" README
354 dodoc "${NV_DOC}/NVIDIA_Changelog"
355 # doman "${NV_MAN}/nvidia-smi.1.gz"
356 doman "${NV_MAN}/nvidia-xconfig.1.gz"
357 fi
358
359 # Helper Apps
360 dobin ${NV_EXEC}/nvidia-xconfig || die
361 dobin ${NV_EXEC}/nvidia-bug-report.sh || die
362 if use gtk; then
363 dobin usr/bin/nvidia-settings || die
364 fi
365 # if use kernel_linux; then
366 # dobin ${NV_EXEC}/nvidia-smi || die
367 # fi
368
369 if has_multilib_profile ; then
370 local OABI=${ABI}
371 for ABI in $(get_install_abis) ; do
372 src_install-libs
373 done
374 ABI=${OABI}
375 unset OABI
376 else
377 src_install-libs
378 fi
379
380 is_final_abi || die "failed to iterate through all ABIs"
381 }
382
383 # Install nvidia library:
384 # the first parameter is the place where to install it
385 # the second parameter is the base name of the library
386 # the third parameter is the provided soversion
387 donvidia() {
388 dodir $1
389 exeinto $1
390
391 libname=$(basename $2)
392
393 doexe $2.$3 || die "failed to install $2"
394 dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
395 [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
396 }
397
398 src_install-libs() {
399 local inslibdir=$(get_libdir)
400 local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
401 local libdir= sover=
402
403 if use kernel_linux; then
404 if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
405 libdir=usr/lib32
406 else
407 libdir=usr/lib
408 fi
409 sover=${PV}
410 else
411 libdir=obj
412 # on FreeBSD it has just .1 suffix
413 sover=1
414 fi
415
416 # The GLX libraries
417 donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
418 donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
419 if use x86-fbsd; then
420 donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
421 else
422 donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
423 fi
424
425 #cuda
426 if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
427 dolib.so ${libdir}/libcuda.so.${sover}
428 [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
429 dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
430 fi
431
432 #vdpau
433 if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
434 dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
435 dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
436 fi
437
438 # OpenCL
439 # NOTE: This isn't currently available in the publicly released drivers.
440 if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
441
442 dolib.so ${libdir}/libnvcompiler.so.${sover}
443 [[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
444 dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
445
446 dolib.so ${libdir}/libOpenCL.so.1.0.0
447 dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
448 dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
449 fi
450 }
451
452 pkg_preinst() {
453 if use kernel_linux; then
454 linux-mod_pkg_postinst
455 fi
456
457 # Clean the dynamic libGL stuff's home to ensure
458 # we dont have stale libs floating around
459 if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
460 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
461 fi
462 # Make sure we nuke the old nvidia-glx's env.d file
463 if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
464 rm -f "${ROOT}"/etc/env.d/09nvidia
465 fi
466 }
467
468 pkg_postinst() {
469 if use kernel_linux; then
470 linux-mod_pkg_postinst
471 fi
472
473 # Switch to the nvidia implementation
474 eselect opengl set --use-old nvidia
475
476 elog "You must be in the video group to use the NVIDIA device"
477 elog "For more info, read the docs at"
478 elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
479 elog
480 elog "This ebuild installs a kernel module and X driver. Both must"
481 elog "match explicitly in their version. This means, if you restart"
482 elog "X, you must modprobe -r nvidia before starting it back up"
483 elog
484 elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
485 elog
486 elog "NVIDIA has requested that any bug reports submitted have the"
487 elog "output of /usr/bin/nvidia-bug-report.sh included."
488 elog
489 }
490
491 pkg_postrm() {
492 if use kernel_linux; then
493 linux-mod_pkg_postrm
494 fi
495 eselect opengl set --use-old xorg-x11
496 }

  ViewVC Help
Powered by ViewVC 1.1.20