aboutsummaryrefslogtreecommitdiff
path: root/build_odin.sh
diff options
context:
space:
mode:
authorHarold Brenes <harold@hbrenes.com>2024-05-16 17:53:41 -0400
committerHarold Brenes <harold@hbrenes.com>2024-05-16 17:53:41 -0400
commitf1b291ed62a8eab35b1d7870f3f49a18319d1cc0 (patch)
tree6f70dc3892fbaeacee4b0a8af16d305dbfa61c15 /build_odin.sh
parentab8e3db7e9db742061858ac907dcb19d212b1646 (diff)
Attempt to automatically resolve the sysroot on build_odin.sh on macOS
Diffstat (limited to 'build_odin.sh')
-rwxr-xr-xbuild_odin.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/build_odin.sh b/build_odin.sh
index 7e0d0e585..c27ad119d 100755
--- a/build_odin.sh
+++ b/build_odin.sh
@@ -64,7 +64,16 @@ Darwin)
fi
fi
- CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)"
+ darwin_sysroot=
+ if [ $(which xcode-select) ]; then
+ darwin_sysroot="--sysroot $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+ elif [[ -e "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" ]]; then
+ darwin_sysroot="--sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
+ else
+ echo "Warning: MacOSX.sdk not found."
+ fi
+
+ CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags) ${darwin_sysroot}"
LDFLAGS="$LDFLAGS -liconv -ldl -framework System -lLLVM"
;;
FreeBSD)