mesa: glGet: add script to generate hash tables in build time

This will be needed by the next patch, which will switch to using
the parameter descriptor- and hash tables generated by the script.

The hash algorithm remains the same, the output parameter descriptor
table format changes slightly. There the TYPE_API_MASK entries are
removed and an invalid NULL entry is inserted at the beginning. This is
ok, as get.c:find_value() doesn't rely on TYPE_API_MASK any more to
detect an invalid enum.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Oliver McFadden <oliver.mcfadden@linux.intel.com>
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 7d7d519..b7f908a 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -77,7 +77,6 @@
     'main/format_pack.c',
     'main/format_unpack.c',
     'main/framebuffer.c',
-    'main/get.c',
     'main/getstring.c',
     'main/glformats.c',
     'main/hash.c',
@@ -140,6 +139,10 @@
     'main/vtxfmt.c',
 ]
 
+glget_sources = [
+    'main/get.c',
+]
+
 math_sources = [
     'math/m_debug_clip.c',
     'math/m_debug_norm.c',
@@ -320,6 +323,7 @@
 
 mesa_sources = (
     main_sources +
+    glget_sources +
     math_sources +
     program_sources +
     vbo_sources +
@@ -369,6 +373,18 @@
 
 env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
 
+get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
+
+get_hash_header = env.CodeGenerate(
+      target = 'main/get_hash.h',
+      script = 'main/get_hash_generator.py',
+      source = GLAPI + 'gen/gl_and_es_API.xml',
+      command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts +
+                ' -f $SOURCE > $TARGET'
+)
+
+env.Depends(glget_sources, get_hash_header)
+
 #
 # Assembly sources
 #