Updated sysroot_path.sh to use current xcodebuild flags.
Change on 2018/09/04 by tball
#!/bin/bash
-# Copyright 2012 Google Inc. All Rights Reserved.
-#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Usage: sysroot_path [--iphoneos | --iphonesimulator]
-SDK_TYPE=MacOSX
+SDK_TYPE=macosx
if [ $# -gt 0 ]; then
case $1 in
- --iphoneos ) SDK_TYPE=iPhoneOS ;;
- --iphonesimulator ) SDK_TYPE=iPhoneSimulator ;;
- --watchos ) SDK_TYPE=WatchOS ;;
- --watchsimulator ) SDK_TYPE=WatchSimulator ;;
- --appletvos ) SDK_TYPE=AppleTVOS ;;
- --appletvsimulator ) SDK_TYPE=AppleTVSimulator ;;
+ --iphoneos ) SDK_TYPE=iphoneos ;;
+ --iphonesimulator ) SDK_TYPE=iphonesimulator ;;
+ --watchos ) SDK_TYPE=watchos ;;
+ --watchsimulator ) SDK_TYPE=watchsimulator ;;
+ --appletvos ) SDK_TYPE=appletvos ;;
+ --appletvsimulator ) SDK_TYPE=appletvsimulator ;;
* ) echo "usage: $0 [--iphoneos | --iphonesimulator | --watchos | --watchsimulator | --appletvos | --appletvsimulator]" && exit 1 ;;
esac
fi
@@ -44,29 +42,11 @@ if [ ! -d "${XCODE_ROOT}" ]; then
exit 1
fi
-LC_SDK_NAME=$(echo $SDK_TYPE | tr /A-Z/ /a-z/)
-SDK_PATH=$(xcrun -sdk $LC_SDK_NAME --show-sdk-path)
+SDK_PATH=$(xcrun -sdk ${SDK_TYPE} --show-sdk-path)
if [ "x${SDK_PATH}" = "x" ]; then
- # SDKs aren't in standard location, so ask xcodebuild to look up a common
- # library, and then remove the library path.
- if [ ${SDK_TYPE} == "iphoneos" ]; then
- SDK_TYPE=iphoneos
- elif [ ${SDK_TYPE} == "iphonesimulator" ]; then
- SDK_TYPE=iphonesimulator
- elif [ ${SDK_TYPE} == "watchos" ]; then
- SDK_TYPE=watchos
- elif [ ${SDK_TYPE} == "watchsimulator" ]; then
- SDK_TYPE=watchsimulator
- elif [ ${SDK_TYPE} == "appletvos" ]; then
- SDK_TYPE=appletvos
- elif [ ${SDK_TYPE} == "appletvsimulator" ]; then
- SDK_TYPE=appletvsimulator
- else
- SDK_TYPE=macosx
- fi
-
- SDK_PATH=$(xcodebuild -sdk ${SDK_TYPE} -find-library system | sed 's/\/usr\/lib\/libsystem.dylib//')
+ # SDKs aren't in standard location, so ask xcodebuild.
+ SDK_PATH=$(xcodebuild -sdk ${SDK_TYPE} -version | awk '/^Path:/ { print $2 }')
fi
if [ "x${SDK_PATH}" = "x" ]; then
