diff options
author | est31 <MTest31@outlook.com> | 2015-04-12 06:18:48 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-05-11 17:48:33 +0200 |
commit | 181f7baa453c58d4070de7196fd74663110946a8 (patch) | |
tree | 3a7f8d55b3d633aa25b66b864fc83272a10197c3 /build/android/Makefile | |
parent | 58eae43322ffa83f634b4199176f4e1bae0cbcde (diff) | |
download | minetest-181f7baa453c58d4070de7196fd74663110946a8.tar.gz minetest-181f7baa453c58d4070de7196fd74663110946a8.tar.bz2 minetest-181f7baa453c58d4070de7196fd74663110946a8.zip |
Add LibGMP
Uses system provided libgmp if found, if not it falls back to mini-gmp.
Diffstat (limited to 'build/android/Makefile')
-rw-r--r-- | build/android/Makefile | 139 |
1 files changed, 101 insertions, 38 deletions
diff --git a/build/android/Makefile b/build/android/Makefile index 569a45a68..898968bed 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -118,6 +118,13 @@ CURL_TIMESTAMP = $(CURL_DIR)/timestamp CURL_TIMESTAMP_INT = $(ROOT)/deps/curl_timestamp CURL_URL_HTTP = http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2 +GMP_VERSION = 6.0.0 +GMP_DIR = $(ROOT)/deps/gmp-$(GMP_VERSION) +GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.la +GMP_TIMESTAMP = $(GMP_DIR)/timestamp +GMP_TIMESTAMP_INT = $(ROOT)/deps/gmp_timestamp +GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2 + FREETYPE_DIR = $(ROOT)/deps/freetype2-android/ FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp @@ -148,14 +155,14 @@ endif $(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \ $(OPENSSL_TIMESTAMP) curl_binary \ $(ROOT)/jni/src/android_version.h - + debug : $(PATHCFGFILE) export NDEBUG=; \ export BUILD_TYPE=debug; \ $(MAKE) apk - + all : debug release - + release : $(PATHCFGFILE) @export NDEBUG=1; \ export BUILD_TYPE=release; \ @@ -194,7 +201,7 @@ $(OPENAL_TIMESTAMP) : openal_download if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ touch ${OPENAL_TIMESTAMP}; \ fi - + openal_download : @if [ ! -d ${OPENAL_DIR} ] ; then \ echo "openal sources missing, downloading..."; \ @@ -202,7 +209,7 @@ openal_download : cd ${ROOT}/deps ; \ git clone ${OPENAL_URL_GIT} || exit 1; \ fi - + openal : $(OPENAL_LIB) $(OPENAL_LIB): $(OPENAL_TIMESTAMP) @@ -227,16 +234,16 @@ $(OPENAL_LIB): $(OPENAL_TIMESTAMP) else \ echo "nothing to be done for openal"; \ fi - + clean_openal : $(RM) -rf ${OPENAL_DIR} - + $(OGG_TIMESTAMP) : ogg_download @LAST_MODIF=$$(find ${OGG_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ touch ${OGG_TIMESTAMP}; \ fi - + ogg_download : @if [ ! -d ${OGG_DIR} ] ; then \ echo "ogg sources missing, downloading..."; \ @@ -246,7 +253,7 @@ ogg_download : cd libvorbis-libogg-android ; \ patch -p1 < ../../libvorbis-libogg-fpu.patch || exit 1; \ fi - + ogg : $(OGG_LIB) $(OGG_LIB): $(OGG_TIMESTAMP) @@ -275,13 +282,13 @@ $(OGG_LIB): $(OGG_TIMESTAMP) clean_ogg : $(RM) -rf ${OGG_DIR} - + $(OPENSSL_TIMESTAMP) : openssl_download @LAST_MODIF=$$(find ${OPENSSL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ touch ${OPENSSL_TIMESTAMP}; \ fi - + openssl_download : @if [ ! -d ${OPENSSL_DIR} ] ; then \ echo "openssl sources missing, downloading..."; \ @@ -292,7 +299,7 @@ openssl_download : cd ${OPENSSL_BASEDIR}; \ patch -p1 < ../../openssl_arch.patch; \ fi - + openssl : $(OPENSSL_LIB) $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) @@ -340,7 +347,7 @@ leveldb_download : cd ${ROOT}/deps ; \ git clone ${LEVELDB_URL_GIT} || exit 1; \ fi - + leveldb : $(LEVELDB_LIB) $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) @@ -374,10 +381,10 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) else \ echo "nothing to be done for leveldb"; \ fi - + clean_leveldb : $(RM) -rf deps/leveldb - + $(FREETYPE_TIMESTAMP) : freetype_download @LAST_MODIF=$$(find ${FREETYPE_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ @@ -391,13 +398,13 @@ freetype_download : cd deps; \ git clone ${FREETYPE_URL_GIT} || exit 1; \ fi - + $(IRRLICHT_TIMESTAMP) : irrlicht_download @LAST_MODIF=$$(find ${IRRLICHT_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ touch ${IRRLICHT_TIMESTAMP}; \ fi - + freetype : $(FREETYPE_LIB) $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP) @@ -426,7 +433,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP) else \ echo "nothing to be done for freetype"; \ fi - + clean_freetype : $(RM) -rf ${FREETYPE_DIR} @@ -475,10 +482,10 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB) else \ echo "nothing to be done for irrlicht"; \ fi - + clean_irrlicht : $(RM) -rf deps/irrlicht - + $(CURL_TIMESTAMP) : curl_download @LAST_MODIF=$$(find ${CURL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ @@ -535,13 +542,13 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB) else \ echo "nothing to be done for curl"; \ fi - + clean_curl : $(RM) -rf deps/curl-${CURL_VERSION} \ $(RM) -f deps/curl - - -curl_binary: + + +curl_binary: @if [ ! -d "deps/curl-${CURL_VERSION_BINARY}" ] ; then \ echo "curl sources missing, downloading..."; \ mkdir -p ${ROOT}/deps; \ @@ -552,6 +559,62 @@ curl_binary: rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \ fi +$(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 ${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}; \ + export PATH="$${PATH}:${SDKFOLDER}/platform-tools:${ANDROID_NDK}"; \ + echo "changed timestamp for gmp detected building..."; \ + cd deps/gmp-${GMP_VERSION}; \ + export CROSS_PREFIX=${CROSS_PREFIX}; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --install-dir=$${TOOLCHAIN}; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + export CC=${CROSS_PREFIX}gcc; \ + export CXX=${CROSS_PREFIX}g++; \ + ./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: + $(RM) -rf deps/gmp-${GMP_VERSION} \ + $(RM) -f deps/gmp + sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c deps/${SQLITE3_FOLDER}/sqlite3.c : @@ -559,7 +622,7 @@ deps/${SQLITE3_FOLDER}/sqlite3.c : wget ${SQLITE3_URL}; \ unzip ${SQLITE3_FOLDER}.zip; \ ln -s ${SQLITE3_FOLDER} sqlite - + clean_sqlite3: cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \ $(RM) -f sqlite @@ -622,7 +685,7 @@ $(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB) if [ ! -e $(ASSETS_TIMESTAMP) ] ; then \ touch $(ASSETS_TIMESTAMP); \ fi - + assets : $(ASSETS_TIMESTAMP) @REFRESH=0; \ if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \ @@ -670,8 +733,8 @@ assets : $(ASSETS_TIMESTAMP) clean_assets : @$(RM) -r assets - -apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \ + +apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \ $(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \ sqlite3_download @export NDEBUG=$$NDEBUG; $(MAKE) manifest; \ @@ -689,32 +752,32 @@ apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \ echo "++ Success!" && \ echo "APK: bin/Minetest-$$BUILD_TYPE.apk" && \ echo "You can install it with \`adb install -r bin/Minetest-$$BUILD_TYPE.apk\`" - + prep_srcdir : @rm ${ROOT}/jni/src; \ ln -s ${ROOT}/../../src ${ROOT}/jni/src - + clean_apk : manifest @export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \ export ANDROID_HOME=${SDKFOLDER}; \ ant clean - -install_debug : + +install_debug : @export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \ adb install -r ${ROOT}/bin/Minetest-debug.apk - + install : @export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \ adb install -r ${ROOT}/bin/Minetest-release.apk - + envpaths : @echo "export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}" > and_env;\ echo "export ANDROID_HOME=${SDKFOLDER}" >> and_env; - -clean_all : + +clean_all : @$(MAKE) clean_apk; \ $(MAKE) clean_assets clean_irrlicht clean_leveldb clean_curl clean_openssl \ - clean_openal clean_ogg clean_manifest; \ + clean_openal clean_ogg clean_gmp clean_manifest; \ sleep 1; \ $(RM) -r gen libs obj deps bin Debug and_env @@ -762,7 +825,7 @@ manifest : sed s/###BASE_VERSION###/$$BASE_VERSION/g | \ sed -e "s@###DEBUG_BUILD###@$$DBG@g" | \ sed -e "s@###DEBUG_FLAG###@$$DBG_FLAG@g" >${ROOT}/AndroidManifest.xml - + clean_manifest : rm -rf ${ROOT}/AndroidManifest.xml |