1#!/bin/sh
2
3[ -z "${CPU}" ] && CPU="arm64"
4CWD="$(dirname "$0")"
5[ -z "${IOSINC}" ] && IOSINC="${CWD}/ios-include"
6CPUS=""
7CPU=`echo $CPU | sed -e 's,+, ,g'`
8for a in `IFS=+ echo ${CPU}` ; do
9	CPUS="-arch $a ${CPUS}"
10done
11[ -z "${SDK}" ] && SDK=iphoneos
12APPLE_SDK=`echo ${SDK} | tr a-z A-Z`
13LD="xcrun --sdk ${SDK} ld ${CPUS} -bitcode_bundle"
14if [ "$SDK" = "iphoneos" ]; then
15	LD="$LD -ios_version_min 10.0"
16else
17	LD="$LD -ios_simulator_version_min 10.0"
18fi
19echo "$LD $*"
20${LD} $*
21r=$?
22if [ "$r" != 0 ]; then
23	echo ${LD} $* >&2
24fi
25exit $r
26