Debian Codegraph @

junixsocket-native/crossclang/Xcode-Support/install

raw
1 #!/bin/sh
2 #
3 # Installs optional Xcode helper components for crossclang
4 #
5 # You should run this as root, i.e.,: sudo ./install
6 #
7
8 cd "$(dirname $0)"
9 pwd=$(pwd)
10
11 developerPath=$(xcode-select -p)
12 if [[ -z "$developerPath" ]]; then
13 echo "Error: Could not resolve XCode Developer path" >&2
14 exit 1
15 fi
16 sdksPath="$developerPath/Platforms/MacOSX.platform/Developer/SDKs"
17 if [[ ! -d "$sdksPath" ]]; then
18 echo "Error: Could not find SDKs path: $sdksPath" >&2
19 exit 1
20 fi
21 toolchainsPath="/Library/Developer/Toolchains"
22 echo "Toolchains path: $toolchainsPath"
23 if [[ ! -d "$toolchainsPath" ]]; then
24 mkdir -pv "$toolchainsPath"
25 fi
26
27 for toolchain in $(ls -1 | grep '\.xctoolchain$'); do
28 echo Installing "$toolchain" ...
29 ( cd "$toolchainsPath" ; ln -sf "$pwd/$toolchain" )
30 done
31 echo
32
33 echo "SDKs path: $sdksPath"
34 for sdk in $(ls -1 | grep '\.sdk$'); do
35 echo Installing "$sdk" ...
36 ( cd "$sdksPath" ; ln -sf "$pwd/$sdk" )
37 done
38
39 if [ $? -eq 0 ]; then
40 echo Done. Now please restart XCode and run \"Clean Build Folder\".
41 else
42 echo There were errors. Try running with sudo.
43 fi