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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Wed Dec 19 16:52:01 2012 UTC (2 years ago) by tetromino
Branch: MAIN
Changes since 1.11: +2 -1 lines
Depend on pangox-compat if using pango-1.32.

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

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

  ViewVC Help
Powered by ViewVC 1.1.20