wrappers: Provide the unprefixed clang-scan-deps as a wrapper, on Windows

When setting up wrappers for Windows, rename clang-scan-deps.exe to
clang-scan-deps-real.exe, make clang-scan-deps.exe a wrapper, and
configure the wrapper to target executing clang-scan-deps-real.exe.

This makes sure that we always pass in crucial options like
-stdlib=libc++.

By default, our Clang executables are built with that option
hardcoded, configured with CLANG_DEFAULT_CXX_STDLIB=libc++
when built for Windows. However, we generally don't rely on this;
we assume the tools could be plain default executables, so we
try to provide wrappers on all common access paths.
This commit is contained in:
Martin Storsjö committed 2024-05-02 20:03:56 +03:00
1 parent 06bd759e50
commit 74e45715e3
2 files changed
+9 -2

No files matched your search

+5 -1
View File
@@ -114,6 +114,7 @@ fi
if [ -n "$EXEEXT" ]; then
CLANG_MAJOR=$(basename $(echo $PREFIX/lib/clang/* | awk '{print $NF}') | cut -f 1 -d .)
WRAPPER_FLAGS="$WRAPPER_FLAGS -municode -DCLANG=\"clang-$CLANG_MAJOR\""
WRAPPER_FLAGS="$WRAPPER_FLAGS -DCLANG_SCAN_DEPS=\"clang-scan-deps-real\""
fi
mkdir -p "$PREFIX/bin"
@@ -171,6 +172,9 @@ if [ -n "$EXEEXT" ]; then
if [ ! -L clang$EXEEXT ] && [ -f clang$EXEEXT ] && [ ! -f clang-$CLANG_MAJOR$EXEEXT ]; then
mv clang$EXEEXT clang-$CLANG_MAJOR$EXEEXT
fi
if [ ! -L clang-scan-deps$EXEEXT ] && [ -f clang-scan-deps$EXEEXT ] && [ ! -f clang-scan-deps-real$EXEEXT ]; then
mv clang-scan-deps$EXEEXT clang-scan-deps-real$EXEEXT
fi
if [ -z "$HOST" ]; then
HOST=$(./clang-$CLANG_MAJOR -dumpmachine | sed 's/-.*//')-w64-mingw32
fi
@@ -179,7 +183,7 @@ if [ -n "$EXEEXT" ]; then
# we are installing wrappers for.
case $ARCHS in
*$HOST_ARCH*)
for exec in clang clang++ gcc g++ c++ addr2line ar dlltool ranlib nm objcopy readelf size strings strip windres; do
for exec in clang clang++ gcc g++ c++ addr2line ar dlltool ranlib nm objcopy readelf size strings strip windres clang-scan-deps; do
ln -sf $HOST-$exec$EXEEXT $exec$EXEEXT
done
for exec in cc c99 c11; do
+4 -1
View File
@@ -18,6 +18,9 @@
#include "native-wrapper.h"
#ifndef CLANG_SCAN_DEPS
#define CLANG_SCAN_DEPS "clang-scan-deps"
#endif
#ifndef DEFAULT_TARGET
#define DEFAULT_TARGET "x86_64-w64-mingw32"
#endif
@@ -29,7 +32,7 @@ int _tmain(int argc, TCHAR *argv[]) {
int max_arg = argc + 3;
const TCHAR **exec_argv = malloc((max_arg + 1) * sizeof(*exec_argv));
int arg = 0;
exec_argv[arg++] = concat(dir, _T("clang-scan-deps"));
exec_argv[arg++] = concat(dir, _T(CLANG_SCAN_DEPS));
// If changing this wrapper, change clang-scan-deps-wrapper.sh accordingly.
int i = 1;