|
15 | 15 | shared_lib_ext = '.dylib' |
16 | 16 | else: |
17 | 17 | shared_lib_ext = '.so' |
| 18 | +static_lib_ext = '.a' |
18 | 19 | macos_deployment_target = '10.15' |
19 | 20 |
|
20 | 21 | def error(message): |
@@ -317,45 +318,45 @@ def install_libraries(args, build_dir, universal_lib_dir, toolchain_lib_dir, tar |
317 | 318 | # shared libraries into the toolchain lib |
318 | 319 | package_subpath = args.configuration |
319 | 320 | for lib in ['libSwiftDriver', 'libSwiftOptions', 'libSwiftDriverExecution']: |
320 | | - install_library(args, build_dir, package_subpath, lib, |
| 321 | + install_library(args, build_dir, package_subpath, lib, shared_lib_ext, |
321 | 322 | universal_lib_dir, toolchain_lib_dir, 'swift-driver', targets) |
322 | 323 |
|
323 | 324 | # Install the swift-tools-support core shared libraries into the toolchain lib |
324 | 325 | package_subpath = os.path.join(args.configuration, 'dependencies', 'swift-tools-support-core') |
325 | 326 | for lib in ['libTSCBasic', 'libTSCLibc', 'libTSCUtility']: |
326 | | - install_library(args, build_dir, package_subpath, lib, |
| 327 | + install_library(args, build_dir, package_subpath, lib, shared_lib_ext, |
327 | 328 | universal_lib_dir, toolchain_lib_dir, 'swift-tools-support-core', targets) |
328 | 329 |
|
329 | 330 | # Install the swift-system shared library into the toolchain lib |
330 | 331 | package_subpath = os.path.join(args.configuration, 'dependencies', 'swift-system') |
331 | | - install_library(args, build_dir, package_subpath, 'libSystemPackage', |
| 332 | + install_library(args, build_dir, package_subpath, 'libSystemPackage', shared_lib_ext, |
332 | 333 | universal_lib_dir, toolchain_lib_dir, 'swift-system', targets) |
333 | 334 |
|
334 | 335 | # Install the swift-argument-parser shared libraries into the toolchain lib |
335 | 336 | package_subpath = os.path.join(args.configuration, 'dependencies', 'swift-argument-parser') |
336 | | - for lib in ['libArgumentParser', 'libArgumentParserToolInfo']: |
337 | | - install_library(args, build_dir, package_subpath, lib, |
| 337 | + for (lib, ext) in [('libArgumentParser', shared_lib_ext), ('libArgumentParserToolInfo', static_lib_ext)]: |
| 338 | + install_library(args, build_dir, package_subpath, lib, ext, |
338 | 339 | universal_lib_dir, toolchain_lib_dir,'swift-argument-parser', targets) |
339 | 340 |
|
340 | 341 | # Install the llbuild core shared libraries into the toolchain lib |
341 | 342 | package_subpath = os.path.join(args.configuration, 'dependencies', 'llbuild') |
342 | 343 | for lib in ['libllbuildSwift', 'libllbuild']: |
343 | | - install_library(args, build_dir, package_subpath, lib, |
| 344 | + install_library(args, build_dir, package_subpath, lib, shared_lib_ext, |
344 | 345 | universal_lib_dir, toolchain_lib_dir,'llbuild', targets) |
345 | 346 |
|
346 | 347 | # Create a universal shared-library file and install it into the toolchain lib |
347 | | -def install_library(args, build_dir, package_subpath, lib_name, |
| 348 | +def install_library(args, build_dir, package_subpath, lib_name, lib_ext, |
348 | 349 | universal_lib_dir, toolchain_lib_dir, package_name, targets): |
349 | | - shared_lib_file = lib_name + shared_lib_ext |
350 | | - output_dylib_path = os.path.join(universal_lib_dir, shared_lib_file) |
| 350 | + lib_file = lib_name + lib_ext |
| 351 | + output_dylib_path = os.path.join(universal_lib_dir, lib_file) |
351 | 352 | lipo_cmd = ['lipo'] |
352 | 353 | for target in targets: |
353 | 354 | input_lib_path = os.path.join(build_dir, target, |
354 | | - package_subpath, 'lib', shared_lib_file) |
| 355 | + package_subpath, 'lib', lib_file) |
355 | 356 | lipo_cmd.append(input_lib_path) |
356 | 357 | lipo_cmd.extend(['-create', '-output', output_dylib_path]) |
357 | 358 | subprocess.check_call(lipo_cmd) |
358 | | - install_binary(shared_lib_file, universal_lib_dir, toolchain_lib_dir, args.verbose) |
| 359 | + install_binary(lib_file, universal_lib_dir, toolchain_lib_dir, args.verbose) |
359 | 360 |
|
360 | 361 | # Install binary .swiftmodule files for the driver and its dependencies into the toolchain lib |
361 | 362 | def install_binary_swift_modules(args, build_dir, toolchain_lib_dir, targets): |
|
0 commit comments