From 37dbb8b4b97b6f31708b006f55921166ba7c9b1a Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@plugapps.com>
Date: Fri, 14 Jan 2011 17:52:00 -0500
Subject: [PATCH] Added extra/mesa with only swrast DRI driver

---
 extra/mesa/LICENSE  |  82 +++++++++++++++++++++++++++++++++
 extra/mesa/PKGBUILD | 110 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 192 insertions(+)
 create mode 100644 extra/mesa/LICENSE
 create mode 100644 extra/mesa/PKGBUILD

diff --git a/extra/mesa/LICENSE b/extra/mesa/LICENSE
new file mode 100644
index 000000000..ae33d2709
--- /dev/null
+++ b/extra/mesa/LICENSE
@@ -0,0 +1,82 @@
+Disclaimer
+
+Mesa is a 3-D graphics library with an API which is very similar to
+that of OpenGL*
+To the extent that Mesa utilizes the OpenGL command syntax or state
+machine, it is being used with authorization from Silicon Graphics,
+Inc.(SGI). However, the author does not possess an OpenGL license
+from SGI, and makes no claim that Mesa is in any way a compatible
+replacement for OpenGL or associated with SGI. Those who want a
+licensed implementation of OpenGL should contact a licensed
+vendor.
+
+Please do not refer to the library as MesaGL (for legal
+reasons). It's just Mesa or The Mesa 3-D graphics
+library
+
+* OpenGL is a trademark of Silicon Graphics Incorporated.
+
+License / Copyright Information
+
+The Mesa distribution consists of several components.  Different copyrights
+and licenses apply to different components.  For example, GLUT is copyrighted
+by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa
+device drivers are copyrighted by their authors.  See below for a list of
+Mesa's main components and the license for each.
+
+The core Mesa library is licensed according to the terms of the MIT license.
+This allows integration with the XFree86, Xorg and DRI projects.
+
+The default Mesa license is as follows:
+
+Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Attention, Contributors
+
+When contributing to the Mesa project you must agree to the licensing terms
+of the component to which you're contributing.
+The following section lists the primary components of the Mesa distribution
+and their respective licenses.
+
+
+Mesa Component Licenses
+
+Component         Location               Primary Author      License
+----------------------------------------------------------------------------
+Main Mesa code    src/mesa/              Brian Paul          Mesa (MIT)
+
+Device drivers    src/mesa/drivers/*     See drivers         See drivers
+
+Ext headers       include/GL/glext.h     SGI                 SGI Free B
+                  include/GL/glxext.h
+
+GLUT              src/glut/              Mark Kilgard        Mark's copyright
+
+Mesa GLU library  src/glu/mesa/          Brian Paul          GNU-LGPL
+
+SGI GLU library   src/glu/sgi/           SGI                 SGI Free B
+
+demo programs     progs/demos/           various             see source files
+
+X demos           progs/xdemos/          Brian Paul          see source files
+
+SGI demos         progs/samples/         SGI                 SGI copyright
+
+RedBook demos     progs/redbook/         SGI                 SGI copyright
diff --git a/extra/mesa/PKGBUILD b/extra/mesa/PKGBUILD
new file mode 100644
index 000000000..340e13ac0
--- /dev/null
+++ b/extra/mesa/PKGBUILD
@@ -0,0 +1,110 @@
+# $Id: PKGBUILD 102424 2010-12-07 20:27:42Z andyrtr $
+# Maintainer: Jan de Groot <jgc@archlinux.org>
+# Maintainer: Andreas Radke <andyrtr@archlinux.org>
+
+# PlugApps: Kevin Mihelich <kevin@plugapps.com>
+#  - Removed DRI and Gallium3D drivers/packages for chipsets that don't exist in plugs (intel, radeon, etc).
+#  - Package for the swrast driver for those brave enough.
+
+plugrel=1
+
+pkgbase=mesa
+pkgname=('mesa' 'libgl' 'swrast-dri')
+pkgver=7.9.0.git20101207
+pkgrel=2
+arch=(i686 x86_64)
+makedepends=('glproto>=1.4.12' 'pkgconfig' 'libdrm>=2.4.22' 'libxxf86vm>=1.1.0' 'libxdamage>=1.1.3' 'expat>=2.0.1' 'libx11>=1.3.5' 'libxt>=1.0.8' 
+             'gcc-libs>=4.5' 'dri2proto=2.3' 'python2' 'talloc' 'libxml2')
+url="http://mesa3d.sourceforge.net"
+license=('custom')
+source=( # ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2
+	# mesa git shot from 7.9 branch - see for state: http://cgit.freedesktop.org/mesa/mesa/commit/?h=7.9&id=dc4956922dfbec2fb2f60539be97760022bd4613
+	ftp://ftp.archlinux.org/other/mesa/mesa-dc4956922dfbec2fb2f60539be97760022bd4613.tar.bz2
+        ftp://ftp.archlinux.org/other/mesa/gl-manpages-1.0.1.tar.bz2
+        LICENSE)
+md5sums=('c44b2d5a82f466325163cb68abe61ec7'
+         '6ae05158e678f4594343f32c2ca50515'
+         '5c65a0fe315dd347e09b1f2826a1df5a')
+
+build() {
+#  cd "${srcdir}/Mesa-${pkgver}"
+  cd ${srcdir}/mesa-*
+
+  # required for git build
+#  autoreconf -vfi
+
+  # python2 build fixes
+  sed -i -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
+         -e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" $(find $srcdir -name '*.py')
+#  sed -i -e "s|PYTHON2 = python|PYTHON2 = python2|" "${srcdir}/Mesa-${pkgver}"/configs/{default,autoconf.in}
+  sed -i -e "s|PYTHON2 = python|PYTHON2 = python2|" ${srcdir}/mesa-*/configs/{default,autoconf.in}
+#  sed -i -e "s|python|python2|" "${srcdir}/Mesa-${pkgver}"/src/gallium/auxiliary/Makefile
+  sed -i -e "s|python|python2|" ${srcdir}/mesa-*/src/gallium/auxiliary/Makefile
+
+#  ./configure --prefix=/usr \
+  ./autogen.sh --prefix=/usr \
+    --with-dri-driverdir=/usr/lib/xorg/modules/dri \
+    --with-dri-drivers="swrast" \
+    --disable-egl \
+    --enable-gallium-swrast \
+    --enable-glx-tls \
+    --with-driver=dri \
+    --enable-xcb \
+    --with-state-trackers=dri,glx \
+    --disable-glut
+  make
+
+  cd "${srcdir}/gl-manpages-1.0.1"
+  ./configure --prefix=/usr
+  make
+}
+
+package_libgl() {
+  depends=('libdrm>=2.4.22' 'libxxf86vm>=1.1.0' 'libxdamage>=1.1.3' 'expat>=2.0.1')
+  pkgdesc="Mesa 3-D graphics library and DRI software rasterizer"
+
+#  cd "${srcdir}/Mesa-${pkgver}"
+  cd ${srcdir}/mesa-*
+  install -m755 -d "${pkgdir}/usr/lib"
+  install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions"
+
+  bin/minstall lib/libGL.so* "${pkgdir}/usr/lib/"
+
+  cd src/mesa/drivers/dri
+  make -C swrast DESTDIR="${pkgdir}" install
+  ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so"
+
+  install -m755 -d "${pkgdir}/usr/share/licenses/libgl"
+  install -m755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/libgl/"
+}
+
+package_mesa() {
+  depends=('libgl' 'libx11>=1.3.5' 'libxt>=1.0.8' 'gcc-libs>=4.5' 'dri2proto=2.3' 'libdrm>=2.4.22' 'glproto>=1.4.12')
+  pkgdesc="Mesa 3-D graphics libraries and include files"
+
+#  cd "${srcdir}/Mesa-${pkgver}"
+  cd ${srcdir}/mesa-*
+  make DESTDIR="${pkgdir}" install
+
+  rm -f "${pkgdir}/usr/lib/libGL.so"*
+  rm -rf "${pkgdir}/usr/lib/xorg"
+  rm -f "${pkgdir}/usr/include/GL/glew.h"
+  rm -f "${pkgdir}/usr/include/GL/glxew.h"
+  rm -f "${pkgdir}/usr/include/GL/wglew.h"
+  rm -f "${pkgdir}/usr/include/GL/glut.h"
+
+  cd "${srcdir}/gl-manpages-1.0.1"
+  make DESTDIR="${pkgdir}" install
+
+  install -m755 -d "${pkgdir}/usr/share/licenses/mesa"
+  install -m755 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/"
+}
+
+package_swrast-dri() {
+  depends=("libgl=${pkgver}")
+  pkgdesc="Mesa DRI + Gallium3D swrast drivers"
+
+  cd ${srcdir}/mesa-*/src/mesa/drivers/dri
+  make -C swrast DESTDIR="${pkgdir}" install
+  make -C ${srcdir}/mesa-*/src/gallium/targets/dri-swrast DESTDIR="${pkgdir}" install
+}