Allow building with latest ndk

This commit is contained in:
Benau 2020-02-29 01:18:09 +08:00
parent 8b119201dc
commit 6630f21295
4 changed files with 13 additions and 10 deletions

View File

@ -231,7 +231,7 @@ LOCAL_CPPFLAGS := -std=gnu++0x
LOCAL_STATIC_LIBRARIES := irrlicht bullet enet ifaddrs angelscript mcpp \ LOCAL_STATIC_LIBRARIES := irrlicht bullet enet ifaddrs angelscript mcpp \
vorbisfile vorbis ogg openal curl libssl libcrypto \ vorbisfile vorbis ogg openal curl libssl libcrypto \
gnustl_static raqm fribidi harfbuzz freetype graphics_utils c++_static raqm fribidi harfbuzz freetype graphics_utils
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)

View File

@ -33,7 +33,7 @@
</application> </application>
<uses-sdk android:minSdkVersion="19" <uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="26" /> android:targetSdkVersion="29" />
<uses-feature android:glEsVersion="0x00020000" /> <uses-feature android:glEsVersion="0x00020000" />
<uses-feature android:name="android.software.leanback" android:required="false" /> <uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.software.input_methods" android:required="false" /> <uses-feature android:name="android.software.input_methods" android:required="false" />

View File

@ -44,8 +44,8 @@ and extract it to stk-code/lib. It contains sources of libraries that are used
in STK, but are not availiable in stk-code repository (curl, freetype, openal). in STK, but are not availiable in stk-code repository (curl, freetype, openal).
You need also Android SDK for android-19 platform (the API for Android 4.4) and You need also Android SDK for android-19 platform (the API for Android 4.4) and
Android NDK. Note that NDK >= r15 is atm. not supported. Version r12b is Android NDK. Version r20 is recommended, because it's known that it works
strongly recommended, because it's known that it works without issues. without issues.
You need to create proper "android-sdk" and "android-ndk" symlinks in the You need to create proper "android-sdk" and "android-ndk" symlinks in the
directory with Android project, so that the compilation script will have access directory with Android project, so that the compilation script will have access

View File

@ -13,7 +13,6 @@ export SDK_PATH_DEFAULT="$DIRNAME/android-sdk"
export NDK_TOOLCHAIN_PATH="$DIRNAME/obj/bin" export NDK_TOOLCHAIN_PATH="$DIRNAME/obj/bin"
export NDK_BUILD_SCRIPT="$DIRNAME/Android.mk" export NDK_BUILD_SCRIPT="$DIRNAME/Android.mk"
export PATH="$DIRNAME/obj/bin:$PATH" export PATH="$DIRNAME/obj/bin:$PATH"
export CROSS_SYSROOT="$DIRNAME/obj/sysroot"
#export NDK_CCACHE=ccache #export NDK_CCACHE=ccache
export NDK_CPPFLAGS="-O3 -g" export NDK_CPPFLAGS="-O3 -g"
@ -298,7 +297,7 @@ if [ ! -f "$DIRNAME/obj/zlib.stamp" ]; then
cd "$DIRNAME/obj/zlib" cd "$DIRNAME/obj/zlib"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \ cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST && -DHOST=$HOST -DCMAKE_C_FLAGS="-fpic" &&
make $@ make $@
check_error check_error
touch "$DIRNAME/obj/zlib.stamp" touch "$DIRNAME/obj/zlib.stamp"
@ -414,8 +413,10 @@ if [ ! -f "$DIRNAME/obj/openssl.stamp" ]; then
cp -a -f "$DIRNAME/../lib/openssl/"* "$DIRNAME/obj/openssl" cp -a -f "$DIRNAME/../lib/openssl/"* "$DIRNAME/obj/openssl"
cd "$DIRNAME/obj/openssl" cd "$DIRNAME/obj/openssl"
./Configure android --cross-compile-prefix="$HOST-" export ANDROID_NDK_HOME="$DIRNAME/obj/"
./Configure android-$ARCH
make $@ make $@
unset ANDROID_NDK_HOME
check_error check_error
touch "$DIRNAME/obj/openssl.stamp" touch "$DIRNAME/obj/openssl.stamp"
fi fi
@ -447,7 +448,7 @@ if [ ! -f "$DIRNAME/obj/jpeglib.stamp" ]; then
cd "$DIRNAME/obj/jpeglib" cd "$DIRNAME/obj/jpeglib"
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \ cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/Toolchain-android.cmake \
-DHOST=$HOST && -DHOST=$HOST -DCMAKE_C_FLAGS="-fpic" &&
make $@ make $@
check_error check_error
touch "$DIRNAME/obj/jpeglib.stamp" touch "$DIRNAME/obj/jpeglib.stamp"
@ -474,8 +475,10 @@ if [ ! -f "$DIRNAME/obj/libvorbis.stamp" ]; then
cd "$DIRNAME/obj/libvorbis" cd "$DIRNAME/obj/libvorbis"
CPPFLAGS="-I$DIRNAME/obj/libogg/include $CPPFLAGS" \ CPPFLAGS="-I$DIRNAME/obj/libogg/include $CPPFLAGS" \
LDFLAGS="-L$DIRNAME/obj/libogg/src/.libs $LDFLAGS" \ LDFLAGS="-L$DIRNAME/obj/libogg/src/.libs -lm $LDFLAGS" \
./configure --host=$HOST && ./configure --host=$HOST &&
sed -i '/#define size_t/d' config.h
sed -i 's/-mno-ieee-fp//' lib/Makefile
make $@ make $@
check_error check_error
touch "$DIRNAME/obj/libvorbis.stamp" touch "$DIRNAME/obj/libvorbis.stamp"
@ -489,7 +492,7 @@ ${NDK_PATH}/ndk-build $@ \
APP_ABI="$NDK_ABI" \ APP_ABI="$NDK_ABI" \
APP_PLATFORM="$NDK_PLATFORM" \ APP_PLATFORM="$NDK_PLATFORM" \
APP_CPPFLAGS="$NDK_CPPFLAGS" \ APP_CPPFLAGS="$NDK_CPPFLAGS" \
APP_STL=gnustl_static \ APP_STL=c++_static \
NDK_DEBUG=$IS_DEBUG_BUILD NDK_DEBUG=$IS_DEBUG_BUILD
check_error check_error