Implement clang-target-wrapper as an executable for windows

This allows non-msys build systems to use the triplet prefixed
compiler frontends on windows.

Keep the old shell script version as well, for easier hackability
on unix platforms.
This commit is contained in:
Martin Storsjö committed 2018-10-03 22:48:36 +03:00
1 parent 9f3a4a25f2
commit ad47efba70
3 files changed
+171 -1

No files matched your search

+16 -1
View File
@@ -15,13 +15,28 @@ if [ -n "$HOST" ] && [ -z "$CC" ]; then
fi
: ${CC:=cc}
case $(uname) in
MINGW*)
EXEEXT=.exe
;;
esac
mkdir -p $PREFIX/bin
cp wrappers/*-wrapper.sh $PREFIX/bin
$CC wrappers/change-pe-arch.c -o $PREFIX/bin/change-pe-arch$EXEEXT
$CC wrappers/clang-target-wrapper.c -o $PREFIX/bin/clang-target-wrapper$EXEEXT -O2 -Wl,-s
if [ -n "$EXEEXT" ]; then
# For Windows, we should prefer the executable wrapper, which also works
# when invoked from outside of MSYS.
CTW_SUFFIX=$EXEEXT
CTW_LINK_SUFFIX=$EXEEXT
else
CTW_SUFFIX=.sh
fi
cd $PREFIX/bin
for arch in $ARCHS; do
for exec in clang clang++ gcc g++; do
ln -sf clang-target-wrapper.sh $arch-w64-mingw32-$exec
ln -sf clang-target-wrapper$CTW_SUFFIX $arch-w64-mingw32-$exec$CTW_LINK_SUFFIX
done
for exec in ar ranlib nm strings; do
ln -sf llvm-$exec$EXEEXT $arch-w64-mingw32-$exec || true