Skip to content

Commit

Permalink
Backport Android cleanup parts from #7123 (#7513)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nerzhul committed Jul 1, 2018
1 parent ad3d1d2 commit 7d20ff4
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 21 deletions.
35 changes: 14 additions & 21 deletions build/android/Makefile
Expand Up @@ -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
Expand Down Expand Up @@ -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" "); \
Expand Down Expand Up @@ -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" "); \
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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" "); \
Expand Down Expand Up @@ -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" "); \
Expand Down Expand Up @@ -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

Expand All @@ -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; \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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"; \
Expand Down
68 changes: 68 additions & 0 deletions build/android/build.gradle
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'
}

0 comments on commit 7d20ff4

Please sign in to comment.