Merge "This patch addresses the following issues:"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index d103aa6..ea28ec0 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -109,6 +109,9 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbcinfo_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+# Now we switched to build against Mac OS X SDK 10.6
+$(call add-clean-step, rm -rf $(OUT_DIR)/host/darwin-x86/obj)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index e136c45..74883d4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1447,6 +1447,7 @@
done; \
if [ $$FAIL ]; then exit 1; fi
$(hide) ( \
+ ATREE_STRIP="strip -x" \
$(HOST_OUT_EXECUTABLES)/atree \
$(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
-m $(PRIVATE_DEP_FILE) \
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index aeb91c2..8be6a42 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -23,21 +23,23 @@
HOST_GLOBAL_CFLAGS += -m32
HOST_GLOBAL_LDFLAGS += -m32
-# Use the Mac OSX SDK 10.5 if the build host is 10.6
build_mac_version := $(shell sw_vers -productVersion)
-ifneq ($(filter 10.6.%, $(build_mac_version)),)
-sdk_105_root := /Developer/SDKs/MacOSX10.5.sdk
-ifeq ($(wildcard $(sdk_105_root)),)
+mac_sdk_version := 10.6
+mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+ifeq ($(wildcard $(mac_sdk_root)),)
+recent_xcode4_mac_sdk_root := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+ifeq ($(wildcard $(recent_xcode4_mac_sdk_root)),)
$(warning *****************************************************)
-$(warning * You are building on Mac OSX 10.6.)
-$(warning * Can not find SDK 10.5 at $(sdk_105_root))
+$(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root))
+$(warning * or $(recent_xcode4_mac_sdk_root))
$(warning *****************************************************)
$(error Stop.)
endif
+mac_sdk_root := $(recent_xcode4_mac_sdk_root)
+endif
-HOST_GLOBAL_CFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
-HOST_GLOBAL_LDFLAGS += -isysroot $(sdk_105_root) -mmacosx-version-min=10.5
-endif # build_mac_version is 10.6
+HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
HOST_GLOBAL_CFLAGS += -fPIC
HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
diff --git a/tools/atree/fs.cpp b/tools/atree/fs.cpp
index b648394..9468cfd 100644
--- a/tools/atree/fs.cpp
+++ b/tools/atree/fs.cpp
@@ -152,8 +152,8 @@
int
strip_file(const string& path)
{
- // Default strip command to run is "strip" unless overridden by the STRIP env var.
- const char* strip_cmd = getenv("STRIP");
+ // Default strip command to run is "strip" unless overridden by the ATREE_STRIP env var.
+ const char* strip_cmd = getenv("ATREE_STRIP");
if (!strip_cmd || !strip_cmd[0]) {
strip_cmd = "strip";
}
@@ -163,7 +163,52 @@
return -1;
} else if (pid == 0) {
// Exec in the child. Only returns if execve failed.
- return execlp(strip_cmd, strip_cmd, path.c_str(), (char *)NULL);
+
+ int num_args = 0;
+ const char *s = strip_cmd;
+ while (*s) {
+ while (*s == ' ') ++s;
+ if (*s && *s != ' ') {
+ ++num_args;
+ while (*s && *s != ' ') ++s;
+ }
+ }
+
+ if (num_args <= 0) {
+ fprintf(stderr, "Invalid ATREE_STRIP command '%s'\n", strip_cmd);
+ return 1;
+
+ } else if (num_args == 1) {
+ return execlp(strip_cmd, strip_cmd, path.c_str(), (char *)NULL);
+
+ } else {
+ // Split the arguments if more than 1
+ char* cmd = strdup(strip_cmd);
+ const char** args = (const char**) malloc(sizeof(const char*) * (num_args + 2));
+
+ const char** curr = args;
+ char* s = cmd;
+ while (*s) {
+ while (*s == ' ') ++s;
+ if (*s && *s != ' ') {
+ *curr = s;
+ ++curr;
+ while (*s && *s != ' ') ++s;
+ if (*s) {
+ *s = '\0';
+ ++s;
+ }
+ }
+ }
+
+ args[num_args] = path.c_str();
+ args[num_args + 1] = NULL;
+
+ int ret = execvp(args[0], (char* const*)args);
+ free(args);
+ free(cmd);
+ return ret;
+ }
} else {
// Wait for child pid and return its exit code.
int status;