/[gentoo-alt]/trunk/overlay/media-video/nvidia-glx/nvidia-glx-1.0.7676-r1.ebuild
Gentoo

Contents of /trunk/overlay/media-video/nvidia-glx/nvidia-glx-1.0.7676-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 851 - (show annotations) (download)
Fri Oct 28 09:05:53 2005 UTC (9 years, 1 month ago) by flameeyes
File size: 9205 byte(s)
Updated to 7676 and merged with latest changes for original ebuild, need a bit more testing.
1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-glx/nvidia-glx-1.0.7676-r1.ebuild,v 1.4 2005/09/05 23:18:42 eradicator Exp $
4
5 inherit eutils multilib versionator
6
7 X86_PKG_V="pkg0"
8 AMD64_PKG_V="pkg2"
9 NV_V="${PV/1.0./1.0-}"
10 X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
11 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
12 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${NV_V}"
13
14 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
15 HOMEPAGE="http://www.nvidia.com/"
16 SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run )
17 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run )
18 x86-fbsd? ( http://download.nvidia.com/freebsd/${NV_V}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
19
20 LICENSE="NVIDIA"
21 SLOT="0"
22
23 KEYWORDS="-* ~amd64 ~x86"
24
25 RESTRICT="nostrip multilib-pkg-force"
26 IUSE="dlloader"
27
28 RDEPEND="|| ( virtual/x11 >=x11-base/xorg-server-0.99.1-r7 )
29 || ( virtual/x11 media-libs/mesa )
30 app-admin/eselect-opengl
31 kernel_linux? ( ~media-video/nvidia-kernel-${PV} )
32 !app-emulation/emul-linux-x86-nvidia"
33 # This should be added to have full dependencies for Gentoo FreeBSD
34 # but can't be added until the profiles are in main portage (for repoman)
35 # kernel_FreeBSD? ( ~media-video/nvidia-freebsd-${PV} )
36
37 PROVIDE="virtual/opengl"
38 export _POSIX2_VERSION="199209"
39
40 if use x86; then
41 PKG_V="-${X86_PKG_V}"
42 NV_PACKAGE="${X86_NV_PACKAGE}"
43 elif use amd64; then
44 PKG_V="-${AMD64_PKG_V}"
45 NV_PACKAGE="${AMD64_NV_PACKAGE}"
46 elif use x86-fbsd; then
47 PKG_V=""
48 NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
49 fi
50
51 S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
52
53 # On BSD userland it wants real make command
54 MAKE="make"
55
56 check_xfree() {
57 # This isn't necessary, true. But its about time people got the idea.
58 if has_version "x11-base/xfree"; then
59 eerror "Support for x11-base/xfree is deprecated. Upgrade to x11-base/xorg-x11."
60 fi
61 }
62
63 pkg_setup() {
64 check_xfree
65
66 if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
67 eerror "This ebuild doesn't currently support changing your defualt abi."
68 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
69 fi
70 }
71
72 src_unpack() {
73 local NV_PATCH_PREFIX="${FILESDIR}/${PV}/NVIDIA_glx-${PV}"
74
75 if ! use x86-fbsd; then
76 cd ${WORKDIR}
77 bash ${DISTDIR}/${NV_PACKAGE}${PKG_V}.run --extract-only
78 else
79 unpack ${A}
80 fi
81
82 # Patchs go below here, add breif description
83 cd ${S}
84 if ! use x86-fbsd; then
85 # nVidia wants us to use nvidia-installer, removing warning.
86 epatch ${NV_PATCH_PREFIX//$(get_version_component_range 3)/6629}-makefile.patch
87 else
88 cd ${S}/doc
89 fi
90 # Use the correct defines to make gtkglext build work
91 epatch ${NV_PATCH_PREFIX//$(get_version_component_range 3)/6629}-defines.patch
92 # Use some more sensible gl headers and make way for new glext.h
93 epatch ${NV_PATCH_PREFIX//$(get_version_component_range 3)/6629}-glheader.patch
94
95 # Closing bug #37517 by letting virtual/x11 provide system wide glext.h
96 # 16 July 2004, opengl-update is now supplying glext.h for system wide
97 # compatibility, so we still need to remove this.
98 # 7 November 2004, Keeping this around for 6629 to see what happens.
99 #rm -f usr/include/GL/glext.h
100 }
101
102 src_install() {
103 local MLTEST=$(type dyn_unpack)
104
105 if [[ "${MLTEST/set_abi}" == "${MLTEST}" ]] && has_multilib_profile ; then
106 local OABI=${ABI}
107 for ABI in $(get_install_abis) ; do
108 src_install-libs
109 done
110 ABI=${OABI}
111 unset OABI
112 elif use amd64 ; then
113 src_install-libs lib32 $(get_multilibdir)
114 src_install-libs lib $(get_libdir)
115
116 rm -rf ${D}/usr/$(get_multilibdir)/opengl/nvidia/include
117 rm -rf ${D}/usr/$(get_multilibdir)/opengl/nvidia/extensions
118 else
119 src_install-libs
120 fi
121
122 is_final_abi || return 0
123
124 if ! use x86-fbsd; then
125 # Docs, remove nvidia-settings as provided by media-video/nvidia-settings
126 rm -f usr/share/doc/nvidia-settings*
127 dodoc usr/share/doc/*
128 else
129 dodoc doc/README doc/README.Linux doc/XF86Config.sample
130 fi
131
132 # nVidia want bug reports using this script
133 exeinto /usr/bin
134 doexe usr/bin/nvidia-bug-report.sh
135 }
136
137 # Install nvidia library:
138 # the first parameter is the place where to install it
139 # the second paramis the base name of the library
140 # the third parameter is the provided soversion
141 donvidia() {
142 dodir $1
143 exeinto $1
144
145 libname=$(basename $2)
146
147 doexe $2.$3
148 dosym ${libname}.$3 $1/${libname}
149
150 [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
151 }
152
153 src_install-libs() {
154 local pkglibdir=lib
155 local inslibdir=$(get_libdir)
156
157 if [[ ${#} -eq 2 ]] ; then
158 pkglibdir=${1}
159 inslibdir=${2}
160 elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
161 pkglibdir=lib32
162 fi
163
164 local usrpkglibdir=usr/${pkglibdir}
165 local libdir=usr/X11R6/${pkglibdir}
166 local drvdir=${libdir}/modules/drivers
167 local extdir=${libdir}/modules/extensions
168 local incdir=usr/include/GL
169 local sover=${PV}
170 local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
171 local NO_TLS_ROOT="${NV_ROOT}/no-tls"
172 local TLS_ROOT="${NV_ROOT}/tls"
173 local X11_LIB_DIR="/usr/${inslibdir}/xorg"
174
175 if use x86-fbsd; then
176 # on FreeBSD everything is on obj/
177 pkglibdir=obj
178 usrpkglibdir=obj
179 x11pkglibdir=obj
180 drvdir=obj
181 extdir=obj
182
183 # don't ask me why the headers are there.. glxext.h is missing
184 incdir=doc
185
186 # on FreeBSD it has just .1 suffix
187 sover=1
188 fi
189
190 # The GLX libraries
191 donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover}
192 donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover}
193
194 dodir ${NO_TLS_ROOT}
195 donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover}
196
197 if ! use x86-fbsd; then
198 donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover}
199 fi
200
201 if want_tls ; then
202 dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib
203 dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
204 dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
205 else
206 dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib
207 dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
208 dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
209 fi
210
211 if ! use x86-fbsd; then
212 # Not sure whether installing the .la file is neccessary;
213 # this is adopted from the `nvidia' ebuild
214 local ver1=$(get_version_component_range 1)
215 local ver2=$(get_version_component_range 2)
216 local ver3=$(get_version_component_range 3)
217 sed -e "s:\${PV}:${PV}:" \
218 -e "s:\${ver1}:${ver1}:" \
219 -e "s:\${ver2}:${ver2}:" \
220 -e "s:\${ver3}:${ver3}:" \
221 -e "s:\${libdir}:${inslibdir}:" \
222 ${FILESDIR}/libGL.la-r2 > ${D}/${NV_ROOT}/lib/libGL.la
223 fi
224
225 exeinto ${X11_LIB_DIR}/modules/drivers
226
227 if use dlloader; then
228 [[ -f ${drvdir}/nvidia_drv.so ]] && \
229 doexe ${drvdir}/nvidia_drv.so
230 else
231 [[ -f ${drvdir}/nvidia_drv.o ]] && \
232 doexe ${drvdir}/nvidia_drv.o
233 fi
234
235 insinto ${X11_LIB_DIR}
236 [[ -f ${libdir}/libXvMCNVIDIA.a ]] && \
237 doins ${libdir}/libXvMCNVIDIA.a
238 exeinto ${X11_LIB_DIR}
239 [[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \
240 doexe ${libdir}/libXvMCNVIDIA.so.${PV}
241
242 exeinto ${NV_ROOT}/extensions
243 [[ -f ${extdir}/libglx.so.${sover} ]] && \
244 newexe ${extdir}/libglx.so.${sover} libglx.so
245
246 # Includes
247 insinto ${NV_ROOT}/include
248 doins ${incdir}/*.h
249 }
250
251 pkg_preinst() {
252 if ! has_version x11-base/xorg-server ; then
253 for dir in lib lib32 lib64 ; do
254 if [[ -d ${D}/usr/${dir}/xorg ]] ; then
255 mv ${D}/usr/${dir}/xorg/* ${D}/usr/${dir}
256 rmdir ${D}/usr/${dir}/xorg
257 fi
258 done
259 fi
260
261 # The X module
262 # Since we moved away from libs in /usr/X11R6 need to check this
263 if has_version "<x11-base/xorg-x11-6.8.0-r4" || \
264 has_version "x11-base/xfree86" ; then
265 mkdir -p ${D}/usr/X11R6
266 for dir in lib lib32 lib64 ; do
267 [[ -d ${D}/usr/${dir} ]] && mv ${D}/usr/${dir} ${D}/usr/X11R6
268 done
269 fi
270
271
272 # Clean the dinamic libGL stuff's home to ensure
273 # we dont have stale libs floating around
274 if [[ -d ${ROOT}/usr/lib/opengl/nvidia ]] ; then
275 rm -rf ${ROOT}/usr/lib/opengl/nvidia/*
276 fi
277 # Make sure we nuke the old nvidia-glx's env.d file
278 if [[ -e ${ROOT}/etc/env.d/09nvidia ]] ; then
279 rm -f ${ROOT}/etc/env.d/09nvidia
280 fi
281 }
282
283 pkg_postinst() {
284 #switch to the nvidia implementation
285 eselect opengl set --use-old nvidia
286
287 echo
288 einfo "To use the Nvidia GLX, run \"eselect opengl set nvidia\""
289 echo
290 einfo "You may also be interested in media-video/nvidia-settings"
291 echo
292 einfo "nVidia have requested that any bug reports submitted have the"
293 einfo "output of /usr/bin/nvidia-bug-report.sh included."
294 }
295
296 want_tls() {
297 # For uclibc or anything non glibc, return false
298 has_version sys-libs/glibc || return 1
299
300 # Old versions of glibc were lt/no-tls only
301 has_version '<sys-libs/glibc-2.3.2' && return 1
302
303 local valid_chost="true"
304 if use x86 ; then
305 case ${CHOST/-*} in
306 i486|i586|i686) ;;
307 *) valid_chost="false"
308 esac
309 fi
310
311 [[ ${valid_chost} == "false" ]] && return 1
312
313 # If we've got nptl, we've got tls
314 built_with_use sys-libs/glibc nptl && return 0
315
316 # 2.3.5 turned off tls for linuxthreads glibc on i486 and i586
317 if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then
318 case ${CHOST/-*} in
319 i486|i586) return 1 ;;
320 esac
321 fi
322
323 # These versions built linuxthreads version to support tls, too
324 has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0
325
326 return 1
327 }
328
329 pkg_postrm() {
330 eselect opengl set --use-old xorg-x11
331 }

  ViewVC Help
Powered by ViewVC 1.1.20