@@ -55,6 +55,10 @@ def scrub(b):
55
55
"lib/librustllvm.so" ]
56
56
}
57
57
58
+ winnt_runtime_deps = ["libgcc_s_dw2-1.dll" ,
59
+ "libstdc++-6.dll" ,
60
+ "libpthread-2.dll" ]
61
+
58
62
def parse_line (n , line ):
59
63
global snapshotfile
60
64
@@ -155,6 +159,19 @@ def hash_file(x):
155
159
h .update (open (x , "rb" ).read ())
156
160
return scrub (h .hexdigest ())
157
161
162
+ # Returns a list of paths of Rust's system runtime dependencies
163
+ def get_winnt_runtime_deps ():
164
+ runtime_deps = []
165
+ path_dirs = os .environ ["PATH" ].split (';' )
166
+ for name in winnt_runtime_deps :
167
+ for dir in path_dirs :
168
+ matches = glob .glob (os .path .join (dir , name ))
169
+ if matches :
170
+ runtime_deps .append (matches [0 ])
171
+ break
172
+ else :
173
+ raise Exception ("Could not find runtime dependency: %s" % name )
174
+ return runtime_deps
158
175
159
176
def make_snapshot (stage , triple ):
160
177
kernel = get_kernel (triple )
@@ -170,6 +187,7 @@ def in_tar_name(fn):
170
187
return os .sep .join (cs [- 2 :])
171
188
172
189
tar = tarfile .open (file0 , "w:bz2" )
190
+
173
191
for name in snapshot_files [kernel ]:
174
192
dir = stage
175
193
if stage == "stage1" and re .match (r"^lib/(lib)?std.*" , name ):
@@ -181,8 +199,15 @@ def in_tar_name(fn):
181
199
if len (matches ) == 1 :
182
200
tar .add (matches [0 ], "rust-stage0/" + in_tar_name (matches [0 ]))
183
201
else :
184
- raise Exception ("Found stale files: \n %s\n \
185
- Please make a clean build." % "\n " .join (matches ))
202
+ raise Exception ("Found stale files: \n %s\n "
203
+ "Please make a clean build." % "\n " .join (matches ))
204
+
205
+ if kernel == "winnt" :
206
+ for path in get_winnt_runtime_deps ():
207
+ tar .add (path , "rust-stage0/bin/" + os .path .basename (path ))
208
+ tar .add (os .path .join (os .path .dirname (__file__ ), "third-party" ),
209
+ "rust-stage0/bin/third-party" )
210
+
186
211
tar .close ()
187
212
188
213
h = hash_file (file0 )
0 commit comments