aboutsummaryrefslogtreecommitdiff
path: root/android/native
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-10-31 23:32:25 +0100
committerGitHub <noreply@github.com>2021-10-31 22:32:25 +0000
commit4114e3047bd2cc975d829f24d73991650817ad66 (patch)
tree42c439f81df640bedd73de080ffbbfca015a3c7c /android/native
parentcef016d393959e989df259aeacd055fc702a55ca (diff)
downloadminetest-4114e3047bd2cc975d829f24d73991650817ad66.tar.gz
minetest-4114e3047bd2cc975d829f24d73991650817ad66.tar.bz2
minetest-4114e3047bd2cc975d829f24d73991650817ad66.zip
Update Android to new dependency repo (#11690)
Diffstat (limited to 'android/native')
-rw-r--r--android/native/build.gradle46
-rw-r--r--android/native/jni/Android.mk110
-rw-r--r--android/native/jni/Application.mk16
3 files changed, 78 insertions, 94 deletions
diff --git a/android/native/build.gradle b/android/native/build.gradle
index a7f095641..e37694f5b 100644
--- a/android/native/build.gradle
+++ b/android/native/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'de.undercouch.download'
android {
compileSdkVersion 29
buildToolsVersion '30.0.3'
- ndkVersion '22.0.7026061'
+ ndkVersion "$ndk_version"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
@@ -50,53 +50,19 @@ android {
}
// get precompiled deps
-def folder = 'minetest_android_deps_binaries'
-
task downloadDeps(type: Download) {
- src 'https://github.com/minetest/' + folder + '/archive/master.zip'
+ src 'https://github.com/minetest/minetest_android_deps/releases/download/latest/deps.zip'
dest new File(buildDir, 'deps.zip')
overwrite false
}
task getDeps(dependsOn: downloadDeps, type: Copy) {
- def deps = file('deps')
- def f = file("$buildDir/" + folder + "-master")
-
- if (!deps.exists() && !f.exists()) {
+ def deps = new File(buildDir.parent, 'deps')
+ if (!deps.exists()) {
+ deps.mkdir()
from zipTree(downloadDeps.dest)
- into buildDir
- }
-
- doLast {
- if (!deps.exists()) {
- file(f).renameTo(file(deps))
- }
- }
-}
-
-// get sqlite
-def sqlite_ver = '3340000'
-task downloadSqlite(dependsOn: getDeps, type: Download) {
- src 'https://www.sqlite.org/2020/sqlite-amalgamation-' + sqlite_ver + '.zip'
- dest new File(buildDir, 'sqlite.zip')
- overwrite false
-}
-
-task getSqlite(dependsOn: downloadSqlite, type: Copy) {
- def sqlite = file('deps/Android/sqlite')
- def f = file("$buildDir/sqlite-amalgamation-" + sqlite_ver)
-
- if (!sqlite.exists() && !f.exists()) {
- from zipTree(downloadSqlite.dest)
- into buildDir
- }
-
- doLast {
- if (!sqlite.exists()) {
- file(f).renameTo(file(sqlite))
- }
+ into deps
}
}
preBuild.dependsOn getDeps
-preBuild.dependsOn getSqlite
diff --git a/android/native/jni/Android.mk b/android/native/jni/Android.mk
index 26e9b058b..85c13bfb3 100644
--- a/android/native/jni/Android.mk
+++ b/android/native/jni/Android.mk
@@ -4,62 +4,82 @@ LOCAL_PATH := $(call my-dir)/..
include $(CLEAR_VARS)
LOCAL_MODULE := Curl
-LOCAL_SRC_FILES := deps/Android/Curl/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libcurl.a
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := Freetype
-LOCAL_SRC_FILES := deps/Android/Freetype/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libfreetype.a
+LOCAL_MODULE := libmbedcrypto
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedcrypto.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := Irrlicht
-LOCAL_SRC_FILES := deps/Android/Irrlicht/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libIrrlichtMt.a
+LOCAL_MODULE := libmbedtls
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedtls.a
include $(PREBUILT_STATIC_LIBRARY)
-#include $(CLEAR_VARS)
-#LOCAL_MODULE := LevelDB
-#LOCAL_SRC_FILES := deps/Android/LevelDB/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libleveldb.a
-#include $(PREBUILT_STATIC_LIBRARY)
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmbedx509
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Curl/libmbedx509.a
+include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := LuaJIT
-LOCAL_SRC_FILES := deps/Android/LuaJIT/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libluajit.a
+LOCAL_MODULE := Freetype
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Freetype/libfreetype.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := mbedTLS
-LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedtls.a
+LOCAL_MODULE := Iconv
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Iconv/libiconv.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := mbedx509
-LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedx509.a
+LOCAL_MODULE := libcharset
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Iconv/libcharset.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := mbedcrypto
-LOCAL_SRC_FILES := deps/Android/mbedTLS/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libmbedcrypto.a
+LOCAL_MODULE := Irrlicht
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Irrlicht/libIrrlichtMt.a
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := LuaJIT
+LOCAL_SRC_FILES := deps/$(APP_ABI)/LuaJIT/libluajit.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := OpenAL
-LOCAL_SRC_FILES := deps/Android/OpenAL-Soft/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libopenal.a
+LOCAL_SRC_FILES := deps/$(APP_ABI)/OpenAL-Soft/libopenal.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := GetText
-LOCAL_SRC_FILES := deps/Android/GetText/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libintl.a
+LOCAL_MODULE := Gettext
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Gettext/libintl.a
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := SQLite3
+LOCAL_SRC_FILES := deps/$(APP_ABI)/SQLite/libsqlite3.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Vorbis
-LOCAL_SRC_FILES := deps/Android/Vorbis/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libvorbis.a
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libvorbis.a
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libvorbisfile
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libvorbisfile.a
+include $(PREBUILT_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libogg
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Vorbis/libogg.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := Zstd
-LOCAL_SRC_FILES := deps/Android/Zstd/${NDK_TOOLCHAIN_VERSION}/$(APP_ABI)/libzstd.a
+LOCAL_SRC_FILES := deps/$(APP_ABI)/Zstd/libzstd.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
@@ -96,18 +116,16 @@ LOCAL_C_INCLUDES := \
../../src/script \
../../lib/gmp \
../../lib/jsoncpp \
- deps/Android/Curl/include \
- deps/Android/Freetype/include \
- deps/Android/Irrlicht/include \
- deps/Android/LevelDB/include \
- deps/Android/GetText/include \
- deps/Android/libiconv/include \
- deps/Android/libiconv/libcharset/include \
- deps/Android/LuaJIT/src \
- deps/Android/OpenAL-Soft/include \
- deps/Android/sqlite \
- deps/Android/Vorbis/include \
- deps/Android/Zstd/include
+ deps/$(APP_ABI)/Curl/include \
+ deps/$(APP_ABI)/Freetype/include/freetype2 \
+ deps/$(APP_ABI)/Irrlicht/include \
+ deps/$(APP_ABI)/Gettext/include \
+ deps/$(APP_ABI)/Iconv/include \
+ deps/$(APP_ABI)/LuaJIT/include \
+ deps/$(APP_ABI)/OpenAL-Soft/include \
+ deps/$(APP_ABI)/SQLite/include \
+ deps/$(APP_ABI)/Vorbis/include \
+ deps/$(APP_ABI)/Zstd/include
LOCAL_SRC_FILES := \
$(wildcard ../../src/client/*.cpp) \
@@ -190,24 +208,24 @@ LOCAL_SRC_FILES := \
../../src/voxel.cpp \
../../src/voxelalgorithms.cpp
-# LevelDB backend is disabled
-# ../../src/database/database-leveldb.cpp
-
# GMP
LOCAL_SRC_FILES += ../../lib/gmp/mini-gmp.c
# JSONCPP
LOCAL_SRC_FILES += ../../lib/jsoncpp/jsoncpp.cpp
-# iconv
-LOCAL_SRC_FILES += \
- deps/Android/libiconv/lib/iconv.c \
- deps/Android/libiconv/libcharset/lib/localcharset.c
-
-# SQLite3
-LOCAL_SRC_FILES += deps/Android/sqlite/sqlite3.c
-
-LOCAL_STATIC_LIBRARIES += Curl Freetype Irrlicht OpenAL mbedTLS mbedx509 mbedcrypto Vorbis LuaJIT GetText Zstd android_native_app_glue $(PROFILER_LIBS) #LevelDB
+LOCAL_STATIC_LIBRARIES += \
+ Curl libmbedcrypto libmbedtls libmbedx509 \
+ Freetype \
+ Iconv libcharset \
+ Irrlicht \
+ LuaJIT \
+ OpenAL \
+ Gettext \
+ SQLite3 \
+ Vorbis libvorbisfile libogg \
+ Zstd
+LOCAL_STATIC_LIBRARIES += android_native_app_glue $(PROFILER_LIBS)
LOCAL_LDLIBS := -lEGL -lGLESv1_CM -lGLESv2 -landroid -lOpenSLES
diff --git a/android/native/jni/Application.mk b/android/native/jni/Application.mk
index 82f0148f0..e21bca61c 100644
--- a/android/native/jni/Application.mk
+++ b/android/native/jni/Application.mk
@@ -5,22 +5,22 @@ NDK_TOOLCHAIN_VERSION := clang
APP_SHORT_COMMANDS := true
APP_MODULES := Minetest
-APP_CPPFLAGS := -Ofast -fvisibility=hidden -fexceptions -Wno-deprecated-declarations -Wno-extra-tokens
+APP_CPPFLAGS := -O2 -fvisibility=hidden
ifeq ($(APP_ABI),armeabi-v7a)
-APP_CPPFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
+APP_CPPFLAGS += -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb
endif
-#ifeq ($(APP_ABI),x86)
-#APP_CPPFLAGS += -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -funroll-loops
-#endif
+ifeq ($(APP_ABI),x86)
+APP_CPPFLAGS += -mssse3 -mfpmath=sse -funroll-loops
+endif
ifndef NDEBUG
-APP_CPPFLAGS := -g -D_DEBUG -O0 -fno-omit-frame-pointer -fexceptions
+APP_CPPFLAGS := -g -Og -fno-omit-frame-pointer
endif
-APP_CFLAGS := $(APP_CPPFLAGS) -Wno-parentheses-equality #-Werror=shorten-64-to-32
-APP_CXXFLAGS := $(APP_CPPFLAGS) -frtti -std=gnu++17
+APP_CFLAGS := $(APP_CPPFLAGS) -Wno-inconsistent-missing-override -Wno-parentheses-equality
+APP_CXXFLAGS := $(APP_CPPFLAGS) -fexceptions -frtti -std=gnu++17
APP_LDFLAGS := -Wl,--no-warn-mismatch,--gc-sections,--icf=safe
ifeq ($(APP_ABI),arm64-v8a)