For cross-built toolchains, rename the clang executable to clang-$MAJOR.exe
This commit is contained in:
1 parent
fb26be33a1
commit
1bc3d75a41
2 files changed
+15
-5
No files matched your search
+8
-2
@@ -22,13 +22,14 @@ MINGW*)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$EXEEXT" ]; then
|
if [ -n "$EXEEXT" ]; then
|
||||||
UNICODE=-municode
|
CLANG_MAJOR=$(basename $(echo $PREFIX/lib/clang/* | awk '{print $NF}') | cut -f 1 -d .)
|
||||||
|
CTW_FLAGS="-municode -DCLANG=\"clang-$CLANG_MAJOR\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $PREFIX/bin
|
mkdir -p $PREFIX/bin
|
||||||
cp wrappers/*-wrapper.sh $PREFIX/bin
|
cp wrappers/*-wrapper.sh $PREFIX/bin
|
||||||
$CC wrappers/change-pe-arch.c -o $PREFIX/bin/change-pe-arch$EXEEXT
|
$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 $UNICODE
|
$CC wrappers/clang-target-wrapper.c -o $PREFIX/bin/clang-target-wrapper$EXEEXT -O2 -Wl,-s $CTW_FLAGS
|
||||||
if [ -n "$EXEEXT" ]; then
|
if [ -n "$EXEEXT" ]; then
|
||||||
# For Windows, we should prefer the executable wrapper, which also works
|
# For Windows, we should prefer the executable wrapper, which also works
|
||||||
# when invoked from outside of MSYS.
|
# when invoked from outside of MSYS.
|
||||||
@@ -52,3 +53,8 @@ for arch in $ARCHS; do
|
|||||||
ln -sf objcopy-wrapper.sh $arch-w64-mingw32-$exec
|
ln -sf objcopy-wrapper.sh $arch-w64-mingw32-$exec
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
if [ -n "$EXEEXT" ]; then
|
||||||
|
if [ ! -L clang$EXEEXT ]; then
|
||||||
|
mv clang$EXEEXT clang-$CLANG_MAJOR$EXEEXT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
#define _UNICODE
|
#define _UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CLANG
|
||||||
|
#define CLANG "clang"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -82,13 +86,13 @@ int _tmain(int argc, TCHAR* argv[]) {
|
|||||||
const TCHAR *sep = _tcsrchr(argv0, '/');
|
const TCHAR *sep = _tcsrchr(argv0, '/');
|
||||||
if (!sep)
|
if (!sep)
|
||||||
sep = _tcsrchr(argv0, '\\');
|
sep = _tcsrchr(argv0, '\\');
|
||||||
TCHAR *clang = _T("clang");
|
TCHAR *clang = _T(CLANG);
|
||||||
const TCHAR *basename = argv0;
|
const TCHAR *basename = argv0;
|
||||||
if (sep) {
|
if (sep) {
|
||||||
int baselen = sep + 1 - argv0;
|
int baselen = sep + 1 - argv0;
|
||||||
clang = malloc((_tcslen(argv0) + 50) * sizeof(*clang));
|
clang = malloc((_tcslen(argv0) + 50) * sizeof(*clang));
|
||||||
memcpy(clang, argv0, baselen * sizeof(*clang));
|
memcpy(clang, argv0, baselen * sizeof(*clang));
|
||||||
_tcscpy(clang + baselen, _T("clang"));
|
_tcscpy(clang + baselen, _T(CLANG));
|
||||||
basename = sep + 1;
|
basename = sep + 1;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -96,7 +100,7 @@ int _tmain(int argc, TCHAR* argv[]) {
|
|||||||
GetModuleFileName(NULL, module_path, sizeof(module_path)/sizeof(module_path[0]));
|
GetModuleFileName(NULL, module_path, sizeof(module_path)/sizeof(module_path[0]));
|
||||||
TCHAR *sep2 = _tcsrchr(module_path, '\\');
|
TCHAR *sep2 = _tcsrchr(module_path, '\\');
|
||||||
if (sep2) {
|
if (sep2) {
|
||||||
_tcscpy(sep2 + 1, _T("clang"));
|
_tcscpy(sep2 + 1, _T(CLANG));
|
||||||
clang = module_path;
|
clang = module_path;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in new issue
Block a user