Gentoo Archives: gentoo-commits

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