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