Cleanup installed binaries before the NDK build begins.

Ensures that no stale/obsolete shared libraries are left in the
application's project path before the build.

Also fix a minor typo that made the ABI selection process not
work properly in certain cases.
This commit is contained in:
David 'Digit' Turner
2009-11-23 16:12:12 -08:00
parent 0431e70ddd
commit cb96cddc77
4 changed files with 24 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ $(LOCAL_INSTALLED_MODULE): PRIVATE_SRC := $(LOCAL_BUILT_MODULE)
$(LOCAL_INSTALLED_MODULE): PRIVATE_DEST := $(NDK_APP_DEST) $(LOCAL_INSTALLED_MODULE): PRIVATE_DEST := $(NDK_APP_DEST)
$(LOCAL_INSTALLED_MODULE): PRIVATE_DST := $(LOCAL_INSTALLED_MODULE) $(LOCAL_INSTALLED_MODULE): PRIVATE_DST := $(LOCAL_INSTALLED_MODULE)
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) clean-installed-binaries
@ echo "Install : $(PRIVATE_NAME) => $(PRIVATE_DEST)" @ echo "Install : $(PRIVATE_NAME) => $(PRIVATE_DEST)"
$(hide) mkdir -p $(PRIVATE_DEST) $(hide) mkdir -p $(PRIVATE_DEST)
$(hide) install -p $(PRIVATE_SRC) $(PRIVATE_DST) $(hide) install -p $(PRIVATE_SRC) $(PRIVATE_DST)

View File

@@ -224,7 +224,8 @@ $(call __ndk_info,Building for application '$(NDK_APPS)')
executables libraries static_libraries shared_libraries \ executables libraries static_libraries shared_libraries \
clean clean-config clean-objs-dir \ clean clean-config clean-objs-dir \
clean-executables clean-libraries \ clean-executables clean-libraries \
clean-installed-modules clean-installed-modules \
clean-installed-binaries
# These macros are used in Android.mk to include the corresponding # These macros are used in Android.mk to include the corresponding
# build script that will parse the LOCAL_XXX variable definitions. # build script that will parse the LOCAL_XXX variable definitions.

View File

@@ -57,7 +57,7 @@ HOST_OBJS := $(HOST_OUT)/objs
# the target to use # the target to use
TARGET_TOOLCHAIN := $(NDK_TARGET_TOOLCHAIN) TARGET_TOOLCHAIN := $(NDK_TARGET_TOOLCHAIN)
APP_ABI := $(strip $(APP_ABI)) APP_ABI := $(strip $(NDK_APP_ABI))
ifndef APP_ABI ifndef APP_ABI
# the default ABI for now is armeabi # the default ABI for now is armeabi
APP_ABI := armeabi APP_ABI := armeabi
@@ -66,12 +66,22 @@ endif
# check the target ABIs for this application # check the target ABIs for this application
_bad_abis = $(strip $(filter-out $(NDK_ALL_ABIS),$(APP_ABI))) _bad_abis = $(strip $(filter-out $(NDK_ALL_ABIS),$(APP_ABI)))
ifneq ($(_bad_abis),) ifneq ($(_bad_abis),)
$(info _bad_abis = '$(_bad_abis)')
$(call __ndk_info,NDK Application '$(_app)' targets unknown ABI(s): $(_bad_abis)) $(call __ndk_info,NDK Application '$(_app)' targets unknown ABI(s): $(_bad_abis))
$(call __ndk_info,Please fix the APP_ABI definition in $(NDK_APP_APPLICATION_MK)) $(call __ndk_info,Please fix the APP_ABI definition in $(NDK_APP_APPLICATION_MK))
$(call __ndk_error,Aborting) $(call __ndk_error,Aborting)
endif endif
# Clear all installed binaries for this application
# This ensures that if the build fails, you're not going to mistakenly
# package an obsolete version of it. Or if you change the ABIs you're targetting,
# you're not going to leave a stale shared library for the old one.
#
ifeq ($($(_map).cleaned_binaries),)
$(_map).cleaned_binaries := true
clean-installed-binaries:
$(hide) rm -f $(NDK_ALL_ABIS:%=$(NDK_APP_PROJECT_PATH)/libs/%/lib*.so)
endif
$(foreach _abi,$(APP_ABI),\ $(foreach _abi,$(APP_ABI),\
$(eval TARGET_ARCH_ABI := $(_abi))\ $(eval TARGET_ARCH_ABI := $(_abi))\
$(eval include $(BUILD_SYSTEM)/setup-abi.mk) \ $(eval include $(BUILD_SYSTEM)/setup-abi.mk) \

View File

@@ -56,6 +56,15 @@ IMPORTANT CHANGES:
OpenGL ES 2.0 is currently *not* available from Java, and must be used OpenGL ES 2.0 is currently *not* available from Java, and must be used
through native code exclusively. through native code exclusively.
- The NDK build script will now remove installed binaries from the application
project's path before starting the build. This ensures that:
- if the build fails for some reason, a stale/obsolete file is not left in
your application project tree by mistake.
- if you change the target ABI, a stale/obsolete file is not left into the
folder corresponding to the old ABI.
OTHER FIXES & CHANGES: OTHER FIXES & CHANGES: