blob: 011a6edf01e6c5e8f067df5500d2ca8464be2d26 [file] [log] [blame]
Jack Palevich4e70a9e2009-04-14 19:00:09 -07001#!/bin/bash
2set -u
Jack Palevich27f80022009-04-15 19:13:17 -07003set -e
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004rm -rf out generated
5
6mkdir out
7mkdir -p out/javax/microedition/khronos/opengles
8mkdir -p out/com/google/android/gles_jni
9mkdir -p out/android/graphics
Jack Palevich27f80022009-04-15 19:13:17 -070010mkdir -p out/android/opengl
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080011
12echo "package android.graphics;" > out/android/graphics/Canvas.java
13echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
14
15GLFILE=out/javax/microedition/khronos/opengles/GL.java
Jack Palevich27f80022009-04-15 19:13:17 -070016cp stubs/jsr239/GLHeader.java-if $GLFILE
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017
Jack Palevich27f80022009-04-15 19:13:17 -070018GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019
20pushd src > /dev/null
21javac ${GLGEN_FILES}
Jack Palevich4e70a9e2009-04-14 19:00:09 -070022JAVAC_RESULT=$?
23if [ $JAVAC_RESULT -ne 0 ]; then
24 echo "Could not compile glgen."
25 exit $JAVAC_RESULT
26fi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027popd > /dev/null
Jack Palevich27f80022009-04-15 19:13:17 -070028
29echo "Generating JSR239-like APIs"
30java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks
31JAVA_RESULT=$?
32if [ $JAVA_RESULT -ne 0 ]; then
33 echo "Could not run GenerateGL."
34 exit $JAVA_RESULT
35fi
36
37echo "Generating static OpenGLES 1.1 bindings"
38java -classpath src GenerateGLES
39JAVA_RESULT=$?
40if [ $JAVA_RESULT -ne 0 ]; then
41 echo "Could not run GenerateGLES."
42 exit $JAVA_RESULT
43fi
44
Jack Palevich4e70a9e2009-04-14 19:00:09 -070045rm src/*.class
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
47pushd out > /dev/null
48mkdir classes
Jack Palevich27f80022009-04-15 19:13:17 -070049javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050popd > /dev/null
Jack Palevich27f80022009-04-15 19:13:17 -070051JAVA_RESULT=$?
52if [ $JAVA_RESULT -ne 0 ]; then
53 echo "Could not compile generated classes."
54 exit $JAVA_RESULT
55fi
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056
57rm -rf generated
58mkdir -p generated/C
59cp out/com_google_android_gles_jni_GLImpl.cpp generated/C
60cp -r out/com generated
61cp -r out/javax generated
62
Jack Palevich27f80022009-04-15 19:13:17 -070063cp out/android_opengl_*.cpp generated/C
64mkdir -p generated/android/opengl
65cp -r out/android/opengl generated/android
66
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067rm -rf out
Jack Palevichc005f8b2009-04-02 13:38:26 -070068KEEP_GENERATED=0
Jack Palevich27f80022009-04-15 19:13:17 -070069SAID_PLEASE=0
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070
Jack Palevich27f80022009-04-15 19:13:17 -070071# compareGenerated destDir generatedDir file
72compareGenerated() {
73 if cmp -s $1/$3 $2/$3 ; then
74 echo "# " $3 unchanged
75 else
76 if [ $SAID_PLEASE == "0" ] ; then
77 echo Please evaluate the following commands:
78 echo
79 SAID_PLEASE=1
80 fi
81 echo " " cp $2/$3 $1
82 echo " " git add $1/$3
83 KEEP_GENERATED=1
84 fi
85}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086
Jack Palevich27f80022009-04-15 19:13:17 -070087compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp
88compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089
Jack Palevich27f80022009-04-15 19:13:17 -070090for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java
91do
92 compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
93done
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094
Jack Palevich27f80022009-04-15 19:13:17 -070095for x in GLES10 GLES10Ext GLES11 GLES11Ext
96do
97 compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java
98 compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp
99done
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100
Jack Palevichc005f8b2009-04-02 13:38:26 -0700101if [ $KEEP_GENERATED == "0" ] ; then
Jack Palevich27f80022009-04-15 19:13:17 -0700102 rm -rf generated
Jack Palevichc005f8b2009-04-02 13:38:26 -0700103fi