summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/gen
blob: c060040cec44690c5dc5d06d30676c7ba956eff0 (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
#!/bin/sh
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

GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java"

pushd src > /dev/null
javac ${GLGEN_FILES}
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

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
KEEP_GENERATED=0

# com_google_android_gles_jni_GLImpl.cpp
if cmp ../../../../../frameworks/base/core/jni/com_google_android_gles_jni_GLImpl.cpp generated/C/com_google_android_gles_jni_GLImpl.cpp ; then
echo com_google_android_gles_jni_GLImpl.cpp unchanged
else
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
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
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
KEEP_GENERATED=1
fi

if [ $KEEP_GENERATED == "0" ] ; then
rm -rf generated
fi