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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Mon Nov 12 16:25:58 2007 UTC (10 years, 3 months ago) by welp
Branch: MAIN
Changes since 1.7: +2 -2 lines
Stable on amd64 wrt bug 186490
(Portage version: 2.1.3.16)

1 # Copyright 1999-2007 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-100.14.19.ebuild,v 1.7 2007/10/29 19:19:03 jokey Exp $
4
5 inherit eutils multilib versionator linux-mod flag-o-matic nvidia-driver
6
7 X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
8 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
9 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
10
11 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
12 HOMEPAGE="http://www.nvidia.com/"
13 SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
14 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
15 x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
16
17 LICENSE="NVIDIA"
18 SLOT="0"
19 KEYWORDS="-* amd64 x86 ~x86-fbsd"
20 IUSE="acpi gtk multilib"
21 RESTRICT="strip"
22 EMULTILIB_PKG="true"
23
24 COMMON="x11-base/xorg-server
25 multilib? ( app-emulation/emul-linux-x86-xlibs )
26 kernel_FreeBSD? ( !media-video/nvidia-freebsd )
27 !app-emulation/emul-linux-x86-nvidia
28 !x11-drivers/nvidia-legacy-drivers"
29 DEPEND="${COMMON}
30 kernel_linux? ( virtual/linux-sources )
31 app-admin/eselect-opengl"
32 RDEPEND="${COMMON}
33 kernel_linux? ( virtual/modutils )
34 media-libs/mesa
35 acpi? ( sys-power/acpid )"
36 PDEPEND="gtk? ( media-video/nvidia-settings )"
37
38 QA_TEXTRELS_x86="usr/lib/xorg/libXvMCNVIDIA.so.${PV}
39 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
40 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
41 usr/lib/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
42 usr/lib/opengl/nvidia/tls/libnvidia-tls.so.${PV}
43 usr/lib/opengl/nvidia/no-tls/libnvidia-tls.so.${PV}
44 usr/lib/libXvMCNVIDIA.so.${PV}
45 usr/lib/xorg/modules/drivers/nvidia_drv.so
46 usr/lib/opengl/nvidia/extensions/libglx.so"
47
48 QA_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
51 usr/lib/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
52 usr/lib/opengl/nvidia/no-tls/libnvidia-tls.so.1
53 usr/lib/opengl/nvidia/extensions/libglx.so
54 usr/lib/xorg/modules/drivers/nvidia_drv.so"
55
56 QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
57 usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
58 usr/lib/opengl/nvidia/extensions/libglx.so"
59
60 QA_TEXTRELS_amd64="usr/lib64/xorg/libXvMCNVIDIA.so.${PV}
61 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
62 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
63 usr/lib64/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
64 usr/lib64/opengl/nvidia/tls/libnvidia-tls.so.${PV}
65 usr/lib64/opengl/nvidia/no-tls/libnvidia-tls.so.${PV}
66 usr/lib64/libXvMCNVIDIA.so.${PV}
67 usr/lib64/xorg/modules/drivers/nvidia_drv.so
68 usr/lib64/opengl/nvidia/extensions/libglx.so
69 usr/lib32/xorg/libXvMCNVIDIA.so.${PV}
70 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
71 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
72 usr/lib32/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
73 usr/lib32/opengl/nvidia/tls/libnvidia-tls.so.${PV}
74 usr/lib32/opengl/nvidia/no-tls/libnvidia-tls.so.${PV}
75 usr/lib32/libXvMCNVIDIA.so.${PV}
76 usr/lib32/xorg/modules/drivers/nvidia_drv.so
77 usr/lib32/opengl/nvidia/extensions/libglx.so"
78
79 QA_WX_LOAD_amd64="usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
80 usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
81 usr/lib64/opengl/nvidia/extensions/libglx.so
82 usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
83 usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
84 usr/lib32/opengl/nvidia/extensions/libglx.so"
85
86 QA_EXECSTACK_amd64="usr/lib64/xorg/modules/drivers/nvidia_drv.so
87 usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
88 usr/lib64/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
89 usr/lib64/opengl/nvidia/extensions/libglx.so
90 usr/lib64/libXvMCNVIDIA.so.${PV}
91 usr/bin/nvidia-xconfig"
92
93 QA_EXECSTACK_x86="usr/lib/xorg/modules/drivers/nvidia_drv.so
94 usr/lib/opengl/nvidia/lib/libGL.so.${PV}
95 usr/lib/opengl/nvidia/lib/libnvidia-cfg.so.${PV}
96 usr/lib/opengl/nvidia/extensions/libglx.so
97 usr/lib/libXvMCNVIDIA.so.${PV}
98 usr/bin/nvidia-xconfig"
99
100 export _POSIX2_VERSION="199209"
101
102 if use x86; then
103 PKG_V="-pkg0"
104 NV_PACKAGE="${X86_NV_PACKAGE}"
105 elif use amd64; then
106 PKG_V="-pkg2"
107 NV_PACKAGE="${AMD64_NV_PACKAGE}"
108 elif use x86-fbsd; then
109 PKG_V=""
110 NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
111 fi
112
113 S="${WORKDIR}/${NV_PACKAGE}${PKG_V}/usr/src/nv"
114
115 # On BSD userland it wants real make command
116 MAKE="make"
117
118 mtrr_check() {
119 ebegin "Checking for MTRR support"
120 linux_chkconfig_present MTRR
121 eend $?
122
123 if [[ $? -ne 0 ]] ; then
124 eerror "This version needs MTRR support for most chipsets!"
125 eerror "Please enable MTRR support in your kernel config, found at:"
126 eerror
127 eerror " Processor type and features"
128 eerror " [*] MTRR (Memory Type Range Register) support"
129 eerror
130 eerror "and recompile your kernel ..."
131 die "MTRR support not detected!"
132 fi
133 }
134
135 pkg_setup() {
136 if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
137 eerror "This ebuild doesn't currently support changing your default abi."
138 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
139 fi
140
141 if ! use x86-fbsd; then
142 linux-mod_pkg_setup
143 MODULE_NAMES="nvidia(video:${S})"
144 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
145 mtrr_check
146 fi
147
148 # Since Nvidia ships 3 different series of drivers, we need to give the user
149 # some kind of guidance as to what version they should install. This tries
150 # to point the user in the right direction but can't be perfect. check
151 # nvidia-driver.eclass
152 nvidia-driver-check-warning
153 }
154
155 src_unpack() {
156 local NV_PATCH_PREFIX="${FILESDIR}/${PV}/NVIDIA-${PV}"
157
158 if ! use x86-fbsd; then
159 if [[ ${KV_MINOR} -eq 6 && ${KV_PATCH} -lt 7 ]] ; then
160 echo
161 ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
162 ewarn "This is not officially supported for ${P}. It is likely you"
163 ewarn "will not be able to compile or use the kernel module."
164 ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
165 echo
166 ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
167 fi
168 fi
169
170 if ! use x86-fbsd; then
171 cd "${WORKDIR}"
172 bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only
173 else
174 unpack ${A}
175 fi
176
177 # Patches go below here, add brief description
178 use x86-fbsd \
179 && cd "${WORKDIR}/${NV_PACKAGE}${PKG_V}/doc" \
180 || cd "${WORKDIR}/${NV_PACKAGE}${PKG_V}"
181 # Use the correct defines to make gtkglext build work
182 epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
183 # Use some more sensible gl headers and make way for new glext.h
184 epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
185 # allow on board sensors to work with lm_sensors
186 epatch "${FILESDIR}"/NVIDIA_i2c-hwmon.patch
187
188 if ! use x86-fbsd; then
189 # Quiet down warnings the user does not need to see
190 sed -i \
191 -e 's:-Wpointer-arith::g' \
192 -e 's:-Wsign-compare::g' \
193 "${S}"/Makefile.kbuild
194
195 # If you set this then it's your own fault when stuff breaks :)
196 [[ -n ${USE_CRAZY_OPTS} ]] && sed -i "s:-O:${CFLAGS}:" Makefile.*
197
198 # If greater than 2.6.5 use M= instead of SUBDIR=
199 cd "${S}"; convert_to_m Makefile.kbuild
200 fi
201 }
202
203 src_compile() {
204 # This is already the default on Linux, as there's no toplevel Makefile, but
205 # on FreeBSD there's one and triggers the kernel module build, as we install
206 # it by itself, pass this.
207 if use x86-fbsd; then
208 cd "${WORKDIR}/${NV_PACKAGE}${PKG_V}/src"
209 echo LDFLAGS="$(raw-ldflags)"
210 MAKE="$(get_bmake)" emake CC="$(tc-getCC)" LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
211 else
212 linux-mod_src_compile
213 fi
214 }
215
216 src_install() {
217 local MLTEST=$(type dyn_unpack)
218
219 cd "${WORKDIR}"/${NV_PACKAGE}${PKG_V}
220
221 if ! use x86-fbsd; then
222 linux-mod_src_install
223
224 VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
225 if [ -z "$VIDEOGROUP" ]; then
226 eerror "Failed to determine the video group gid."
227 die "Failed to determine the video group gid."
228 fi
229
230 # Add the aliases
231 [ -f "${FILESDIR}/nvidia" ] || die "nvidia missing in FILESDIR"
232 sed -e 's:PACKAGE:'${PF}':g' \
233 -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia > \
234 "${WORKDIR}"/nvidia
235 insinto /etc/modules.d
236 doins "${WORKDIR}"/nvidia || die
237 else
238 insinto /boot/modules
239 doins "${WORKDIR}/${X86_FBSD_NV_PACKAGE}/src/nvidia.kld" || die
240
241 exeinto /boot/modules
242 doexe "${WORKDIR}/${X86_FBSD_NV_PACKAGE}/src/nvidia.ko" || die
243 fi
244
245 if [[ "${MLTEST/set_abi}" == "${MLTEST}" ]] && has_multilib_profile ; then
246 local OABI=${ABI}
247 for ABI in $(get_install_abis) ; do
248 src_install-libs
249 done
250 ABI=${OABI}
251 unset OABI
252 elif use amd64 ; then
253 src_install-libs lib32 $(get_multilibdir)
254 src_install-libs lib $(get_libdir)
255
256 rm -rf "${D}"/usr/$(get_multilibdir)/opengl/nvidia/include
257 rm -rf "${D}"/usr/$(get_multilibdir)/opengl/nvidia/extensions
258 else
259 src_install-libs
260 fi
261
262 is_final_abi || return 0
263
264 if ! use x86-fbsd; then
265 # Docs
266 newdoc usr/share/doc/README.txt README
267 dodoc usr/share/doc/Copyrights usr/share/doc/NVIDIA_Changelog
268 dodoc usr/share/doc/XF86Config.sample
269 dohtml usr/share/doc/html/*
270
271 # nVidia want bug reports using this script
272 dobin usr/bin/nvidia-bug-report.sh || die
273 else
274 dodoc doc/{README,XF86Config.sample,Copyrights}
275 dohtml doc/html/*
276 fi
277
278 # Taking nvidia-xconfig from nvidia-drivers to help config xorg.conf
279 dobin usr/bin/nvidia-xconfig || die
280 }
281
282 # Install nvidia library:
283 # the first parameter is the place where to install it
284 # the second parameter is the base name of the library
285 # the third parameter is the provided soversion
286 donvidia() {
287 dodir $1
288 exeinto $1
289
290 libname=$(basename $2)
291
292 doexe $2.$3
293 dosym ${libname}.$3 $1/${libname}
294
295 [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
296 }
297
298 src_install-libs() {
299 local pkglibdir=lib
300 local inslibdir=$(get_libdir)
301
302 if [[ ${#} -eq 2 ]] ; then
303 pkglibdir=${1}
304 inslibdir=${2}
305 elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
306 pkglibdir=lib32
307 fi
308
309 local usrpkglibdir=usr/${pkglibdir}
310 local libdir=usr/X11R6/${pkglibdir}
311 local drvdir=${libdir}/modules/drivers
312 local extdir=${libdir}/modules/extensions
313 local incdir=usr/include/GL
314 local sover=${PV}
315 local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
316 local NO_TLS_ROOT="${NV_ROOT}/no-tls"
317 local TLS_ROOT="${NV_ROOT}/tls"
318 local X11_LIB_DIR="/usr/${inslibdir}/xorg"
319
320 if ! has_version x11-base/xorg-server ; then
321 X11_LIB_DIR="/usr/${inslibdir}"
322 fi
323
324 if use x86-fbsd; then
325 # on FreeBSD everything is on obj/
326 pkglibdir=obj
327 usrpkglibdir=obj
328 x11pkglibdir=obj
329 drvdir=obj
330 extdir=obj
331
332 # don't ask me why the headers are there.. glxext.h is missing
333 incdir=doc
334
335 # on FreeBSD it has just .1 suffix
336 sover=1
337 fi
338
339 # The GLX libraries
340 donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover}
341 donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover}
342
343 donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover}
344
345 dodir ${NO_TLS_ROOT}
346 donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover}
347
348 if ! use x86-fbsd; then
349 donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover}
350 fi
351
352 if want_tls ; then
353 dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib
354 dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
355 dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
356 else
357 dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib
358 dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
359 dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
360 fi
361
362 if ! use x86-fbsd; then
363 # Install the .la file for libtool, to prevent e.g. bug #176423
364 [ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR"
365 local ver1=$(get_version_component_range 1)
366 local ver2=$(get_version_component_range 2)
367 local ver3=$(get_version_component_range 3)
368 sed -e "s:\${PV}:${PV}:" \
369 -e "s:\${ver1}:${ver1}:" \
370 -e "s:\${ver2}:${ver2}:" \
371 -e "s:\${ver3}:${ver3}:" \
372 -e "s:\${libdir}:${inslibdir}:" \
373 "${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la
374 fi
375
376 exeinto ${X11_LIB_DIR}/modules/drivers
377
378 [[ -f ${drvdir}/nvidia_drv.so ]] && \
379 doexe ${drvdir}/nvidia_drv.so
380
381 insinto /usr/${inslibdir}
382 [[ -f ${libdir}/libXvMCNVIDIA.a ]] && \
383 doins ${libdir}/libXvMCNVIDIA.a
384 exeinto /usr/${inslibdir}
385 # fix Bug 131315
386 [[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \
387 doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \
388 dosym libXvMCNVIDIA.so.${PV} \
389 /usr/${inslibdir}/libXvMCNVIDIA.so
390
391 exeinto ${NV_ROOT}/extensions
392 [[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \
393 newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so
394 [[ -f ${extdir}/libglx.so.${sover} ]] && \
395 newexe ${extdir}/libglx.so.${sover} libglx.so
396
397 # Includes
398 insinto ${NV_ROOT}/include
399 doins ${incdir}/*.h
400 }
401
402 pkg_preinst() {
403 # Can we make up our minds ?!?!?
404 local NV_D=${D}
405
406 if ! has_version x11-base/xorg-server ; then
407 for dir in lib lib32 lib64 ; do
408 if [[ -d ${NV_D}/usr/${dir}/xorg ]] ; then
409 mv ${NV_D}/usr/${dir}/xorg/* ${NV_D}/usr/${dir}
410 rmdir ${NV_D}/usr/${dir}/xorg
411 fi
412 done
413 fi
414
415 # Clean the dynamic libGL stuff's home to ensure
416 # we dont have stale libs floating around
417 if [[ -d ${ROOT}/usr/lib/opengl/nvidia ]] ; then
418 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
419 fi
420 # Make sure we nuke the old nvidia-glx's env.d file
421 if [[ -e ${ROOT}/etc/env.d/09nvidia ]] ; then
422 rm -f "${ROOT}"/etc/env.d/09nvidia
423 fi
424 }
425
426 pkg_postinst() {
427 if ! use x86-fbsd; then
428 linux-mod_pkg_postinst
429 fi
430
431 # Switch to the nvidia implementation
432 eselect opengl set --use-old nvidia
433
434 echo
435 elog "To use the Nvidia GLX, run \"eselect opengl set nvidia\""
436 elog
437 elog "nVidia has requested that any bug reports submitted have the"
438 elog "output of /usr/bin/nvidia-bug-report.sh included."
439 elog
440 elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
441 elog
442 elog "If you are having resolution problems, try disabling DynamicTwinView."
443 echo
444 }
445
446 want_tls() {
447 # For uclibc or anything non glibc, return false
448 has_version sys-libs/glibc || return 1
449
450 # Old versions of glibc were lt/no-tls only
451 has_version '<sys-libs/glibc-2.3.2' && return 1
452
453 local valid_chost="true"
454 if use x86 ; then
455 case ${CHOST/-*} in
456 i486|i586|i686) ;;
457 *) valid_chost="false"
458 esac
459 fi
460
461 [[ ${valid_chost} == "false" ]] && return 1
462
463 # If we've got nptl, we've got tls
464 built_with_use --missing true sys-libs/glibc nptl && return 0
465
466 # 2.3.5 turned off tls for linuxthreads glibc on i486 and i586
467 if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then
468 case ${CHOST/-*} in
469 i486|i586) return 1 ;;
470 esac
471 fi
472
473 # These versions built linuxthreads version to support tls, too
474 has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0
475
476 return 1
477 }
478
479 pkg_postrm() {
480 if ! use x86-fbsd; then
481 linux-mod_pkg_postrm
482 fi
483 eselect opengl set --use-old xorg-x11
484 }

  ViewVC Help
Powered by ViewVC 1.1.20