File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,14 @@ MINGW*)
2222esac
2323
2424if [ -n " $EXEEXT " ]; then
25- UNICODE=-municode
25+ CLANG_MAJOR=$( basename $( echo $PREFIX /lib/clang/* | awk ' {print $NF}' ) | cut -f 1 -d .)
26+ CTW_FLAGS=" -municode -DCLANG=\" clang-$CLANG_MAJOR \" "
2627fi
2728
2829mkdir -p $PREFIX /bin
2930cp wrappers/* -wrapper.sh $PREFIX /bin
3031$CC wrappers/change-pe-arch.c -o $PREFIX /bin/change-pe-arch$EXEEXT
31- $CC wrappers/clang-target-wrapper.c -o $PREFIX /bin/clang-target-wrapper$EXEEXT -O2 -Wl,-s $UNICODE
32+ $CC wrappers/clang-target-wrapper.c -o $PREFIX /bin/clang-target-wrapper$EXEEXT -O2 -Wl,-s $CTW_FLAGS
3233if [ -n " $EXEEXT " ]; then
3334 # For Windows, we should prefer the executable wrapper, which also works
3435 # when invoked from outside of MSYS.
@@ -52,3 +53,8 @@ for arch in $ARCHS; do
5253 ln -sf objcopy-wrapper.sh $arch -w64-mingw32-$exec
5354 done
5455done
56+ if [ -n " $EXEEXT " ]; then
57+ if [ ! -L clang$EXEEXT ]; then
58+ mv clang$EXEEXT clang-$CLANG_MAJOR$EXEEXT
59+ fi
60+ fi
Original file line number Diff line number Diff line change 2020#define _UNICODE
2121#endif
2222
23+ #ifndef CLANG
24+ #define CLANG "clang"
25+ #endif
26+
2327#include <stdio.h>
2428#include <string.h>
2529#include <stdlib.h>
@@ -82,21 +86,21 @@ int _tmain(int argc, TCHAR* argv[]) {
8286 const TCHAR * sep = _tcsrchr (argv0 , '/' );
8387 if (!sep )
8488 sep = _tcsrchr (argv0 , '\\' );
85- TCHAR * clang = _T ("clang" );
89+ TCHAR * clang = _T (CLANG );
8690 const TCHAR * basename = argv0 ;
8791 if (sep ) {
8892 int baselen = sep + 1 - argv0 ;
8993 clang = malloc ((_tcslen (argv0 ) + 50 ) * sizeof (* clang ));
9094 memcpy (clang , argv0 , baselen * sizeof (* clang ));
91- _tcscpy (clang + baselen , _T ("clang" ));
95+ _tcscpy (clang + baselen , _T (CLANG ));
9296 basename = sep + 1 ;
9397 }
9498#ifdef _WIN32
9599 TCHAR module_path [8192 ];
96100 GetModuleFileName (NULL , module_path , sizeof (module_path )/sizeof (module_path [0 ]));
97101 TCHAR * sep2 = _tcsrchr (module_path , '\\' );
98102 if (sep2 ) {
99- _tcscpy (sep2 + 1 , _T ("clang" ));
103+ _tcscpy (sep2 + 1 , _T (CLANG ));
100104 clang = module_path ;
101105 }
102106#endif
You can’t perform that action at this time.
0 commit comments