build-lldb-mi: Fix finding the build directory
As build-llvm now can create a larger variety of build dir names, enumerating all possible suffixes becomes problematic (especially as they don't necessarily appear in one canonical order). Instead, iterate over potential matches. If cross compiling, it is easy as we can require the directory to contain the expected suffix. If not cross compiling, we have no explicit suffix to look for, but we can check that the directory doesn't match common cross compilation triples.
This commit is contained in:
1 parent
839b37219e
commit
d69ccd33a7
1 file changed
+24
-4
+24
-4
@@ -75,12 +75,32 @@ export LLVM_DIR="$PREFIX"
|
|||||||
LLVM_SRC="$(pwd)/llvm-project/llvm"
|
LLVM_SRC="$(pwd)/llvm-project/llvm"
|
||||||
if [ -d "$LLVM_SRC" ]; then
|
if [ -d "$LLVM_SRC" ]; then
|
||||||
SUFFIX=${HOST+-}$HOST
|
SUFFIX=${HOST+-}$HOST
|
||||||
for base in build build-asserts; do
|
DIRS=""
|
||||||
if [ -d "$LLVM_SRC/$base$SUFFIX" ]; then
|
cd llvm-project/llvm
|
||||||
export LLVM_DIR="$LLVM_SRC/$base$SUFFIX"
|
for dir in build*$SUFFIX; do
|
||||||
break
|
if [ -z "$SUFFIX" ]; then
|
||||||
|
case $dir in
|
||||||
|
*linux*|*mingw32*)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
DIRS="$DIRS $dir"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ -n "$DIRS" ]; then
|
||||||
|
dir="$(ls -td $DIRS | head -1)"
|
||||||
|
export LLVM_DIR="$LLVM_SRC/$dir"
|
||||||
|
echo Using $LLVM_DIR as LLVM build dir
|
||||||
|
break
|
||||||
|
else
|
||||||
|
# No build directory found; this is ok if the installed prefix is a
|
||||||
|
# full (development) install of LLVM. Warn that we didn't find what
|
||||||
|
# we were looking for.
|
||||||
|
echo Warning, did not find a suitable LLVM build dir, assuming $PREFIX contains LLVM development files >&2
|
||||||
|
fi
|
||||||
|
cd ../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$HOST" ]; then
|
if [ -n "$HOST" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user