summaryrefslogtreecommitdiffstats
path: root/android/compile.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xandroid/compile.sh43
1 files changed, 19 insertions, 24 deletions
diff --git a/android/compile.sh b/android/compile.sh
index 78a42d883..8be0e147c 100755
--- a/android/compile.sh
+++ b/android/compile.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
# This script cross-compiles cuberite for the android platform. It uses
# the following enviroment variables
# CMAKE: Should be the path to a cmake executable of version 3.7+
@@ -13,16 +15,16 @@ function usage() {
}
BASEDIR="$(realpath $(dirname $0))"
+BUILDDIR="$BASEDIR/../android-build"
SELF="./$(basename $0)"
# Clean doesn't need CMAKE and NDK, so it's handled here
if [ "$1" == "clean" ]; then
- cd $BASEDIR
- rm -rf ../android-build/
+ rm -rf $BUILDDIR
exit 0
fi
-if [ -z "$CMAKE" -o -z "$NDK" ];then
+if [ -z "$CMAKE" -o -z "$NDK" ]; then
usage;
fi
@@ -41,28 +43,17 @@ fi
cd $BASEDIR
case "$1" in
- armeabi)
- APILEVEL=16
- ;;
armeabi-v7a)
- APILEVEL=16
+ APILEVEL=14
;;
arm64-v8a)
APILEVEL=21
;;
- mips)
- APILEVEL=16
- ;;
-
- mips64)
- APILEVEL=21
- ;;
-
x86)
- APILEVEL=16
+ APILEVEL=14
;;
x86_64)
@@ -71,22 +62,22 @@ case "$1" in
all)
echo "Packing server.zip ..."
+ rm -rf Server
mkdir -p Server
cd $BASEDIR/../Server
zip -r $BASEDIR/Server/server.zip *
- for arch in armeabi armeabi-v7a arm64-v8a mips mips64 x86 x86_64; do
+ for arch in armeabi-v7a arm64-v8a x86 x86_64; do
echo "Doing ... $arch ..." && \
cd $BASEDIR && \
"$SELF" clean && \
"$SELF" "$arch" && \
- cd Server && \
- zip "$arch".zip Cuberite && \
- rm Cuberite
+ cd $BUILDDIR/Server && \
+ zip $BASEDIR/Server/"$arch".zip Cuberite
done
cd $BASEDIR/Server
- for file in server.zip armeabi.zip armeabi-v7a.zip arm64-v8a.zip mips.zip mips64.zip x86.zip x86_64.zip; do
+ for file in server.zip armeabi-v7a.zip arm64-v8a.zip x86.zip x86_64.zip; do
echo "Generating sha1 sum for ... $file ..." && \
sha1sum "$file" > "$file".sha1
done
@@ -100,7 +91,11 @@ case "$1" in
;;
esac
-mkdir -p $BASEDIR/../android-build
-cd $BASEDIR/../android-build
-"$CMAKE" $BASEDIR/../android -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION="$APILEVEL" -DCMAKE_BUILD_TYPE="$TYPE" -DCMAKE_ANDROID_ARCH_ABI="$1" -DCMAKE_ANDROID_NDK="$NDK"
+mkdir -p $BUILDDIR
+cd $BUILDDIR
+"$CMAKE" $BASEDIR/../android -DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
+ -DANDROID_ABI="$1" \
+ -DANDROID_NATIVE_API_LEVEL="$APILEVEL" \
+ -DCMAKE_BUILD_TYPE="$TYPE"
+
make -j "$THREADS"