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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Sat Jul 21 21:45:01 2012 UTC (9 months, 3 weeks ago) by chithanh
Branch: MAIN
Changes since 1.1: +4 -4 lines
Import driver for legacy hardware from x11 overlay, ebuild by Enrico Tagliavini. Update 12.6 ebuild patches per bug #420689 and bug #420751.

(Portage version: 2.2.0_alpha115/cvs/Linux x86_64)

1 scarabeus 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 chithanh 1.2 # $Header: /var/cvsroot/gentoo-x86/x11-drivers/ati-drivers/ati-drivers-12.6.ebuild,v 1.1 2012/06/30 09:17:19 scarabeus Exp $
4 scarabeus 1.1
5     EAPI=4
6    
7     inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
8    
9     DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
10     HOMEPAGE="http://www.amd.com"
11     MY_V=( $(get_version_components) )
12     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 chithanh 1.2 IUSE="debug +modules multilib qt4 static-libs"
22 scarabeus 1.1
23     LICENSE="AMD GPL-2 QPL-1.0 as-is"
24     KEYWORDS="amd64 x86"
25     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     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     [[ ${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="${S}/${A/%.zip/.run}"
291     else
292     RUN="${DISTDIR}/${A}"
293     fi
294     sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
295     }
296    
297     src_prepare() {
298     # All kernel options for prepare are ment to be in here
299     if use modules; then
300     # version patches
301     # epatch "${FILESDIR}"/kernel/${PV}-*.patch
302     if use debug; then
303     sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
304     "${MODULE_DIR}/firegl_public.c" \
305     || die "Failed to enable debug output."
306     fi
307     fi
308    
309     # These are the userspace utilities that we also have source for.
310     # We rebuild these later.
311     rm \
312     "${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
313     || die "bin rm failed"
314    
315     # in this version amdcccle isn't static, thus we depend on qt4
316     use qt4 || rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle
317    
318     # ACPI fixups
319     sed -i \
320     -e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
321     -e "s:/var/lib/gdm/:/var/gdm/:" \
322     "${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
323     || die "sed failed."
324    
325     # Since "who" is in coreutils, we're using that one instead of "finger".
326     sed -i -e 's:finger:who:' \
327     "${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
328     || die "Replacing 'finger' with 'who' failed."
329     # Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
330     # add function to detect default state.
331     epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
332    
333 chithanh 1.2 #fixes bug #420751
334     epatch "${FILESDIR}"/ati-drivers-do_mmap.patch
335 scarabeus 1.1
336     # see http://ati.cchtml.com/show_bug.cgi?id=495
337     epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
338    
339     cd "${MODULE_DIR}"
340    
341     # bugged fglrx build system, this file should be copied by hand
342     cp ${ARCH_DIR}/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
343    
344     convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
345    
346     # When built with ati's make.sh it defines a bunch of macros if
347     # certain .config values are set, falling back to less reliable
348     # detection methods if linux/autoconf.h is not available. We
349     # simply use the linux/autoconf.h settings directly, bypassing the
350     # detection script.
351     sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
352     sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
353     || die "MODVERSIONS sed failed"
354     cd "${S}"
355    
356     mkdir extra || die "mkdir failed"
357     cd extra
358     unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
359    
360     # Get rid of watermark. Oldest known reference:
361     # http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
362     ebegin "Disabling watermark"
363     driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
364     for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
365     sed -i "s/${x}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
366     done
367     eend $? || die "Disabling watermark failed"
368     }
369    
370     src_compile() {
371     use modules && linux-mod_src_compile
372    
373     ebegin "Building fgl_glxgears"
374     cd "${S}"/extra/fgl_glxgears
375     # These extra libs/utils either have an Imakefile that does not
376     # work very well without tweaking or a Makefile ignoring CFLAGS
377     # and the like. We bypass those.
378     # The -DUSE_GLU is needed to compile using nvidia headers
379     # according to a comment in ati-drivers-extra-8.33.6.ebuild.
380     "$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
381     -I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
382     -lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
383     eend $?
384     }
385    
386     src_test() { :; } # no tests present
387    
388     src_install() {
389     use modules && linux-mod_src_install
390    
391     # We can do two things here, and neither of them is very nice.
392    
393     # For direct rendering libGL has to be able to load one or more
394     # dri modules (files ending in _dri.so, like fglrx_dri.so).
395     # Gentoo's mesa looks for these files in the location specified by
396     # LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
397     # location /usr/$(get_libdir)/dri. Ati's libGL does the same
398     # thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
399     # on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
400     # 64bit. So we can either put the .so files in that (unusual,
401     # compared to "normal" mesa libGL) location or set
402     # LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
403     # 101539.
404    
405     # The problem with this approach is that LIBGL_DRIVERS_PATH
406     # *overrides* the default hardcoded location, it does not extend
407     # it. So if ati-drivers is merged but a non-ati libGL is selected
408     # and its hardcoded path does not match our LIBGL_DRIVERS_PATH
409     # (because it changed in a newer mesa or because it was compiled
410     # for a different set of multilib abis than we are) stuff breaks.
411    
412     # We create one file per ABI to work with "native" multilib, see
413     # below.
414    
415     echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
416     doenvd "${T}/03ati-colon-sep" || die
417    
418     # All libraries that we have a 32 bit and 64 bit version of on
419     # amd64 are installed in src_install-libs. Everything else
420     # (including libraries only available in native 64bit on amd64)
421     # goes in here.
422    
423     # There used to be some code here that tried to detect running
424     # under a "native multilib" portage ((precursor of)
425     # http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
426     # should just work (only doing some duplicate work). --marienz
427     if has_multilib_profile; then
428     local OABI=${ABI}
429     for ABI in $(get_install_abis); do
430     src_install-libs
431     done
432     ABI=${OABI}
433     unset OABI
434     else
435     src_install-libs
436     fi
437    
438     # This is sorted by the order the files occur in the source tree.
439    
440     # X modules.
441     exeinto /usr/$(get_libdir)/xorg/modules/drivers
442     doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
443     exeinto /usr/$(get_libdir)/xorg/modules/linux
444     doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
445     exeinto /usr/$(get_libdir)/xorg/modules
446     doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
447    
448     # Arch-specific files.
449     # (s)bin.
450     into /opt
451     dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
452     use qt4 && dosbin "${ARCH_DIR}"/usr/sbin/amdnotifyui
453     dobin "${ARCH_DIR}"/usr/bin/clinfo
454     # We cleaned out the compilable stuff in src_unpack
455     dobin "${ARCH_DIR}"/usr/X11R6/bin/*
456    
457     # Common files.
458     # etc.
459     insinto /etc/ati
460     exeinto /etc/ati
461     # Everything except for the authatieventsd.sh script.
462     doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
463     doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
464    
465     # include.
466     insinto /usr
467     doins -r ${FOLDER_PREFIX}usr/include
468     insinto /usr/include/X11/extensions
469    
470     # Just the atigetsysteminfo.sh script.
471     into /usr
472     dosbin ${FOLDER_PREFIX}usr/sbin/*
473    
474     # data files for the control panel.
475     if use qt4 ; then
476     insinto /usr/share
477     doins -r ${FOLDER_PREFIX}usr/share/ati
478     insinto /usr/share/pixmaps
479     doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
480     make_desktop_entry amdcccle 'AMD Catalyst Control Center' \
481     ccc_large System
482     fi
483    
484     # doc.
485     dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
486    
487     doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
488    
489     pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
490    
491     exeinto /etc/acpi
492     doexe ati-powermode.sh
493     insinto /etc/acpi/events
494     doins events/*
495    
496     popd > /dev/null
497    
498     # Done with the "source" tree. Install tools we rebuilt:
499     dobin extra/fgl_glxgears/fgl_glxgears
500     newdoc extra/fgl_glxgears/README README.fgl_glxgears
501    
502     # Gentoo-specific stuff:
503     newinitd "${FILESDIR}"/atieventsd.init atieventsd
504     echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
505     newconfd "${T}"/atieventsd.conf atieventsd
506    
507     # PowerXpress stuff
508     exeinto /usr/$(get_libdir)/fglrx
509     doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
510     cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
511     doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
512     }
513    
514     src_install-libs() {
515     if [[ "${ABI}" == "amd64" ]]; then
516     local EX_BASE_DIR="${BASE_DIR}_64a"
517     local pkglibdir=lib64
518     local MY_ARCH_DIR="${S}/arch/x86_64"
519     local oclsuffix=64
520     else
521     local EX_BASE_DIR="${BASE_DIR}"
522     local pkglibdir=lib
523     local MY_ARCH_DIR="${S}/arch/x86"
524     local oclsuffix=32
525     fi
526     einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
527    
528     local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
529     # To make sure we do not miss a spot when these change.
530     local libmajor=1 libminor=2
531     local libver=${libmajor}.${libminor}
532    
533     # The GLX libraries
534     # (yes, this really is "lib" even on amd64/multilib --marienz)
535     exeinto ${ATI_ROOT}/lib
536     newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
537     libGL.so.${libver}
538     dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
539     dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
540    
541     exeinto ${ATI_ROOT}/extensions
542     doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
543     mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
544    
545     # other libs
546     exeinto /usr/$(get_libdir)
547     # Everything except for the libGL.so installed some row above
548     doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
549     -maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
550     insinto /usr/$(get_libdir)
551     doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
552     -maxdepth 1 -type f -not -name '*.so*')
553    
554     # DRI modules, installed into the path used by recent versions of mesa.
555     exeinto /usr/$(get_libdir)/dri
556     doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
557    
558     # AMD Cal and OpenCL libraries
559     exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
560     doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
561     doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
562     dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
563     exeinto /usr/$(get_libdir)
564     doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
565    
566     # OpenCL vendor files
567     insinto /etc/OpenCL/vendors/
568     cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
569     /usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
570     EOF
571     doins "${T}"/amdocl${oclsuffix}.icd
572    
573     local envname="${T}"/04ati-dri-path
574     if [[ -n ${ABI} ]]; then
575     envname="${envname}-${ABI}"
576     fi
577     echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
578     doenvd "${envname}"
579    
580     # Silence the QA notice by creating missing soname symlinks
581     for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
582     do
583     local soname=${so##*/}
584     ## let's keep also this alternative way ;)
585     #dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
586     dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
587     done
588    
589     #remove static libs if not wanted
590     use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
591     }
592    
593     pkg_postinst() {
594     elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
595     elog "To change your xorg.conf you can use the bundled \"aticonfig\""
596     elog
597     elog "If you experience unexplained segmentation faults and kernel crashes"
598     elog "with this driver and multi-threaded applications such as wine,"
599     elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
600     elog
601     elog "Fully rebooting the system after an ${PN} update is recommended"
602     elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
603     elog "might not work"
604     elog
605     elog "Some cards need acpid running to handle events"
606     elog "Please add it to boot runlevel with rc-update add acpid boot"
607     elog
608    
609     use modules && linux-mod_pkg_postinst
610     "${ROOT}"/usr/bin/eselect opengl set --use-old ati
611     "${ROOT}"/usr/bin/eselect opencl set --use-old amd
612     }
613    
614     pkg_preinst() {
615     use modules && linux-mod_pkg_preinst
616     }
617    
618     pkg_prerm() {
619     "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
620     }
621    
622     pkg_postrm() {
623     use modules && linux-mod_pkg_postrm
624     "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
625     }

  ViewVC Help
Powered by ViewVC 1.1.13