--- /dev/null
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=Mesa
+PKG_RELEASE:=1
+PKG_VERSION:=7.2
+
+PKG_SOURCE_URL:=@SF/mesa3d
+PKG_SOURCE:=$(PKG_NAME)Lib-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=04d379292e023df0b0266825cb0dbde5
+PKG_FIXUP:=libtool
+PKG_BUILD_DEPENDS:=glproto
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL:=1
+
+define Package/libgl-mesa
+ SECTION:=xorg-lib
+ CATEGORY:=Xorg
+ SUBMENU:=lib
+ DEPENDS:=+libX11 +libXext +libXfixes +libXdamage +libXxf86vm +libdrm
+ TITLE:=Mesa OpenGL library
+ URL:=http://mesa3d.org
+endef
+
+define Package/libglu-mesa
+ SECTION:=xorg-lib
+ CATEGORY:=Xorg
+ SUBMENU:=lib
+ DEPENDS:=+libgl-mesa
+ TITLE:=Mesa OpenGL utility library
+ URL:=http://mesa3d.org
+endef
+
+define Package/libgl-mesa-dri/Default
+define Package/libgl-mesa-dri-$(1)
+ SECTION:=xorg-lib
+ CATEGORY:=Xorg
+ SUBMENU:=lib
+ DEPENDS:=libgl-mesa
+ TITLE:=mesa dri $(1)
+ URL:=http://mesa3d.org
+endef
+endef
+
+DRIDRIVERS:=i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
+ savage sis tdfx trident unichrome ffb swrast
+
+$(foreach dri,$(DRIDRIVERS),$(eval $(call Package/libgl-mesa-dri/Default,$(dri))))
+
+STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(call confvar,CONFIG_PACKAGE_libgl-mesa \
+ CONFIG_PACKAGE_libglu-mesa \
+ $(foreach dri,$(DRIDRIVERS),CONFIG_PACKAGE_libgl-mesa-dri-$(dri)))
+
+define Build/Configure
+ $(call Build/Configure/Default, \
+ --disable-glw \
+ --with-driver=dri \
+ --with-dri-drivers="$(foreach dri,$(DRIDRIVERS),$(if $(CONFIG_PACKAGE_libgl-mesa-dri-$(dri)),$(dri)))" \
+ )
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/{include/GL,lib/pkgconfig}
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/include/GL/* \
+ $(1)/usr/include/GL
+
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+ $(1)/usr/lib
+
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+ $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libgl-mesa/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/libGL.so* \
+ $(1)/usr/lib/
+endef
+
+define Package/libglu-mesa/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/libGLU.so* \
+ $(1)/usr/lib/
+endef
+
+define Package/libgl-mesa-dri/install/Default
+define Package/libgl-mesa-dri-$(1)/install
+ $(INSTALL_DIR) $$(1)/usr/lib/dri/
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/dri/$(1)_dri.so* \
+ $$(1)/usr/lib/dri
+endef
+endef
+
+$(foreach dri,$(DRIDRIVERS),$(eval $(call Package/libgl-mesa-dri/install/Default,$(dri))))
+
+$(eval $(call BuildPackage,libgl-mesa))
+$(eval $(call BuildPackage,libglu-mesa))
+$(foreach dri,$(DRIDRIVERS),$(eval $(call BuildPackage,libgl-mesa-dri-$(dri))))
--- /dev/null
+diff --git a/src/glu/glu.pc.in b/src/glu/glu.pc.in
+index 8606b9b..4ed39f9 100644
+--- a/src/glu/glu.pc.in
++++ b/src/glu/glu.pc.in
+@@ -1,10 +1,10 @@
+-prefix=@INSTALL_DIR@
+-exec_prefix=${prefix}
+-libdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
+
+ Name: glu
+ Description: Mesa OpenGL Utility library
+ Requires: gl
+-Version: @VERSION@
++Version: @PACKAGE_VERSION@
+ Libs: -L${libdir} -lGLU
+diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in
+index 25f3f73..2b9a343 100644
+--- a/src/glw/glw.pc.in
++++ b/src/glw/glw.pc.in
+@@ -1,10 +1,10 @@
+-prefix=@INSTALL_DIR@
+-exec_prefix=${prefix}
+-libdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
+
+ Name: glw
+ Description: Mesa OpenGL widget library
+ Requires: gl
+-Version: @VERSION@
++Version: @PACKAGE_VERSION@
+ Libs: -L${libdir} -lGLw
+diff --git a/src/mesa/drivers/dri/dri.pc.in b/src/mesa/drivers/dri/dri.pc.in
+index c47ee9c..3abb846 100644
+--- a/src/mesa/drivers/dri/dri.pc.in
++++ b/src/mesa/drivers/dri/dri.pc.in
+@@ -1,10 +1,10 @@
+-prefix=@INSTALL_DIR@
+-exec_prefix=${prefix}
+-libdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
+-dridriverdir=@DRI_DRIVER_DIR@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++dridriverdir=@DRI_DRIVER_INSTALL_DIR@
+
+ Name: dri
+ Description: Direct Rendering Infrastructure
+-Version: @VERSION@
++Version: @PACKAGE_VERSION@
+ Cflags: -I${includedir}
+diff --git a/src/mesa/gl.pc.in b/src/mesa/gl.pc.in
+index 1927880..716876b 100644
+--- a/src/mesa/gl.pc.in
++++ b/src/mesa/gl.pc.in
+@@ -1,10 +1,10 @@
+-prefix=@INSTALL_DIR@
+-exec_prefix=${prefix}
+-libdir=@INSTALL_LIB_DIR@
+-includedir=@INSTALL_INC_DIR@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
+
+ Name: gl
+ Description: Mesa OpenGL library
+ Requires:
+-Version: @VERSION@
++Version: @PACKAGE_VERSION@
+ Libs: -L${libdir} -lGL
+diff --git a/configure b/configure
+index 77bc39b..4767483 100755
+--- a/configure
++++ b/configure
+@@ -8858,7 +8858,7 @@ fi
+ LDFLAGS="$_SAVE_LDFLAGS"
+ CPPFLAGS="$_SAVE_CPPFLAGS"
+
+-ac_config_files="$ac_config_files configs/autoconf"
++ac_config_files="$ac_config_files configs/autoconf src/glu/glu.pc src/glw/glw.pc src/mesa/drivers/dri/dri.pc src/mesa/gl.pc"
+
+
+ ac_config_commands="$ac_config_commands configs"
+@@ -9435,6 +9435,10 @@ cat >>$CONFIG_STATUS <<\_ACEOF
+ for ac_config_target in $ac_config_targets
+ do
+ case $ac_config_target in
++ "src/glu/glu.pc") CONFIG_FILES="$CONFIG_FILES src/glu/glu.pc" ;;
++ "src/glw/glw.pc") CONFIG_FILES="$CONFIG_FILES src/glw/glw.pc" ;;
++ "src/mesa/drivers/dri/dri.pc") CONFIG_FILES="$CONFIG_FILES src/mesa/drivers/dri/dri.pc" ;;
++ "src/mesa/gl.pc") CONFIG_FILES="$CONFIG_FILES src/mesa/gl.pc" ;;
+ "configs/autoconf") CONFIG_FILES="$CONFIG_FILES configs/autoconf" ;;
+ "configs") CONFIG_COMMANDS="$CONFIG_COMMANDS configs" ;;
+