From 7d20ff47d7ce83825ccad81427fc8b45f80a2a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 1 Jul 2018 12:23:38 +0200 Subject: [PATCH] Backport Android cleanup parts from #7123 (#7513) Also resync properly the dependencies versions. Don't let the makefile handle the cleanups itself. Let gradle do it. This is one of the first steps to remove the makefile and replace it with a full gradle support --- build/android/Makefile | 35 ++++++++------------ build/android/build.gradle | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 21 deletions(-) diff --git a/build/android/Makefile b/build/android/Makefile index b9abbd644..c4110aadd 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -88,14 +88,14 @@ OGG_TIMESTAMP = $(OGG_DIR)timestamp OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android -IRRLICHT_REVISION = 5145 +IRRLICHT_REVISION = 5150 IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/ IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp IRRLICHT_URL_SVN = https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@$(IRRLICHT_REVISION) -OPENSSL_VERSION = 1.0.2k +OPENSSL_VERSION = 1.0.2n OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION) OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/ OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a @@ -392,7 +392,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) endif clean_leveldb : - $(RM) -rf deps/leveldb + ./gradlew cleanLevelDB $(FREETYPE_TIMESTAMP) : freetype_download @LAST_MODIF=$$(find ${FREETYPE_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @@ -439,7 +439,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP) fi clean_freetype : - $(RM) -rf ${FREETYPE_DIR} + ./gradlew cleanFreetype $(ICONV_TIMESTAMP) : iconv_download @LAST_MODIF=$$(find ${ICONV_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @@ -502,7 +502,7 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP) fi clean_iconv : - $(RM) -rf ${ICONV_DIR} + ./gradlew cleanIconv #Note: Texturehack patch is required for gpu's not supporting color format # correctly. Known bad GPU: @@ -559,7 +559,7 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB) fi clean_irrlicht : - $(RM) -rf deps/irrlicht + ./gradlew cleanIrrlicht $(CURL_TIMESTAMP) : curl_download @LAST_MODIF=$$(find ${CURL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @@ -619,8 +619,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB) fi clean_curl : - $(RM) -rf deps/curl-${CURL_VERSION} \ - $(RM) -f deps/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" "); \ @@ -679,8 +678,7 @@ $(GMP_LIB): $(GMP_TIMESTAMP) fi clean_gmp: - $(RM) -rf deps/gmp-${GMP_VERSION} \ - $(RM) -f deps/gmp + ./gradlew cleanGMP sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c @@ -692,8 +690,7 @@ deps/${SQLITE3_FOLDER}/sqlite3.c : cd ${SQLITE3_FOLDER}; clean_sqlite3: - cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \ - $(RM) -f sqlite + ./gradlew cleanSQLite3 $(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB) @mkdir -p ${ANDR_ROOT}/deps; \ @@ -771,7 +768,7 @@ assets : $(ASSETS_TIMESTAMP) fi clean_assets : - @$(RM) -r ${APP_ROOT}/assets + ./gradlew cleanAssets apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \ $(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \ @@ -804,24 +801,20 @@ install_release: prep_srcdir : @if [ ! -e ${ANDR_ROOT}/jni/src ]; then \ - ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \ + ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \ fi; \ if [ ! -e ${ANDR_ROOT}/jni/lib ]; then \ - ln -s ${PROJ_ROOT}/lib ${ANDR_ROOT}/jni/lib; \ + ln -s ${PROJ_ROOT}/lib ${ANDR_ROOT}/jni/lib; \ fi clean_apk : ./gradlew clean clean_all : - @$(MAKE) clean_apk; \ - $(MAKE) clean_assets clean_iconv clean_irrlicht clean_leveldb clean_curl \ - clean_openssl clean_openal clean_ogg clean_gmp; \ - sleep 1; \ - $(RM) -r gen libs obj deps bin Debug and_env + ./gradlew cleanAll $(ANDR_ROOT)/jni/src/android_version_githash.h : prep_srcdir - @export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version_githash.h; \ + @export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version_githash.h; \ export VERSION_FILE_NEW=$${VERSION_FILE}.new; \ { \ echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \ diff --git a/build/android/build.gradle b/build/android/build.gradle index ad2f6ed03..9f747c11a 100644 --- a/build/android/build.gradle +++ b/build/android/build.gradle @@ -9,6 +9,13 @@ buildscript { } } +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" +def sqlite3_version = "3240000" + apply plugin: "com.android.application" android { @@ -54,3 +61,64 @@ android { } } } + +task cleanAssets(type:Delete) { + delete 'src/main/assets' +} + +task cleanIconv(type:Delete) { + delete 'deps/libiconv' +} + +task cleanIrrlicht(type:Delete) { + delete 'deps/irrlicht' +} + +task cleanLevelDB(type:Delete) { + delete 'deps/leveldb' +} + +task cleanCURL(type:Delete) { + delete 'deps/curl' + delete 'deps/curl-' + curl_version +} + +task cleanOpenSSL(type:Delete) { + delete 'deps/openssl' + delete 'deps/openssl-' + openssl_version + delete 'deps/openssl-' + openssl_version + '.tar.gz' +} + +task cleanOpenAL(type:Delete) { + delete 'deps/openal-soft' +} + +task cleanFreetype(type:Delete) { + delete 'deps/freetype2-android' +} + +task cleanOgg(type:Delete) { + delete 'deps/libvorbis-libogg-android' +} + +task cleanSQLite3(type:Delete) { + delete 'deps/sqlite-amalgamation-' + sqlite3_version + 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]) { + delete 'deps' + delete 'gen' + delete 'libs' + delete 'obj' + delete 'bin' + delete 'Debug' + delete 'and_env' +}