From 9e628b0f2d1b893643b0542ecd4cdfb891e43520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 4 Jun 2025 15:25:17 +0300 Subject: [PATCH] build-lldb-mi: Disallow detecting LLVM outside of $LLVM_DIR Do the same as when cross compiling; disallow detecting dependencies outside of the given CMAKE_FIND_ROOT_PATH. Don't export LLVM_DIR as we no longer need to pass it implicitly that way. This makes the errors clearer, if LLVM isn't found where expected, instead of misdetecting it from a different installation of LLVM in the system. If lldb-mi would try to find other optional dependencies, they would no longer be found; this was already the case when cross compiling though. --- build-lldb-mi.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build-lldb-mi.sh b/build-lldb-mi.sh index ebc4db0..1dd6b13 100755 --- a/build-lldb-mi.sh +++ b/build-lldb-mi.sh @@ -65,7 +65,7 @@ else esac fi -export LLVM_DIR="$PREFIX" +LLVM_DIR="$PREFIX" # Try to find/guess the builddir under the llvm buildtree next by. # If LLVM was built without LLVM_INSTALL_TOOLCHAIN_ONLY, and the LLVM @@ -91,7 +91,7 @@ if [ -d "$LLVM_SRC" ]; then done if [ -n "$DIRS" ]; then dir="$(ls -td $DIRS | head -1)" - export LLVM_DIR="$LLVM_SRC/$dir" + LLVM_DIR="$LLVM_SRC/$dir" echo Using $LLVM_DIR as LLVM build dir break else @@ -121,14 +121,14 @@ if [ -n "$HOST" ]; then exit 1 ;; esac - - CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$LLVM_DIR" - CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER" - CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY" - CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY" - CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY" fi +CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$LLVM_DIR" +CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER" +CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY" +CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY" +CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY" + if [ -n "$MACOS_REDIST" ]; then : ${MACOS_REDIST_ARCHS:=arm64 x86_64} : ${MACOS_REDIST_VERSION:=10.12}