Commits

Anonymous committed 31ec241

fix nvidia compilation for linux-3.3-rc7

Comments (0)

Files changed (18)

x11-drivers/nvidia-drivers/Manifest

+AUX 09nvidia 61 RMD160 b69c3282ba6195112e312fe34bdcb12544aef8ca SHA1 05dd043f66f53409dfe511636d92a339edb4c765 SHA256 14702d6726cc9f0ad832a3cc90059999eb956f9e3a35397cb63cfa6347b33e39
+AUX 195.30-unified-arch.patch 1525 RMD160 9872c270b4bb3d3010af3f2b83798631562c8d8f SHA1 06330376e9a25e3317a4bfe12f74af17e56f3448 SHA256 b6224e213820c698315a8645204d992b779f31e8c45c025e740bc189dc1f9bae
+AUX 256.35-unified-arch.patch 1380 RMD160 2612cad105f442d4232b99e3054124e8037860bb SHA1 d82433c0b3520c87e05f1013a59b243ec65ebe97 SHA256 5e84bb51e0f9b3ceba270d53ad2a739dc534861df9acd6ab6852670f5a1357d7
+AUX NVIDIA_glx-defines.patch 437 RMD160 7cc38de0663c51d9e3718f02035a940a5d31e53c SHA1 eef9bcae32d4e00133b205e27ce766488d5c6cdb SHA256 0007f3d962edb87da4788ce58869679c1b10f28223a6bf1c23696fede57305da
+AUX NVIDIA_glx-glheader.patch 380 RMD160 ee9a10cfbed10d5711f58a80553ffebeea5853bf SHA1 72abfedb9dfb7dae7dc23a5701d3e00282fef2c0 SHA256 f630e24067bf6199a64f8fe8c5d6fc158cb4b153bda65ffc3f97b36a9cb08faf
+AUX eblits/donvidia.eblit 695 RMD160 e83869944dfce52a62423412e6c22b4e4468bc3c SHA1 0c877bbe4402c2845f8f4353c9f2d8086d364fbc SHA256 d404dd7e5657d83ccf3687720fb978030a3716e47957fb8bb80dea3ed57b3672
+AUX eblits/mtrr_check.eblit 629 RMD160 a7f9090f419faa17e74b81346c4bb019a7700138 SHA1 edb9ba38de929a9a0406408701a454f514fe78ed SHA256 ae1b8fb37985fc3e42a4a776779b3fe3d70be2c826df5c3f99d03ba7209ca0b1
+AUX eblits/src_install-libs.eblit 3472 RMD160 3e00b70ea45c7fdf6ec6a48c121f56b8faae15da SHA1 ec4cb37556284846a24fcdd54cff1a4cd0ccc539 SHA256 6f301de374736cec316794bf1935a15de025b3c505981f24e06e3df75818ad6a
+AUX eblits/want_tls.eblit 952 RMD160 4f33e6aef50032665d68654af1cfdbd9abc54195 SHA1 cf96ae8227913439526f0ab2ec984e5be6f3a1fd SHA256 e5ce767a2e9a5c0682e764b9ba42a20e721a093f4c0626605570c8b5e3afecd0
+AUX libGL.la-r2 733 RMD160 479612ab30c04ca0683c7d9edaf9ab3de783e4a9 SHA1 88656b7e7234ade4f5564373fd6eb5c040167655 SHA256 4856e7a2c31763ade41c93a395f3e80a2705ac2ab4dbd73e5161cdba132f407b
+AUX nvidia 1510 RMD160 ca0d0e5375109d9edf682d9bdda743b7c693e4d4 SHA1 85cf9bff167dcc063ba61426523973e9598085f7 SHA256 b193cc3f6d6f39138720a2282d9f161fc8f2e8a15bc43d183a30eb879add06c5
+AUX nvidia-169.07 639 RMD160 8baddb6fd1bf7f0e2688870a78e8ace051d62e3f SHA1 b30487ba2a24a6b1359d1fd831eeb1705060953c SHA256 a8c4860f008d53776fda7a17b59524f271236559af688e9a2c9845cbbcba1577
+AUX nvidia-drivers-173.14.30-2.6.39.patch 599 RMD160 9dd06b0036a2ceed8b5a4874b584d32ac25c17f5 SHA1 d5dcbc8edfb05b79ea1f73068b87cd9068f8cf06 SHA256 f1528152fb786d74701bd5d99ccbabad0b1ac791958d83c17bf783484dda9474
+AUX nvidia-drivers-190.53-2.6.33.patch 2893 RMD160 29f6cf29909828f8d22504dfcb43b23aeeff78dd SHA1 412f8a2b208e8af886891985fcabf8623c9943c3 SHA256 68f5cdf4489fb6bc480319e4bda6e6481beb189cf37920b939b8f7bbf77aed1f
+AUX nvidia-drivers-260.19.44-2.6.39.patch 591 RMD160 8e53d800b86c380da9e9c978957a4d1b7f749fe4 SHA1 39be99b92fb16a71347fb8fb39301241550a1958 SHA256 dc9478bb4ff12d820f82bb13a8d7f956456ea97217ba89e6619f1c8d72127be3
+AUX nvidia-drivers-295.20-r1.patch 577 RMD160 81f8601b0a445cd27bfbc689c2f333ec12686e05 SHA1 a462eab07ffad4beb79773c96746e6aee75a716f SHA256 123e5b320f6bb8154d79e4901e9a7e7fbd6236ae0193e09a8a4b96c34a46fd34
+DIST NVIDIA-FreeBSD-x86-295.20.tar.gz 31993959 RMD160 56a123e11f288fe9c0b4a8249326c653e151575a SHA1 b1a9d50668f7d958627939b26e33a574aaf06275 SHA256 fea6d5552a50e2aedc4726944fea85ac8baf0d0b26661fc3b1f97f54ebec6736
+DIST NVIDIA-Linux-x86-295.20.run 34641353 RMD160 9727ee28dab4a5489124e3382d67be8d4b9c2b32 SHA1 67cac5eb191fa8e6661f24e1f37254689e634fe0 SHA256 0f9dc3d493053cffe37f72b6783edc6c14afd31532b43a7cf0bfce763cf2d500
+DIST NVIDIA-Linux-x86_64-295.20.run 58403208 RMD160 c7e1844a40ac6e4506d5e3671bfdbc6feb18c5f1 SHA1 fcf34baca50177bafb56cf64cedd24ecc543048c SHA256 3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c
+EBUILD nvidia-drivers-295.20-r1.ebuild 17588 RMD160 f2f8bf706181ea39cd1b0469398aa225c70d229a SHA1 3e02a4e942bf3f81bc4190da91d5e42cd60e9987 SHA256 a35476df7e7a64e94ba6ad5b0deeb119d01af10986cde0e8a9b31e0d4fd08d07

x11-drivers/nvidia-drivers/files/09nvidia

+# Has to precede X11's own libraries!
+LDPATH=/opt/nvidia/lib

x11-drivers/nvidia-drivers/files/195.30-unified-arch.patch

+diff -Naurp NVIDIA-Linux-x86_64-195.30-pkg2-orig/usr/src/nv/conftest.sh NVIDIA-Linux-x86_64-195.30-pkg2/usr/src/nv/conftest.sh
+--- NVIDIA-Linux-x86_64-195.30-pkg2-orig/usr/src/nv/conftest.sh	2010-02-07 22:53:38.000000000 +0100
++++ NVIDIA-Linux-x86_64-195.30-pkg2/usr/src/nv/conftest.sh	2010-02-07 22:57:10.000000000 +0100
+@@ -82,7 +82,7 @@ build_cflags() {
+ 
+     if [ "$OUTPUT" != "$SOURCES" ]; then
+         MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -91,7 +91,7 @@ build_cflags() {
+         fi
+     else
+         MACH_CFLAGS="-I$HEADERS/asm/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -102,7 +102,7 @@ build_cflags() {
+ 
+     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS"
+ 
+-    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
+     fi
+     if [ -n "$BUILD_PARAMS" ]; then

x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch

+Add support for the 'x86' unified kernel arch in conftest.sh
+
+--- NVIDIA-Linux-x86-256.25/kernel/conftest.sh
++++ NVIDIA-Linux-x86-256.25/kernel/conftest.sh
+@@ -101,7 +101,7 @@ build_cflags() {
+ 
+     if [ "$OUTPUT" != "$SOURCES" ]; then
+         MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -110,7 +110,7 @@ build_cflags() {
+         fi
+     else
+         MACH_CFLAGS="-I$HEADERS/asm/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -121,7 +121,7 @@ build_cflags() {
+ 
+     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+ 
+-    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
+     fi
+     if [ -n "$BUILD_PARAMS" ]; then

x11-drivers/nvidia-drivers/files/NVIDIA_glx-defines.patch

+diff -ur NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h
+--- NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h	2002-12-09 21:26:55.000000000 +0100
++++ NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h	2003-01-30 18:20:23.000000000 +0100
+@@ -39,6 +39,7 @@
+ typedef XID GLXPixmap;
+ typedef XID GLXDrawable;
+ typedef XID GLXPbuffer;
++typedef XID GLXPbufferSGIX;
+ typedef XID GLXWindow;
+ typedef XID GLXFBConfigID;
+ 

x11-drivers/nvidia-drivers/files/NVIDIA_glx-glheader.patch

+--- usr/include/GL/gl.g.orig	2004-07-17 19:56:59.789410584 +1000
++++ usr/include/GL/gl.h	2004-07-17 19:59:08.844791184 +1000
+@@ -66,6 +66,10 @@
+ typedef double GLclampd;
+ typedef void GLvoid;
+ 
++/* Patching for some better defines in the global system */
++#ifndef GL_GLEXT_LEGACY
++#include <GL/glext.h>
++#endif
+ 
+ /*************************************************************/
+ 

x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit

+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	# libnvidia-cfg.so is no longer supplied in lib32; step over it gracefully
+	if [ -e $2.$3 ] ; then
+		doexe $2.$3
+		dosym ${libname}.$3 $1/${libname}
+		[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+	fi
+}

x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit

+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}

x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit

+# Copyright 1999-2008 Gentoo Foundation
+# Distribnuted under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+#
+src_install-libs() {
+	local pkglibdir=lib
+	local inslibdir=$(get_libdir)
+
+	if [[ ${#} -eq 2 ]] ; then
+		pkglibdir=${1}
+		inslibdir=${2}
+	elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+		pkglibdir=lib32
+	fi
+
+	local usrpkglibdir=usr/${pkglibdir}
+	local libdir=usr/X11R6/${pkglibdir}
+	local drvdir=${libdir}/modules/drivers
+	local extdir=${libdir}/modules/extensions
+	local incdir=usr/include/GL
+	local sover=${PV}
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local NO_TLS_ROOT="${NV_ROOT}/no-tls"
+	local TLS_ROOT="${NV_ROOT}/tls"
+	local X11_LIB_DIR="/usr/${inslibdir}/xorg"
+
+	if use x86-fbsd; then
+		# on FreeBSD everything is on obj/
+		pkglibdir=obj
+		usrpkglibdir=obj
+		x11pkglibdir=obj
+		drvdir=obj
+		extdir=obj
+
+		# don't ask me why the headers are there.. glxext.h is missing
+		incdir=doc
+
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover}
+
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover}
+
+	dodir ${NO_TLS_ROOT}
+	donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover}
+
+	if ! use x86-fbsd; then
+		donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	if want_tls ; then
+		dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	else
+		dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	fi
+
+	if ! use x86-fbsd; then
+		# Install the .la file for libtool, to prevent e.g. bug #176423
+		[ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR"
+		local ver1=$(get_version_component_range 1)
+		local ver2=$(get_version_component_range 2)
+		local ver3=$(get_version_component_range 3)
+		sed -e "s:\${PV}:${PV}:"     \
+			-e "s:\${ver1}:${ver1}:" \
+			-e "s:\${ver2}:${ver2}:" \
+			-e "s:\${ver3}:${ver3}:" \
+			-e "s:\${libdir}:${inslibdir}:" \
+			"${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la
+	fi
+
+	exeinto ${X11_LIB_DIR}/modules/drivers
+
+	[[ -f ${drvdir}/nvidia_drv.so ]] && \
+		doexe ${drvdir}/nvidia_drv.so
+
+	insinto /usr/${inslibdir}
+	[[ -f ${libdir}/libXvMCNVIDIA.a ]] && \
+		doins ${libdir}/libXvMCNVIDIA.a
+	exeinto /usr/${inslibdir}
+	# fix Bug 131315
+	[[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \
+		doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \
+		dosym libXvMCNVIDIA.so.${PV} \
+			/usr/${inslibdir}/libXvMCNVIDIA.so
+
+	exeinto ${NV_ROOT}/extensions
+	[[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \
+		newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so
+	[[ -f ${extdir}/libglx.so.${sover} ]] && \
+		newexe ${extdir}/libglx.so.${sover} libglx.so
+
+	# Includes
+	insinto ${NV_ROOT}/include
+	doins ${incdir}/*.h
+
+	#cuda
+	if [[ -f usr/include/cuda/cuda.h ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h
+
+		if [[ -f usr/${pkglibdir}/libcuda.so.${PV} ]]; then
+			dolib.so usr/${pkglibdir}/libcuda.so.${PV}
+			dosym libcuda.so.${PV} /usr/${inslibdir}/libcuda.so.1
+			dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+		fi
+	fi
+}

x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit

+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+want_tls() {
+	# For uclibc or anything non glibc, return false
+	has_version sys-libs/glibc || return 1
+
+	# Old versions of glibc were lt/no-tls only
+	has_version '<sys-libs/glibc-2.3.2' && return 1
+
+	if use x86 ; then
+		case ${CHOST/-*} in
+			i486|i586|i686) ;;
+			*) return 1 ;;
+		esac
+	fi
+
+	# If we've got nptl, we've got tls
+	built_with_use --missing true sys-libs/glibc nptl && return 0
+
+	# 2.3.5 turned off tls for linuxthreads glibc on i486 and i586
+	if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then
+		case ${CHOST/-*} in
+			i486|i586) return 1 ;;
+		esac
+	fi
+
+	# These versions built linuxthreads version to support tls, too
+	has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0
+
+	return 1
+}

x11-drivers/nvidia-drivers/files/libGL.la-r2

+# libGL.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libGL.so.1'
+
+# Names of this library.
+library_names='libGL.so.${PV} libGL.so.1 libGL.so'
+
+# The name of the static archive.
+old_library=''
+
+# Libraries that this one depends upon.
+dependency_libs='-L/usr/${libdir} -lm -lX11 -lXext -ldl'
+
+# Version information for libGL.
+current=${ver1}
+age=${ver2}
+revision=${ver3}
+
+# Is this an already installed library?
+installed=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/${libdir}'

x11-drivers/nvidia-drivers/files/nvidia

+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+#   To enable Side Band Adressing:  NVreg_EnableAGPSBA=1
+#
+#   To enable Fast Writes: NVreg_EnableAGPFW=1
+#
+# To enable both for instance, uncomment following line:
+#
+#options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
+# If you have a mobile chip, you may need to enable this option
+# if you have hard lockups when starting X.
+#
+# See: Appendix I. Configuring your laptop
+# In /usr/share/doc/PACKAGE/README for full details
+#
+# Choose the appropriate value for NVreg_Mobile from the table:
+#        Value		Meaning
+#        ----------	--------------------------------------------------
+#        0xFFFFFFFF	let the kernel module autodetect the correct value
+#        1		Dell laptops
+#        2		non-Compal Toshiba laptops
+#        3		all other laptops
+#        4		Compal Toshiba laptops
+#        5		Gateway laptops
+#
+#options nvidia NVreg_SoftEDIDs=0 NVreg_Mobile=3
+
+
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1

x11-drivers/nvidia-drivers/files/nvidia-169.07

+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1

x11-drivers/nvidia-drivers/files/nvidia-drivers-173.14.30-2.6.39.patch

+linux/smp_lock.h no longer exists in linux-2.6.39+
+
+--- a/usr/src/nv/nv-linux.h
++++ b/usr/src/nv/nv-linux.h
+@@ -87,7 +87,9 @@
+ #if !defined(KERNEL_2_4)
+ #include <linux/sched.h>            /* suser(), capable() replacement   */
+ #include <linux/moduleparam.h>      /* module_param()                   */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
+ #include <linux/smp_lock.h>         /* kernel_locked                    */
++#endif
+ #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
+ #include <asm/kmap_types.h>         /* page table entry lookup          */
+ #endif

x11-drivers/nvidia-drivers/files/nvidia-drivers-190.53-2.6.33.patch

+Index: usr/src/nv/conftest.sh
+===================================================================
+--- usr/src/nv/conftest.sh	
++++ usr/src/nv/conftest.sh	2010-01-06 12:10:56.000000000 +0530
+@@ -32,14 +32,14 @@
+     # CONFIG_XEN and CONFIG_PARAVIRT are present, text_xen() treats
+     # the kernel as a stand-alone kernel.
+     #
+-    FILE="linux/autoconf.h"
++    FILE="generated/autoconf.h"
+ 
+     if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then
+         #
+         # We are looking at a configured source tree; verify
+         # that it's not a Xen kernel.
+         #
+-        echo "#include <linux/autoconf.h>
++        echo "#include <generated/autoconf.h>
+         #if defined(CONFIG_XEN) && !defined(CONFIG_PARAVIRT)
+         #error CONFIG_XEN defined!
+         #endif
+@@ -111,7 +111,12 @@
+     fi
+ }
+ 
+-CONFTEST_PREAMBLE="#include <linux/autoconf.h>
++CONFTEST_PREAMBLE="#include <linux/version.h>
++    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++    #include <generated/autoconf.h>
++    #else
++    #include <linux/autoconf.h>
++    #endif
+     #if defined(CONFIG_XEN) && \
+         defined(CONFIG_XEN_INTERFACE_VERSION) &&  !defined(__XEN_INTERFACE_VERSION__)
+     #define __XEN_INTERFACE_VERSION__ CONFIG_XEN_INTERFACE_VERSION
+@@ -1294,7 +1299,7 @@
+                 echo "";
+             fi
+         fi
+-        exit $RET
++#        exit $RET
+     ;;
+ 
+     get_uname)
+@@ -1316,11 +1321,11 @@
+             # tree or at headers shipped for a specific kernel.
+             # Determine the kernel version using a compile check.
+             #
+-            FILE="linux/utsrelease.h"
++            FILE="generated/utsrelease.h"
+ 
+             if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then
+                 echo "$CONFTEST_PREAMBLE
+-                #include <linux/utsrelease.h>
++                #include <generated/utsrelease.h>
+                 int main() {
+                     printf(\"%s\", UTS_RELEASE);
+                     return 0;
+@@ -1375,7 +1380,7 @@
+         #
+         RET=1
+         VERBOSE=$6
+-        FILE="linux/autoconf.h"
++        FILE="generated/autoconf.h"
+ 
+         if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then
+             #
+@@ -1429,7 +1434,7 @@
+         #
+         RET=1
+         VERBOSE=$6
+-        FILE="linux/autoconf.h"
++        FILE="generated/autoconf.h"
+ 
+         if [ -f $HEADERS/$FILE -o -f $OUTPUT/include/$FILE ]; then
+             #
+Index: usr/src/nv/nvacpi.c
+===================================================================
+--- usr/src/nv/nvacpi.c	
++++ usr/src/nv/nvacpi.c	2010-01-06 12:10:56.000000000 +0530
+@@ -49,6 +49,10 @@
+ };
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
++#define acpi_walk_namespace(a,b,c,d,e,f) acpi_walk_namespace(a,b,c,d,e,f,NULL)
++#endif
++
+ static struct acpi_driver *nv_acpi_driver;
+ static acpi_handle nvif_handle = NULL;
+ static acpi_handle dsm_handle  = NULL;
+

x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch

+linux/smp_lock.h no longer exists in linux-2.6.39+
+
+--- a/kernel/nv-linux.h
++++ b/kernel/nv-linux.h
+@@ -87,7 +87,9 @@
+ #if !defined(KERNEL_2_4)
+ #include <linux/sched.h>            /* suser(), capable() replacement   */
+ #include <linux/moduleparam.h>      /* module_param()                   */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
+ #include <linux/smp_lock.h>         /* kernel_locked                    */
++#endif
+ #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
+ #include <asm/kmap_types.h>         /* page table entry lookup          */
+ #endif

x11-drivers/nvidia-drivers/files/nvidia-drivers-295.20-r1.patch

+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index c7cd056..e0cda73 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -126,7 +126,7 @@ build_cflags() {
+     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+ 
+     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
++        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+     elif [ "$ARCH" = "ARMv7" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include"
+     fi

x11-drivers/nvidia-drivers/nvidia-drivers-295.20-r1.ebuild

+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-295.20-r1.ebuild,v 1.1 2012/02/15 09:53:34 xarthisius Exp $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 driver and GLX libraries"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags gtk multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.11.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}
+	kernel_linux? ( virtual/linux-sources )"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1
+	gtk? ( media-video/nvidia-settings )"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+S=${WORKDIR}/
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+	epatch "${FILESDIR}"/nvidia-drivers-295.20-r1.patch
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+		use gtk && doman "${NV_MAN}/nvidia-settings.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		use gtk && doman "${NV_MAN}/nvidia-settings.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	if use gtk; then
+		dobin ${NV_EXEC}/nvidia-settings || die
+	fi
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	# Desktop entries for nvidia-settings
+	if use gtk; then
+		sed -e 's:__UTILS_PATH__:/usr/bin:' \
+			-e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' \
+			-i "${NV_EXEC}/nvidia-settings.desktop"
+		domenu ${NV_EXEC}/nvidia-settings.desktop
+
+		doicon ${NV_EXEC}/nvidia-settings.png
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+	eselect opencl set --use-old nvidia
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This ebuild installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+
+	if ! use gtk; then
+		elog "USE=gtk controls whether the nvidia-settings application"
+		elog "is installed. If you would like to use it, enable that"
+		elog "flag and re-emerge this ebuild. media-video/nvidia-settings"
+		elog "no longer installs nvidia-settings but only installs the"
+		elog "associated user space libraries."
+	fi
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+	eselect opengl set --use-old xorg-x11
+}