From 6d9f39b8276ea1b742065560e23cd909ac0e6123 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 16 Oct 2012 07:46:21 +0000
Subject: [PATCH] main/mesa: upgrade to 9.0

---
 main/mesa/APKBUILD                            | 64 ++++++++-----------
 main/mesa/imports-uclibc.patch                | 11 ----
 main/mesa/mesa-8.0.3-llvm-3.1-fixes.patch     | 46 -------------
 main/mesa/mesa-8.0.3-uclibc-strtod.patch      | 11 ----
 main/mesa/parallel.patch                      | 14 ----
 ...clibc-gallium.patch => uclibc-debug.patch} | 11 ++--
 6 files changed, 33 insertions(+), 124 deletions(-)
 delete mode 100644 main/mesa/imports-uclibc.patch
 delete mode 100644 main/mesa/mesa-8.0.3-llvm-3.1-fixes.patch
 delete mode 100644 main/mesa/mesa-8.0.3-uclibc-strtod.patch
 delete mode 100644 main/mesa/parallel.patch
 rename main/mesa/{mesa-7.10-uclibc-gallium.patch => uclibc-debug.patch} (65%)

diff --git a/main/mesa/APKBUILD b/main/mesa/APKBUILD
index 7485da2b3619..4e4352c32661 100644
--- a/main/mesa/APKBUILD
+++ b/main/mesa/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
 pkgname=mesa
-pkgver=8.0.4
-pkgrel=2
+pkgver=9.0
+pkgrel=0
 pkgdesc="Mesa DRI OpenGL library"
 url="http://www.mesa3d.org"
 arch="all"
@@ -10,26 +10,23 @@ depends=
 subpackages="$pkgname-dev 
 	$pkgname-dri-ati:ati
 	$pkgname-dri-intel:intel
+	$pkgname-dri-nouveau:nouveau
 	$pkgname-dri-swrast:swrast
 	$pkgname-dri-vmwgfx:vmwgfx
-	$pkgname-glapi $pkgname-egl $pkgname-glu $pkgname-gl $pkgname-gles
+	$pkgname-dricore $pkgname-glapi $pkgname-egl $pkgname-gl $pkgname-gles
 	$pkgname-xatracker $pkgname-osmesa $pkgname-gbm
 	"
-#	$pkgname-dri-nouveau:nouveau
 
 depends_dev="libdrm-dev dri2proto libx11-dev libxext-dev libxxf86vm-dev
 	libxdamage-dev libxfixes-dev libxcb-dev glproto"
 makedepends="$depends_dev expat-dev xextproto python libxt-dev makedepend
-	talloc-dev py-libxml2 flex bison llvm-dev udev-dev
-	autoconf automake"
+	talloc-dev py-libxml2 flex bison llvm-dev udev-dev libvdpau-dev
+	libxvmc-dev
+	autoconf automake libtool"
 source="ftp://ftp.freedesktop.org/pub/mesa/$pkgver/MesaLib-$pkgver.tar.bz2
-	mesa-8.0.3-uclibc-strtod.patch
-	mesa-8.0.3-llvm-3.1-fixes.patch
-	mesa-7.10-uclibc-gallium.patch
-	imports-uclibc.patch
 	glx_ro_text_segm.patch
 	ccache.patch
-	parallel.patch
+	uclibc-debug.patch
 	"
 
 
@@ -53,19 +50,23 @@ prepare() {
 		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
 		esac
 	done
-	aclocal && automake --add-missing && autoreconf || return 1
+	libtoolize --force \
+		&& aclocal \
+		&& automake --add-missing \
+		&& autoreconf || return 1
 }
 
 build() {
 	cd "$_builddir"
 	export LDFLAGS="$LDFLAGS -Wl,-z,lazy"
 	./configure --prefix=/usr \
+		--sysconfdir=/etc \
 		--with-dri-driverdir=$_dri_driverdir \
 		--disable-asm \
 		--enable-pic \
 		--enable-glx-rts \
-		--with-gallium-drivers=r300,r600,svga,swrast \
-		--with-dri-drivers=i915,i965,r200,radeon,swrast \
+		--with-gallium-drivers=r300,r600,svga,swrast,nouveau \
+		--with-dri-drivers=i915,i965,r200,radeon,swrast,nouveau \
 		--enable-gallium-llvm \
 		--enable-gallium-egl \
 		--enable-shared-glapi \
@@ -79,17 +80,8 @@ build() {
 		--enable-egl \
 		--enable-texture-float \
 		--enable-xa \
-		--enable-shared-dricore \
 		|| return 1
 
-#		--with-driver=dri \
-#		--enable-egl \
-#		--enable-gles2 \
-#		--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast \
-#		--enable-gallium-llvm \
-#		--enable-gallium-egl \
-#		--enable-glx-rts \
-	make -C src/mesa depend || return 1
 	make || return 1
 	
 	# check so we dont have any bind NOW
@@ -100,6 +92,15 @@ build() {
 package() {
 	cd "$_builddir"
 	make -j1 DESTDIR="$pkgdir" install || return 1
+	find "$pkgdir" -name '*.la' -delete
+}
+
+dricore() {
+	pkgdesc="Mesa dricore runtime libraries"
+	install -d "$subpkgdir"/usr/lib "$subpkgdir"/etc
+	mv "$pkgdir"/usr/lib/libdricore*.so.* \
+		"$subpkgdir"/usr/lib/
+	mv "$pkgdir"/etc/drirc "$subpkgdir"/etc/drirc
 }
 
 egl() {
@@ -116,18 +117,9 @@ gl() {
 	pkgdesc="Mesa libGL runtime libraries"
 	install -d "$subpkgdir"/usr/lib
 	mv "$pkgdir"/usr/lib/libGL.so* \
-		"$pkgdir"/$_dri_driverdir/libglsl.so \
-		"$pkgdir"/$_dri_driverdir/libdricore.so \
 		"$subpkgdir"/usr/lib/
 }
 
-glu() {
-	replaces="mesa"
-	pkgdesc="Mesa libGLU runtime libraries"
-	install -d "$subpkgdir"/usr/lib
-	mv "$pkgdir"/usr/lib/libGLU.so* "$subpkgdir"/usr/lib/
-}
-
 glapi() {
 	replaces="$pkgname-gles"
 	pkgdesc="Mesa shared glapi"
@@ -182,11 +174,7 @@ nouveau() {	_mv_dri nouveau_dri nouveau_vieux_dri; }
 swrast() {	_mv_dri swrast_dri; }
 vmwgfx() {	_mv_dri vmwgfx_dri; }
 
-md5sums="d546f988adfdf986cff45b1efa2d8a46  MesaLib-8.0.4.tar.bz2
-13cc91257dac1311013f681705bcf3aa  mesa-8.0.3-uclibc-strtod.patch
-c452ed3392468170726c004c2f4e02ca  mesa-8.0.3-llvm-3.1-fixes.patch
-90a2ea438ff328443a0436a91a74d518  mesa-7.10-uclibc-gallium.patch
-bc2d3e144f7577be016b44b514d0b923  imports-uclibc.patch
+md5sums="60e557ce407be3732711da484ab3db6c  MesaLib-9.0.tar.bz2
 a1a766b4c6a96d67cad9bd7ad5c578e8  glx_ro_text_segm.patch
 1f30bf8340114b455f005cc9b134c414  ccache.patch
-d6319aa729775249541550154ebf7d8f  parallel.patch"
+cff511b3d459189751c841b8f99e7112  uclibc-debug.patch"
diff --git a/main/mesa/imports-uclibc.patch b/main/mesa/imports-uclibc.patch
deleted file mode 100644
index 19e7e32d7246..000000000000
--- a/main/mesa/imports-uclibc.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./src/mesa/main/imports.c.orig
-+++ ./src/mesa/main/imports.c
-@@ -767,7 +767,7 @@
- _mesa_strtof( const char *s, char **end )
- {
- #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
--   !defined(ANDROID) && !defined(__HAIKU__)
-+   !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__)
-    static locale_t loc = NULL;
-    if (!loc) {
-       loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/main/mesa/mesa-8.0.3-llvm-3.1-fixes.patch b/main/mesa/mesa-8.0.3-llvm-3.1-fixes.patch
deleted file mode 100644
index a567b5926375..000000000000
--- a/main/mesa/mesa-8.0.3-llvm-3.1-fixes.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
-index a50a51d..f1bb4d9 100644
---- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
-+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
-@@ -235,7 +235,24 @@ lp_disassemble(const void* func)
-    int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
- #endif
- 
--#if HAVE_LLVM >= 0x0300
-+#if HAVE_LLVM >= 0x0301
-+   OwningPtr<const MCRegisterInfo> MRI(T->createMCRegInfo(Triple));
-+   if (!MRI) {
-+      debug_printf("error: no register info for target %s\n", Triple.c_str());
-+      return;
-+   }
-+
-+   OwningPtr<const MCInstrInfo> MII(T->createMCInstrInfo());
-+   if (!MII) {
-+      debug_printf("error: no instruction info for target %s\n", Triple.c_str());
-+      return;
-+   }
-+#endif
-+
-+#if HAVE_LLVM >= 0x0301
-+   OwningPtr<MCInstPrinter> Printer(
-+         T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *MII, *MRI, *STI));
-+#elif HAVE_LLVM == 0x0300
-    OwningPtr<MCInstPrinter> Printer(
-          T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo, *STI));
- #elif HAVE_LLVM >= 0x0208
-diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
-index fe7616b..68f8808 100644
---- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
-+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
-@@ -62,7 +62,11 @@
- extern "C" void
- lp_register_oprofile_jit_event_listener(LLVMExecutionEngineRef EE)
- {
-+#if HAVE_LLVM >= 0x0301
-+   llvm::unwrap(EE)->RegisterJITEventListener(llvm::JITEventListener::createOProfileJITEventListener());
-+#else
-    llvm::unwrap(EE)->RegisterJITEventListener(llvm::createOProfileJITEventListener());
-+#endif
- }
- 
- 
diff --git a/main/mesa/mesa-8.0.3-uclibc-strtod.patch b/main/mesa/mesa-8.0.3-uclibc-strtod.patch
deleted file mode 100644
index 53f4bd3f7727..000000000000
--- a/main/mesa/mesa-8.0.3-uclibc-strtod.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./src/glsl/strtod.c.orig
-+++ ./src/glsl/strtod.c
-@@ -45,7 +45,7 @@
- glsl_strtod(const char *s, char **end)
- {
- #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
--   !defined(__HAIKU__)
-+   !defined(__HAIKU__) && !defined(__UCLIBC__)
-    static locale_t loc = NULL;
-    if (!loc) {
-       loc = newlocale(LC_CTYPE_MASK, "C", NULL);
diff --git a/main/mesa/parallel.patch b/main/mesa/parallel.patch
deleted file mode 100644
index 44bd7b11f56d..000000000000
--- a/main/mesa/parallel.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- src/mesa/Makefile.orig
-+++ ./src/mesa/Makefile
-@@ -65,7 +65,10 @@
- 
- # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
- # then convenience libs (.a) and finally the device drivers:
--default: $(DEPENDS) asm_subdirs $(MESA_LIBS) $(DRICORE_LIBS) driver_subdirs
-+default: $(DEPENDS)
-+	@for i in asm_subdirs $(MESA_LIBS) $(DRICORE_LIBS) driver_subdirs; do \
-+		$(MAKE) $$i || exit 1; \
-+	done
- 
- # include glapi_gen.mk for generating glapi headers for GLES
- GLAPI := $(TOP)/src/mapi/glapi/gen
diff --git a/main/mesa/mesa-7.10-uclibc-gallium.patch b/main/mesa/uclibc-debug.patch
similarity index 65%
rename from main/mesa/mesa-7.10-uclibc-gallium.patch
rename to main/mesa/uclibc-debug.patch
index a14743bc172b..e503d15a6096 100644
--- a/main/mesa/mesa-7.10-uclibc-gallium.patch
+++ b/main/mesa/uclibc-debug.patch
@@ -1,15 +1,18 @@
---- Mesa-7.10.orig/src/gallium/auxiliary/util/u_debug_symbol.c
-+++ Mesa-7.10/src/gallium/auxiliary/util/u_debug_symbol.c
-@@ -145,7 +145,7 @@
+--- ./src/gallium/auxiliary/util/u_debug_symbol.c.orig
++++ ./src/gallium/auxiliary/util/u_debug_symbol.c
+@@ -151,10 +151,8 @@
  }
  #endif
  
 -#ifdef __GLIBC__
+-#ifndef __UCLIBC__
 +#if defined(__GLIBC__) && !defined(__UCLIBC__)
  #include <execinfo.h>
+-#endif
  
  /* This can only provide dynamic symbols, or binary offsets into a file.
-@@ -171,7 +171,7 @@
+  *
+@@ -179,7 +177,7 @@
        return;
  #endif
  
-- 
GitLab