support using an existing clang installation

add an option --host-clang which will skip building llvm,
and instead provide symlinks and wrappers for clang and
llvm tools.

Currently the clang version is detected, but it does not
affect the llvm version that will be downloaded and used.
This commit is contained in:
Norbert Lange authored and Martin Storsjö committed 2024-02-26 00:22:14 +02:00
1 parent da480f0100
commit 47355937ad
3 files changed
+72 -12

No files matched your search

+10 -2
View File
@@ -81,6 +81,8 @@ else
fi
cd llvm-project/compiler-rt
# Use a staging directory in case parts of the resource dir are immutable
WORKDIR=$(mktemp -d); trap "rm -rf $WORKDIR" 0
for arch in $ARCHS; do
if [ -n "$SANITIZERS" ]; then
@@ -123,10 +125,16 @@ for arch in $ARCHS; do
-DCMAKE_CXX_FLAGS_INIT="$CFGUARD_CFLAGS" \
$SRC_DIR
cmake --build . ${CORES:+-j${CORES}}
cmake --install .
cmake --install . --prefix "${WORKDIR}/install"
mkdir -p "$PREFIX/$arch-w64-mingw32/bin"
if [ -n "$SANITIZERS" ]; then
mv "$CLANG_RESOURCE_DIR/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
mv "${WORKDIR}/install/lib/windows/"*.dll "$PREFIX/$arch-w64-mingw32/bin"
fi
cd ..
done
if [ -h "$CLANG_RESOURCE_DIR/include" ]; then
# symlink to system headers - skip copy
rm -rf ${WORKDIR}/install/include
fi
cp -r ${WORKDIR}/install/. $CLANG_RESOURCE_DIR