/[gentoo-x86]/x11-drivers/ati-drivers/ati-drivers-12.11_beta11.ebuild
Gentoo

Contents of /x11-drivers/ati-drivers/ati-drivers-12.11_beta11.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jan 4 22:00:09 2013 UTC (18 months, 3 weeks ago) by chithanh
Branch: MAIN
Changes since 1.4: +3 -2 lines
Add dependency on virtual/glu, bug #437720.

(Portage version: 2.1.11.31/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/ati-drivers/ati-drivers-12.11_beta11.ebuild,v 1.4 2012/12/30 17:05:35 mr_bones_ Exp $
4
5 EAPI=4
6
7 inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
8
9 DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
10 HOMEPAGE="http://www.amd.com"
11 MY_V=( $(get_version_components) )
12 #RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
13 SRC_URI="http://www2.ati.com/drivers/beta/amd-driver-installer-catalyst-12.11-beta11-x86.x86_64.zip"
14 FOLDER_PREFIX="common/"
15 IUSE="debug +modules multilib qt4 static-libs disable-watermark"
16
17 LICENSE="AMD GPL-2 QPL-1.0"
18 KEYWORDS="-* amd64 x86"
19 SLOT="1"
20
21 RESTRICT="bindist"
22
23 RDEPEND="
24 <=x11-base/xorg-server-1.13.49[-minimal]
25 >=app-admin/eselect-opengl-1.0.7
26 app-admin/eselect-opencl
27 sys-power/acpid
28 x11-apps/xauth
29 x11-libs/libX11
30 x11-libs/libXext
31 x11-libs/libXinerama
32 x11-libs/libXrandr
33 x11-libs/libXrender
34 virtual/glu
35 multilib? (
36 app-emulation/emul-linux-x86-opengl
37 app-emulation/emul-linux-x86-xlibs
38 )
39 qt4? (
40 x11-libs/libICE
41 x11-libs/libSM
42 x11-libs/libXcursor
43 x11-libs/libXfixes
44 x11-libs/libXxf86vm
45 x11-libs/qt-core:4
46 x11-libs/qt-gui:4[accessibility]
47 )
48 "
49
50 DEPEND="${RDEPEND}
51 x11-proto/inputproto
52 x11-proto/xf86miscproto
53 x11-proto/xf86vidmodeproto
54 x11-proto/xineramaproto
55 x11-libs/libXtst
56 sys-apps/findutils
57 app-misc/pax-utils
58 app-arch/unzip
59 "
60
61 EMULTILIB_PKG="true"
62
63 S="${WORKDIR}"
64
65 # QA Silencing
66 QA_TEXTRELS="
67 usr/lib*/opengl/ati/lib/libGL.so.1.2
68 usr/lib*/libatiadlxx.so
69 usr/lib*/xorg/modules/glesx.so
70 usr/lib*/libaticaldd.so
71 usr/lib*/dri/fglrx_dri.so
72 "
73
74 QA_EXECSTACK="
75 opt/bin/atiode
76 opt/bin/amdcccle
77 usr/lib*/opengl/ati/lib/libGL.so.1.2
78 usr/lib*/dri/fglrx_dri.so
79 "
80
81 QA_WX_LOAD="
82 usr/lib*/opengl/ati/lib/libGL.so.1.2
83 usr/lib*/dri/fglrx_dri.so
84 "
85
86 QA_PRESTRIPPED="
87 usr/lib\(32\|64\)\?/libXvBAW.so.1.0
88 usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
89 usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
90 usr/lib\(32\|64\)\?/xorg/modules/glesx.so
91 usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
92 usr/lib\(32\|64\)\?/libaticaldd.so
93 usr/lib\(32\|64\)\?/dri/fglrx_dri.so
94 "
95
96 QA_SONAME="
97 usr/lib\(32\|64\)\?/libatiadlxx.so
98 usr/lib\(32\|64\)\?/libaticalcl.so
99 usr/lib\(32\|64\)\?/libaticaldd.so
100 usr/lib\(32\|64\)\?/libaticalrt.so
101 usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
102 "
103
104 QA_DT_HASH="
105 opt/bin/amdcccle
106 opt/bin/aticonfig
107 opt/bin/atiodcli
108 opt/bin/atiode
109 opt/bin/clinfo
110 opt/bin/fglrxinfo
111 opt/sbin/atieventsd
112 opt/sbin/amdnotifyui
113 usr/lib\(32\|64\)\?/libaticalcl.so
114 usr/lib\(32\|64\)\?/libaticalrt.so
115 usr/lib\(32\|64\)\?/libatiuki.so.1.0
116 usr/lib\(32\|64\)\?/libatiadlxx.so
117 usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
118 usr/lib\(32\|64\)\?/libXvBAW.so.1.0
119 usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
120 usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
121 usr/lib\(32\|64\)\?/xorg/modules/glesx.so
122 usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
123 usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
124 usr/lib\(32\|64\)\?/libaticaldd.so
125 usr/lib\(32\|64\)\?/dri/fglrx_dri.so
126 usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
127 usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
128 usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
129 usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
130 usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
131 usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
132 "
133
134 _check_kernel_config() {
135 local failed=0
136 local error=""
137 if ! kernel_is ge 2 6; then
138 eerror "You need a 2.6 linux kernel to compile against!"
139 die "No 2.6 Kernel found"
140 fi
141
142 if ! linux_chkconfig_present MTRR; then
143 ewarn "You don't have MTRR support enabled in the kernel."
144 ewarn "Direct rendering will not work."
145 fi
146
147 if linux_chkconfig_builtin DRM; then
148 ewarn "You have DRM support built in to the kernel"
149 ewarn "Direct rendering will not work."
150 fi
151
152 if ! linux_chkconfig_present AGP && \
153 ! linux_chkconfig_present PCIEPORTBUS; then
154 ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
155 ewarn "Direct rendering will not work."
156 fi
157
158 if ! linux_chkconfig_present ACPI; then
159 eerror "${P} requires the ACPI support in the kernel"
160 eerror "Please enable it:"
161 eerror " CONFIG_ACPI=y"
162 eerror "in /usr/src/linux/.config or"
163 eerror " Power management and ACPI options --->"
164 eerror " [*] Power Management support"
165 eerror "in the 'menuconfig'"
166 error+=" CONFIG_ACPI disabled;"
167 failed=1
168 fi
169
170 if ! linux_chkconfig_present PCI_MSI; then
171 eerror "${P} requires MSI in the kernel."
172 eerror "Please enable it:"
173 eerror " CONFIG_PCI_MSI=y"
174 eerror "in /usr/src/linux/.config or"
175 eerror " Bus options (PCI etc.) --->"
176 eerror " [*] Message Signaled Interrupts (MSI and MSI-X)"
177 eerror "in the kernel config."
178 error+=" CONFIG_PCI_MSI disabled;"
179 failed=1
180 fi
181
182 if linux_chkconfig_present LOCKDEP; then
183 eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
184 eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
185 eerror "This prevents ${P} from compiling with an error like this:"
186 eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
187 eerror "Please make sure the following options have been unset:"
188 eerror " Kernel hacking --->"
189 eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
190 eerror " [ ] Lock debugging: prove locking correctness"
191 eerror " [ ] Lock usage statistics"
192 eerror "in 'menuconfig'"
193 error+=" LOCKDEP enabled;"
194 failed=1
195 fi
196
197 use amd64 && if ! linux_chkconfig_present COMPAT; then
198 eerror "${P} requires COMPAT."
199 eerror "Please enable the 32 bit emulation:"
200 eerror "Executable file formats / Emulations --->"
201 eerror " [*] IA32 Emulation"
202 eerror "in the kernel config."
203 eerror "if this doesn't enable CONFIG_COMPAT add"
204 eerror " CONFIG_COMPAT=y"
205 eerror "in /usr/src/linux/.config"
206 error+=" COMPAT disabled;"
207 failed=1
208 fi
209
210 kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
211 eerror "${P} requires BKL."
212 eerror "Please enable the Big Kernel Lock:"
213 eerror "Kernel hacking --->"
214 eerror " [*] Big Kernel Lock"
215 eerror "in the kernel config."
216 eerror "or add"
217 eerror " CONFIG_BKL=y"
218 eerror "in /usr/src/linux/.config"
219 error+=" BKL disabled;"
220 failed=1
221 fi
222
223 #if linux_chkconfig_present X86_X32; then
224 # eerror "You've enabled x32 in the kernel."
225 # eerror "Unfortunately, this option is not supported yet and prevents the fglrx"
226 # eerror "kernel module from loading."
227 # error+=" X86_32 enabled;"
228 # failed=1
229 #fi
230
231 [[ ${failed} -ne 0 ]] && die "${error}"
232 }
233
234 pkg_pretend() {
235 # workaround until bug 365543 is solved
236 if use modules; then
237 linux-info_pkg_setup
238 require_configured_kernel
239 _check_kernel_config
240 fi
241 }
242
243 pkg_setup() {
244 if use modules; then
245 MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
246 BUILD_TARGETS="kmod_build"
247 linux-mod_pkg_setup
248 BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
249 BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
250 if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
251 BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
252 else
253 BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
254 fi
255 fi
256 # Define module dir.
257 MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
258 # get the xorg-server version and set BASE_DIR for that
259 BASE_DIR="${S}/xpic"
260
261 # amd64/x86
262 if use amd64 ; then
263 MY_BASE_DIR="${BASE_DIR}_64a"
264 PKG_LIBDIR=lib64
265 ARCH_DIR="${S}/arch/x86_64"
266 else
267 MY_BASE_DIR="${BASE_DIR}"
268 PKG_LIBDIR=lib
269 ARCH_DIR="${S}/arch/x86"
270 fi
271
272 elog
273 elog "Please note that this driver supports only graphic cards based on"
274 elog "Evergreen chipset and newer."
275 elog "This represent the AMD Radeon HD 5400+ series at this moment."
276 elog
277 elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
278 elog "For migration informations please reffer to:"
279 elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
280 einfo
281 }
282
283 src_unpack() {
284 if [[ ${A} =~ .*\.tar\.gz ]]; then
285 unpack ${A}
286 else
287 #please note, RUN may be insanely assigned at top near SRC_URI
288 if [[ ${A} =~ .*\.zip ]]; then
289 unpack ${A}
290 [[ -z "$RUN" ]] && RUN="${S}/${A/%.zip/.run}"
291 else
292 RUN="${DISTDIR}/${A}"
293 fi
294 sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
295 fi
296 }
297
298 src_prepare() {
299 # All kernel options for prepare are ment to be in here
300 if use modules; then
301 # version patches
302 # epatch "${FILESDIR}"/kernel/${PV}-*.patch
303 if use debug; then
304 sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
305 "${MODULE_DIR}/firegl_public.c" \
306 || die "Failed to enable debug output."
307 fi
308 fi
309
310 # These are the userspace utilities that we also have source for.
311 # We rebuild these later.
312 rm \
313 "${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
314 || die "bin rm failed"
315
316 # in this version amdcccle isn't static, thus we depend on qt4
317 use qt4 || rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle
318
319 # ACPI fixups
320 sed -i \
321 -e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
322 -e "s:/var/lib/gdm/:/var/gdm/:" \
323 "${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
324 || die "sed failed."
325
326 # Since "who" is in coreutils, we're using that one instead of "finger".
327 sed -i -e 's:finger:who:' \
328 "${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
329 || die "Replacing 'finger' with 'who' failed."
330 # Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
331 # add function to detect default state.
332 epatch "${FILESDIR}"/ati-powermode-opt-path-3.patch
333
334 # see http://ati.cchtml.com/show_bug.cgi?id=495
335 #epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
336 # first hunk applied upstream second (x32 related) was not
337 epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
338
339 # compile fix for linux-3.7
340 # https://bugs.gentoo.org/show_bug.cgi?id=438516
341 epatch "${FILESDIR}/ati-drivers-vm-reserverd.patch"
342
343 # compile fix for AGP-less kernel, bug #435322
344 epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
345
346 # Use ACPI_DEVICE_HANDLE wrapper to make driver build on linux-3.8
347 # see https://bugs.gentoo.org/show_bug.cgi?id=448216
348 epatch "${FILESDIR}/ati-drivers-kernel-3.8-acpihandle.patch"
349
350 cd "${MODULE_DIR}"
351
352 # bugged fglrx build system, this file should be copied by hand
353 cp ${ARCH_DIR}/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
354
355 convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
356
357 # When built with ati's make.sh it defines a bunch of macros if
358 # certain .config values are set, falling back to less reliable
359 # detection methods if linux/autoconf.h is not available. We
360 # simply use the linux/autoconf.h settings directly, bypassing the
361 # detection script.
362 sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
363 sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
364 || die "MODVERSIONS sed failed"
365 cd "${S}"
366
367 mkdir extra || die "mkdir failed"
368 cd extra
369 unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
370
371 # Get rid of watermark. Oldest known reference:
372 # http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
373 if use disable-watermark; then
374 ebegin "Disabling watermark"
375 driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
376 for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
377 sed -i "s/${x/x5b/\x5b}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
378 done
379 eend $? || die "Disabling watermark failed"
380 fi
381 }
382
383 src_compile() {
384 use modules && linux-mod_src_compile
385
386 ebegin "Building fgl_glxgears"
387 cd "${S}"/extra/fgl_glxgears
388 # These extra libs/utils either have an Imakefile that does not
389 # work very well without tweaking or a Makefile ignoring CFLAGS
390 # and the like. We bypass those.
391 # The -DUSE_GLU is needed to compile using nvidia headers
392 # according to a comment in ati-drivers-extra-8.33.6.ebuild.
393 "$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
394 -I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
395 -lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
396 eend $?
397 }
398
399 src_test() { :; } # no tests present
400
401 src_install() {
402 use modules && linux-mod_src_install
403
404 # We can do two things here, and neither of them is very nice.
405
406 # For direct rendering libGL has to be able to load one or more
407 # dri modules (files ending in _dri.so, like fglrx_dri.so).
408 # Gentoo's mesa looks for these files in the location specified by
409 # LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
410 # location /usr/$(get_libdir)/dri. Ati's libGL does the same
411 # thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
412 # on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
413 # 64bit. So we can either put the .so files in that (unusual,
414 # compared to "normal" mesa libGL) location or set
415 # LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
416 # 101539.
417
418 # The problem with this approach is that LIBGL_DRIVERS_PATH
419 # *overrides* the default hardcoded location, it does not extend
420 # it. So if ati-drivers is merged but a non-ati libGL is selected
421 # and its hardcoded path does not match our LIBGL_DRIVERS_PATH
422 # (because it changed in a newer mesa or because it was compiled
423 # for a different set of multilib abis than we are) stuff breaks.
424
425 # We create one file per ABI to work with "native" multilib, see
426 # below.
427
428 echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
429 doenvd "${T}/03ati-colon-sep" || die
430
431 # All libraries that we have a 32 bit and 64 bit version of on
432 # amd64 are installed in src_install-libs. Everything else
433 # (including libraries only available in native 64bit on amd64)
434 # goes in here.
435
436 # There used to be some code here that tried to detect running
437 # under a "native multilib" portage ((precursor of)
438 # http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
439 # should just work (only doing some duplicate work). --marienz
440 if has_multilib_profile; then
441 local OABI=${ABI}
442 for ABI in $(get_install_abis); do
443 src_install-libs
444 done
445 ABI=${OABI}
446 unset OABI
447 else
448 src_install-libs
449 fi
450
451 # This is sorted by the order the files occur in the source tree.
452
453 # X modules.
454 exeinto /usr/$(get_libdir)/xorg/modules/drivers
455 doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
456 exeinto /usr/$(get_libdir)/xorg/modules/linux
457 doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
458 exeinto /usr/$(get_libdir)/xorg/modules
459 doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
460
461 # Arch-specific files.
462 # (s)bin.
463 into /opt
464 dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
465 use qt4 && dosbin "${ARCH_DIR}"/usr/sbin/amdnotifyui
466 dobin "${ARCH_DIR}"/usr/bin/clinfo
467 # We cleaned out the compilable stuff in src_unpack
468 dobin "${ARCH_DIR}"/usr/X11R6/bin/*
469
470 # Common files.
471 # etc.
472 insinto /etc/ati
473 exeinto /etc/ati
474 # Everything except for the authatieventsd.sh script.
475 doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
476 doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
477
478 # include.
479 insinto /usr
480 doins -r ${FOLDER_PREFIX}usr/include
481 insinto /usr/include/X11/extensions
482
483 # Just the atigetsysteminfo.sh script.
484 into /usr
485 dosbin ${FOLDER_PREFIX}usr/sbin/*
486
487 # data files for the control panel.
488 if use qt4 ; then
489 insinto /usr/share
490 doins -r ${FOLDER_PREFIX}usr/share/ati
491 insinto /usr/share/pixmaps
492 doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
493 make_desktop_entry amdcccle 'AMD Catalyst Control Center' \
494 ccc_large System
495 fi
496
497 # doc.
498 dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
499
500 doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
501
502 pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
503
504 exeinto /etc/acpi
505 doexe ati-powermode.sh
506 insinto /etc/acpi/events
507 doins events/*
508
509 popd > /dev/null
510
511 # Done with the "source" tree. Install tools we rebuilt:
512 dobin extra/fgl_glxgears/fgl_glxgears
513 newdoc extra/fgl_glxgears/README README.fgl_glxgears
514
515 # Gentoo-specific stuff:
516 newinitd "${FILESDIR}"/atieventsd.init atieventsd
517 echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
518 newconfd "${T}"/atieventsd.conf atieventsd
519
520 # PowerXpress stuff
521 exeinto /usr/$(get_libdir)/fglrx
522 doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
523 cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
524 doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
525 }
526
527 src_install-libs() {
528 if [[ "${ABI}" == "amd64" ]]; then
529 local EX_BASE_DIR="${BASE_DIR}_64a"
530 local pkglibdir=lib64
531 local MY_ARCH_DIR="${S}/arch/x86_64"
532 local oclsuffix=64
533 else
534 local EX_BASE_DIR="${BASE_DIR}"
535 local pkglibdir=lib
536 local MY_ARCH_DIR="${S}/arch/x86"
537 local oclsuffix=32
538 fi
539 einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
540
541 local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
542 # To make sure we do not miss a spot when these change.
543 local libmajor=1 libminor=2
544 local libver=${libmajor}.${libminor}
545
546 # The GLX libraries
547 # (yes, this really is "lib" even on amd64/multilib --marienz)
548 exeinto ${ATI_ROOT}/lib
549 newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
550 libGL.so.${libver}
551 dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
552 dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
553
554 exeinto ${ATI_ROOT}/extensions
555 doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
556 mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
557
558 # other libs
559 exeinto /usr/$(get_libdir)
560 # Everything except for the libGL.so installed some row above
561 doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
562 -maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
563 insinto /usr/$(get_libdir)
564 doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
565 -maxdepth 1 -type f -not -name '*.so*')
566
567 # DRI modules, installed into the path used by recent versions of mesa.
568 exeinto /usr/$(get_libdir)/dri
569 doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
570
571 # AMD Cal and OpenCL libraries
572 exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
573 doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
574 doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
575 dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
576 exeinto /usr/$(get_libdir)
577 doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
578
579 # OpenCL vendor files
580 insinto /etc/OpenCL/vendors/
581 cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
582 /usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
583 EOF
584 doins "${T}"/amdocl${oclsuffix}.icd
585
586 local envname="${T}"/04ati-dri-path
587 if [[ -n ${ABI} ]]; then
588 envname="${envname}-${ABI}"
589 fi
590 echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
591 doenvd "${envname}"
592
593 # Silence the QA notice by creating missing soname symlinks
594 for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
595 do
596 local soname=${so##*/}
597 local soname_one=${soname%.[0-9]}
598 local soname_zero=${soname_one%.[0-9]}
599 dosym ${soname} /usr/$(get_libdir)/${soname_one}
600 dosym ${soname_one} /usr/$(get_libdir)/${soname_zero}
601 done
602
603 # See https://bugs.gentoo.org/show_bug.cgi?id=443466
604 dodir /etc/revdep-rebuild/
605 echo "SEARCH_DIRS_MASK=\"/opt/bin/clinfo\"" > "${ED}/etc/revdep-rebuild/62-ati-drivers"
606
607 #remove static libs if not wanted
608 use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
609 }
610
611 pkg_postinst() {
612 elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
613 elog "To change your xorg.conf you can use the bundled \"aticonfig\""
614 elog
615 elog "If you experience unexplained segmentation faults and kernel crashes"
616 elog "with this driver and multi-threaded applications such as wine,"
617 elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
618 elog
619 elog "Fully rebooting the system after an ${PN} update is recommended"
620 elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
621 elog "might not work"
622 elog
623 elog "Some cards need acpid running to handle events"
624 elog "Please add it to boot runlevel with rc-update add acpid boot"
625 elog
626
627 use modules && linux-mod_pkg_postinst
628 "${ROOT}"/usr/bin/eselect opengl set --use-old ati
629 "${ROOT}"/usr/bin/eselect opencl set --use-old amd
630
631 if has_version ">=x11-drivers/xf86-video-intel-2.20.3"; then
632 ewarn "It is reported that xf86-video-intel-2.20.3 and later cause the X server"
633 ewarn "to crash on systems that use hybrid AMD/Intel graphics. If you experience"
634 ewarn "this crash, downgrade to xf86-video-intel-2.20.2 or earlier."
635 ewarn "For details, see https://bugs.gentoo.org/show_bug.cgi?id=430000"
636 fi
637 }
638
639 pkg_preinst() {
640 use modules && linux-mod_pkg_preinst
641 }
642
643 pkg_prerm() {
644 "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
645 }
646
647 pkg_postrm() {
648 use modules && linux-mod_pkg_postrm
649 "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
650 }

  ViewVC Help
Powered by ViewVC 1.1.20