Skip to content

Commit 08a5bd5

Browse files
committed
Apply lipo on libArgumentParserToolInfo.a
1 parent dee03c5 commit 08a5bd5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Utilities/build-script-helper.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
shared_lib_ext = '.dylib'
1616
else:
1717
shared_lib_ext = '.so'
18+
static_lib_ext = '.a'
1819
macos_deployment_target = '10.15'
1920

2021
def error(message):
@@ -317,45 +318,45 @@ def install_libraries(args, build_dir, universal_lib_dir, toolchain_lib_dir, tar
317318
# shared libraries into the toolchain lib
318319
package_subpath = args.configuration
319320
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,
321322
universal_lib_dir, toolchain_lib_dir, 'swift-driver', targets)
322323

323324
# Install the swift-tools-support core shared libraries into the toolchain lib
324325
package_subpath = os.path.join(args.configuration, 'dependencies', 'swift-tools-support-core')
325326
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,
327328
universal_lib_dir, toolchain_lib_dir, 'swift-tools-support-core', targets)
328329

329330
# Install the swift-system shared library into the toolchain lib
330331
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,
332333
universal_lib_dir, toolchain_lib_dir, 'swift-system', targets)
333334

334335
# Install the swift-argument-parser shared libraries into the toolchain lib
335336
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,
338339
universal_lib_dir, toolchain_lib_dir,'swift-argument-parser', targets)
339340

340341
# Install the llbuild core shared libraries into the toolchain lib
341342
package_subpath = os.path.join(args.configuration, 'dependencies', 'llbuild')
342343
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,
344345
universal_lib_dir, toolchain_lib_dir,'llbuild', targets)
345346

346347
# 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,
348349
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)
351352
lipo_cmd = ['lipo']
352353
for target in targets:
353354
input_lib_path = os.path.join(build_dir, target,
354-
package_subpath, 'lib', shared_lib_file)
355+
package_subpath, 'lib', lib_file)
355356
lipo_cmd.append(input_lib_path)
356357
lipo_cmd.extend(['-create', '-output', output_dylib_path])
357358
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)
359360

360361
# Install binary .swiftmodule files for the driver and its dependencies into the toolchain lib
361362
def install_binary_swift_modules(args, build_dir, toolchain_lib_dir, targets):

0 commit comments

Comments
 (0)