summaryrefslogtreecommitdiff
path: root/extra/mesa
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-02-26 00:04:24 -0800
committerroot <root@rshg054.dnsready.net>2013-02-26 00:04:24 -0800
commit6c56414fe7bf470adb65cbd5ece3dce77ea9c617 (patch)
tree4190641f9a1d00a142902d10b7fbc068751e3821 /extra/mesa
parent099ae9e11de65606b67c6344d4f62fcd74f20a36 (diff)
Tue Feb 26 00:04:24 PST 2013
Diffstat (limited to 'extra/mesa')
-rw-r--r--extra/mesa/PKGBUILD318
-rw-r--r--extra/mesa/llvm32.patch284
2 files changed, 84 insertions, 518 deletions
diff --git a/extra/mesa/PKGBUILD b/extra/mesa/PKGBUILD
index e7c0a4029..51a0e0fe4 100644
--- a/extra/mesa/PKGBUILD
+++ b/extra/mesa/PKGBUILD
@@ -1,46 +1,29 @@
-# $Id: PKGBUILD 175899 2013-01-23 16:58:37Z andyrtr $
+# $Id: PKGBUILD 178616 2013-02-25 20:44:59Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
pkgbase=mesa
-pkgname=('libglapi' 'libgl' 'mesa' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel' 'ati-dri' 'intel-dri' 'svga-dri' 'nouveau-dri')
-
-#_git=true
-#_gitdate=20121006
-_git=false
-
-if [ "${_git}" = "true" ]; then
- pkgver=8.99.git_$_gitdate
- else
- pkgver=9.0.2
-fi
-pkgrel=1
+pkgname=('ati-dri' 'intel-dri' 'nouveau-dri' 'svga-dri' 'mesa' 'mesa-libgl')
+pkgver=9.1
+pkgrel=2
arch=('i686' 'x86_64')
-makedepends=('glproto>=1.4.16' 'libdrm>=2.4.39' 'libxxf86vm>=1.1.2' 'libxdamage>=1.1.3' 'expat>=2.1.0' 'libx11>=1.5.0' 'libxt>=1.1.3'
- 'gcc-libs>=4.7.1-6' 'dri2proto>=2.8' 'python2' 'libxml2' 'imake' 'llvm-amdgpu-snapshot' 'systemd' 'libvdpau>=0.5')
+makedepends=('python2' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'libxxf86vm' 'libxdamage'
+ 'libvdpau' 'wayland' 'llvm-amdgpu-snapshot')
url="http://mesa3d.sourceforge.net"
license=('custom')
options=('!libtool')
-source=(LICENSE llvm32.patch)
-if [ "${_git}" = "true" ]; then
- # mesa git shot from 9.0 branch - see for state: http://cgit.freedesktop.org/mesa/mesa/log/?h=9.0
- #source=(${source[@]} 'ftp://ftp.archlinux.org/other/mesa/mesa-41d14eaf193c6b1eb87fe1998808a887f1c6c698.tar.gz')
- source=(${source[@]} "MesaLib-git${_gitdate}.zip"::"http://cgit.freedesktop.org/mesa/mesa/snapshot/mesa-7851d398def2df3f6836a500d67123eed50f3943.tar.gz")
- else
- source=(${source[@]} "ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2"
- #source=(${source[@]} "ftp://ftp.freedesktop.org/pub/mesa/8.0/MesaLib-8.0-rc2.tar.bz2"
-)
-fi
-md5sums=('5c65a0fe315dd347e09b1f2826a1df5a'
- '5fe9ad0c5beed19bc98d8c34aaad4ade'
- 'dc45d1192203e418163e0017640e1cfc')
+source=(ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2
+ #ftp://ftp.freedesktop.org/pub/mesa/9.1/MesaLib-9.1-rc2.tar.bz2 # for RC testing
+ LICENSE)
+md5sums=('d3891e02215422e120271d976ff1947e'
+ '5c65a0fe315dd347e09b1f2826a1df5a')
build() {
cd ${srcdir}/?esa-*
-
- patch -Np1 -i ${srcdir}/llvm32.patch
- COMMONOPTS="--prefix=/usr \
+ autoreconf -vfi # our automake is far too new for their build system :)
+
+ ./configure --prefix=/usr \
--sysconfdir=/etc \
--with-dri-driverdir=/usr/lib/xorg/modules/dri \
--with-gallium-drivers=r300,r600,radeonsi,nouveau,svga,swrast \
@@ -48,7 +31,7 @@ build() {
--enable-gallium-llvm \
--enable-egl \
--enable-gallium-egl \
- --with-egl-platforms=x11,drm \
+ --with-egl-platforms=x11,drm,wayland \
--enable-shared-glapi \
--enable-gbm \
--enable-glx-tls \
@@ -59,240 +42,107 @@ build() {
--enable-gles2 \
--enable-texture-float \
--enable-xa \
- --enable-vdpau "
-
-# not default:
-# --enable-gallium-egl enable optional EGL state tracker (not required for
-# EGL support in Gallium with OpenGL and OpenGL ES)
-# [default=disable]
-# --enable-xa enable build of the XA X Acceleration API [default=no]
-
-
-if [ "${_git}" = "true" ]; then
- ./autogen.sh \
- $COMMONOPTS
- else
- autoreconf -vfi
- ./configure \
- $COMMONOPTS
-fi
-
- # fix a build break with new llvm
- sed -i "s:-Werror=implicit-function-declaration::" src/gallium/drivers/r600/Makefile
+ --enable-vdpau \
+ # --help
+ # --with-llvm-shared-libs \ # enabling this would force us to move llvm-amdgpu-snapshot from community to extra, delay it until llvm 3.3 / Mesa 9.2/10.0
make
-}
-
-package_libglapi() {
- depends=('glibc')
- pkgdesc="free implementation of the GL API -- shared library. The Mesa GL API module is responsible for dispatching all the gl* functions"
-
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
-
- install -m755 -d "${pkgdir}/usr/share/licenses/libglapi"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libglapi/"
-}
-
-package_libgl() {
- depends=('libdrm>=2.4.39' 'libxxf86vm>=1.1.2' 'libxdamage>=1.1.3' 'expat>=2.1.0' 'libglapi' 'gcc-libs')
- pkgdesc="Mesa 3-D graphics library and DRI software rasterizer"
-
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
-
- # libGL & libdricore
- make -C ${srcdir}/?esa-*/src/glx DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" uninstall
-
-
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-swrast DESTDIR="${pkgdir}" install
-
- # See FS#26284
- install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions"
- ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
-
- install -m755 -d "${pkgdir}/usr/share/licenses/libgl"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgl/"
-}
-
-package_mesa() {
- # check also gl.pc
- depends=('libgl' 'libx11>=1.5.0' 'libxext>=1.3.1' 'libxdamage' 'libxfixes' 'libxcb' 'libxxf86vm')
- optdepends=('opengl-man-pages: for the OpenGL API man pages')
- pkgdesc="Mesa 3-D graphics libraries and include files"
-
- make -C ${srcdir}/?esa-*/src/mesa DESTDIR="${pkgdir}" install-glHEADERS
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri DESTDIR="${pkgdir}" install-driincludeHEADERS
- make -C ${srcdir}/?esa-*/src/mesa DESTDIR="${pkgdir}" install-pkgconfigDATA
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri DESTDIR="${pkgdir}" install-pkgconfigDATA
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/common DESTDIR="${pkgdir}" install-sysconfDATA
-
- make -C ${srcdir}/?esa-*/src/gallium/targets/xa-vmwgfx DESTDIR="${pkgdir}" install
-
- install -m755 -d "${pkgdir}/usr/share/licenses/mesa"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/"
-}
-
-package_osmesa() {
- depends=('libglapi' 'gcc-libs')
- optdepends=('opengl-man-pages: for the OpenGL API man pages')
- pkgdesc="Mesa 3D off-screen rendering library"
-
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
-
- make -C ${srcdir}/?esa-*/src/mesa/drivers/osmesa DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" uninstall
-
- install -m755 -d "${pkgdir}/usr/share/licenses/osmesa"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/osmesa/"
-}
-
-package_libgbm() {
- depends=('systemd' 'libglapi' 'libdrm')
- pkgdesc="Mesa gbm library"
-
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
-
- make -C ${srcdir}/?esa-*/src/gbm DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" uninstall
-
- install -m755 -d "${pkgdir}/usr/share/licenses/libgbm"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgbm/"
-}
-
-package_libgles() {
- depends=('libglapi' 'libdrm' 'khrplatform-devel')
- pkgdesc="Mesa GLES libraries and headers"
-
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
-
- make -C ${srcdir}/?esa-*/src/mapi/es1api DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/mapi/es2api DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" uninstall
-
- install -m755 -d "${pkgdir}/usr/share/licenses/libgles"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgles/"
-}
-
-package_libegl() {
- # check also egl.pc
- depends=('libx11' 'libxext' 'libxdamage' 'libxfixes' 'libxxf86vm' 'libxcb' 'libgbm' 'khrplatform-devel')
- pkgdesc="Mesa EGL libraries and headers"
-
- make -C ${srcdir}/?esa-*/src/gallium/targets/egl-static DESTDIR="${pkgdir}" install
- install -m755 -d "${pkgdir}/usr/share/doc/libegl"
- install -m644 ${srcdir}/?esa-*/docs/egl.html "${pkgdir}/usr/share/doc/libegl/"
-
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/gbm DESTDIR="${pkgdir}" install
-
- make -C ${srcdir}/?esa-*/src/egl DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/gbm DESTDIR="${pkgdir}" uninstall
- make -C ${srcdir}/?esa-*/src/mapi/shared-glapi DESTDIR="${pkgdir}" uninstall
-
- install -m755 -d "${pkgdir}/usr/share/licenses/libegl"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libegl/"
-
- # fix file conflicts
- rm -rf ${pkgdir}/usr/include/KHR
-}
-
-package_khrplatform-devel() {
- pkgdesc="Khronos platform development package"
-
- install -m755 -d "${pkgdir}/usr/include/KHR"
- install -m644 ${srcdir}/?esa-*/include/KHR/khrplatform.h "${pkgdir}/usr/include/KHR/"
-
- install -m755 -d "${pkgdir}/usr/share/licenses/khrplatform-devel"
- install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/khrplatform-devel/"
+ # fake installation
+ mkdir $srcdir/fakeinstall
+ make DESTDIR=${srcdir}/fakeinstall install
}
package_ati-dri() {
- depends=("libgl=${pkgver}")
- pkgdesc="Mesa DRI radeon/r200 + Gallium3D r300,r600 drivers for AMD/ATI Radeon"
+ pkgdesc="Mesa drivers for AMD/ATI Radeon"
+ depends=("mesa-libgl=${pkgver}")
conflicts=('xf86-video-ati<6.9.0-6')
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" install
-
- # classic mesa drivers for radeon,r200
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/radeon DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/r200 DESTDIR="${pkgdir}" install
- # gallium3D driver for r300,r600,radeonsi
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-r300 DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-r600 DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-radeonsi DESTDIR="${pkgdir}" install
- # vdpau driver
- make -C ${srcdir}/?esa-*/src/gallium/targets/vdpau-r300 DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/gallium/targets/vdpau-r600 DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/gallium/targets/vdpau-radeonsi DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" uninstall
+ install -m755 -d ${pkgdir}/usr/lib/vdpau/
+ mv -v ${srcdir}/fakeinstall/usr/lib/vdpau/libvdpau_{r300,r600,radeonsi}.* ${pkgdir}/usr/lib/vdpau/
+ install -m755 -d ${pkgdir}/usr/lib/xorg/modules/dri
+ mv -v ${srcdir}/fakeinstall/usr/lib/xorg/modules/dri/{r200,r300,r600,radeon,radeonsi}_dri.so ${pkgdir}/usr/lib/xorg/modules/dri/
+
+ install -m755 -d ${pkgdir}/usr/lib/gallium-pipe
+ mv -v ${srcdir}/fakeinstall/usr/lib/gallium-pipe/pipe_{r300,r600,radeonsi}* ${pkgdir}/usr/lib/gallium-pipe/
+
install -m755 -d "${pkgdir}/usr/share/licenses/ati-dri"
install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/ati-dri/"
}
package_intel-dri() {
- depends=("libgl=${pkgver}")
- pkgdesc="Mesa DRI drivers for Intel"
+ pkgdesc="Mesa drivers for Intel"
+ depends=("mesa-libgl=${pkgver}")
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" install
+ install -m755 -d ${pkgdir}/usr/lib/xorg/modules/dri
+ mv -v ${srcdir}/fakeinstall/usr/lib/xorg/modules/dri/{i915,i965}_dri.so ${pkgdir}/usr/lib/xorg/modules/dri/
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/i915 DESTDIR="${pkgdir}" install
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/i965 DESTDIR="${pkgdir}" install
-
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" uninstall
-
install -m755 -d "${pkgdir}/usr/share/licenses/intel-dri"
install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/intel-dri/"
}
package_nouveau-dri() {
- depends=("libgl=${pkgver}")
- pkgdesc="Mesa classic DRI + Gallium3D drivers for Nouveau"
+ pkgdesc="Mesa drivers for Nouveau"
+ depends=("mesa-libgl=${pkgver}")
- # fix linking because of splitted package
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" install
+ install -m755 -d ${pkgdir}/usr/lib/vdpau/
+ mv -v ${srcdir}/fakeinstall/usr/lib/vdpau/libvdpau_nouveau.* ${pkgdir}/usr/lib/vdpau/
- # classic mesa driver for nv10 , nv20 nouveau_vieux_dri.so
- make -C ${srcdir}/?esa-*/src/mesa/drivers/dri/nouveau DESTDIR="${pkgdir}" install
- # gallium3D driver for nv30 - nv40 - nv50 nouveau_dri.so
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-nouveau DESTDIR="${pkgdir}" install
- # vdpau driver
- make -C ${srcdir}/?esa-*/src/gallium/targets/vdpau-nouveau DESTDIR="${pkgdir}" install
+ install -m755 -d ${pkgdir}/usr/lib/xorg/modules/dri
+ mv -v ${srcdir}/fakeinstall/usr/lib/xorg/modules/dri/nouveau_{dri,vieux_dri}.so ${pkgdir}/usr/lib/xorg/modules/dri/
- # fix linking because of splitted package - cleanup
- make -C ${srcdir}/?esa-*/src/mesa/libdricore DESTDIR="${pkgdir}" uninstall
+ install -m755 -d ${pkgdir}/usr/lib/gallium-pipe
+ mv -v ${srcdir}/fakeinstall/usr/lib/gallium-pipe/pipe_nouveau* ${pkgdir}/usr/lib/gallium-pipe/
install -m755 -d "${pkgdir}/usr/share/licenses/nouveau-dri"
install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/nouveau-dri/"
}
package_svga-dri() {
- depends=('gcc-libs' 'libdrm' 'expat')
pkgdesc="Gallium3D VMware guest GL driver"
+ depends=('gcc-libs' 'libdrm' 'expat' 'libffi')
+
+ install -m755 -d ${pkgdir}/usr/lib/xorg/modules/dri
+ mv -v ${srcdir}/fakeinstall/usr/lib/xorg/modules/dri/vmwgfx_dri.so ${pkgdir}/usr/lib/xorg/modules/dri/
- make -C ${srcdir}/?esa-*/src/gallium/targets/dri-vmwgfx DESTDIR="${pkgdir}" install
+ install -m755 -d ${pkgdir}/usr/lib/gallium-pipe
+ mv -v ${srcdir}/fakeinstall/usr/lib/gallium-pipe/pipe_vmwgfx* ${pkgdir}/usr/lib/gallium-pipe/
install -m755 -d "${pkgdir}/usr/share/licenses/svga-dri"
install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/svga-dri/"
}
+
+package_mesa() {
+ pkgdesc="an open-source implementation of the OpenGL specification"
+ depends=('libdrm' 'libvdpau' 'wayland' 'libxxf86vm' 'libxdamage' 'systemd')
+ optdepends=('opengl-man-pages: for the OpenGL API man pages')
+ provides=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel')
+ conflicts=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel')
+ replaces=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel')
+
+ mv -v ${srcdir}/fakeinstall/* ${pkgdir}
+ # rename libgl.so to not conflict with blobs - may break gl.pc ?
+ mv ${pkgdir}/usr/lib/libGL.so.1.2.0 ${pkgdir}/usr/lib/mesa-libGL.so.1.2.0
+ rm ${pkgdir}/usr/lib/libGL.so{,.1}
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/mesa"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/"
+}
+
+package_mesa-libgl() {
+ pkgdesc="Mesa 3-D graphics library"
+ depends=("mesa=${pkgver}")
+ provides=("libgl=${pkgver}")
+ replaces=('libgl')
+
+ # See FS#26284
+ install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions"
+ ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
+
+ ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so
+ ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1
+ ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1.2.0
+
+ install -m755 -d "${pkgdir}/usr/share/licenses/mesa-libgl"
+ install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa-libgl/"
+}
diff --git a/extra/mesa/llvm32.patch b/extra/mesa/llvm32.patch
deleted file mode 100644
index 946c07849..000000000
--- a/extra/mesa/llvm32.patch
+++ /dev/null
@@ -1,284 +0,0 @@
-From 8d9778589f4b3a174e884338adb0fe1bdeca5eb7 Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Thu, 10 May 2012 14:21:54 +0000
-Subject: radeon: Support LLVM 3.2
-
-LLVM 3.2 and newer requires that the R600/SI backend be part of the
-LLVM tree.
----
-diff --git a/configure.ac b/configure.ac
-index 896f98a..32f412b 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1661,6 +1661,7 @@ if test "x$enable_gallium_llvm" = xyes; then
- if $LLVM_CONFIG --components | grep -q '\<mcjit\>'; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
- fi
-+ LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets"
- if test "x$enable_opencl" = xyes; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
- fi
-@@ -1782,6 +1783,23 @@ gallium_require_drm_loader() {
- fi
- }
-
-+radeon_llvm_check() {
-+ LLVM_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
-+ if test "$LLVM_VERSION_MAJOR" -lt "3" -o "x$LLVM_VERSION" = "x3.0"; then
-+ AC_MSG_ERROR([LLVM 3.1 or newer is required for the r600/radeonsi llvm compiler.])
-+ fi
-+ if test "$LLVM_VERSION_MAJOR" -ge "3" -a "x$LLVM_VERSION" != "x3.1" && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
-+ AC_MSG_ERROR([To use the r600/radeonsi LLVM backend with LLVM 3.2 and newer, you need to fetch the LLVM source from:
-+ git://people.freedesktop.org/~tstellar/llvm master
-+ and build with --enable-experimental-targets==AMDGPU])
-+ fi
-+ if test "$LLVM_VERSION" = "3.2"; then
-+ dnl LLVM 3.2 does not add experimental libraries to llvm-config's
-+ dnl library list.
-+ LLVM_LIBS="$LLVM_LIBS -lLLVMAMDGPUCodeGen -lLLVMAMDGPUDesc -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUInfo `$LLVM_CONFIG --libs mc`"
-+ fi
-+}
-+
- dnl Gallium drivers
- dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
- if test "x$with_gallium_drivers" != x; then
-@@ -1812,9 +1830,7 @@ if test "x$with_gallium_drivers" != x; then
- gallium_require_drm_loader
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
- if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
-- if test "x$LLVM_VERSION" != "x3.1"; then
-- AC_MSG_ERROR([LLVM 3.1 is required for the r600 llvm compiler.])
-- fi
-+ radeon_llvm_check
- NEED_RADEON_GALLIUM=yes;
- fi
- if test "x$enable_r600_llvm" = xyes; then
-@@ -1829,9 +1845,7 @@ if test "x$with_gallium_drivers" != x; then
- PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
- gallium_require_drm_loader
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
-- if test "x$LLVM_VERSION" != "x3.1"; then
-- AC_MSG_ERROR([LLVM 3.1 is required to build the radeonsi driver.])
-- fi
-+ radeon_llvm_check
- NEED_RADEON_GALLIUM=yes;
- gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
- ;;
-diff --git a/src/gallium/drivers/radeon/Makefile b/src/gallium/drivers/radeon/Makefile
-index 7f1c613..bcc2646 100644
---- a/src/gallium/drivers/radeon/Makefile
-+++ b/src/gallium/drivers/radeon/Makefile
-@@ -12,6 +12,12 @@ TBLGEN = $(LLVM_BINDIR)/llvm-tblgen
-
- CXXFLAGS+= $(LLVM_CXXFLAGS)
-
-+ifeq ($(LLVM_VERSION),3.1)
-+ CPP_SOURCES += $(LLVM_CPP_SOURCES)
-+else
-+ CXXFLAGS+= -DEXTERNAL_LLVM
-+endif
-+
- include ../../Makefile.template
-
- CXXFLAGS := $(filter-out -DDEBUG, $(CXXFLAGS))
-diff --git a/src/gallium/drivers/radeon/Makefile.sources b/src/gallium/drivers/radeon/Makefile.sources
-index c5d1207..5e79342 100644
---- a/src/gallium/drivers/radeon/Makefile.sources
-+++ b/src/gallium/drivers/radeon/Makefile.sources
-@@ -23,8 +23,7 @@ TD_FILES := \
- SIRegisterInfo.td \
- SISchedule.td
-
--
--GENERATED_SOURCES := \
-+LLVM_GENERATED_SOURCES := \
- R600Intrinsics.td \
- R600RegisterInfo.td \
- SIRegisterInfo.td \
-@@ -41,7 +40,7 @@ GENERATED_SOURCES := \
- AMDGPUGenMCCodeEmitter.inc \
- AMDGPUGenDFAPacketizer.inc
-
--CPP_SOURCES := \
-+LLVM_CPP_SOURCES := \
- AMDIL7XXDevice.cpp \
- AMDILCFGStructurizer.cpp \
- AMDILDevice.cpp \
-@@ -81,6 +80,8 @@ CPP_SOURCES := \
- MCTargetDesc/SIMCCodeEmitter.cpp \
- MCTargetDesc/R600MCCodeEmitter.cpp \
- TargetInfo/AMDGPUTargetInfo.cpp \
-+
-+CPP_SOURCES := \
- radeon_llvm_emit.cpp
-
- C_SOURCES := \
-diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-index 1b67bfe..625b0b4 100644
---- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-@@ -90,6 +90,7 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
- /* XXX: Can we just initialize the AMDGPU target here? */
- InitializeAllTargets();
- InitializeAllTargetMCs();
-+ InitializeAllAsmPrinters();
- #else
- LLVMInitializeAMDGPUTargetInfo();
- LLVMInitializeAMDGPUTarget();
---
-cgit v0.9.0.2-2-gbebe
-From 67fcb3c2b4ecbd87e465b6c6b316be44811ea116 Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Mon, 01 Oct 2012 21:00:00 +0000
-Subject: configure.ac: Use amdgpu component for LLVM 3.2
-
-The amdgpu component actually does exist. I must have been using an
-older version of llvm-config by accident when I first made this change.
----
-diff --git a/configure.ac b/configure.ac
-index 32f412b..0de506d 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1793,10 +1793,8 @@ radeon_llvm_check() {
- git://people.freedesktop.org/~tstellar/llvm master
- and build with --enable-experimental-targets==AMDGPU])
- fi
-- if test "$LLVM_VERSION" = "3.2"; then
-- dnl LLVM 3.2 does not add experimental libraries to llvm-config's
-- dnl library list.
-- LLVM_LIBS="$LLVM_LIBS -lLLVMAMDGPUCodeGen -lLLVMAMDGPUDesc -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUInfo `$LLVM_CONFIG --libs mc`"
-+ if test "x$LLVM_VERSION" = "x3.2"; then
-+ LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
- fi
- }
-
---
-cgit v0.9.0.2-2-gbebe
-From 4cc530f452436a5304a628d1428ed7f07247a175 Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Wed, 10 Oct 2012 21:00:13 +0000
-Subject: radeon/llvm: Fix build with LLVM 3.2
-
----
-diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-index 2f2eb4c..21661a0 100644
---- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-@@ -36,13 +36,16 @@
- #include <llvm/Support/TargetRegistry.h>
- #include <llvm/Support/TargetSelect.h>
- #include <llvm/Support/Threading.h>
--#include <llvm/Target/TargetData.h>
- #include <llvm/Target/TargetMachine.h>
--
- #include <llvm/Transforms/Scalar.h>
--
- #include <llvm-c/Target.h>
-
-+#if HAVE_LLVM < 0x0302
-+#include <llvm/Target/TargetData.h>
-+#else
-+#include <llvm/DataLayout.h>
-+#endif
-+
- #include <iostream>
- #include <stdlib.h>
- #include <stdio.h>
-@@ -120,7 +123,11 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
- ));
- TargetMachine &AMDGPUTargetMachine = *tm.get();
- PassManager PM;
-+#if HAVE_LLVM < 0x0302
- PM.add(new TargetData(*AMDGPUTargetMachine.getTargetData()));
-+#else
-+ PM.add(new DataLayout(*AMDGPUTargetMachine.getDataLayout()));
-+#endif
- PM.add(createPromoteMemoryToRegisterPass());
- AMDGPUTargetMachine.setAsmVerbosityDefault(true);
-
---
-cgit v0.9.0.2-2-gbebe
-From b21455f27db6e55e708f8e264f4a15412ee8fa52 Mon Sep 17 00:00:00 2001
-From: Dmitry Cherkasov <dcherkassov@gmail.com>
-Date: Wed, 17 Oct 2012 18:03:13 +0000
-Subject: configure.ac: Fix LLVM 3.2 r600/radeonsi error message
-
-Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
-Signed-off-by: Dmitry Cherkasov <Dmitrii.Cherkasov@amd.com>
----
-diff --git a/configure.ac b/configure.ac
-index aefa142..ca24856 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1757,7 +1757,7 @@ radeon_llvm_check() {
- if test "$LLVM_VERSION_MAJOR" -ge "3" -a "x$LLVM_VERSION" != "x3.1" && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
- AC_MSG_ERROR([To use the r600/radeonsi LLVM backend with LLVM 3.2 and newer, you need to fetch the LLVM source from:
- git://people.freedesktop.org/~tstellar/llvm master
-- and build with --enable-experimental-targets==AMDGPU])
-+ and build with --enable-experimental-targets=AMDGPU])
- fi
- if test "x$LLVM_VERSION" = "x3.2"; then
- LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
---
-cgit v0.9.0.2-2-gbebe
-From d2b0338e3354fadc90a3751520f4aa44ba01954f Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Wed, 17 Oct 2012 19:21:48 +0000
-Subject: r600g: Remove special handling of PRED_SET* insructions for LLVM 3.2
-
-The 3.2 version of the backend now sets all the correct fields for
-PRED_SET* instructions.
----
-diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
-index 053a988..58b7fb2 100644
---- a/src/gallium/drivers/r600/r600_shader.c
-+++ b/src/gallium/drivers/r600/r600_shader.c
-@@ -330,6 +330,7 @@ static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx,
- alu.src[src_idx].sel += 512;
- }
-
-+#if HAVE_LLVM < 0x0302
- if (alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE) ||
- alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE) ||
- alu.inst == CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT) ||
-@@ -340,6 +341,7 @@ static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx,
- alu.src[1].chan = 0;
- alu.last = 1;
- }
-+#endif
-
- if (alu.execute_mask) {
- alu.pred_sel = 0;
---
-cgit v0.9.0.2-2-gbebe
-From f2f17fc348c847bbf5c54bb75b76e1661e8ced60 Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Mon, 01 Oct 2012 21:01:06 +0000
-Subject: radeon/llvm: Only initialize the AMDGPU target
-
----
-diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-index 625b0b4..2f2eb4c 100644
---- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
-@@ -86,17 +86,11 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char ** bytes,
-
- Triple AMDGPUTriple(sys::getDefaultTargetTriple());
-
--#ifdef EXTERNAL_LLVM
-- /* XXX: Can we just initialize the AMDGPU target here? */
-- InitializeAllTargets();
-- InitializeAllTargetMCs();
-- InitializeAllAsmPrinters();
--#else
- LLVMInitializeAMDGPUTargetInfo();
- LLVMInitializeAMDGPUTarget();
- LLVMInitializeAMDGPUTargetMC();
- LLVMInitializeAMDGPUAsmPrinter();
--#endif
-+
- std::string err;
- const Target * AMDGPUTarget = TargetRegistry::lookupTarget("r600", err);
- if(!AMDGPUTarget) {
---
-cgit v0.9.0.2-2-gbebe