From cb96cddc7706c859803153bb08772a54ec1f7f48 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 23 Nov 2009 16:12:12 -0800 Subject: [PATCH] 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. --- ndk/build/core/install-binary.mk | 2 +- ndk/build/core/main.mk | 3 ++- ndk/build/core/setup-app.mk | 14 ++++++++++++-- ndk/docs/CHANGES.TXT | 9 +++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ndk/build/core/install-binary.mk b/ndk/build/core/install-binary.mk index 441469cfe..63b54258d 100644 --- a/ndk/build/core/install-binary.mk +++ b/ndk/build/core/install-binary.mk @@ -22,7 +22,7 @@ $(LOCAL_INSTALLED_MODULE): PRIVATE_SRC := $(LOCAL_BUILT_MODULE) $(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 1c3442aad..8285e4165 100644 --- a/ndk/build/core/main.mk +++ b/ndk/build/core/main.mk @@ -224,7 +224,8 @@ $(call __ndk_info,Building for application '$(NDK_APPS)') 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 d835e6f8c..f8f57b6f5 100644 --- a/ndk/build/core/setup-app.mk +++ b/ndk/build/core/setup-app.mk @@ -57,7 +57,7 @@ HOST_OBJS := $(HOST_OUT)/objs # 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 @@ endif # 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 656b1b499..145933c0b 100644 --- a/ndk/docs/CHANGES.TXT +++ b/ndk/docs/CHANGES.TXT @@ -56,6 +56,15 @@ IMPORTANT CHANGES: 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: