@@ -173,14 +173,38 @@ def export_sdk(tgt, swift_source_tree, swift_build_tree):
173
173
ignore = shutil .ignore_patterns ('CMakeLists.txt' ))
174
174
175
175
176
- def export_libs (exported_dir , libs ):
176
+ def export_stdlibs (exported_dir , swift_build_tree ):
177
+ ext = 'dylib'
178
+ platform = 'macosx'
179
+ if get_platform () == "linux" :
180
+ platform = 'linux'
181
+ ext = 'so'
182
+ lib_dir = swift_build_tree / 'lib/swift' / platform
183
+ stdlibs = [
184
+ f'libswiftCore.{ ext } ' ,
185
+ 'libswiftCompatibility50.a' ,
186
+ 'libswiftCompatibility51.a' ,
187
+ 'libswiftCompatibilityConcurrency.a' ,
188
+ 'libswiftCompatibilityDynamicReplacements.a' ]
189
+ for stdlib in stdlibs :
190
+ lib_path = lib_dir / stdlib
191
+ if lib_path .exists ():
192
+ print (f'Copying { stdlib } ' )
193
+ shutil .copy (lib_path , exported_dir )
194
+ else :
195
+ print (f'Skipping { stdlib } ' )
196
+
197
+
198
+ def export_libs (exported_dir , libs , swift_build_tree ):
177
199
print ("exporting libraries" )
178
200
exportedlibs = [
179
201
create_static_lib (exported_dir , libs ),
180
202
create_shared_lib (exported_dir , libs )
181
203
]
204
+
182
205
for l in exportedlibs :
183
206
l .rename (exported_dir / l .name )
207
+ export_stdlibs (exported_dir , swift_build_tree )
184
208
185
209
186
210
def export_headers (exported_dir , swift_source_tree , llvm_build_tree , swift_build_tree ):
@@ -200,12 +224,6 @@ def zip_dir(src, tgt):
200
224
archive = shutil .make_archive (tgt , 'zip' , src )
201
225
print (f"created { archive } " )
202
226
203
- def tar_dir (src , tgt ):
204
- tgt = get_tgt (tgt , f"swift-prebuilt-{ get_platform ()} .tar.gz" )
205
- print (f"compressing { src .name } to { tgt } " )
206
- archive = shutil .make_archive (tgt , 'gztar' , src )
207
- print (f"created { archive } " )
208
-
209
227
210
228
def main (opts ):
211
229
tmp = pathlib .Path ('/tmp/llvm-swift' )
@@ -217,12 +235,11 @@ def main(opts):
217
235
218
236
exported = tmp / "exported"
219
237
exported .mkdir ()
220
- export_libs (exported , libs )
238
+ export_libs (exported , libs , opts . swift_build_tree )
221
239
export_headers (exported , opts .swift_source_tree , opts .llvm_build_tree , opts .swift_build_tree )
222
240
export_sdk (exported / "sdk" , opts .swift_source_tree , opts .swift_build_tree )
223
241
224
242
zip_dir (exported , opts .output )
225
- tar_dir (exported , opts .output )
226
243
227
244
228
245
if __name__ == "__main__" :
0 commit comments