forked from Mirrorlandia_minetest/minetest
Drop libgmp on Android and use mini-gmp (#8047)
This commit is contained in:
parent
6b978f88e3
commit
9854340c0b
@ -106,13 +106,6 @@ CURL_TIMESTAMP = $(CURL_DIR)/timestamp
|
||||
CURL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/curl_timestamp
|
||||
CURL_URL_HTTP = https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2
|
||||
|
||||
GMP_VERSION = 6.1.2
|
||||
GMP_DIR = $(ANDR_ROOT)/deps/gmp-$(GMP_VERSION)
|
||||
GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.so
|
||||
GMP_TIMESTAMP = $(GMP_DIR)/timestamp
|
||||
GMP_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gmp_timestamp
|
||||
GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2
|
||||
|
||||
FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype2-android/
|
||||
FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a
|
||||
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp
|
||||
@ -297,7 +290,7 @@ openssl_download :
|
||||
|
||||
openssl : $(OPENSSL_LIB)
|
||||
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \
|
||||
echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \
|
||||
@ -319,8 +312,8 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
CC=${CROSS_CC} ./Configure enable-gmp no-asm -DL_ENDIAN -I${GMP_DIR} \
|
||||
-L${GMP_DIR}/usr/lib android-${TARGET_ARCH} -D__ANDROID_API__=$(API); \
|
||||
CC=${CROSS_CC} ./Configure -DL_ENDIAN android-${TARGET_ARCH} \
|
||||
-D__ANDROID_API__=$(API); \
|
||||
CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \
|
||||
CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
@ -617,65 +610,6 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
clean_curl :
|
||||
./gradlew cleanCURL
|
||||
|
||||
$(GMP_TIMESTAMP) : gmp_download
|
||||
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
gmp_download :
|
||||
@if [ ! -d "${GMP_DIR}" ] ; then \
|
||||
echo "gmp sources missing, downloading..."; \
|
||||
mkdir -p ${ANDR_ROOT}/deps; \
|
||||
cd deps; \
|
||||
wget ${GMP_URL_HTTP} || exit 1; \
|
||||
tar -xjf gmp-${GMP_VERSION}.tar.bz2 || exit 1; \
|
||||
rm gmp-${GMP_VERSION}.tar.bz2; \
|
||||
ln -s gmp-${GMP_VERSION} gmp; \
|
||||
fi
|
||||
|
||||
gmp : $(GMP_LIB)
|
||||
|
||||
$(GMP_LIB): $(GMP_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${GMP_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${GMP_DIR}; \
|
||||
echo "changed timestamp for gmp detected building..."; \
|
||||
cd deps/gmp-${GMP_VERSION}; \
|
||||
export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--platform=${APP_PLATFORM} \
|
||||
--stl=libc++ \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_CC}; \
|
||||
export CXX=${CROSS_CXX}; \
|
||||
export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
export LIBGMP_LDFLAGS="-avoid-version"; \
|
||||
export LIBGMPXX_LDFLAGS="-avoid-version"; \
|
||||
./configure --disable-static --host=${TARGET_HOST} --prefix=/usr; \
|
||||
$(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
touch ${GMP_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for gmp"; \
|
||||
fi
|
||||
|
||||
clean_gmp:
|
||||
./gradlew cleanGMP
|
||||
|
||||
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
|
||||
|
||||
deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
@ -747,7 +681,7 @@ assets : $(ASSETS_TIMESTAMP)
|
||||
clean_assets :
|
||||
./gradlew cleanAssets
|
||||
|
||||
apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \
|
||||
apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \
|
||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
|
||||
$(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download
|
||||
+ @export TARGET_LIBDIR=${TARGET_LIBDIR}; \
|
||||
|
@ -16,7 +16,6 @@ allprojects {
|
||||
}
|
||||
|
||||
def curl_version = "7.60.0"
|
||||
def gmp_version = "6.1.2"
|
||||
def irrlicht_revision = "5150"
|
||||
def openal_version = "1.18.2"
|
||||
def openssl_version = "1.0.2n"
|
||||
@ -154,14 +153,9 @@ task cleanSQLite3(type: Delete) {
|
||||
delete 'deps/sqlite-amalgamation-' + sqlite3_version + '.zip'
|
||||
}
|
||||
|
||||
task cleanGMP(type: Delete) {
|
||||
delete 'deps/gmp'
|
||||
delete 'deps/gmp-' + gmp_version
|
||||
}
|
||||
|
||||
task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv,
|
||||
cleanFreetype, cleanIrrlicht, cleanLevelDB, cleanSQLite3, cleanCURL,
|
||||
cleanOpenSSL, cleanOpenAL, cleanOgg, cleanGMP]) {
|
||||
cleanOpenSSL, cleanOpenAL, cleanOgg]) {
|
||||
delete 'deps'
|
||||
delete 'gen'
|
||||
delete 'libs'
|
||||
|
@ -44,11 +44,6 @@ LOCAL_MODULE := vorbis
|
||||
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gmp
|
||||
LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ssl
|
||||
LOCAL_SRC_FILES := deps/openssl/libssl.a
|
||||
@ -98,6 +93,7 @@ endif
|
||||
LOCAL_C_INCLUDES := \
|
||||
jni/src \
|
||||
jni/src/script \
|
||||
jni/lib/gmp \
|
||||
jni/lib/lua/src \
|
||||
jni/lib/jsoncpp \
|
||||
jni/src/cguittfont \
|
||||
@ -107,7 +103,6 @@ LOCAL_C_INCLUDES := \
|
||||
deps/curl/include \
|
||||
deps/openal-soft/jni/OpenAL/include \
|
||||
deps/libvorbis-libogg-android/jni/include \
|
||||
deps/gmp/usr/include \
|
||||
deps/leveldb/include \
|
||||
deps/sqlite/
|
||||
|
||||
@ -374,6 +369,9 @@ LOCAL_SRC_FILES += \
|
||||
#freetype2 support
|
||||
#LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp
|
||||
|
||||
# GMP
|
||||
LOCAL_SRC_FILES += jni/lib/gmp/mini-gmp.c
|
||||
|
||||
# Lua
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/lib/lua/src/lapi.c \
|
||||
@ -419,7 +417,7 @@ LOCAL_SRC_FILES += \
|
||||
# JSONCPP
|
||||
LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
|
||||
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB), 1)
|
||||
|
@ -14,7 +14,6 @@ public class MtNativeActivity extends NativeActivity {
|
||||
System.loadLibrary("openal");
|
||||
System.loadLibrary("ogg");
|
||||
System.loadLibrary("vorbis");
|
||||
System.loadLibrary("gmp");
|
||||
System.loadLibrary("iconv");
|
||||
System.loadLibrary("minetest");
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if USE_SYSTEM_GMP || defined (__ANDROID__) || defined (ANDROID)
|
||||
#if USE_SYSTEM_GMP
|
||||
#include <gmp.h>
|
||||
#else
|
||||
#include <mini-gmp.h>
|
||||
|
Loading…
Reference in New Issue
Block a user