summaryrefslogtreecommitdiff
path: root/community-testing/catalyst/PKGBUILD
blob: 80652f726556a467ff3a06827ac2012751babc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# $Id: PKGBUILD 76561 2012-09-23 08:26:49Z lcarlier $
# Maintainer: idontknow
# Contributor: to fill with a lot of people

pkgname=catalyst
pkgver=12.8
pkgrel=0.1
_extramodules=extramodules-3.5-ARCH
pkgdesc="AMD proprietary gpu drivers"
arch=('i686' 'x86_64')
url="http://www.amd.com"
license=('custom')
depends=('linux>=3.5' 'linux<3.6')
makedepends=('linux-headers>=3.5' 'linux-headers<3.6')
#conflicts=('nvidia' 'xf86-video-ati' 'ati-dri')
source=(http://www2.ati.com/drivers/linux/amd-driver-installer-${pkgver/./-}-x86.x86_64.zip
        3.5-do_mmap.patch)
md5sums=('41c5478322b13be6909eeb46412a3aa0'
         'a450e2e3db61994b09e9d99d95bee837')
install=catalyst.install

build() {
  cd ${srcdir}
  
  if [ "${CARCH}" = "x86_64" ]; then
    BUILDARCH=x86_64
    _archdir=x86_64
  else
    BUILDARCH=i386
    _archdir=x86
  fi

  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
  sh ./amd-driver-installer*.run --extract fglrx-install
  
  cd fglrx-install
  patch -Np1 -i ../3.5-do_mmap.patch
  
  cd common/lib/modules/fglrx/build_mod
  ln -s "${srcdir}/fglrx-install/arch/${_archdir}"/lib/modules/fglrx/build_mod/libfglrx_ip.a
  ln -s 2.6.x/Makefile
  
  CFLAGS_MODULE="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=0 -DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space -D__SMP__ -DMODVERSIONS"

  make -C /usr/lib/modules/${_kernver}/build SUBDIRS="`pwd`" ARCH=${BUILDARCH} \
    MODFLAGS="$CFLAGS_MODULE" CFLAGS_MODULE="$CFLAGS_MODULE" \
    KVER=${_kernver} PAGE_ATTR_FIX=0 modules
}

package() {
  depends=(${depends[@]} "catalyst-utils=${pkgver}")

  cd ${srcdir}/fglrx-install/common/lib/modules/fglrx/build_mod
  
  install -Dm644 fglrx.ko "${pkgdir}/usr/lib/modules/${_extramodules}/fglrx.ko"
  install -dm755 "${pkgdir}/usr/lib/modprobe.d"
  echo "blacklist radeon" >> "${pkgdir}/usr/lib/modprobe.d/catalyst.conf"
  sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/catalyst.install"
  gzip "${pkgdir}/usr/lib/modules/${_extramodules}/fglrx.ko"
  
  # license
  install -Dm644 "${srcdir}/fglrx-install/LICENSE.TXT" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.TXT"
}