5 MANIFEST_FILE="AndroidManifest.xml"
6 MANIFEST_TMPL="$MANIFEST_FILE.tmpl"
8 MAIN_H="$BASE_DIR/src/main.h"
10 VERSION_SUPER=`grep "#define PROGRAM_VERSION_SUPER" $MAIN_H | awk '{print $3}'`
11 VERSION_MAJOR=`grep "#define PROGRAM_VERSION_MAJOR" $MAIN_H | awk '{print $3}'`
12 VERSION_MINOR=`grep "#define PROGRAM_VERSION_MINOR" $MAIN_H | awk '{print $3}'`
13 VERSION_PATCH=`grep "#define PROGRAM_VERSION_PATCH" $MAIN_H | awk '{print $3}'`
14 VERSION_EXTRA=`grep "#define PROGRAM_VERSION_EXTRA" $MAIN_H \
15 | awk -F\" '{print $2}' \
16 | tr '[A-Z ]' '[a-z-]'`
18 UNIQUE_VERSION=`echo "$VERSION_SUPER" | wc -l | awk '{ print $1 }'`
19 if [ "$UNIQUE_VERSION" != "1" ]; then
20 echo "ERROR: program version number ('PROGRAM_VERSION_SUPER') not unique!"
24 VERSION_NAME="$VERSION_SUPER.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
25 VERSION_CODE=$(printf '%d%02d%02d%02d' \
31 if [ "$VERSION_EXTRA" != "" ]; then
32 VERSION_NAME="$VERSION_NAME$VERSION_EXTRA"
35 # echo "::: VERSION_NAME == '$VERSION_NAME'"
36 # echo "::: VERSION_CODE == '$VERSION_CODE'"
38 cat "$MANIFEST_TMPL" \
39 | sed -e "s/__VERSION_NAME__/$VERSION_NAME/" \
40 | sed -e "s/__VERSION_CODE__/$VERSION_CODE/" \