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")
31 if [ -z "$OUTDIR" ]; then
32 panic "No output dir defined!"
35 QEMU_TOP_DIR=$(cd $PROGDIR/../ && pwd -P)
37 if [ ! -d "$QEMU_TOP_DIR/$SCRIPT_DIR" ]; then
38 panic "Missing scripts directory: $QEMU_TOP_DIR/$SCRIPT_DIR"
42 GEN_ENTRIES=$SCRIPT_DIR/gen-emugl-entries.py
43 if [ ! -f "$GEN_ENTRIES" ]; then
44 panic "Missing script: $GEN_ENTRIES"
51 # $3: gen-entries script.
52 gen_functions_header () {
55 local GEN_ENTRIES="$3"
56 if [ ! -f "$SRC_FILE" ]; then
57 echo "ERROR: Missing source file: $SRC_FILE"
60 echo "Generating $DST_FILE"
61 $GEN_ENTRIES --mode=functions $SRC_FILE --output=$DST_FILE
67 # $3: gen-entries script.
68 gen_funcargs_header () {
71 local GEN_ENTRIES="$3"
72 if [ ! -f "$SRC_FILE" ]; then
73 echo "ERROR: Missing source file: $SRC_FILE"
76 echo "Generating $DST_FILE"
77 $GEN_ENTRIES --mode=funcargs $SRC_FILE --output=$DST_FILE
83 ## libOpenGLESDispatch headers.
85 OPENGLES_DISPATCH_SRCDIR=external/android-emugl/host/libs/libOpenGLESDispatch
86 OPENGLES_DISPATCH_INCLUDE=$OUTDIR/external/android-emugl/host/include/OpenGLESDispatch
87 mkdir -p $OPENGLES_DISPATCH_INCLUDE
89 gen_functions_header \
90 "$OPENGLES_DISPATCH_SRCDIR"/render_egl.entries \
91 "$OPENGLES_DISPATCH_INCLUDE"/RenderEGL_functions.h \
94 gen_functions_header \
95 "$OPENGLES_DISPATCH_SRCDIR"/render_egl_extensions.entries \
96 "$OPENGLES_DISPATCH_INCLUDE"/RenderEGL_extensions_functions.h \
99 GLES_ENTRIES="gles_common gles_extensions gles1_only gles1_extensions gles2_only \
100 gles2_extensions gles3_only"
102 for ENTRY in $GLES_ENTRIES; do
103 SRC_FILE=$OPENGLES_DISPATCH_SRCDIR/${ENTRY}.entries
104 DST_FILE=$OPENGLES_DISPATCH_INCLUDE/${ENTRY}_functions.h
105 gen_funcargs_header "$SRC_FILE" "$DST_FILE" "$GEN_ENTRIES"
108 if [ "$FAILURES" ]; then