3 # Copyright 2014 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.
23 PROGDIR=$(dirname "$0")
24 PROGNAME=$(basename "$0")
38 OPTARG=$(expr "x$OPT" : "x[^=]*=\\(.*\\)" || true)
50 fatal "Invalid option '$OPT', see --help."
53 fatal "This script doesn't take arguments, see --help."
58 if [ "$OPT_HELP" ]; then
60 Usage: $PROGNAME [options]
62 Update the sources of the GPU emulation encoder and decoder, after an update
65 Valid options (defaults are in brackets):
66 --help|-h|-? Print this help.
67 --anbox-dir=<dir> Specify top-level Anbox directory [$ANBOX_DIR].
68 --emugen=<program> Emugen program path, if not in path.
74 if [ "$OPT_EMUGEN" ]; then
76 if [ ! -f "$EMUGEN" ]; then
77 fatal "Missing emugen binary: $EMUGEN"
80 EMUGEN=$PROGDIR/../../../objs/build/intermediates64/emugen/emugen
81 if [ ! -f "$EMUGEN" ]; then
82 fatal "Missing emugen binary: $EMUGEN, please build it or use --emugen=<program>"
84 echo "Auto-config: --emugen=$EMUGEN"
87 if [ "$OPT_ANBOX_DIR" ]; then
88 ANBOX_DIR=$OPT_ANBOX_DIR
90 echo "Auto-config: --anbox-dir=$ANBOX_DIR"
92 if [ ! -d "$ANBOX_DIR/src/anbox" ]; then
93 fatal "Not an Anbox directory: $ANBOX_DIR"
96 ANBOX_DIR=$(cd "$ANBOX_DIR" && pwd -P)
98 # Find the sources for the encoder:
99 ENCODER_TOP_DIR=$ANBOX_DIR/android/opengl/system
100 DECODER_TOP_DIR=$ANBOX_DIR/external/android-emugl/host/libs
102 if [ ! -d "$ENCODER_TOP_DIR" ]; then
103 fatal "Missing encoder source directory: $ENCODER_TOP_DIR"
105 if [ ! -d "$DECODER_TOP_DIR" ]; then
106 fatal "Missing decoder source directory: $DECODER_TOP_DIR"
110 GLESv1_INPUT_DIR=$DECODER_TOP_DIR/GLESv1_dec
111 GLESv2_INPUT_DIR=$DECODER_TOP_DIR/GLESv2_dec
112 RENDERCONTROL_INPUT_DIR=$DECODER_TOP_DIR/renderControl_dec
114 # The encoder has prefix GL while decoder has GLES
115 cp -f $DECODER_TOP_DIR/GLESv1_dec/gles1.attrib $DECODER_TOP_DIR/GLESv1_dec/gl.attrib
116 cp -f $DECODER_TOP_DIR/GLESv1_dec/gles1.in $DECODER_TOP_DIR/GLESv1_dec/gl.in
117 cp -f $DECODER_TOP_DIR/GLESv1_dec/gles1.types $DECODER_TOP_DIR/GLESv1_dec/gl.types
119 cp -f $DECODER_TOP_DIR/GLESv2_dec/gles2.attrib $DECODER_TOP_DIR/GLESv2_dec/gl2.attrib
120 cp -f $DECODER_TOP_DIR/GLESv2_dec/gles2.in $DECODER_TOP_DIR/GLESv2_dec/gl2.in
121 cp -f $DECODER_TOP_DIR/GLESv2_dec/gles2.types $DECODER_TOP_DIR/GLESv2_dec/gl2.types
123 $EMUGEN -i $DECODER_TOP_DIR/GLESv1_dec -E $ENCODER_TOP_DIR/GLESv1_enc gl
124 $EMUGEN -i $DECODER_TOP_DIR/GLESv2_dec -E $ENCODER_TOP_DIR/GLESv2_enc gl2
125 $EMUGEN -i $DECODER_TOP_DIR/renderControl_dec -E $ENCODER_TOP_DIR/renderControl_enc renderControl
127 rm $DECODER_TOP_DIR/GLESv1_dec/gl.attrib
128 rm $DECODER_TOP_DIR/GLESv1_dec/gl.in
129 rm $DECODER_TOP_DIR/GLESv1_dec/gl.types
131 rm $DECODER_TOP_DIR/GLESv2_dec/gl2.attrib
132 rm $DECODER_TOP_DIR/GLESv2_dec/gl2.in
133 rm $DECODER_TOP_DIR/GLESv2_dec/gl2.types
135 echo "Done, see $ENCODER_TOP_DIR"