aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-08-18 23:42:00 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-08-19 00:02:14 +0200
commitea7e8f075d506508ce6bc565faef0f21fdfd5872 (patch)
tree488ce54fd8e03631719a053c9a1ce2aeaf8b14ee
parentae417793668b1e74aae165e61cd2f29ed0c2cee0 (diff)
query brew for llvm-config location if possible
-rwxr-xr-xbuild_odin.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/build_odin.sh b/build_odin.sh
index 599f6190a..f283dc441 100755
--- a/build_odin.sh
+++ b/build_odin.sh
@@ -23,6 +23,14 @@ error() {
exit 1
}
+# Brew advises people not to add llvm to their $PATH, so try and use brew to find it.
+if [ -z "$LLVM_CONFIG" ] && [ -n "$(command -v brew)" ]; then
+ if [ -n "$(command -v $(brew --prefix llvm@18)/bin/llvm-config)" ]; then LLVM_CONFIG="$(brew --prefix llvm@18)/bin/llvm-config"
+ elif [ -n "$(command -v $(brew --prefix llvm@17)/bin/llvm-config)" ]; then LLVM_CONFIG="$(brew --prefix llvm@17)/bin/llvm-config"
+ elif [ -n "$(command -v $(brew --prefix llvm@14)/bin/llvm-config)" ]; then LLVM_CONFIG="$(brew --prefix llvm@14)/bin/llvm-config"
+ fi
+fi
+
if [ -z "$LLVM_CONFIG" ]; then
# darwin, linux, openbsd
if [ -n "$(command -v llvm-config-18)" ]; then LLVM_CONFIG="llvm-config-18"