Merge change Icb96cddc into eclair
* changes:
Cleanup installed binaries before the NDK build begins.
diff --git a/ndk/build/core/install-binary.mk b/ndk/build/core/install-binary.mk
index 441469c..63b5425 100644
--- a/ndk/build/core/install-binary.mk
+++ b/ndk/build/core/install-binary.mk
@@ -22,7 +22,7 @@
$(LOCAL_INSTALLED_MODULE): PRIVATE_DEST := $(NDK_APP_DEST)
$(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)"
$(hide) mkdir -p $(PRIVATE_DEST)
$(hide) install -p $(PRIVATE_SRC) $(PRIVATE_DST)
diff --git a/ndk/build/core/main.mk b/ndk/build/core/main.mk
index 1c3442a..8285e41 100644
--- a/ndk/build/core/main.mk
+++ b/ndk/build/core/main.mk
@@ -224,7 +224,8 @@
executables libraries static_libraries shared_libraries \
clean clean-config clean-objs-dir \
clean-executables clean-libraries \
- clean-installed-modules
+ clean-installed-modules \
+ clean-installed-binaries
# These macros are used in Android.mk to include the corresponding
# build script that will parse the LOCAL_XXX variable definitions.
diff --git a/ndk/build/core/setup-app.mk b/ndk/build/core/setup-app.mk
index d835e6f..f8f57b6 100644
--- a/ndk/build/core/setup-app.mk
+++ b/ndk/build/core/setup-app.mk
@@ -57,7 +57,7 @@
# the target to use
TARGET_TOOLCHAIN := $(NDK_TARGET_TOOLCHAIN)
-APP_ABI := $(strip $(APP_ABI))
+APP_ABI := $(strip $(NDK_APP_ABI))
ifndef APP_ABI
# the default ABI for now is armeabi
APP_ABI := armeabi
@@ -66,12 +66,22 @@
# check the target ABIs for this application
_bad_abis = $(strip $(filter-out $(NDK_ALL_ABIS),$(APP_ABI)))
ifneq ($(_bad_abis),)
- $(info _bad_abis = '$(_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_error,Aborting)
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),\
$(eval TARGET_ARCH_ABI := $(_abi))\
$(eval include $(BUILD_SYSTEM)/setup-abi.mk) \
diff --git a/ndk/docs/CHANGES.TXT b/ndk/docs/CHANGES.TXT
index 656b1b4..145933c 100644
--- a/ndk/docs/CHANGES.TXT
+++ b/ndk/docs/CHANGES.TXT
@@ -56,6 +56,15 @@
OpenGL ES 2.0 is currently *not* available from Java, and must be used
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: