Jack Palevich | 4e70a9e | 2009-04-14 19:00:09 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -u |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 3 | set -e |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 4 | rm -rf out generated |
| 5 | |
| 6 | mkdir out |
| 7 | mkdir -p out/javax/microedition/khronos/opengles |
| 8 | mkdir -p out/com/google/android/gles_jni |
| 9 | mkdir -p out/android/graphics |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 10 | mkdir -p out/android/opengl |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 11 | |
| 12 | echo "package android.graphics;" > out/android/graphics/Canvas.java |
| 13 | echo "public interface Canvas {}" >> out/android/graphics/Canvas.java |
| 14 | |
| 15 | GLFILE=out/javax/microedition/khronos/opengles/GL.java |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 16 | cp stubs/jsr239/GLHeader.java-if $GLFILE |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 18 | GLGEN_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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
| 20 | pushd src > /dev/null |
| 21 | javac ${GLGEN_FILES} |
Jack Palevich | 4e70a9e | 2009-04-14 19:00:09 -0700 | [diff] [blame] | 22 | JAVAC_RESULT=$? |
| 23 | if [ $JAVAC_RESULT -ne 0 ]; then |
| 24 | echo "Could not compile glgen." |
| 25 | exit $JAVAC_RESULT |
| 26 | fi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | popd > /dev/null |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 28 | |
| 29 | echo "Generating JSR239-like APIs" |
| 30 | java -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 |
| 31 | JAVA_RESULT=$? |
| 32 | if [ $JAVA_RESULT -ne 0 ]; then |
| 33 | echo "Could not run GenerateGL." |
| 34 | exit $JAVA_RESULT |
| 35 | fi |
| 36 | |
| 37 | echo "Generating static OpenGLES 1.1 bindings" |
| 38 | java -classpath src GenerateGLES |
| 39 | JAVA_RESULT=$? |
| 40 | if [ $JAVA_RESULT -ne 0 ]; then |
| 41 | echo "Could not run GenerateGLES." |
| 42 | exit $JAVA_RESULT |
| 43 | fi |
| 44 | |
Jack Palevich | 4e70a9e | 2009-04-14 19:00:09 -0700 | [diff] [blame] | 45 | rm src/*.class |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | |
| 47 | pushd out > /dev/null |
| 48 | mkdir classes |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 49 | javac -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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | popd > /dev/null |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 51 | JAVA_RESULT=$? |
| 52 | if [ $JAVA_RESULT -ne 0 ]; then |
| 53 | echo "Could not compile generated classes." |
| 54 | exit $JAVA_RESULT |
| 55 | fi |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | |
| 57 | rm -rf generated |
| 58 | mkdir -p generated/C |
| 59 | cp out/com_google_android_gles_jni_GLImpl.cpp generated/C |
| 60 | cp -r out/com generated |
| 61 | cp -r out/javax generated |
| 62 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 63 | cp out/android_opengl_*.cpp generated/C |
| 64 | mkdir -p generated/android/opengl |
| 65 | cp -r out/android/opengl generated/android |
| 66 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 67 | rm -rf out |
Jack Palevich | c005f8b | 2009-04-02 13:38:26 -0700 | [diff] [blame] | 68 | KEEP_GENERATED=0 |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 69 | SAID_PLEASE=0 |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 71 | # compareGenerated destDir generatedDir file |
| 72 | compareGenerated() { |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 86 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 87 | compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp |
| 88 | compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 90 | for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java |
| 91 | do |
| 92 | compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x |
| 93 | done |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 94 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 95 | for x in GLES10 GLES10Ext GLES11 GLES11Ext |
| 96 | do |
| 97 | compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java |
| 98 | compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp |
| 99 | done |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 100 | |
Jack Palevich | c005f8b | 2009-04-02 13:38:26 -0700 | [diff] [blame] | 101 | if [ $KEEP_GENERATED == "0" ] ; then |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame^] | 102 | rm -rf generated |
Jack Palevich | c005f8b | 2009-04-02 13:38:26 -0700 | [diff] [blame] | 103 | fi |