From 1e29ab26da7f574ce29eeb949f5c46378968e0dd Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sat, 17 Jan 2015 17:51:10 -0800
Subject: [PATCH 1002/1008] MacPorts Only: Fall back on xcodebuild -sdk when
xcrun --sdk is not supported
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit c69389a9ad48948076d754f99b94fbf797ea01fd)
runtime/compiler-rt/Makefile | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git llvm_release_37/tools/clang/runtime/compiler-rt/Makefile macports_release_37/tools/clang/runtime/compiler-rt/Makefile
index 9976438..fc43e72 100644
--- llvm_release_37/tools/clang/runtime/compiler-rt/Makefile
+++ macports_release_37/tools/clang/runtime/compiler-rt/Makefile
@@ -81,8 +81,18 @@ RuntimeLibrary.darwin.Configs := \
-IOS_SDK := $(shell xcrun --show-sdk-path -sdk iphoneos 2> /dev/null)
-IOSSIM_SDK := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2> /dev/null)
+ result=`xcrun --sdk $(1) --show-sdk-path 2> /dev/null`; \
+ if [ "$$?" != "0" ]; then \
+ result=`xcodebuild -sdk $(1) -version 2> /dev/null \
+ | sed -n 's/^Path: \(..*\)$$/\1/p'`; \
+ if [ "$$?" != "0" ]; then result=""; fi; \
+IOS_SDK := $(call XCRunSdkPath,iphoneos)
+IOSSIM_SDK := $(call XCRunSdkPath,iphonesimulator)
ifneq ($(IOS_SDK)$(IOSSIM_SDK),)
RuntimeLibrary.darwin.Configs += ios.a profile_ios.a