12
12
import os
13
13
import sys
14
14
15
+ target_triple = sys .argv [14 ]
15
16
16
17
def normalize_path (v ):
17
18
"""msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
@@ -22,8 +23,11 @@ def normalize_path(v):
22
23
windows paths so it is really error-prone. revert it for peace."""
23
24
v = v .replace ('\\ ' , '/' )
24
25
# c:/path -> /c/path
25
- if ':/' in v :
26
- v = '/' + v .replace (':/' , '/' )
26
+ # "c:/path" -> "/c/path"
27
+ start = v .find (':/' )
28
+ while start != - 1 :
29
+ v = v [:start - 1 ] + '/' + v [start - 1 :start ] + v [start + 1 :]
30
+ start = v .find (':/' )
27
31
return v
28
32
29
33
@@ -39,17 +43,21 @@ def convert_path_spec(name, value):
39
43
return value
40
44
41
45
make = sys .argv [2 ]
42
- putenv ('RUSTC' , os .path .abspath (sys .argv [3 ]))
43
- putenv ('TMPDIR' , os .path .abspath (sys .argv [4 ]))
44
- putenv ('CC' , sys .argv [5 ] + ' ' + sys .argv [6 ])
45
- putenv ('RUSTDOC' , os .path .abspath (sys .argv [7 ]))
46
+ os . putenv ('RUSTC' , os .path .abspath (sys .argv [3 ]))
47
+ os . putenv ('TMPDIR' , os .path .abspath (sys .argv [4 ]))
48
+ os . putenv ('CC' , sys .argv [5 ] + ' ' + sys .argv [6 ])
49
+ os . putenv ('RUSTDOC' , os .path .abspath (sys .argv [7 ]))
46
50
filt = sys .argv [8 ]
47
51
putenv ('LD_LIB_PATH_ENVVAR' , sys .argv [9 ])
48
52
putenv ('HOST_RPATH_DIR' , os .path .abspath (sys .argv [10 ]))
49
53
putenv ('TARGET_RPATH_DIR' , os .path .abspath (sys .argv [11 ]))
50
54
putenv ('RUST_BUILD_STAGE' , sys .argv [12 ])
51
- putenv ('S' , os .path .abspath (sys .argv [13 ]))
52
- putenv ('PYTHON' , sys .executable )
55
+ os .putenv ('S' , os .path .abspath (sys .argv [13 ]))
56
+ os .putenv ('PYTHON' , sys .executable )
57
+ os .putenv ('TARGET' , target_triple )
58
+
59
+ if 'msvc' in target_triple :
60
+ os .putenv ('IS_MSVC' , '1' )
53
61
54
62
if filt not in sys .argv [1 ]:
55
63
sys .exit (0 )
0 commit comments