blob: 7146a29fa57f3349312c8fa549ff29c00e96fa64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
#!/bin/bash
set -u
set -e
rm -rf out generated
mkdir out
# Create dummy Java files for Android APIs that are used by the code we generate.
# This allows us to test the generated code without building the rest of Android.
mkdir -p out/javax/microedition/khronos/opengles
mkdir -p out/com/google/android/gles_jni
mkdir -p out/android/app
mkdir -p out/android/graphics
mkdir -p out/android/view
mkdir -p out/android/opengl
mkdir -p out/android/content
mkdir -p out/android/content/pm
mkdir -p out/android/os
mkdir -p out/android/util
echo "package android.graphics;" > out/android/graphics/Canvas.java
echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
echo "package android.app; import android.content.pm.IPackageManager; public class AppGlobals { public static IPackageManager getPackageManager() { return null;} }" > out/android/app/AppGlobals.java
# echo "package android.content; import android.content.pm.PackageManager; public interface Context { public PackageManager getPackageManager(); }" > out/android/content/Context.java
echo "package android.content.pm; public class ApplicationInfo {public int targetSdkVersion;}" > out/android/content/pm/ApplicationInfo.java
echo "package android.content.pm; public interface IPackageManager {ApplicationInfo getApplicationInfo(java.lang.String packageName, int flags, java.lang.String userId) throws android.os.RemoteException;}" > out/android/content/pm/IPackageManager.java
echo "package android.os; public class Build {public static class VERSION_CODES { public static final int CUPCAKE = 3;}; }" > out/android/os/Build.java
echo "package android.os; public class UserHandle {public static String myUserId() { return \"\"; } }" > out/android/os/UserHandle.java
echo "package android.os; public class RemoteException extends Exception {}" > out/android/os/RemoteException.java
echo "package android.util; public class Log {public static void w(String a, String b) {} public static void e(String a, String b) {}}" > out/android/util/Log.java
echo "package android.opengl; public abstract class EGLObjectHandle { public int getHandle() { return 0; } }" > out/android/opengl/EGLObjectHandle.java
echo "package android.graphics;" > out/android/graphics/SurfaceTexture.java
echo "public interface SurfaceTexture {}" >> out/android/graphics/SurfaceTexture.java
echo "package android.view;" > out/android/view/SurfaceView.java
echo "public interface SurfaceView { SurfaceHolder getHolder(); }" >> out/android/view/SurfaceView.java
echo "package android.view;" > out/android/view/Surface.java
echo "public interface Surface {}" >> out/android/view/Surface.java
echo "package android.view;" > out/android/view/SurfaceHolder.java
echo "public interface SurfaceHolder { Surface getSurface(); }" >> out/android/view/SurfaceHolder.java
cp static/egl/*.java out/android/opengl/
GLFILE=out/javax/microedition/khronos/opengles/GL.java
cp stubs/jsr239/GLHeader.java-if $GLFILE
GLGEN_FILES="CFunc.java CType.java CodeEmitter.java EGLCodeEmitter.java GenerateEGL.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
pushd src > /dev/null
javac ${GLGEN_FILES}
JAVAC_RESULT=$?
if [ $JAVAC_RESULT -ne 0 ]; then
echo "Could not compile glgen."
exit $JAVAC_RESULT
fi
popd > /dev/null
echo "Generating JSR239-like APIs"
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
JAVA_RESULT=$?
if [ $JAVA_RESULT -ne 0 ]; then
echo "Could not run GenerateGL."
exit $JAVA_RESULT
fi
echo "Generating static OpenGLES bindings"
java -classpath src GenerateGLES
JAVA_RESULT=$?
if [ $JAVA_RESULT -ne 0 ]; then
echo "Could not run GenerateGLES."
exit $JAVA_RESULT
fi
echo "Generating static EGL bindings"
java -classpath src GenerateEGL
JAVA_RESULT=$?
if [ $JAVA_RESULT -ne 0 ]; then
echo "Could not run GenerateEGL."
exit $JAVA_RESULT
fi
rm src/*.class
pushd out > /dev/null
mkdir classes
javac -d classes android/opengl/EGL14.java \
android/opengl/EGLExt.java \
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 \
android/opengl/GLES20.java \
android/opengl/GLES30.java
popd > /dev/null
JAVA_RESULT=$?
if [ $JAVA_RESULT -ne 0 ]; then
echo "Could not compile generated classes."
exit $JAVA_RESULT
fi
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
cp out/android_opengl_*.cpp generated/C
mkdir -p generated/android/opengl
cp -r out/android/opengl generated/android
rm -rf out
KEEP_GENERATED=0
SAID_PLEASE=0
# compareGenerated destDir generatedDir file
compareGenerated() {
if cmp -s $1/$3 $2/$3 ; then
echo "# " $3 unchanged
else
echo "# " $3 changed
if [ $SAID_PLEASE == "0" ] ; then
echo Please evaluate the following commands:
echo
SAID_PLEASE=1
fi
echo " cp $2/$3 $1"
echo " (cd $1; git add $3)"
KEEP_GENERATED=1
fi
}
compareGenerated ../../../../base/core/jni generated/C com_google_android_gles_jni_GLImpl.cpp
compareGenerated ../../../../base/opengl/java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java
for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java
do
compareGenerated ../../../../base/opengl/java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x
done
for x in EGL14 EGLExt GLES10 GLES10Ext GLES11 GLES11Ext GLES20 GLES30
do
compareGenerated ../../../../base/opengl/java/android/opengl generated/android/opengl ${x}.java
compareGenerated ../../../../base/core/jni generated/C android_opengl_${x}.cpp
done
for x in EGLConfig EGLContext EGLDisplay EGLObjectHandle EGLSurface
do
compareGenerated ../../../../base/opengl/java/android/opengl generated/android/opengl ${x}.java
done
if [ $KEEP_GENERATED == "0" ] ; then
rm -rf generated
fi
|