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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sun Nov 18 11:18:17 2012 UTC (17 months ago) by ago
Branch: MAIN
Changes since 1.2: +2 -2 lines
stable on amd64 and x86

(Portage version: 2.1.11.31/cvs/Linux x86_64, unsigned Manifest commit)

1 # Copyright 1999-2012 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-304.60.ebuild,v 1.2 2012/11/13 15:53:10 cardoe Exp $
4
5 EAPI=4
6
7 inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
8 portability toolchain-funcs unpacker user versionator
9
10 X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
11 AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
12 X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
13 AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
14
15 DESCRIPTION="NVIDIA X11 driver and GLX libraries"
16 HOMEPAGE="http://www.nvidia.com/"
17 SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
18 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
19 amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
20 x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
21
22 LICENSE="NVIDIA"
23 SLOT="0"
24 KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
25 IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X"
26 RESTRICT="strip"
27 EMULTILIB_PKG="true"
28
29 COMMON="app-admin/eselect-opencl
30 kernel_linux? ( >=sys-libs/glibc-2.6.1 )
31 multilib? ( app-emulation/emul-linux-x86-xlibs )
32 X? (
33 <x11-base/xorg-server-1.13.99
34 >=app-admin/eselect-opengl-1.0.9
35 )"
36 DEPEND="${COMMON}
37 kernel_linux? (
38 virtual/linux-sources
39 virtual/pkgconfig
40 )"
41 RDEPEND="${COMMON}
42 acpi? ( sys-power/acpid )
43 tools? (
44 dev-libs/atk
45 dev-libs/glib
46 x11-libs/gdk-pixbuf
47 x11-libs/gtk+:2
48 x11-libs/libX11
49 x11-libs/libXext
50 x11-libs/pango[X]
51 )
52 X? ( x11-libs/libXvMC )"
53 PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
54
55 REQUIRED_USE="tools? ( X )"
56
57 QA_PREBUILT="opt/* usr/lib*"
58
59 S=${WORKDIR}/
60
61 pkg_pretend() {
62
63 if use amd64 && has_multilib_profile && \
64 [ "${DEFAULT_ABI}" != "amd64" ]; then
65 eerror "This ebuild doesn't currently support changing your default ABI"
66 die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
67 fi
68
69 # Kernel features/options to check for
70 CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
71 use x86 && CONFIG_CHECK+=" ~HIGHMEM"
72
73 # Now do the above checks
74 use kernel_linux && check_extra_config
75 }
76
77 pkg_setup() {
78 # try to turn off distcc and ccache for people that have a problem with it
79 export DISTCC_DISABLE=1
80 export CCACHE_DISABLE=1
81
82 if use kernel_linux; then
83 linux-mod_pkg_setup
84 MODULE_NAMES="nvidia(video:${S}/kernel)"
85 BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
86 SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
87 # linux-mod_src_compile calls set_arch_to_kernel, which
88 # sets the ARCH to x86 but NVIDIA's wrapping Makefile
89 # expects x86_64 or i386 and then converts it to x86
90 # later on in the build process
91 BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
92 fi
93
94 # Since Nvidia ships 3 different series of drivers, we need to give the user
95 # some kind of guidance as to what version they should install. This tries
96 # to point the user in the right direction but can't be perfect. check
97 # nvidia-driver.eclass
98 nvidia-driver-check-warning
99
100 # set variables to where files are in the package structure
101 if use kernel_FreeBSD; then
102 use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
103 use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
104 NV_DOC="${S}/doc"
105 NV_OBJ="${S}/obj"
106 NV_SRC="${S}/src"
107 NV_MAN="${S}/x11/man"
108 NV_X11="${S}/obj"
109 NV_SOVER=1
110 elif use kernel_linux; then
111 NV_DOC="${S}"
112 NV_OBJ="${S}"
113 NV_SRC="${S}/kernel"
114 NV_MAN="${S}"
115 NV_X11="${S}"
116 NV_SOVER=${PV}
117 else
118 die "Could not determine proper NVIDIA package"
119 fi
120 }
121
122 src_unpack() {
123 if ! use kernel_FreeBSD; then
124 cd "${S}"
125 unpack_makeself
126 else
127 unpack ${A}
128 fi
129 }
130
131 src_prepare() {
132 # Please add a brief description for every added patch
133
134 if use kernel_linux; then
135 if kernel_is lt 2 6 9 ; then
136 eerror "You must build this against 2.6.9 or higher kernels."
137 fi
138
139 # If greater than 2.6.5 use M= instead of SUBDIR=
140 convert_to_m "${NV_SRC}"/Makefile.kbuild
141 fi
142
143 if use pax_kernel; then
144 ewarn "Using PAX patches is not supported. You will be asked to"
145 ewarn "use a standard kernel should you have issues. Should you"
146 ewarn "need support with these patches, contact the PaX team."
147 epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
148 epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
149 fi
150
151 cat <<- EOF > "${S}"/nvidia.icd
152 /usr/$(get_libdir)/libnvidia-opencl.so
153 EOF
154
155 # Allow user patches so they can support RC kernels and whatever else
156 epatch_user
157 }
158
159 src_compile() {
160 # This is already the default on Linux, as there's no toplevel Makefile, but
161 # on FreeBSD there's one and triggers the kernel module build, as we install
162 # it by itself, pass this.
163
164 cd "${NV_SRC}"
165 if use kernel_FreeBSD; then
166 MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
167 LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
168 elif use kernel_linux; then
169 linux-mod_src_compile
170 fi
171 }
172
173 # Install nvidia library:
174 # the first parameter is the library to install
175 # the second parameter is the provided soversion
176 # the third parameter is the target directory if its not /usr/lib
177 donvidia() {
178 # Full path to library minus SOVER
179 MY_LIB="$1"
180
181 # SOVER to use
182 MY_SOVER="$2"
183
184 # Where to install
185 MY_DEST="$3"
186
187 if [[ -z "${MY_DEST}" ]]; then
188 MY_DEST="/usr/$(get_libdir)"
189 action="dolib.so"
190 else
191 exeinto ${MY_DEST}
192 action="doexe"
193 fi
194
195 # Get just the library name
196 libname=$(basename $1)
197
198 # Install the library with the correct SOVER
199 ${action} ${MY_LIB}.${MY_SOVER} || \
200 die "failed to install ${libname}"
201
202 # If SOVER wasn't 1, then we need to create a .1 symlink
203 if [[ "${MY_SOVER}" != "1" ]]; then
204 dosym ${libname}.${MY_SOVER} \
205 ${MY_DEST}/${libname}.1 || \
206 die "failed to create ${libname} symlink"
207 fi
208
209 # Always create the symlink from the raw lib to the .1
210 dosym ${libname}.1 \
211 ${MY_DEST}/${libname} || \
212 die "failed to create ${libname} symlink"
213 }
214
215 src_install() {
216 if use kernel_linux; then
217 linux-mod_src_install
218
219 VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
220 if [ -z "$VIDEOGROUP" ]; then
221 eerror "Failed to determine the video group gid."
222 die "Failed to determine the video group gid."
223 fi
224
225 # Add the aliases
226 [ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
227 sed -e 's:PACKAGE:'${PF}':g' \
228 -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
229 "${WORKDIR}"/nvidia
230 insinto /etc/modprobe.d
231 newins "${WORKDIR}"/nvidia nvidia.conf || die
232
233 local udevdir=/lib/udev
234 has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
235
236 # Ensures that our device nodes are created when not using X
237 exeinto "${udevdir}"
238 doexe "${FILESDIR}"/nvidia-udev.sh
239
240 insinto "${udevdir}"/rules.d
241 newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
242 elif use kernel_FreeBSD; then
243 if use x86-fbsd; then
244 insinto /boot/modules
245 doins "${S}/src/nvidia.kld" || die
246 fi
247
248 exeinto /boot/modules
249 doexe "${S}/src/nvidia.ko" || die
250 fi
251
252 # NVIDIA kernel <-> userspace driver config lib
253 donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
254
255 if use kernel_linux; then
256 # NVIDIA video decode <-> CUDA
257 donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
258 fi
259
260 if use X; then
261 # Xorg DDX driver
262 insinto /usr/$(get_libdir)/xorg/modules/drivers
263 doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
264
265 # Xorg GLX driver
266 donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
267 /usr/$(get_libdir)/opengl/nvidia/extensions
268
269 # XvMC driver
270 dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
271 die "failed to install libXvMCNVIDIA.so"
272 donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
273 dosym libXvMCNVIDIA.so.${NV_SOVER} \
274 /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
275 die "failed to create libXvMCNVIDIA_dynamic.so symlink"
276 fi
277
278 # OpenCL ICD for NVIDIA
279 if use kernel_linux; then
280 insinto /etc/OpenCL/vendors
281 doins nvidia.icd
282 donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER}
283 fi
284
285 # Documentation
286 dohtml ${NV_DOC}/html/*
287 if use kernel_FreeBSD; then
288 dodoc "${NV_DOC}/README"
289 use X && doman "${NV_MAN}/nvidia-xconfig.1"
290 use tools && doman "${NV_MAN}/nvidia-settings.1"
291 else
292 # Docs
293 newdoc "${NV_DOC}/README.txt" README
294 dodoc "${NV_DOC}/NVIDIA_Changelog"
295 doman "${NV_MAN}/nvidia-smi.1.gz"
296 use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
297 use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
298 doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
299 fi
300
301 # Helper Apps
302 exeinto /opt/bin/
303
304 if use X; then
305 doexe ${NV_OBJ}/nvidia-xconfig || die
306 fi
307
308 if use kernel_linux ; then
309 doexe ${NV_OBJ}/nvidia-debugdump || die
310 doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
311 doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
312 doexe ${NV_OBJ}/nvidia-smi || die
313 newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
314 fi
315
316 if use tools; then
317 doexe ${NV_OBJ}/nvidia-settings || die
318 fi
319
320 exeinto /usr/bin/
321 doexe ${NV_OBJ}/nvidia-bug-report.sh || die
322
323 # Desktop entries for nvidia-settings
324 if use tools ; then
325 # There is no icon in the FreeBSD tarball.
326 use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png nvidia-drivers-settings.png
327 domenu "${FILESDIR}"/nvidia-drivers-settings.desktop
328 exeinto /etc/X11/xinit/xinitrc.d
329 doexe "${FILESDIR}"/95-nvidia-settings
330 fi
331
332 #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
333
334 if has_multilib_profile && use multilib ; then
335 local OABI=${ABI}
336 for ABI in $(get_install_abis) ; do
337 src_install-libs
338 done
339 ABI=${OABI}
340 unset OABI
341 else
342 src_install-libs
343 fi
344
345 is_final_abi || die "failed to iterate through all ABIs"
346 }
347
348 src_install-libs() {
349 local inslibdir=$(get_libdir)
350 local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
351 local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
352 local libdir=${NV_OBJ}
353
354 if use kernel_linux && has_multilib_profile && \
355 [[ ${ABI} == "x86" ]] ; then
356 libdir=${NV_OBJ}/32
357 fi
358
359 if use X; then
360 # The GLX libraries
361 donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
362 donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
363 if use kernel_FreeBSD; then
364 donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
365 else
366 donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
367 fi
368
369 # VDPAU
370 donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
371 fi
372
373 # NVIDIA monitoring library
374 if use kernel_linux ; then
375 donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
376 fi
377
378 # CUDA & OpenCL
379 if use kernel_linux; then
380 donvidia ${libdir}/libcuda.so ${NV_SOVER}
381 donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
382 donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
383 fi
384 }
385
386 pkg_preinst() {
387 use kernel_linux && linux-mod_pkg_preinst
388
389 # Clean the dynamic libGL stuff's home to ensure
390 # we dont have stale libs floating around
391 if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
392 rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
393 fi
394 # Make sure we nuke the old nvidia-glx's env.d file
395 if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
396 rm -f "${ROOT}"/etc/env.d/09nvidia
397 fi
398 }
399
400 pkg_postinst() {
401 use kernel_linux && linux-mod_pkg_postinst
402
403 # Switch to the nvidia implementation
404 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
405 "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
406
407 elog "You must be in the video group to use the NVIDIA device"
408 elog "For more info, read the docs at"
409 elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
410 elog
411 elog "This ebuild installs a kernel module and X driver. Both must"
412 elog "match explicitly in their version. This means, if you restart"
413 elog "X, you must modprobe -r nvidia before starting it back up"
414 elog
415 elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
416 elog
417 elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
418 elog
419 elog "NVIDIA has requested that any bug reports submitted have the"
420 elog "output of /opt/bin/nvidia-bug-report.sh included."
421 elog
422 if ! use X; then
423 elog "You have elected to not install the X.org driver. Along with"
424 elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
425 elog "installed. Additionally, once the driver is loaded your card"
426 elog "and fan will run at max speed which may not be desirable."
427 elog "Use the 'nvidia-smi' init script to have your card and fan"
428 elog "speed scale appropriately."
429 elog
430 fi
431 if ! use tools; then
432 elog "USE=tools controls whether the nvidia-settings application"
433 elog "is installed. If you would like to use it, enable that"
434 elog "flag and re-emerge this ebuild. Optionally you can install"
435 elog "media-video/nvidia-settings"
436 elog
437 fi
438 }
439
440 pkg_prerm() {
441 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
442 }
443
444 pkg_postrm() {
445 use kernel_linux && linux-mod_pkg_postrm
446 use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
447 }

  ViewVC Help
Powered by ViewVC 1.1.20