1 # Maintainer: Vi0L0 <vi0l093@gmail.com>
2 # Great Contributor: Eduardo "kensai" Romero (previous maintainer)
3 # Contributor: aidanlinz
13 pkgdesc="AMD/ATI Catalyst drivers for linux. fglrx kernel module only"
14 arch=('i686' 'x86_64')
15 url="http://www.ati.amd.com"
17 depends=('linux>=3.0' 'linux<3.3' 'catalyst-utils')
18 makedepends=('gcc-libs' 'gcc>4.0.0' 'make' 'linux-headers')
19 conflicts=('catalyst-test' 'nvidia' 'xf86-video-ati' 'xf86-video-radeonhd' 'ati-dri')
20 install=catalyst.install
22 source=(http://www2.ati.com/drivers/linux/amd-driver-installer-${pkgver/./-}-x86.x86_64.run
24 makefile_compat.patch)
26 md5sums=('6396d0f6f70b89d605bac896feb2b7c9'
27 '660396540b0ceaff71d6155c986734de'
28 '3e1b82bd69774ea808da69c983d6a43b')
34 msg "Setting compilation variables ..."
35 ## include ati_make.sh and use _ati_check function from it
40 msg "Unpacking archive ..."
41 /bin/sh ./amd-driver-installer-${pkgver/./-}-x86.x86_64.run --extract archive_files
44 if [ "${CARCH}" = "x86_64" ]; then
48 if [ "${CARCH}" = "i686" ]; then
53 cd "${srcdir}/archive_files/"
56 msg "Applying patch(es) ..."
57 ## makefile patch to choose arch_compat_alloc_user_space or older compat_alloc_user_space
58 ## works only in combination with ati_make.sh script
59 patch -Np1 -i ../makefile_compat.patch || return 1
61 # if [[ ${_kernver:0:6} < "2.6.39" ]] && [[ `cat /lib/modules/${_kernver}/build/.config | grep -c CONFIG_BKL=y` = 0 ]]; then
62 # patch -Np1 -i ../no_bkl.patch || return 1
65 # if [[ ${_kernver:0:6} == "2.6.39" ]] || [[ ${_kernver:0:6} > "2.6.39" ]]; then
66 # patch -Np1 -i ../no_bkl.patch || return 1
67 # patch -Np1 -i ../2.6.39_bkl.patch || return 1
70 cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
71 cp "${srcdir}/archive_files/arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a" . || return 1
72 cp 2.6.x/Makefile . || return 1
75 msg "Compiling fglrx module ..."
76 ## Compile module using _ati_check variables
77 make -C /lib/modules/${_kernver}/build SUBDIRS="`pwd`" ARCH=${BUILDARCH} \
78 MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \
79 PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules || return 1
84 ## here we are checking kernel's extramodules dir
85 for r in /lib/modules/*; do
87 if [[ ${s:0:3} = "ext" ]]; then
88 if [[ `cat ${r}/version | grep -c ${_kernver}` != 0 ]]; then
90 sed -i -e "s/EXTRAMODULES=.*/EXTRAMODULES=${s}/" $startdir/catalyst.install
92 elif [[ ${s} = ${_kernver} ]] && [[ ! -e ${r}/extramodules ]]; then
93 _destidir=${_kernver}/video
94 sed -i -e "s/EXTRAMODULES=.*/EXTRAMODULES=null/" $startdir/catalyst.install
99 cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
100 install -m755 -d "${pkgdir}/lib/modules/${_destidir}/" || return 1
101 install -m644 fglrx.ko "${pkgdir}/lib/modules/${_destidir}/" || return 1
102 find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
103 sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" $startdir/catalyst.install
106 install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
107 install -m644 "${srcdir}/archive_files/LICENSE.TXT" "${pkgdir}/usr/share/licenses/${pkgname}/" || return 1
109 sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" $startdir/*.install