1#!/bin/sh
2# Generate the Android-side encoder source files.
3# Requirements:
4# (a) The ANDROID_BUILD_TOP and ANDROID_HOST_OUT environment variables must be
5#     defined appropriately. The Android "lunch" bash function will do this.
6# (b) The emugen binary must already be built. Any normal build that includes
7#     the emulator will do this.
8
9if [ -z "$ANDROID_BUILD_TOP" ]; then
10    echo error: ANDROID_BUILD_TOP not set
11    exit 1
12fi
13cd "$ANDROID_BUILD_TOP" >/dev/null
14SRCDIR="sdk/emulator/opengl/host/libs"
15DSTDIR="device/generic/goldfish/opengl/system"
16EMUGEN="external/qemu/objs/emugen"
17if [ ! -d "$SRCDIR" -o ! -d "$DSTDIR" ]; then
18    echo error: can\'t find source and/or destination directory
19    exit 1
20fi
21if [ ! -x "$EMUGEN" ]; then
22    echo error: emugen not available, did you forget to build?
23    exit 1
24fi
25
26function gen() {
27    local src="$SRCDIR/$1_dec"
28    local dst="$DSTDIR/$1_enc"
29    local name="$2"
30    echo "${EMUGEN}" -E "$dst" -i "$src" "$name" "$src/$name".{attrib,in,types}
31}
32
33$(gen GLESv1 gl)
34$(gen GLESv2 gl2)
35$(gen renderControl renderControl)
36