2009-04-15 02:00:09 +00:00
#!/bin/bash
set -u
2009-03-04 03:31:44 +00:00
rm -rf out generated
mkdir out
mkdir -p out/javax/microedition/khronos/opengles
mkdir -p out/com/google/android/gles_jni
mkdir -p out/android/graphics
echo "package android.graphics;" > out/android/graphics/Canvas.java
echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
GLFILE=out/javax/microedition/khronos/opengles/GL.java
cp stubs/GLHeader.java-if $GLFILE
2009-04-15 02:00:09 +00:00
GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
2009-03-04 03:31:44 +00:00
pushd src > /dev/null
javac ${GLGEN_FILES}
2009-04-15 02:00:09 +00:00
JAVAC_RESULT=$?
if [ $JAVAC_RESULT -ne 0 ]; then
echo "Could not compile glgen."
exit $JAVAC_RESULT
fi
2009-03-04 03:31:44 +00:00
popd > /dev/null
java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks
2009-04-15 02:00:09 +00:00
rm src/*.class
2009-03-04 03:31:44 +00:00
pushd out > /dev/null
mkdir classes
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
popd > /dev/null
rm -rf generated
mkdir -p generated/C
cp out/com_google_android_gles_jni_GLImpl.cpp generated/C
cp -r out/com generated
cp -r out/javax generated
rm -rf out
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=0
2009-03-04 03:31:44 +00:00
# com_google_android_gles_jni_GLImpl.cpp
2009-04-02 20:38:26 +00:00
if cmp ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then
2009-03-04 03:31:44 +00:00
echo com_google_android_gles_jni_GLImpl.cpp unchanged
else
2009-04-02 20:38:26 +00:00
echo Please p4 edit ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp
echo Please cp generated/C/com_google_android_gles_jni_GLImpl.cpp ../../../../../frameworks/base/core/jni
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GLImpl.java
if cmp ../../java/com/google/android/gles_jni/GLImpl.java generated/com/google/android/gles_jni/GLImpl.java ; then
echo GLImpl.java unchanged
else
echo Please edit ../../java/com/google/android/gles_jni/GLImpl.java
echo Please cp generated/com/google/android/gles_jni/GLImpl.java ../../java/com/google/android/gles_jni
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL.java
if cmp ../../java/javax/microedition/khronos/opengles/GL.java generated/javax/microedition/khronos/opengles/GL.java ; then
echo GL.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL.java
echo Please cp generated/javax/microedition/khronos/opengles/GL.java ../../java/javax/microedition/khronos/opengles/GL.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL10.java
if cmp ../../java/javax/microedition/khronos/opengles/GL10.java generated/javax/microedition/khronos/opengles/GL10.java ; then
echo GL10.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL10.java
echo Please cp generated/javax/microedition/khronos/opengles/GL10.java ../../java/javax/microedition/khronos/opengles/GL10.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL10Ext.java
if cmp ../../java/javax/microedition/khronos/opengles/GL10Ext.java generated/javax/microedition/khronos/opengles/GL10Ext.java ; then
echo GL10Ext.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL10Ext.java
echo Please cp generated/javax/microedition/khronos/opengles/GL10Ext.java ../../java/javax/microedition/khronos/opengles/GL10Ext.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL11.java
if cmp ../../java/javax/microedition/khronos/opengles/GL11.java generated/javax/microedition/khronos/opengles/GL11.java ; then
echo GL11.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL11.java
echo Please cp generated/javax/microedition/khronos/opengles/GL11.java ../../java/javax/microedition/khronos/opengles/GL11.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL11Ext.java
if cmp ../../java/javax/microedition/khronos/opengles/GL11Ext.java generated/javax/microedition/khronos/opengles/GL11Ext.java ; then
echo GL11Ext.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL11Ext.java
echo Please cp generated/javax/microedition/khronos/opengles/GL11Ext.java ../../java/javax/microedition/khronos/opengles/GL11Ext.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
# GL11ExtensionPack.java
if cmp ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ; then
echo GL11ExtensionPack.java unchanged
else
echo Please edit ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
echo Please cp generated/javax/microedition/khronos/opengles/GL11ExtensionPack.java ../../java/javax/microedition/khronos/opengles/GL11ExtensionPack.java
2009-04-02 20:38:26 +00:00
KEEP_GENERATED=1
2009-03-04 03:31:44 +00:00
fi
2009-04-02 20:38:26 +00:00
if [ $KEEP_GENERATED == "0" ] ; then
2009-03-04 03:31:44 +00:00
rm -rf generated
2009-04-02 20:38:26 +00:00
fi