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
This commit is contained in:
Loïc Blot 2018-07-01 12:23:38 +02:00 committed by GitHub
parent ad3d1d20d1
commit 7d20ff47d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 21 deletions

@ -88,14 +88,14 @@ OGG_TIMESTAMP = $(OGG_DIR)timestamp
OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp
OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android
IRRLICHT_REVISION = 5145 IRRLICHT_REVISION = 5150
IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/ IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/
IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a
IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp
IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_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) 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_BASEDIR = openssl-$(OPENSSL_VERSION)
OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/ OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/
OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a
@ -392,7 +392,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
endif endif
clean_leveldb : clean_leveldb :
$(RM) -rf deps/leveldb ./gradlew cleanLevelDB
$(FREETYPE_TIMESTAMP) : freetype_download $(FREETYPE_TIMESTAMP) : freetype_download
@LAST_MODIF=$$(find ${FREETYPE_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @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 fi
clean_freetype : clean_freetype :
$(RM) -rf ${FREETYPE_DIR} ./gradlew cleanFreetype
$(ICONV_TIMESTAMP) : iconv_download $(ICONV_TIMESTAMP) : iconv_download
@LAST_MODIF=$$(find ${ICONV_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @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 fi
clean_iconv : clean_iconv :
$(RM) -rf ${ICONV_DIR} ./gradlew cleanIconv
#Note: Texturehack patch is required for gpu's not supporting color format #Note: Texturehack patch is required for gpu's not supporting color format
# correctly. Known bad GPU: # correctly. Known bad GPU:
@ -559,7 +559,7 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB)
fi fi
clean_irrlicht : clean_irrlicht :
$(RM) -rf deps/irrlicht ./gradlew cleanIrrlicht
$(CURL_TIMESTAMP) : curl_download $(CURL_TIMESTAMP) : curl_download
@LAST_MODIF=$$(find ${CURL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @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 fi
clean_curl : clean_curl :
$(RM) -rf deps/curl-${CURL_VERSION} \ ./gradlew cleanCURL
$(RM) -f deps/curl
$(GMP_TIMESTAMP) : gmp_download $(GMP_TIMESTAMP) : gmp_download
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @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 fi
clean_gmp: clean_gmp:
$(RM) -rf deps/gmp-${GMP_VERSION} \ ./gradlew cleanGMP
$(RM) -f deps/gmp
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
@ -692,8 +690,7 @@ deps/${SQLITE3_FOLDER}/sqlite3.c :
cd ${SQLITE3_FOLDER}; cd ${SQLITE3_FOLDER};
clean_sqlite3: clean_sqlite3:
cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \ ./gradlew cleanSQLite3
$(RM) -f sqlite
$(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB) $(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB)
@mkdir -p ${ANDR_ROOT}/deps; \ @mkdir -p ${ANDR_ROOT}/deps; \
@ -771,7 +768,7 @@ assets : $(ASSETS_TIMESTAMP)
fi fi
clean_assets : clean_assets :
@$(RM) -r ${APP_ROOT}/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) $(GMP_LIB) $(LEVELDB_TARGET) \
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \ $(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
@ -804,24 +801,20 @@ install_release:
prep_srcdir : prep_srcdir :
@if [ ! -e ${ANDR_ROOT}/jni/src ]; then \ @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; \ fi; \
if [ ! -e ${ANDR_ROOT}/jni/lib ]; then \ 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 fi
clean_apk : clean_apk :
./gradlew clean ./gradlew clean
clean_all : clean_all :
@$(MAKE) clean_apk; \ ./gradlew cleanAll
$(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
$(ANDR_ROOT)/jni/src/android_version_githash.h : prep_srcdir $(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; \ export VERSION_FILE_NEW=$${VERSION_FILE}.new; \
{ \ { \
echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \ echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \

@ -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" apply plugin: "com.android.application"
android { 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'
}