[Mesa-dev] [PATCH 04/16] xmlconfig: move into src/util

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 30 12:45:45 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 configure.ac                                       |  2 +-
 src/gallium/state_trackers/dri/Makefile.am         |  2 +-
 src/gallium/state_trackers/dri/dri_screen.c        |  2 +-
 src/gallium/state_trackers/dri/dri_screen.h        |  2 +-
 src/gallium/targets/d3dadapter9/Makefile.am        |  1 -
 src/gallium/targets/d3dadapter9/drm.c              |  4 +-
 src/loader/Makefile.am                             |  4 +-
 src/loader/loader.c                                |  4 +-
 src/mesa/drivers/SConscript                        |  1 -
 src/mesa/drivers/dri/Makefile.am                   |  2 +-
 src/mesa/drivers/dri/common/Android.mk             | 48 +---------------------
 src/mesa/drivers/dri/common/Makefile.am            | 12 +-----
 src/mesa/drivers/dri/common/Makefile.sources       |  4 --
 src/mesa/drivers/dri/common/SConscript             |  7 +---
 src/mesa/drivers/dri/common/dri_util.c             |  2 +-
 src/mesa/drivers/dri/common/dri_util.h             |  2 +-
 src/mesa/drivers/dri/i915/Makefile.am              |  2 +-
 src/mesa/drivers/dri/i915/intel_screen.c           |  2 +-
 src/mesa/drivers/dri/i915/intel_screen.h           |  2 +-
 src/mesa/drivers/dri/i965/Makefile.am              |  2 +-
 src/mesa/drivers/dri/i965/intel_screen.c           |  2 +-
 src/mesa/drivers/dri/i965/intel_screen.h           |  2 +-
 src/mesa/drivers/dri/r200/Makefile.am              |  2 +-
 src/mesa/drivers/dri/r200/r200_context.c           |  2 +-
 src/mesa/drivers/dri/r200/r200_state_init.c        |  2 +-
 src/mesa/drivers/dri/r200/r200_tex.c               |  2 +-
 src/mesa/drivers/dri/radeon/Makefile.am            |  2 +-
 .../drivers/dri/radeon/radeon_common_context.c     |  2 +-
 src/mesa/drivers/dri/radeon/radeon_context.c       |  2 +-
 src/mesa/drivers/dri/radeon/radeon_screen.c        |  2 +-
 src/mesa/drivers/dri/radeon/radeon_screen.h        |  2 +-
 src/mesa/drivers/dri/radeon/radeon_state_init.c    |  2 +-
 src/mesa/drivers/dri/radeon/radeon_tex.c           |  2 +-
 src/mesa/drivers/dri/radeon/radeon_texture.c       |  2 +-
 src/mesa/drivers/dri/swrast/Makefile.am            |  2 +-
 src/util/Android.mk                                | 47 ++++++++++++++++++++-
 src/util/Makefile.am                               | 20 ++++++++-
 src/util/Makefile.sources                          |  4 ++
 src/util/SConscript                                | 16 +++++++-
 src/{mesa/drivers/dri/common => util}/drirc        |  0
 src/{mesa/drivers/dri/common => util}/xmlconfig.c  |  0
 src/{mesa/drivers/dri/common => util}/xmlconfig.h  |  0
 src/{mesa/drivers/dri/common => util}/xmlpool.h    |  0
 .../drivers/dri/common => util}/xmlpool/.gitignore |  0
 .../dri/common => util}/xmlpool/Makefile.am        |  0
 .../drivers/dri/common => util}/xmlpool/SConscript |  0
 .../drivers/dri/common => util}/xmlpool/ca.po      |  0
 .../drivers/dri/common => util}/xmlpool/de.po      |  0
 .../drivers/dri/common => util}/xmlpool/es.po      |  0
 .../drivers/dri/common => util}/xmlpool/fr.po      |  0
 .../dri/common => util}/xmlpool/gen_xmlpool.py     |  0
 .../drivers/dri/common => util}/xmlpool/nl.po      |  0
 .../drivers/dri/common => util}/xmlpool/sv.po      |  0
 .../dri/common => util}/xmlpool/t_options.h        |  0
 54 files changed, 117 insertions(+), 107 deletions(-)
 rename src/{mesa/drivers/dri/common => util}/drirc (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlconfig.c (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlconfig.h (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool.h (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/.gitignore (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/Makefile.am (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/SConscript (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/ca.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/de.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/es.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/fr.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/gen_xmlpool.py (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/nl.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/sv.po (100%)
 rename src/{mesa/drivers/dri/common => util}/xmlpool/t_options.h (100%)

diff --git a/configure.ac b/configure.ac
index 7fade23..edc1b5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2830,34 +2830,34 @@ AC_CONFIG_FILES([Makefile
 		src/intel/Makefile
 		src/loader/Makefile
 		src/mapi/Makefile
 		src/mapi/es1api/glesv1_cm.pc
 		src/mapi/es2api/glesv2.pc
 		src/mapi/glapi/gen/Makefile
 		src/mesa/Makefile
 		src/mesa/gl.pc
 		src/mesa/drivers/dri/dri.pc
 		src/mesa/drivers/dri/common/Makefile
-		src/mesa/drivers/dri/common/xmlpool/Makefile
 		src/mesa/drivers/dri/i915/Makefile
 		src/mesa/drivers/dri/i965/Makefile
 		src/mesa/drivers/dri/Makefile
 		src/mesa/drivers/dri/nouveau/Makefile
 		src/mesa/drivers/dri/r200/Makefile
 		src/mesa/drivers/dri/radeon/Makefile
 		src/mesa/drivers/dri/swrast/Makefile
 		src/mesa/drivers/osmesa/Makefile
 		src/mesa/drivers/osmesa/osmesa.pc
 		src/mesa/drivers/x11/Makefile
 		src/mesa/main/tests/Makefile
 		src/util/Makefile
 		src/util/tests/hash_table/Makefile
+		src/util/xmlpool/Makefile
 		src/vulkan/Makefile])
 
 AC_OUTPUT
 
 # Fix up dependencies in *.Plo files, where we changed the extension of a
 # source file
 $SED -i -e 's/brw_blorp.cpp/brw_blorp.c/' src/mesa/drivers/dri/i965/.deps/brw_blorp.Plo
 
 
 dnl
diff --git a/src/gallium/state_trackers/dri/Makefile.am b/src/gallium/state_trackers/dri/Makefile.am
index 61a1cab..8b427f9 100644
--- a/src/gallium/state_trackers/dri/Makefile.am
+++ b/src/gallium/state_trackers/dri/Makefile.am
@@ -21,21 +21,21 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	$(GALLIUM_CFLAGS) \
 	$(LIBDRM_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
 if HAVE_GALLIUM_SOFTPIPE
 AM_CPPFLAGS += \
 	-DGALLIUM_SOFTPIPE
 endif # HAVE_GALLIUM_SOFTPIPE
 
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 6b58830..3d86cce 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -23,21 +23,21 @@
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  **************************************************************************/
 /*
  * Author: Keith Whitwell <keithw at vmware.com>
  * Author: Jakob Bornecrantz <wallbraker at gmail.com>
  */
 
 #include "utils.h"
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 #include "dri_screen.h"
 #include "dri_context.h"
 
 #include "util/u_inlines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_format.h"
 #include "pipe-loader/pipe_loader.h"
 #include "state_tracker/st_gl_api.h" /* for st_gl_api_create */
 #include "state_tracker/drm_driver.h"
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
index 550bc51..383e762 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -26,21 +26,21 @@
  **************************************************************************/
 /*
  * Author: Keith Whitwell <keithw at vmware.com>
  * Author: Jakob Bornecrantz <wallbraker at gmail.com>
  */
 
 #ifndef DRI_SCREEN_H
 #define DRI_SCREEN_H
 
 #include "dri_util.h"
-#include "xmlconfig.h"
+#include "util/xmlconfig.h"
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "state_tracker/st_api.h"
 #include "state_tracker/opencl_interop.h"
 #include "os/os_thread.h"
 #include "postprocess/filters.h"
 
 struct dri_context;
diff --git a/src/gallium/targets/d3dadapter9/Makefile.am b/src/gallium/targets/d3dadapter9/Makefile.am
index 7a783f4..9d1c941 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -20,21 +20,20 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/include/D3D9 \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_srcdir)/src/mapi/ \
 	-I$(top_srcdir)/src/mesa/ \
-	-I$(top_builddir)/src/mesa/drivers/dri/common/ \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common/ \
 	-I$(top_srcdir)/src/gallium/winsys \
 	-I$(top_srcdir)/src/gallium/state_trackers/nine \
 	$(GALLIUM_TARGET_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
 AM_CPPFLAGS = \
 	$(DEFINES) \
 	-DGALLIUM_DDEBUG \
 	-DGALLIUM_RBUG \
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 27c3fb1..c0ed97a 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -30,22 +30,22 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 
 #include "target-helpers/drm_helper.h"
 #include "target-helpers/sw_helper.h"
 #include "state_tracker/drm_driver.h"
 
 #include "d3dadapter/d3dadapter9.h"
 #include "d3dadapter/drm.h"
 
-#include "xmlconfig.h"
-#include "xmlpool.h"
+#include "util/xmlconfig.h"
+#include "util/xmlpool.h"
 
 #include <drm.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <stdio.h>
 
 #define DBG_CHANNEL DBG_ADAPTER
 
 const char __driConfigOptionsNine[] =
 DRI_CONF_BEGIN
diff --git a/src/loader/Makefile.am b/src/loader/Makefile.am
index 340b335..8b197f2 100644
--- a/src/loader/Makefile.am
+++ b/src/loader/Makefile.am
@@ -32,28 +32,28 @@ AM_CPPFLAGS = \
 	$(VISIBILITY_CFLAGS) \
 	$(XCB_DRI3_CFLAGS) \
 	$(LIBDRM_CFLAGS)
 
 libloader_la_CPPFLAGS = $(AM_CPPFLAGS)
 libloader_la_SOURCES = $(LOADER_C_FILES)
 libloader_la_LIBADD =
 
 if HAVE_DRICOMMON
 libloader_la_CPPFLAGS += \
-	-I$(top_builddir)/src/mesa/drivers/dri/common/ \
+	-I$(top_builddir)/src/util/ \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common/ \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/mapi/ \
 	-DUSE_DRICONF
 
 libloader_la_LIBADD += \
-	$(top_builddir)/src/mesa/drivers/dri/common/libxmlconfig.la
+	$(top_builddir)/src/util/libxmlconfig.la
 
 endif
 
 if HAVE_LIBDRM
 libloader_la_LIBADD += \
 	$(LIBDRM_LIBS)
 endif
 
 if HAVE_PLATFORM_X11
 if HAVE_DRI3
diff --git a/src/loader/loader.c b/src/loader/loader.c
index c3fc961..182ba90 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -39,22 +39,22 @@
 #include <sys/mkdev.h>
 #endif
 #ifdef MAJOR_IN_SYSMACROS
 #include <sys/sysmacros.h>
 #endif
 #include "loader.h"
 
 #ifdef HAVE_LIBDRM
 #include <xf86drm.h>
 #ifdef USE_DRICONF
-#include "xmlconfig.h"
-#include "xmlpool.h"
+#include "util/xmlconfig.h"
+#include "util/xmlpool.h"
 #endif
 #endif
 
 #define __IS_LOADER
 #include "pci_id_driver_map.h"
 
 static void default_logger(int level, const char *fmt, ...)
 {
    if (level <= _LOADER_WARNING) {
       va_list args;
diff --git a/src/mesa/drivers/SConscript b/src/mesa/drivers/SConscript
index 476425b..f549910 100644
--- a/src/mesa/drivers/SConscript
+++ b/src/mesa/drivers/SConscript
@@ -1,12 +1,11 @@
 Import('*')
 
 SConscript('osmesa/SConscript')
 
 if env['x11']:
     SConscript('x11/SConscript')
 
 if env['dri']:
     SConscript([
-        'dri/common/xmlpool/SConscript',
         'dri/common/SConscript',
     ])
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index 381c6a2..95c637d 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -58,21 +58,21 @@ mesa_dri_drivers_la_LDFLAGS = \
 	-no-undefined \
 	-avoid-version \
 	$(BSYMBOLIC) \
 	$(GC_SECTIONS) \
 	$(LD_NO_UNDEFINED)
 
 mesa_dri_drivers_la_LIBADD = \
         ../../libmesa.la \
         common/libmegadriver_stub.la \
         common/libdricommon.la \
-        common/libxmlconfig.la \
+        $(top_builddir)/src/util/libxmlconfig.la \
         $(top_builddir)/src/mapi/shared-glapi/libglapi.la \
         $(MEGADRIVERS_DEPS) \
         $(DRI_LIB_DEPS) \
         $()
 
 if NEED_MEGADRIVER
 dri_LTLIBRARIES = mesa_dri_drivers.la
 
 if HAVE_COMPAT_SYMLINKS
 # Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
diff --git a/src/mesa/drivers/dri/common/Android.mk b/src/mesa/drivers/dri/common/Android.mk
index 8a21e63..573189d 100644
--- a/src/mesa/drivers/dri/common/Android.mk
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -37,67 +37,21 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 intermediates := $(call local-generated-sources-dir)
 
 LOCAL_C_INCLUDES := \
     $(MESA_DRI_C_INCLUDES)
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
     $(LOCAL_PATH) \
     $(intermediates)
 
 LOCAL_SRC_FILES := \
-	$(DRI_COMMON_FILES) \
-	$(XMLCONFIG_FILES)
-
-MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
-LOCAL_GENERATED_SOURCES := $(MESA_DRI_OPTIONS_H)
-
-#
-# Generate options.h from gettext translations.
-#
-
-MESA_DRI_OPTIONS_LANGS := de es nl fr sv
-POT := $(intermediates)/xmlpool.pot
-
-$(POT): $(LOCAL_PATH)/xmlpool/t_options.h
-	@mkdir -p $(dir $@)
-	xgettext -L C --from-code utf-8 -o $@ $<
-
-$(intermediates)/xmlpool/%.po: $(LOCAL_PATH)/xmlpool/%.po $(POT)
-	lang=$(basename $(notdir $@)); \
-	mkdir -p $(dir $@); \
-	if [ -f $< ]; then \
-		msgmerge -o $@ $^; \
-	else \
-		msginit -i $(POT) \
-			-o $@ \
-			--locale=$$lang \
-			--no-translator; \
-		sed -i -e 's/charset=.*\\n/charset=UTF-8\\n/' $@; \
-	fi
-
-PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
-PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
-PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
-PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
-
-LOCAL_GENERATED_SOURCES += $(PRIVATE_MO_FILES)
-
-$(PRIVATE_MO_FILES): $(intermediates)/xmlpool/%/LC_MESSAGES/options.mo: $(intermediates)/xmlpool/%.po
-	mkdir -p $(dir $@)
-	msgfmt -o $@ $<
-
-$(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
-$(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ $(PRIVATE_TEMPLATE_HEADER) \
-		$(PRIVATE_LOCALEDIR) $(MESA_DRI_OPTIONS_LANGS) > $@
-
-$(MESA_DRI_OPTIONS_H): $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) $(PRIVATE_MO_FILES)
-	$(transform-generated-source)
+	$(DRI_COMMON_FILES)
 
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
 #
 # Build libmesa_megadriver_stub
 #
 
 include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
diff --git a/src/mesa/drivers/dri/common/Makefile.am b/src/mesa/drivers/dri/common/Makefile.am
index c85c470..2582cbe 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -12,42 +12,32 @@
 # 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
 # THE AUTHORS OR COPYRIGHT HOLDERS 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.
 
-SUBDIRS = xmlpool
-
 include Makefile.sources
 
-EXTRA_DIST = drirc xmlpool.h SConscript
+EXTRA_DIST = SConscript
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
 	$(LIBDRM_CFLAGS) \
 	$(DEFINES) \
-	-DSYSCONFDIR=\"$(sysconfdir)\" \
 	$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = \
 	libdricommon.la \
-	libxmlconfig.la \
 	libmegadriver_stub.la
 
 libdricommon_la_SOURCES = $(DRI_COMMON_FILES)
 
-libxmlconfig_la_SOURCES = $(XMLCONFIG_FILES)
-libxmlconfig_la_CFLAGS = $(AM_CFLAGS) $(EXPAT_CFLAGS)
-libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
-
 libmegadriver_stub_la_SOURCES = $(megadriver_stub_FILES)
-
-sysconf_DATA = drirc
diff --git a/src/mesa/drivers/dri/common/Makefile.sources b/src/mesa/drivers/dri/common/Makefile.sources
index 9d3cdd3..fdac0de 100644
--- a/src/mesa/drivers/dri/common/Makefile.sources
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -1,20 +1,16 @@
 DRI_COMMON_FILES := \
 	utils.c \
 	utils.h \
 	dri_util.c \
 	dri_util.h
 
-XMLCONFIG_FILES := \
-	xmlconfig.c \
-	xmlconfig.h
-
 # Paths are relative to MESA_TOP.
 mesa_dri_common_INCLUDES := \
 	include \
 	src/egl/drivers/dri \
 	src/egl/main \
 	src/mapi \
 	src/mesa \
 	src/mesa/drivers/dri/common
 
 megadriver_stub_FILES := \
diff --git a/src/mesa/drivers/dri/common/SConscript b/src/mesa/drivers/dri/common/SConscript
index 52d201f..7a12438 100644
--- a/src/mesa/drivers/dri/common/SConscript
+++ b/src/mesa/drivers/dri/common/SConscript
@@ -1,45 +1,40 @@
 ###################################
 # SConcscript file for dri targets
 
 Import('*')
 
 drienv = env.Clone()
 
 drienv.Replace(CPPPATH = [
     '#src/mesa/drivers/dri/common',
-    xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
     '#include',
     '#include/GL/internal',
     '#src',
     '#src/mapi',
     '#src/gallium/include',
     '#src/gallium/auxiliary',
     '#src/gallium/drivers',
     '#src/gallium/winsys',
     '#src/mesa',
     '#src/mesa/main',
     '#src/mesa/glapi',
     '#src/mesa/math',
     '#src/mesa/transform',
     '#src/mesa/shader',
     '#src/mesa/swrast',
     '#src/mesa/swrast_setup',
     '#src/egl/main',
     '#src/egl/drivers/dri',
 ])
 
-drienv.AppendUnique(LIBS = [
-    'expat',
-])
-
-sources = drienv.ParseSourceList('Makefile.sources', ['DRI_COMMON_FILES', 'XMLCONFIG_FILES' ])
+sources = drienv.ParseSourceList('Makefile.sources', ['DRI_COMMON_FILES'])
 
 dri_common = drienv.ConvenienceLibrary(
 	target = 'dri_common',
 	source = sources,
 )
 
 #
 # megadrivers_stub
 #
 env = env.Clone()
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index f6df488..b1aec7e 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -35,21 +35,21 @@
  * screen initialization, context creation, context binding, DRM setup, etc.
  *
  * These functions are compiled into each DRI driver so libGL.so knows nothing
  * about them.
  */
 
 
 #include <stdbool.h>
 #include "dri_util.h"
 #include "utils.h"
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 #include "main/mtypes.h"
 #include "main/framebuffer.h"
 #include "main/version.h"
 #include "main/debug_output.h"
 #include "main/errors.h"
 #include "main/macros.h"
 
 const char __dri2ConfigOptions[] =
    DRI_CONF_BEGIN
       DRI_CONF_SECTION_PERFORMANCE
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 8fcd632..b353588 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -49,21 +49,21 @@
  * are essentially base classes of the DRI2 structs. DRISW needs to compile on
  * platforms without DRM, so keep the structs opaque to DRM.
  */
 
 #ifndef _DRI_UTIL_H_
 #define _DRI_UTIL_H_
 
 #include <GL/gl.h>
 #include <GL/internal/dri_interface.h>
 #include "main/mtypes.h"
-#include "xmlconfig.h"
+#include "util/xmlconfig.h"
 #include <stdbool.h>
 
 /**
  * Extensions.
  */
 extern const __DRIcoreExtension driCoreExtension;
 extern const __DRIswrastExtension driSWRastExtension;
 extern const __DRIdri2Extension driDRI2Extension;
 extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
 extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
diff --git a/src/mesa/drivers/dri/i915/Makefile.am b/src/mesa/drivers/dri/i915/Makefile.am
index feead3e..70ca049 100644
--- a/src/mesa/drivers/dri/i915/Makefile.am
+++ b/src/mesa/drivers/dri/i915/Makefile.am
@@ -23,19 +23,19 @@
 
 include Makefile.sources
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS) \
 	$(I915_CFLAGS)
 
 noinst_LTLIBRARIES = libi915_dri.la
 libi915_dri_la_SOURCES = $(i915_FILES)
 libi915_dri_la_LIBADD = $(I915_LIBS)
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 686cbf5..5e93817 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -32,21 +32,21 @@
 #include "main/context.h"
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
 #include "main/texobj.h"
 #include "main/hash.h"
 #include "main/fbobject.h"
 #include "main/version.h"
 #include "swrast/s_renderbuffer.h"
 
 #include "utils.h"
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 static const __DRIconfigOptionsExtension i915_config_options = {
    .base = { __DRI_CONFIG_OPTIONS, 1 },
    .xml =
 
 DRI_CONF_BEGIN
    DRI_CONF_SECTION_PERFORMANCE
       DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_ALWAYS_SYNC)
       /* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
        * DRI_CONF_BO_REUSE_ALL
diff --git a/src/mesa/drivers/dri/i915/intel_screen.h b/src/mesa/drivers/dri/i915/intel_screen.h
index 11e1a3f..a22888b 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.h
+++ b/src/mesa/drivers/dri/i915/intel_screen.h
@@ -26,21 +26,21 @@
  **************************************************************************/
 
 #ifndef _INTEL_INIT_H_
 #define _INTEL_INIT_H_
 
 #include <stdbool.h>
 #include <sys/time.h>
 #include "dri_util.h"
 #include "intel_bufmgr.h"
 #include "i915_drm.h"
-#include "xmlconfig.h"
+#include "util/xmlconfig.h"
 
 struct intel_screen
 {
    int deviceID;
    int gen;
 
    __DRIscreen *driScrnPriv;
 
    bool no_hw;
 
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 4b56b4b..c09c519 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -23,21 +23,21 @@
 
 include Makefile.sources
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	-I$(top_srcdir)/src/gtest/include \
 	-I$(top_builddir)/src/compiler/glsl \
 	-I$(top_builddir)/src/compiler/nir \
 	-I$(top_srcdir)/src/compiler/nir \
 	-I$(top_builddir)/src/intel \
 	-I$(top_srcdir)/src/intel \
 	-I$(top_srcdir)/src/intel/drm \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS) \
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index c75f212..7febbfb 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -33,21 +33,21 @@
 #include "main/texobj.h"
 #include "main/hash.h"
 #include "main/fbobject.h"
 #include "main/version.h"
 #include "swrast/s_renderbuffer.h"
 #include "util/ralloc.h"
 #include "brw_defines.h"
 #include "compiler/nir/nir.h"
 
 #include "utils.h"
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 #ifndef DRM_FORMAT_MOD_INVALID
 #define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
 #endif
 
 #ifndef DRM_FORMAT_MOD_LINEAR
 #define DRM_FORMAT_MOD_LINEAR 0
 #endif
 
 static const __DRIconfigOptionsExtension brw_config_options = {
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index f78b3e8..454c5c8 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -29,21 +29,21 @@
 #include <stdbool.h>
 #include <sys/time.h>
 
 #include <GL/internal/dri_interface.h>
 
 #include "isl/isl.h"
 #include "dri_util.h"
 #include "brw_bufmgr.h"
 #include "common/gen_device_info.h"
 #include "i915_drm.h"
-#include "xmlconfig.h"
+#include "util/xmlconfig.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct intel_screen
 {
    int deviceID;
    struct gen_device_info devinfo;
 
diff --git a/src/mesa/drivers/dri/r200/Makefile.am b/src/mesa/drivers/dri/r200/Makefile.am
index 1094343..110c02e 100644
--- a/src/mesa/drivers/dri/r200/Makefile.am
+++ b/src/mesa/drivers/dri/r200/Makefile.am
@@ -27,20 +27,20 @@ EXTRA_DIST = \
 	r200_maos_arrays.c
 
 AM_CFLAGS = \
 	-DRADEON_R200 \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	-I$(top_srcdir)/src/mesa/drivers/dri/r200/server \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS) \
 	$(RADEON_CFLAGS)
 
 noinst_LTLIBRARIES = libr200_dri.la
 libr200_dri_la_SOURCES = $(R200_C_FILES)
 libr200_dri_la_LIBADD = $(RADEON_LIBS)
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index aaa9b93..8dc2c11 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -58,21 +58,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r200_swtcl.h"
 #include "r200_tcl.h"
 #include "r200_vertprog.h"
 #include "radeon_queryobj.h"
 #include "r200_blit.h"
 #include "radeon_fog.h"
 
 #include "radeon_span.h"
 
 #include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
+#include "util/xmlpool.h" /* for symbolic values of enum-type options */
 
 /* Return various strings for glGetString().
  */
 static const GLubyte *r200GetString( struct gl_context *ctx, GLenum name )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    static char buffer[128];
    unsigned   offset;
    GLuint agp_mode = (rmesa->radeon.radeonScreen->card_type == RADEON_CARD_PCI)? 0 :
       rmesa->radeon.radeonScreen->AGPMode;
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 4f584d3..4b589cd 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -42,21 +42,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "tnl/t_pipeline.h"
 #include "swrast_setup/swrast_setup.h"
 
 #include "radeon_common.h"
 #include "radeon_mipmap_tree.h"
 #include "r200_context.h"
 #include "r200_ioctl.h"
 #include "r200_state.h"
 #include "radeon_queryobj.h"
 
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 /* New (1.3) state mechanism.  3 commands (packet, scalar, vector) in
  * 1.3 cmdbuffers allow all previous state to be updated as well as
  * the tcl scalar and vector areas.
  */
 static struct {
 	int start;
 	int len;
 	const char *name;
 } packet[RADEON_MAX_STATE_PACKETS] = {
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 0ddb686..0696c0d 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -38,21 +38,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/image.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
 #include "main/samplerobj.h"
 
 #include "radeon_mipmap_tree.h"
 #include "r200_context.h"
 #include "r200_ioctl.h"
 #include "r200_tex.h"
 
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 
 
 /**
  * Set the texture wrap modes.
  * 
  * \param t Texture object whose wrap modes are to be set
  * \param swrap Wrap mode for the \a s texture coordinate
  * \param twrap Wrap mode for the \a t texture coordinate
  */
diff --git a/src/mesa/drivers/dri/radeon/Makefile.am b/src/mesa/drivers/dri/radeon/Makefile.am
index 176ec79..aa89864 100644
--- a/src/mesa/drivers/dri/radeon/Makefile.am
+++ b/src/mesa/drivers/dri/radeon/Makefile.am
@@ -28,20 +28,20 @@ EXTRA_DIST = \
 	radeon_maos_arrays.c
 
 AM_CFLAGS = \
 	-DRADEON_R100 \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	-I$(top_srcdir)/src/mesa/drivers/dri/radeon/server \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS) \
 	$(RADEON_CFLAGS)
 
 noinst_LTLIBRARIES = libradeon_dri.la
 libradeon_dri_la_SOURCES = $(RADEON_C_FILES)
 libradeon_dri_la_LIBADD = $(RADEON_LIBS)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 7789435..7e24f6d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -26,21 +26,21 @@ 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 THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS 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.
 
 **************************************************************************/
 
 #include "radeon_common.h"
-#include "xmlpool.h"		/* for symbolic values of enum-type options */
+#include "util/xmlpool.h"		/* for symbolic values of enum-type options */
 #include "utils.h"
 #include "drivers/common/meta.h"
 #include "main/context.h"
 #include "main/framebuffer.h"
 #include "main/fbobject.h"
 #include "main/renderbuffer.h"
 #include "main/state.h"
 #include "util/simple_list.h"
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 11afe20..7cd5871 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -60,21 +60,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_state.h"
 #include "radeon_span.h"
 #include "radeon_tex.h"
 #include "radeon_swtcl.h"
 #include "radeon_tcl.h"
 #include "radeon_queryobj.h"
 #include "radeon_blit.h"
 #include "radeon_fog.h"
 
 #include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
+#include "util/xmlpool.h" /* for symbolic values of enum-type options */
 
 extern const struct tnl_pipeline_stage _radeon_render_stage;
 extern const struct tnl_pipeline_stage _radeon_tcl_stage;
 
 static const struct tnl_pipeline_stage *radeon_pipeline[] = {
 
    /* Try and go straight to t&l
     */
    &_radeon_tcl_stage,  
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 79e3889..6c488b6 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -55,21 +55,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r200_context.h"
 #include "r200_tex.h"
 #endif
 
 #include "utils.h"
 
 #include "GL/internal/dri_interface.h"
 
 /* Radeon configuration
  */
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 #define DRI_CONF_COMMAND_BUFFER_SIZE(def,min,max) \
 DRI_CONF_OPT_BEGIN_V(command_buffer_size,int,def, # min ":" # max ) \
         DRI_CONF_DESC(en,"Size of command buffer (in KB)") \
         DRI_CONF_DESC(de,"Grösse des Befehlspuffers (in KB)") \
 DRI_CONF_OPT_END
 
 #if defined(RADEON_R100)	/* R100 */
 static const __DRIconfigOptionsExtension radeon_config_options = {
    .base = { __DRI_CONFIG_OPTIONS, 1 },
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index b3e9267..e70e334 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -38,21 +38,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /*
  * IMPORTS: these headers contain all the DRI, X and kernel-related
  * definitions that we need.
  */
 #include <xf86drm.h>
 #include <radeon_drm.h>
 #include "dri_util.h"
 #include "radeon_chipset.h"
 #include "radeon_reg.h"
-#include "xmlconfig.h"
+#include "util/xmlconfig.h"
 
 
 typedef struct {
    drm_handle_t handle;			/* Handle to the DRM region */
    drmSize size;			/* Size of the DRM region */
    drmAddress map;			/* Mapping of the DRM region */
 } radeonRegionRec, *radeonRegionPtr;
 
 typedef struct radeon_screen {
    int chip_family;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c
index 5e2f41f..99c535a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state_init.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c
@@ -37,21 +37,21 @@
 #include "swrast_setup/swrast_setup.h"
 
 #include "radeon_context.h"
 #include "radeon_mipmap_tree.h"
 #include "radeon_ioctl.h"
 #include "radeon_state.h"
 #include "radeon_queryobj.h"
 
 #include "../r200/r200_reg.h"
 
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 /* New (1.3) state mechanism.  3 commands (packet, scalar, vector) in
  * 1.3 cmdbuffers allow all previous state to be updated as well as
  * the tcl scalar and vector areas.
  */
 static struct {
 	int start;
 	int len;
 	const char *name;
 } packet[RADEON_MAX_STATE_PACKETS] = {
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index c3b83fa..b4964f1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -37,21 +37,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/enums.h"
 #include "main/image.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
 
 #include "radeon_context.h"
 #include "radeon_mipmap_tree.h"
 #include "radeon_ioctl.h"
 #include "radeon_tex.h"
 
-#include "xmlpool.h"
+#include "util/xmlpool.h"
 
 
 
 /**
  * Set the texture wrap modes.
  * 
  * \param t Texture object whose wrap modes are to be set
  * \param swrap Wrap mode for the \a s texture coordinate
  * \param twrap Wrap mode for the \a t texture coordinate
  */
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 4794dda..f2d435a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -34,21 +34,21 @@
 #include "main/context.h"
 #include "main/enums.h"
 #include "main/mipmap.h"
 #include "main/pbo.h"
 #include "main/texcompress.h"
 #include "main/texstore.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
 #include "drivers/common/meta.h"
 
-#include "xmlpool.h"		/* for symbolic values of enum-type options */
+#include "util/xmlpool.h"		/* for symbolic values of enum-type options */
 
 #include "radeon_common.h"
 
 #include "radeon_mipmap_tree.h"
 
 static void teximage_assign_miptree(radeonContextPtr rmesa,
 				    struct gl_texture_object *texObj,
 				    struct gl_texture_image *texImage);
 
 static radeon_mipmap_tree *radeon_miptree_create_for_teximage(radeonContextPtr rmesa,
diff --git a/src/mesa/drivers/dri/swrast/Makefile.am b/src/mesa/drivers/dri/swrast/Makefile.am
index a82e580..7e1ea59 100644
--- a/src/mesa/drivers/dri/swrast/Makefile.am
+++ b/src/mesa/drivers/dri/swrast/Makefile.am
@@ -23,18 +23,18 @@
 
 include Makefile.sources
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/ \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/gallium/include \
 	-I$(top_srcdir)/src/gallium/auxiliary \
-	-I$(top_builddir)/src/mesa/drivers/dri/common \
+	-I$(top_builddir)/src/util \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
 	$(LIBDRM_CFLAGS) \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS)
 
 noinst_LTLIBRARIES = libswrast_dri.la
 libswrast_dri_la_SOURCES = $(SWRAST_C_FILES)
diff --git a/src/util/Android.mk b/src/util/Android.mk
index facdcf8..6c81322 100644
--- a/src/util/Android.mk
+++ b/src/util/Android.mk
@@ -24,35 +24,80 @@ LOCAL_PATH := $(call my-dir)
 
 include $(LOCAL_PATH)/Makefile.sources
 
 # ---------------------------------------
 # Build libmesa_util
 # ---------------------------------------
 
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-	$(MESA_UTIL_FILES)
+	$(MESA_UTIL_FILES) \
+	$(XMLCONFIG_FILES)
 
 LOCAL_C_INCLUDES := \
 	external/zlib \
 	$(MESA_TOP)/src/mesa \
 	$(MESA_TOP)/src/mapi \
 	$(MESA_TOP)/src/gallium/include \
 	$(MESA_TOP)/src/gallium/auxiliary
 
 LOCAL_MODULE := libmesa_util
 
 # Generated sources
 
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
 intermediates := $(call local-generated-sources-dir)
 LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(MESA_UTIL_GENERATED_FILES))
 
+MESA_DRI_OPTIONS_H := $(intermediates)/xmlpool/options.h
+LOCAL_GENERATED_SOURCES += $(MESA_DRI_OPTIONS_H)
+
+#
+# Generate options.h from gettext translations.
+#
+
+MESA_DRI_OPTIONS_LANGS := de es nl fr sv
+POT := $(intermediates)/xmlpool.pot
+
+$(POT): $(LOCAL_PATH)/xmlpool/t_options.h
+	@mkdir -p $(dir $@)
+	xgettext -L C --from-code utf-8 -o $@ $<
+
+$(intermediates)/xmlpool/%.po: $(LOCAL_PATH)/xmlpool/%.po $(POT)
+	lang=$(basename $(notdir $@)); \
+	mkdir -p $(dir $@); \
+	if [ -f $< ]; then \
+		msgmerge -o $@ $^; \
+	else \
+		msginit -i $(POT) \
+			-o $@ \
+			--locale=$$lang \
+			--no-translator; \
+		sed -i -e 's/charset=.*\\n/charset=UTF-8\\n/' $@; \
+	fi
+
+PRIVATE_SCRIPT := $(LOCAL_PATH)/xmlpool/gen_xmlpool.py
+PRIVATE_LOCALEDIR := $(intermediates)/xmlpool
+PRIVATE_TEMPLATE_HEADER := $(LOCAL_PATH)/xmlpool/t_options.h
+PRIVATE_MO_FILES := $(MESA_DRI_OPTIONS_LANGS:%=$(intermediates)/xmlpool/%/LC_MESSAGES/options.mo)
+
+LOCAL_GENERATED_SOURCES += $(PRIVATE_MO_FILES)
+
+$(PRIVATE_MO_FILES): $(intermediates)/xmlpool/%/LC_MESSAGES/options.mo: $(intermediates)/xmlpool/%.po
+	mkdir -p $(dir $@)
+	msgfmt -o $@ $<
+
 $(LOCAL_GENERATED_SOURCES): PRIVATE_PYTHON := $(MESA_PYTHON2)
 $(LOCAL_GENERATED_SOURCES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ > $@
 $(LOCAL_GENERATED_SOURCES): $(intermediates)/%.c: $(LOCAL_PATH)/%.py
 	$(transform-generated-source)
 
+$(PRIVATE_MO_FILES): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PYTHON) $^ $(PRIVATE_TEMPLATE_HEADER) \
+		$(PRIVATE_LOCALEDIR) $(MESA_DRI_OPTIONS_LANGS) > $@
+
+$(MESA_DRI_OPTIONS_H): $(PRIVATE_SCRIPT) $(PRIVATE_TEMPLATE_HEADER) $(PRIVATE_MO_FILES)
+	$(transform-generated-source)
+
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index f094eb4..fa6551e 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -12,25 +12,27 @@
 # 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
 # THE AUTHORS OR COPYRIGHT HOLDERS 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.
 
-SUBDIRS = . tests/hash_table
+SUBDIRS = xmlpool . tests/hash_table
 
 include Makefile.sources
 
-noinst_LTLIBRARIES = libmesautil.la
+noinst_LTLIBRARIES = \
+	libmesautil.la \
+	libxmlconfig.la
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include
 
 libmesautil_la_CPPFLAGS = \
 	$(DEFINES) \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa \
@@ -39,26 +41,40 @@ libmesautil_la_CPPFLAGS = \
 	$(VISIBILITY_CFLAGS) \
 	$(MSVC2013_COMPAT_CFLAGS) \
 	$(ZLIB_CFLAGS)
 
 libmesautil_la_SOURCES = \
 	$(MESA_UTIL_FILES) \
 	$(MESA_UTIL_GENERATED_FILES)
 
 libmesautil_la_LIBADD = $(ZLIB_LIBS)
 
+libxmlconfig_la_SOURCES = $(XMLCONFIG_FILES)
+libxmlconfig_la_CFLAGS = \
+	$(DEFINES) \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/src \
+	-DSYSCONFDIR=\"$(sysconfdir)\" \
+	$(VISIBILITY_CFLAGS) \
+	$(EXPAT_CFLAGS)
+libxmlconfig_la_LIBADD = $(EXPAT_LIBS) -lm
+
+sysconf_DATA = drirc
+
 roundeven_test_LDADD = -lm
 
 check_PROGRAMS = u_atomic_test roundeven_test
 TESTS = $(check_PROGRAMS)
 
 BUILT_SOURCES = $(MESA_UTIL_GENERATED_FILES)
 CLEANFILES = $(BUILT_SOURCES)
 EXTRA_DIST = \
+	drirc \
 	format_srgb.py \
 	SConscript \
+	xmlpool.h \
 	sha1/README
 
 PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
 
 format_srgb.c: format_srgb.py
 	$(PYTHON_GEN) $(srcdir)/format_srgb.py > $@
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index 8ea5f29..3315285 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -49,10 +49,14 @@ MESA_UTIL_FILES := \
 	u_endian.h \
 	u_queue.c \
 	u_queue.h \
 	u_string.h \
 	u_thread.h \
 	u_vector.c \
 	u_vector.h
 
 MESA_UTIL_GENERATED_FILES = \
 	format_srgb.c
+
+XMLCONFIG_FILES := \
+	xmlconfig.c \
+	xmlconfig.h
diff --git a/src/util/SConscript b/src/util/SConscript
index 7e447f6..582592c 100644
--- a/src/util/SConscript
+++ b/src/util/SConscript
@@ -1,46 +1,58 @@
 import common
 
 Import('*')
 
+SConscript([
+   'xmlpool',
+])
+
 from sys import executable as python_cmd
 
 env = env.Clone()
 
 env.MSVC2013Compat()
 
 env.Prepend(CPPPATH = [
     '#include',
+    xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
     '#src',
     '#src/mapi',
     '#src/mesa',
     '#src/gallium/include',
     '#src/gallium/auxiliary',
     '#src/util',
 ])
 
 env.CodeGenerate(
     target = 'format_srgb.c',
     script = 'format_srgb.py',
     source = [],
     command = python_cmd + ' $SCRIPT > $TARGET'
 )
 
 # parse Makefile.sources
 source_lists = env.ParseSourceList('Makefile.sources')
 
 mesautil_sources = (
     source_lists['MESA_UTIL_FILES'] +
-    source_lists['MESA_UTIL_GENERATED_FILES']
+    source_lists['MESA_UTIL_GENERATED_FILES'] +
+    source_lists['XMLCONFIG_FILES']
 )
 
-mesautil = env.ConvenienceLibrary(
+mesautilenv = env.Clone()
+
+mesautilenv.AppendUnique(LIBS = [
+    'expat',
+])
+
+mesautil = mesautilenv.ConvenienceLibrary(
     target = 'mesautil',
     source = mesautil_sources,
 )
 
 env.Alias('mesautil', mesautil)
 Export('mesautil')
 
 
 u_atomic_test = env.Program(
     target = 'u_atomic_test',
diff --git a/src/mesa/drivers/dri/common/drirc b/src/util/drirc
similarity index 100%
rename from src/mesa/drivers/dri/common/drirc
rename to src/util/drirc
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/util/xmlconfig.c
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlconfig.c
rename to src/util/xmlconfig.c
diff --git a/src/mesa/drivers/dri/common/xmlconfig.h b/src/util/xmlconfig.h
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlconfig.h
rename to src/util/xmlconfig.h
diff --git a/src/mesa/drivers/dri/common/xmlpool.h b/src/util/xmlpool.h
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool.h
rename to src/util/xmlpool.h
diff --git a/src/mesa/drivers/dri/common/xmlpool/.gitignore b/src/util/xmlpool/.gitignore
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/.gitignore
rename to src/util/xmlpool/.gitignore
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/src/util/xmlpool/Makefile.am
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/Makefile.am
rename to src/util/xmlpool/Makefile.am
diff --git a/src/mesa/drivers/dri/common/xmlpool/SConscript b/src/util/xmlpool/SConscript
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/SConscript
rename to src/util/xmlpool/SConscript
diff --git a/src/mesa/drivers/dri/common/xmlpool/ca.po b/src/util/xmlpool/ca.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/ca.po
rename to src/util/xmlpool/ca.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/de.po b/src/util/xmlpool/de.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/de.po
rename to src/util/xmlpool/de.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/es.po b/src/util/xmlpool/es.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/es.po
rename to src/util/xmlpool/es.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/fr.po b/src/util/xmlpool/fr.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/fr.po
rename to src/util/xmlpool/fr.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/src/util/xmlpool/gen_xmlpool.py
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
rename to src/util/xmlpool/gen_xmlpool.py
diff --git a/src/mesa/drivers/dri/common/xmlpool/nl.po b/src/util/xmlpool/nl.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/nl.po
rename to src/util/xmlpool/nl.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/sv.po b/src/util/xmlpool/sv.po
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/sv.po
rename to src/util/xmlpool/sv.po
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/util/xmlpool/t_options.h
similarity index 100%
rename from src/mesa/drivers/dri/common/xmlpool/t_options.h
rename to src/util/xmlpool/t_options.h
-- 
2.9.3



More information about the mesa-dev mailing list