3 # Copyright (C) 2015 The Android Open Source Project
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Run this script to re-generate headers with the gen-entries.py script.
23 PROGDIR=$(dirname "$0")
30 QEMU_TOP_DIR=$(cd $PROGDIR/../../.. && pwd -P)
31 SCRIPT_DIR=android/scripts
32 if [ ! -d "$QEMU_TOP_DIR/$SCRIPT_DIR" ]; then
33 panic "Missing scripts directory: $QEMU_TOP_DIR/$SCRIPT_DIR"
37 GEN_ENTRIES=$SCRIPT_DIR/gen-entries.py
38 if [ ! -f "$GEN_ENTRIES" ]; then
39 panic "Missing script: $GEN_ENTRIES"
46 # $3: gen-entries script.
47 gen_functions_header () {
50 local GEN_ENTRIES="$3"
51 if [ ! -f "$SRC_FILE" ]; then
52 echo "ERROR: Missing source file: $SRC_FILE"
55 echo "Generating $DST_FILE"
56 $GEN_ENTRIES --mode=functions $SRC_FILE --output=$DST_FILE
62 # $3: gen-entries script.
63 gen_funcargs_header () {
66 local GEN_ENTRIES="$3"
67 if [ ! -f "$SRC_FILE" ]; then
68 echo "ERROR: Missing source file: $SRC_FILE"
71 echo "Generating $DST_FILE"
72 $GEN_ENTRIES --mode=funcargs $SRC_FILE --output=$DST_FILE
78 ## libOpenglRender headers.
80 LIBRENDER_DIR=distrib/android-emugl/host/libs/libOpenglRender
81 LIBRENDER_INCLUDE=distrib/android-emugl/host/include/OpenglRender
83 "$LIBRENDER_DIR"/render_api.entries \
84 "$LIBRENDER_INCLUDE"/render_api_functions.h \
88 ## libOpenGLESDispatch headers.
90 OPENGLES_DISPATCH_SRCDIR=distrib/android-emugl/host/libs/libOpenGLESDispatch
91 OPENGLES_DISPATCH_INCLUDE=distrib/android-emugl/host/include/OpenGLESDispatch
93 gen_functions_header \
94 "$OPENGLES_DISPATCH_SRCDIR"/render_egl.entries \
95 "$OPENGLES_DISPATCH_INCLUDE"/RenderEGL_functions.h \
98 gen_functions_header \
99 "$OPENGLES_DISPATCH_SRCDIR"/render_egl_extensions.entries \
100 "$OPENGLES_DISPATCH_INCLUDE"/RenderEGL_extensions_functions.h \
103 GLES_ENTRIES="gles_common gles_extensions gles1_only gles1_extensions gles2_only \
104 gles2_extensions gles3_only"
106 for ENTRY in $GLES_ENTRIES; do
107 SRC_FILE=$OPENGLES_DISPATCH_SRCDIR/${ENTRY}.entries
108 DST_FILE=$OPENGLES_DISPATCH_INCLUDE/${ENTRY}_functions.h
109 gen_funcargs_header "$SRC_FILE" "$DST_FILE" "$GEN_ENTRIES"
112 if [ "$FAILURES" ]; then