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