build-llvm: Use llvm-libtool-darwin if doing LTO macOS builds with a custom clang

This commit is contained in:
Martin Storsjö committed 2025-06-25 11:51:06 +03:00
1 parent efb8b34932
commit f5d8121ea2
1 file changed
+13
+13
View File
@@ -298,6 +298,19 @@ if [ -z "$HOST" ] && [ "$(uname)" = "Darwin" ]; then
# This silences a cmake warning.
CMAKEFLAGS="$CMAKEFLAGS -DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
fi
if [ -n "$WITH_CLANG" ] && [ -n "$LTO" ]; then
# If doing LTO, we need to make sure other related tools are used.
# CMAKE_LIBTOOL is not a standard cmake tool, but an LLVM specific
# thing. It defaults to looking up the tool with xcrun rather than
# looking in paths first.
# If building for multiple architectures at once
# (CMAKE_OSX_ARCHITECTURES), we also need to provide a tool named
# "lipo" in the PATH (this is invoked by Clang directly, so we can't
# specify it here unless we pass in the option "-fuse-lipo="). If
# the LLVM CMake build wasn't using libtool, we would also need to
# specify LLVM_AR and LLVM_RANLIB.
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_LIBTOOL=$(command -v llvm-libtool-darwin)"
fi
fi
TOOLCHAIN_ONLY=ON