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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Feb 12 23:06:02 2013 UTC (14 months ago) by jer
Branch: MAIN
Changes since 1.1: +2 -2 lines
Update xorg-server ABI compatible version.

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

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

  ViewVC Help
Powered by ViewVC 1.1.20