x11-drivers/nvidia-drivers-195.30: Bump
[otih-overlay.git] / x11-drivers / nvidia-drivers / nvidia-drivers-195.30.ebuild
Commit [+]AuthorDateLineData
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +02001# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +01003# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-190.42-r3.ebuild,v 1.4 2009/11/12 19:12:29 cardoe Exp $
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +02004
3b17321e
FF
Fabian Fingerle2009-10-28 23:35:46 +01005EAPI="2"
6
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +02007inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver
8
9X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
10AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
11X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
12
13DESCRIPTION="NVIDIA X11 driver and GLX libraries"
14HOMEPAGE="http://www.nvidia.com/"
15SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
16 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
17 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
18
19LICENSE="NVIDIA"
20SLOT="0"
aedf9db0 Fabian Fingerle2009-07-30 06:41:02 +020021KEYWORDS=""
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020022IUSE="acpi custom-cflags gtk multilib kernel_linux"
23RESTRICT="strip"
24EMULTILIB_PKG="true"
25
3f38c36d Fabian Fingerle2009-10-30 22:37:10 +010026COMMON="<x11-base/xorg-server-1.7.99
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010027 kernel_linux? ( >=sys-libs/glibc-2.6.1 )
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +010028 multilib? ( app-emulation/emul-linux-x86-xlibs )
29 >=app-admin/eselect-opengl-1.0.9"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020030DEPEND="${COMMON}
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +010031 kernel_linux? ( virtual/linux-sources )"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020032RDEPEND="${COMMON}
33 kernel_linux? ( virtual/modutils )
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020034 acpi? ( sys-power/acpid )"
3b17321e
FF
Fabian Fingerle2009-10-28 23:35:46 +010035PDEPEND="x11-libs/libvdpau
36 gtk? ( media-video/nvidia-settings )"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020037
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +010038QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020039 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020040 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010041 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020042 usr/lib/xorg/modules/drivers/nvidia_drv.so
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +020043 usr/lib/libcuda.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010044 usr/lib/libnvidia-cfg.so.${PV}
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +010045 usr/lib/libvdpau_nvidia.so.${PV}
46 usr/lib/libXvMCNVIDIA.so.${PV}"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020047
48QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
49 usr/lib/opengl/nvidia/lib/libGL.so.1
50 usr/lib/opengl/nvidia/lib/libGLcore.so.1
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010051 usr/lib/libnvidia-cfg.so.1
52 usr/lib/opengl/nvidia/extensions/libglx.so.1
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020053 usr/lib/xorg/modules/drivers/nvidia_drv.so"
54
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010055QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020056 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
57 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
9ea57b3d
FF
Fabian Fingerle2009-07-30 06:32:14 +020058 usr/lib32/libcuda.so.${PV}
59 usr/lib32/libvdpau_nvidia.so.${PV}"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020060
61QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
62 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010063 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
3f38c36d Fabian Fingerle2009-10-30 22:37:10 +010064 usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020065
66QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
67 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +020068 usr/lib64/libnvcompiler.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020069 usr/lib64/libXvMCNVIDIA.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010070 usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
71 usr/lib64/libnvidia-cfg.so.${PV}
72 usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020073 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010074 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
75 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +020076 usr/bin/nvidia-smi
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010077 usr/bin/nvidia-xconfig"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +020078
79QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
80 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010081 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +020082 usr/lib/libXvMCNVIDIA.a"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020083
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010084QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
85 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020086 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010087 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
88 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +020089
d15d34fb
FF
Fabian Fingerle2009-09-30 23:34:21 +020090QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
91
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010092QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +020093 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +010094 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
95 usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +020096 usr/lib32/libvdpau_nvidia.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010097 usr/lib64/libXvMCNVIDIA.so.${PV}
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +020098 usr/lib64/libcuda.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +010099 usr/lib64/libnvidia-cfg.so.${PV}
9ea57b3d
FF
Fabian Fingerle2009-07-30 06:32:14 +0200100 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
101 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100102 usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
103 usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +0200104 usr/lib64/xorg/modules/drivers/nvidia_drv.so
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +0200105 usr/lib64/libvdpau_nvidia.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100106 usr/bin/nvidia-smi
107 usr/bin/nvidia-xconfig"
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +0200108
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100109QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100110 usr/lib/libnvidia-cfg.so.${PV}
9ea57b3d
FF
Fabian Fingerle2009-07-30 06:32:14 +0200111 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
112 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100113 usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100114 usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
9ea57b3d
FF
Fabian Fingerle2009-07-30 06:32:14 +0200115 usr/lib/xorg/modules/drivers/nvidia_drv.so
116 usr/lib/libXvMCNVIDIA.so.${PV}
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100117 usr/lib/libvdpau_nvidia.so.${PV}
118 usr/bin/nvidia-smi
119 usr/bin/nvidia-xconfig"
3b17321e Fabian Fingerle2009-10-28 23:35:46 +0100120
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200121if use x86; then
122 PKG_V="-pkg0"
123 NV_PACKAGE="${X86_NV_PACKAGE}"
124elif use amd64; then
125 PKG_V="-pkg2"
126 NV_PACKAGE="${AMD64_NV_PACKAGE}"
127elif use x86-fbsd; then
128 PKG_V=""
129 NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
130fi
131
132S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
133
134mtrr_check() {
135 ebegin "Checking for MTRR support"
136 linux_chkconfig_present MTRR
137 eend $?
138
139 if [[ $? -ne 0 ]] ; then
140 eerror "Please enable MTRR support in your kernel config, found at:"
141 eerror
142 eerror " Processor type and features"
143 eerror " [*] MTRR (Memory Type Range Register) support"
144 eerror
145 eerror "and recompile your kernel ..."
146 die "MTRR support not detected!"
147 fi
148}
149
d15d34fb
FF
Fabian Fingerle2009-09-30 23:34:21 +0200150lockdep_check() {
151 if linux_chkconfig_present LOCKDEP; then
152 eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
153 eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
154 eerror "which will prevent ${P} from compiling."
155 eerror "Please make sure the following options have been unset:"
156 eerror " Kernel hacking --->"
157 eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
158 eerror " [ ] Lock debugging: prove locking correctness"
159 eerror " [ ] Lock usage statistics"
160 eerror "in 'menuconfig'"
161 die "LOCKDEP enabled"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200162 fi
163}
164
165pkg_setup() {
166 # try to turn off distcc and ccache for people that have a problem with it
167 export DISTCC_DISABLE=1
168 export CCACHE_DISABLE=1
169
170 if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
171 eerror "This ebuild doesn't currently support changing your default abi."
172 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
173 fi
174
175 if use kernel_linux; then
176 linux-mod_pkg_setup
177 MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
178 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
179 SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
180 mtrr_check
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200181 lockdep_check
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200182 fi
183
184 # On BSD userland it wants real make command
185 use userland_BSD && MAKE="$(get_bmake)"
186
187 export _POSIX2_VERSION="199209"
188
189 # Since Nvidia ships 3 different series of drivers, we need to give the user
190 # some kind of guidance as to what version they should install. This tries
191 # to point the user in the right direction but can't be perfect. check
192 # nvidia-driver.eclass
193 nvidia-driver-check-warning
194
195 # set variables to where files are in the package structure
196 if use kernel_FreeBSD; then
197 NV_DOC="${S}/doc"
198 NV_EXEC="${S}/obj"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100199 NV_LIB="${S}/obj"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200200 NV_SRC="${S}/src"
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200201 NV_MAN="${S}/x11/man"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100202 NV_X11="${S}/obj"
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100203 NV_X11_DRV="${NV_X11}"
204 NV_X11_EXT="${NV_X11}"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100205 NV_SOVER=1
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200206 elif use kernel_linux; then
207 NV_DOC="${S}/usr/share/doc"
208 NV_EXEC="${S}/usr/bin"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100209 NV_LIB="${S}/usr/lib"
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200210 NV_SRC="${S}/usr/src/nv"
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200211 NV_MAN="${S}/usr/share/man/man1"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100212 NV_X11="${S}/usr/X11R6/lib"
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100213 NV_X11_DRV="${NV_X11}/modules/drivers"
214 NV_X11_EXT="${NV_X11}/modules/extensions"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100215 NV_SOVER=${PV}
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200216 else
217 die "Could not determine proper NVIDIA package"
218 fi
219}
220
221src_unpack() {
222 if use kernel_linux && kernel_is lt 2 6 7; then
223 echo
224 ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
225 ewarn "This is not officially supported for ${P}. It is likely you"
226 ewarn "will not be able to compile or use the kernel module."
227 ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
228 echo
229 ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
230 fi
231
232 if ! use x86-fbsd; then
233 mkdir "${S}"
234 cd "${S}"
235 unpack_makeself
236 else
237 unpack ${A}
238 fi
3b17321e Fabian Fingerle2009-10-28 23:35:46 +0100239}
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200240
3b17321e
FF
Fabian Fingerle2009-10-28 23:35:46 +0100241src_prepare() {
242 # Please add a brief description for every added patch
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200243 use x86-fbsd && cd doc
244
245 # Use the correct defines to make gtkglext build work
246 epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
247 # Use some more sensible gl headers and make way for new glext.h
248 epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
249
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100250 # Adjust detection of linux kernel
251 epatch "${FILESDIR}"/NVIDIA_arch.patch
252
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200253 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
268src_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
282src_install() {
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200283 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
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100293 [ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200294 sed -e 's:PACKAGE:'${PF}':g' \
295 -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
296 "${WORKDIR}"/nvidia
297 insinto /etc/modprobe.d
9ea57b3d Fabian Fingerle2009-07-30 06:32:14 +0200298 newins "${WORKDIR}"/nvidia nvidia.conf || die
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200299 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
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100307 # 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
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100313 doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100314
315 # Xorg GLX driver
316 insinto /usr/$(get_libdir)/opengl/nvidia/extensions
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100317 doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100318 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 use kernel_linux; then
333 dodir /usr/include/cuda
334 insinto /usr/include/cuda
335 doins usr/include/cuda/*.h || die "failed to install cuda headers"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200336 fi
337
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100338 # 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
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200344
345 # Documentation
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100346 dodoc ${NV_DOC}/XF86Config.sample
347 dohtml ${NV_DOC}/html/*
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200348 if use x86-fbsd; then
349 dodoc "${NV_DOC}/README"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100350 doman "${NV_MAN}/nvidia-xconfig.1"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200351 else
352 # Docs
353 newdoc "${NV_DOC}/README.txt" README
354 dodoc "${NV_DOC}/NVIDIA_Changelog"
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200355 doman "${NV_MAN}/nvidia-smi.1.gz"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100356 doman "${NV_MAN}/nvidia-xconfig.1.gz"
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200357 fi
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200358
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200359 # Helper Apps
360 dobin ${NV_EXEC}/nvidia-xconfig || die
361 dobin ${NV_EXEC}/nvidia-bug-report.sh || die
d15d34fb
FF
Fabian Fingerle2009-09-30 23:34:21 +0200362 if use kernel_linux; then
363 dobin ${NV_EXEC}/nvidia-smi || die
364 fi
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100365
366 if has_multilib_profile ; then
367 local OABI=${ABI}
368 for ABI in $(get_install_abis) ; do
369 src_install-libs
370 done
371 ABI=${OABI}
372 unset OABI
373 else
374 src_install-libs
375 fi
376
377 is_final_abi || die "failed to iterate through all ABIs"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200378}
379
380# Install nvidia library:
381# the first parameter is the place where to install it
382# the second parameter is the base name of the library
383# the third parameter is the provided soversion
384donvidia() {
385 dodir $1
386 exeinto $1
387
388 libname=$(basename $2)
389
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100390 doexe $2.$3 || die "failed to install $2"
391 dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
392 [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200393}
394
395src_install-libs() {
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200396 local inslibdir=$(get_libdir)
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200397 local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100398 local libdir= sover=
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200399
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100400 if use kernel_linux; then
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100401 if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
402 libdir=usr/lib32
403 else
404 libdir=usr/lib
405 fi
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100406 sover=${PV}
407 else
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100408 libdir=obj
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200409 # on FreeBSD it has just .1 suffix
410 sover=1
411 fi
412
413 # The GLX libraries
89cdcc2e
FF
Fabian Fingerle2009-11-01 08:48:17 +0100414 donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
415 donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100416 if use x86-fbsd; then
417 donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
418 else
419 donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200420 fi
421
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200422 #cuda
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100423 if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
424 dolib.so ${libdir}/libcuda.so.${sover}
425 [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100426 dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200427 fi
428
429 #vdpau
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100430 if [[ -f ${libdir}/vdpau/libvdpau_nvidia.so.${sover} ]]; then
431 dolib.so ${libdir}/vdpau/libvdpau_nvidia.so.${sover}
432 dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
b94fa29f Fabian Fingerle2009-07-13 16:38:38 +0200433 fi
d15d34fb
FF
Fabian Fingerle2009-09-30 23:34:21 +0200434
435 # OpenCL
436 # NOTE: This isn't currently available in the publicly released drivers.
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100437 if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
d15d34fb Fabian Fingerle2009-09-30 23:34:21 +0200438
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100439 dolib.so ${libdir}/libOpenCL.so.1.0.0
d15d34fb
FF
Fabian Fingerle2009-09-30 23:34:21 +0200440 dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
441 dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
442 fi
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200443}
444
445pkg_preinst() {
a1ac88c4
FF
Fabian Fingerle2009-11-30 16:16:45 +0100446 if use kernel_linux; then
447 linux-mod_pkg_postinst
448 fi
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200449
450 # Clean the dynamic libGL stuff's home to ensure
451 # we dont have stale libs floating around
452 if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
453 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
454 fi
455 # Make sure we nuke the old nvidia-glx's env.d file
456 if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
457 rm -f "${ROOT}"/etc/env.d/09nvidia
458 fi
459}
460
461pkg_postinst() {
462 if use kernel_linux; then
463 linux-mod_pkg_postinst
464 fi
465
466 # Switch to the nvidia implementation
467 eselect opengl set --use-old nvidia
468
469 echo
470 elog "You must be in the video group to use the NVIDIA device"
471 elog "For more info, read the docs at"
472 elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
473 elog
474
475 elog "This ebuild installs a kernel module and X driver. Both must"
476 elog "match explicitly in their version. This means, if you restart"
a1ac88c4 Fabian Fingerle2009-11-30 16:16:45 +0100477 elog "X, you must modprobe -r nvidia before starting it back up"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200478 elog
479
480 elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
481 elog
89cdcc2e Fabian Fingerle2009-11-01 08:48:17 +0100482 elog "NVIDIA has requested that any bug reports submitted have the"
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200483 elog "output of /usr/bin/nvidia-bug-report.sh included."
484 elog
485 elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
486 elog
487 elog "If you are having resolution problems, try disabling DynamicTwinView."
488 echo
489}
490
b94fa29f
FF
Fabian Fingerle2009-07-13 16:38:38 +0200491pkg_postrm() {
492 if use kernel_linux; then
493 linux-mod_pkg_postrm
494 fi
495 eselect opengl set --use-old xorg-x11
496}