2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 02:15:55 +01:00
xash3d-fwgs/build
2018-03-21 02:19:43 +03:00

62 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
PROJECT="xashdroid"
KEYSTORE="../myks.keystore"
KEYSTORE_ALIAS="xashdroid"
ANDROID_SDK_PATH="$HOME/.android"
BUILD_TOOLS_VER="27.0.2"
if [[ "$1" = "--help" ]]; then
echo "Usage: ./build.sh <release|debug>"
exit 0
fi
if [[ "$#" -ne "1" ]]; then
echo "Illegal number of parameters, see ./build.sh --help"
exit 0
fi
if [[ "$1" = "release" ]]; then
NDK_BUILD_FLAGS="V=0 NDK_DEBUG=0"
CONFIG="release"
SIGN="sign"
else
NDK_BUILD_FLAGS="V=1 APP_CFLAGS=\"-gdwarf-3\" NDK_DEBUG=1"
CONFIG="debug"
SIGN=""
fi
echo "*****************************************"
echo "* RELEASETYPE: $RELEASE "
echo "*****************************************"
set -x
# Generate config
./gen-config.sh $CONFIG $SIGN
./gen-version.sh default-$CONFIG
# Regenerate PAK file
rm assets/extras.pak 2>/dev/null
python2 makepak.py xash-extras/ assets/extras.pak
# Regenerate resources(otherwise it may glitch)
rm -rf gen/ bin/
# Build
ndk-build NDK_TOOLCHAIN_VERSION=4.8 $NDK_BUILD_FLAGS -j8
ant $1
if [[ "$1" = "release" ]]; then
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $KEYSTORE bin/$PROJECT-$1-unsigned.apk $KEYSTORE_ALIAS # -tsa https://timestamp.geotrust.com/tsa
$ANDROID_SDK_PATH/build-tools/$BUILD_TOOLS_VER/zipalign 4 bin/$PROJECT-$1-unsigned.apk bin/$PROJECT-$1.apk
fi
mv bin/$PROJECT-$1.apk $PROJECT-$1.apk
# Auto deploy to test device
if [[ "$1" = "debug" ]]; then
adb install -f -r $PROJECT-$1.apk
fi