2019-05-01 18:05:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
ARCHS="armeabi-v7a-hard armeabi x86"
|
|
|
|
TOOLCHAIN=4.9
|
2019-05-06 03:24:42 +02:00
|
|
|
API=19
|
2019-05-01 18:05:15 +02:00
|
|
|
ROOT="$PWD" # compile.sh must be run from root of android project sources
|
2019-05-06 03:24:42 +02:00
|
|
|
SUBDIRS="xash3d-fwgs hlsdk-xash3d"
|
|
|
|
SYMLINKS_APPEND=""
|
2019-05-06 18:12:39 +02:00
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
BUILD_TYPE=debug
|
|
|
|
else
|
|
|
|
BUILD_TYPE=$1
|
|
|
|
fi
|
2019-05-06 03:24:42 +02:00
|
|
|
|
|
|
|
# Cleanup libraries
|
|
|
|
rm -rf android/lib/
|
2019-05-01 18:05:15 +02:00
|
|
|
|
|
|
|
# Generate configs
|
|
|
|
android/gen-config.sh android/
|
|
|
|
android/gen-version.sh android/
|
|
|
|
|
2019-05-06 18:12:39 +02:00
|
|
|
# configure android project
|
|
|
|
./waf configure -T $BUILD_TYPE
|
|
|
|
|
2019-05-01 18:05:15 +02:00
|
|
|
build_native_project()
|
|
|
|
{
|
2019-05-06 03:24:42 +02:00
|
|
|
mkdir -p $ROOT/build-$1/$2
|
|
|
|
if [ -L "$1-sl" ]; then
|
|
|
|
cd $1-sl # need to change directory, as waf doesn't work well with symlinks(used in development purposes)
|
|
|
|
else
|
|
|
|
cd $1
|
|
|
|
fi
|
2019-05-06 18:12:39 +02:00
|
|
|
./waf -o $ROOT/build-$1/$2 configure -T $BUILD_TYPE --android="$2,$3,$4" build || exit 1
|
|
|
|
./waf install --destdir=$ROOT/build/android/
|
2019-05-06 03:24:42 +02:00
|
|
|
cd $ROOT # obviously, we can't ../ from symlink directory, so change to our root directory
|
2019-05-01 18:05:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Do it inside waf?
|
|
|
|
for i in $ARCHS; do
|
2019-05-06 03:24:42 +02:00
|
|
|
for j in $SUBDIRS; do
|
|
|
|
build_native_project "$j" "$i" "$TOOLCHAIN" "$API"
|
|
|
|
done
|
2019-05-01 18:05:15 +02:00
|
|
|
done
|
|
|
|
|
2019-05-06 18:12:39 +02:00
|
|
|
find $ROOT/build/android/lib -name "*.a" -delete
|
|
|
|
|
2019-05-01 18:05:15 +02:00
|
|
|
# Run waf
|
2019-05-06 18:12:39 +02:00
|
|
|
./waf build
|
|
|
|
|
|
|
|
# sign
|
|
|
|
cp build/android/xashdroid-src.apk xashdroid.apk
|
|
|
|
apksigner sign --ks ../myks.keystore xashdroid.apk
|