summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2020-01-02 02:54:40 +0100
committerMat <mail@mathias.is>2020-01-02 02:54:40 +0100
commitbf10b566383e67b7a26d1dc80bb3bc613168c1b5 (patch)
tree9c8734d5ddd62f20894844361a188a80d5f25ff4 /android
parentSkip release builds outside master (#4447) (diff)
downloadcuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar.gz
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar.bz2
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar.lz
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar.xz
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.tar.zst
cuberite-bf10b566383e67b7a26d1dc80bb3bc613168c1b5.zip
Diffstat (limited to '')
-rw-r--r--android/.gitignore3
-rw-r--r--android/CMakeLists.txt2
-rwxr-xr-xandroid/compile.sh43
3 files changed, 22 insertions, 26 deletions
diff --git a/android/.gitignore b/android/.gitignore
index f23a2c19b..1335c1112 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -1 +1,2 @@
-/Cuberite/ \ No newline at end of file
+/Cuberite/
+Server \ No newline at end of file
diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt
index 4f863d114..99eada26f 100644
--- a/android/CMakeLists.txt
+++ b/android/CMakeLists.txt
@@ -22,7 +22,7 @@ include_directories(SYSTEM
)
# Disable some compiler warnings (the lazy way out)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-double-promotion -Wno-sign-conversion")
# Build the rest of the server
add_subdirectory(../ Cuberite)
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"