8
8
# option. This file may not be copied, modified, or distributed
9
9
# except according to those terms.
10
10
11
+ # Script parameters:
12
+ # argv[1] = rust component root,
13
+ # argv[2] = gcc component root,
14
+ # argv[3] = target triple
15
+ # The first two correspond to the two installable components defined in the setup script.
16
+
11
17
import sys , os , shutil , subprocess
12
18
13
19
def find_files (files , path ):
@@ -22,7 +28,7 @@ def find_files(files, path):
22
28
raise Exception ("Could not find '%s' in %s" % (fname , path ))
23
29
return found
24
30
25
- def make_win_dist (dist_root , target_triple ):
31
+ def make_win_dist (rust_root , gcc_root , target_triple ):
26
32
# Ask gcc where it keeps its stuff
27
33
gcc_out = subprocess .check_output (["gcc.exe" , "-print-search-dirs" ])
28
34
bin_path = os .environ ["PATH" ].split (os .pathsep )
@@ -90,29 +96,29 @@ def make_win_dist(dist_root, target_triple):
90
96
target_libs = find_files (target_libs , lib_path )
91
97
92
98
# Copy runtime dlls next to rustc.exe
93
- dist_bin_dir = os .path .join (dist_root , "bin" )
99
+ dist_bin_dir = os .path .join (rust_root , "bin" )
94
100
for src in rustc_dlls :
95
101
shutil .copy (src , dist_bin_dir )
96
102
97
103
# Copy platform tools to platform-specific bin directory
98
- target_bin_dir = os .path .join (dist_root , "bin" , "rustlib" , target_triple , "bin" )
104
+ target_bin_dir = os .path .join (gcc_root , "bin" , "rustlib" , target_triple , "bin" )
99
105
if not os .path .exists (target_bin_dir ):
100
106
os .makedirs (target_bin_dir )
101
107
for src in target_tools :
102
108
shutil .copy (src , target_bin_dir )
103
109
104
110
# Copy platform libs to platform-spcific lib directory
105
- target_lib_dir = os .path .join (dist_root , "bin" , "rustlib" , target_triple , "lib" )
111
+ target_lib_dir = os .path .join (gcc_root , "bin" , "rustlib" , target_triple , "lib" )
106
112
if not os .path .exists (target_lib_dir ):
107
113
os .makedirs (target_lib_dir )
108
114
for src in target_libs :
109
115
shutil .copy (src , target_lib_dir )
110
116
111
117
# Copy license files
112
- lic_dir = os .path .join (dist_root , "bin" , "third-party" )
118
+ lic_dir = os .path .join (rust_root , "bin" , "third-party" )
113
119
if os .path .exists (lic_dir ):
114
120
shutil .rmtree (lic_dir ) # copytree() won't overwrite existing files
115
121
shutil .copytree (os .path .join (os .path .dirname (__file__ ), "third-party" ), lic_dir )
116
122
117
123
if __name__ == "__main__" :
118
- make_win_dist (sys .argv [1 ], sys .argv [2 ])
124
+ make_win_dist (sys .argv [1 ], sys .argv [2 ], sys . argv [ 3 ] )
0 commit comments