summaryrefslogtreecommitdiff
path: root/src/glx/apple/gen_gl_h.sh
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2010-04-01 11:01:31 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2010-04-01 12:33:45 -0700
commit0594cf70883b64692ba617d85f4f9b4e636e5c2b (patch)
tree4f0180af9c072c393e3d6270825953bf46a9152e /src/glx/apple/gen_gl_h.sh
parent86a7978d37393ee34f876569ac06ffdb8d7289ae (diff)
apple: Initial import of libGL for OSX from AppleSGLX svn repository.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'src/glx/apple/gen_gl_h.sh')
-rw-r--r--src/glx/apple/gen_gl_h.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/glx/apple/gen_gl_h.sh b/src/glx/apple/gen_gl_h.sh
new file mode 100644
index 0000000000..f10ddd0bfc
--- /dev/null
+++ b/src/glx/apple/gen_gl_h.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+INFILE=$1
+OUTFILE=$2
+
+generate_macros() {
+ grep gl.*ProcPtr /System/Library/Frameworks/OpenGL.framework/Headers/gl{,ext}.h | sed 's:^.*\(gl.*Ptr\).*$:\1:' | sort -u | perl -ne 'chomp($_); $s = "PFN".uc($_); $s =~ s/PROCPTR/PROC/; print "#define ".$_." ".$s."\n"'
+}
+
+generate_function_pointers() {
+ {
+ echo "#define GL_GLEXT_FUNCTION_POINTERS 1"
+ echo "#define GL_GLEXT_LEGACY 1"
+ generate_macros
+ echo '#include "/System/Library/Frameworks/OpenGL.framework/Headers/gl.h"'
+ } | ${CC:-gcc} -E - | grep typedef.*PFN
+}
+
+cat ${INFILE} | while IFS= read LINE ; do
+ case $LINE in
+ "@CGL_MESA_COMPAT_MACROS@")
+ generate_macros
+ ;;
+ "@CGL_MESA_FUNCTION_POINTERS@")
+ if ! grep -q GL_GLEXT_PROTOTYPES /System/Library/Frameworks/OpenGL.framework/Headers/gl.h ; then
+ generate_function_pointers
+ fi
+ ;;
+ *)
+ printf "${LINE}\n"
+ ;;
+ esac
+done > ${OUTFILE}