1#!/bin/sh
2
3# This script configures clang to target the iOS simulator. If you'd like to
4# build for real iOS devices, change SDK to "iphoneos" and PLATFORM to "ios".
5# This uses the latest available iOS SDK, which is recommended. To select a
6# specific SDK, run 'xcodebuild -showsdks' to see the available SDKs and replace
7# iphonesimulator with one of them.
8
9SDK=iphonesimulator
10PLATFORM=ios-simulator
11
12if [ "$GOARCH" == "arm64" ]; then
13	CLANGARCH="arm64"
14else
15	CLANGARCH="x86_64"
16fi
17
18SDK_PATH=`xcrun --sdk $SDK --show-sdk-path`
19
20# cmd/cgo doesn't support llvm-gcc-4.2, so we have to use clang.
21CLANG=`xcrun --sdk $SDK --find clang`
22
23exec "$CLANG" -arch $CLANGARCH -isysroot "$SDK_PATH" -m${PLATFORM}-version-min=12.0 "$@"
24