/[gentoo-x86]/x11-drivers/ati-drivers/ati-drivers-12.6_beta.ebuild
Gentoo

Contents of /x11-drivers/ati-drivers/ati-drivers-12.6_beta.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Fri Jun 22 20:36:50 2012 UTC (2 years, 1 month ago) by ago
Branch: MAIN
Changes since 1.3: +2 -2 lines
Stable for amd64, wrt bug #419473

(Portage version: 2.1.10.65/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20