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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Wed Feb 7 12:31:42 2007 UTC (7 years, 5 months ago) by wolf31o2
Branch: MAIN
Changes since 1.5: +5 -5 lines
Fixed the executable stack warnings with a patch from Vlastimil Babka <caster@gentoo.org> and closing bug #114894.
(Portage version: 2.1.2-r6)

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

  ViewVC Help
Powered by ViewVC 1.1.20