@@ -249,20 +249,6 @@ def install_swiftdriver(args, build_dir, prefix, targets) :
249
249
# swift-driver and swift-help
250
250
install_executables (args , build_dir , bin_dir , install_bin , targets )
251
251
252
- # libSwiftDriver and libSwiftDriverExecution and libSwiftOptions
253
- install_libraries (args , build_dir , lib_dir , install_lib , targets )
254
-
255
- # Binary Swift Modules:
256
- # swift-driver: SwiftDriver.swiftmodule, SwiftOptions.swiftmodule
257
- # swift-tools-support-core: TSCUtility.swiftmodule, TSCLibc.swiftmodule, TSCBasic.swiftmodule
258
- # swift-argument-parser: ArgumentParser.swiftmodule (disabled until needed)
259
- # swift-system: SystemPackage.swiftmodule
260
- install_binary_swift_modules (args , build_dir , install_lib , targets )
261
-
262
- # Modulemaps for C Modules:
263
- # TSCclibc
264
- install_c_module_includes (args , build_dir , install_include )
265
-
266
252
# Install universal binaries for swift-driver and swift-help into the toolchain bin
267
253
# directory
268
254
def install_executables (args , build_dir , universal_bin_dir , toolchain_bin_dir , targets ):
@@ -271,16 +257,6 @@ def install_executables(args, build_dir, universal_bin_dir, toolchain_bin_dir, t
271
257
for target in targets :
272
258
exe_bin_path = os .path .join (build_dir , target ,
273
259
args .configuration , 'bin' , exe )
274
- driver_lib_dir_path = os .path .join (build_dir , target ,
275
- args .configuration , 'lib' )
276
- delete_rpath (driver_lib_dir_path , exe_bin_path , args .verbose )
277
-
278
- for lib in ['swift-tools-support-core' , 'swift-argument-parser' ]:
279
- lib_dir_path = os .path .join (build_dir , target ,
280
- args .configuration , 'dependencies' ,
281
- lib , 'lib' )
282
- delete_rpath (lib_dir_path , exe_bin_path , args .verbose )
283
-
284
260
# Point to the installation toolchain's lib directory
285
261
add_rpath ('@executable_path/../lib/swift/macosx' , exe_bin_path , args .verbose )
286
262
@@ -296,128 +272,6 @@ def install_executables(args, build_dir, universal_bin_dir, toolchain_bin_dir, t
296
272
subprocess .check_call (lipo_cmd )
297
273
install_binary (exe , universal_bin_dir , toolchain_bin_dir , args .verbose )
298
274
299
- # Install shared libraries for the driver and its dependencies into the toolchain
300
- def install_libraries (args , build_dir , universal_lib_dir , toolchain_lib_dir , targets ):
301
- # Fixup the SwiftDriver rpath for libSwiftDriver and libSwiftDriverExecution
302
- for lib in ['libSwiftDriver' , 'libSwiftDriverExecution' ]:
303
- for target in targets :
304
- lib_path = os .path .join (build_dir , target ,
305
- args .configuration , 'lib' , lib + shared_lib_ext )
306
- driver_lib_dir_path = os .path .join (build_dir , target ,
307
- args .configuration , 'lib' )
308
- delete_rpath (driver_lib_dir_path , lib_path , args .verbose )
309
-
310
- # Fixup the TSC and llbuild rpaths
311
- driver_libs = map (lambda d : os .path .join ('lib' , d ), ['libSwiftDriver' , 'libSwiftOptions' , 'libSwiftDriverExecution' ])
312
- tsc_libs = map (lambda d : os .path .join ('dependencies' , 'swift-tools-support-core' , 'lib' , d ),
313
- ['libTSCBasic' , 'libTSCLibc' , 'libTSCUtility' ])
314
- for lib in driver_libs + tsc_libs :
315
- for target in targets :
316
- lib_path = os .path .join (build_dir , target ,
317
- args .configuration , lib + shared_lib_ext )
318
- for dep in ['swift-tools-support-core' , 'llbuild' ]:
319
- lib_dir_path = os .path .join (build_dir , target ,
320
- args .configuration , 'dependencies' ,
321
- dep , 'lib' )
322
- delete_rpath (lib_dir_path , lib_path , args .verbose )
323
-
324
- # Install the libSwiftDriver and libSwiftOptions and libSwiftDriverExecution
325
- # shared libraries into the toolchain lib
326
- package_subpath = args .configuration
327
- for lib in ['libSwiftDriver' , 'libSwiftOptions' , 'libSwiftDriverExecution' ]:
328
- install_library (args , build_dir , package_subpath , lib ,
329
- universal_lib_dir , toolchain_lib_dir , 'swift-driver' , targets )
330
-
331
- # Install the swift-tools-support core shared libraries into the toolchain lib
332
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-tools-support-core' )
333
- for lib in ['libTSCBasic' , 'libTSCLibc' , 'libTSCUtility' ]:
334
- install_library (args , build_dir , package_subpath , lib ,
335
- universal_lib_dir , toolchain_lib_dir , 'swift-tools-support-core' , targets )
336
-
337
- # Install the swift-system shared library into the toolchain lib
338
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-system' )
339
- install_library (args , build_dir , package_subpath , 'libSystemPackage' ,
340
- universal_lib_dir , toolchain_lib_dir , 'swift-system' , targets )
341
-
342
- # Install the swift-argument-parser shared libraries into the toolchain lib
343
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-argument-parser' )
344
- for lib in ['libArgumentParser' , 'libArgumentParserToolInfo' ]:
345
- install_library (args , build_dir , package_subpath , lib ,
346
- universal_lib_dir , toolchain_lib_dir ,'swift-argument-parser' , targets )
347
-
348
- # Install the llbuild core shared libraries into the toolchain lib
349
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'llbuild' )
350
- for lib in ['libllbuildSwift' , 'libllbuild' ]:
351
- install_library (args , build_dir , package_subpath , lib ,
352
- universal_lib_dir , toolchain_lib_dir ,'llbuild' , targets )
353
-
354
- # Create a universal shared-library file and install it into the toolchain lib
355
- def install_library (args , build_dir , package_subpath , lib_name ,
356
- universal_lib_dir , toolchain_lib_dir , package_name , targets ):
357
- shared_lib_file = lib_name + shared_lib_ext
358
- output_dylib_path = os .path .join (universal_lib_dir , shared_lib_file )
359
- lipo_cmd = ['lipo' ]
360
- for target in targets :
361
- input_lib_path = os .path .join (build_dir , target ,
362
- package_subpath , 'lib' , shared_lib_file )
363
- lipo_cmd .append (input_lib_path )
364
- lipo_cmd .extend (['-create' , '-output' , output_dylib_path ])
365
- subprocess .check_call (lipo_cmd )
366
- install_binary (shared_lib_file , universal_lib_dir , toolchain_lib_dir , args .verbose )
367
-
368
- # Install binary .swiftmodule files for the driver and its dependencies into the toolchain lib
369
- def install_binary_swift_modules (args , build_dir , toolchain_lib_dir , targets ):
370
- # The common subpath from a project's build directory to where its build products are found
371
- product_subpath = 'swift'
372
-
373
- # swift-driver
374
- package_subpath = os .path .join (args .configuration , product_subpath )
375
- for module in ['SwiftDriver' , 'SwiftOptions' ]:
376
- install_module (args , build_dir , package_subpath , toolchain_lib_dir , module , targets )
377
-
378
- # swift-tools-support-core
379
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-tools-support-core' ,
380
- product_subpath )
381
- for module in ['TSCUtility' , 'TSCLibc' , 'TSCBasic' ]:
382
- install_module (args , build_dir , package_subpath , toolchain_lib_dir , module , targets )
383
-
384
- # swift-argument-parser
385
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-argument-parser' ,
386
- product_subpath )
387
- install_module (args , build_dir , package_subpath , toolchain_lib_dir , 'ArgumentParser' , targets )
388
-
389
- # swift-system
390
- package_subpath = os .path .join (args .configuration , 'dependencies' , 'swift-system' ,
391
- product_subpath )
392
- install_module (args , build_dir , package_subpath , toolchain_lib_dir , 'SystemPackage' , targets )
393
-
394
-
395
- # Install the modulemaps and headers of the driver's C module dependencies into the toolchain
396
- # include directory
397
- def install_c_module_includes (args , build_dir , toolchain_include_dir ):
398
- # TSCclibc C module's modulemap and header files
399
- tscc_include_dir = os .path .join (os .path .dirname (args .package_path ), 'swift-tools-support-core' , 'Sources' ,
400
- 'TSCclibc' , 'include' )
401
- install_include_artifacts (args , toolchain_include_dir , tscc_include_dir , 'TSCclibc' )
402
-
403
- def install_module (args , build_dir , package_subpath , toolchain_lib , module_name , targets ):
404
- toolchain_module_dir = os .path .join (toolchain_lib , module_name + '.swiftmodule' )
405
- mkdir_p (toolchain_module_dir )
406
- for target in targets :
407
- swift_dir = os .path .join (build_dir , target ,
408
- package_subpath )
409
- for fileext in ['.swiftmodule' , '.swiftdoc' ]:
410
- install_binary (module_name + fileext , swift_dir , toolchain_module_dir , args .verbose )
411
- os .rename (os .path .join (toolchain_module_dir , module_name + fileext ),
412
- os .path .join (toolchain_module_dir , target + fileext ))
413
-
414
- # Copy over the contents of a module's include directory contents (modulemap, headers, etc.)
415
- def install_include_artifacts (args , toolchain_include_dir , src_include_dir , dst_module_name ):
416
- toolchain_module_include_dir = os .path .join (toolchain_include_dir , dst_module_name )
417
- if os .path .exists (toolchain_module_include_dir ):
418
- shutil .rmtree (toolchain_module_include_dir , ignore_errors = True )
419
- shutil .copytree (src_include_dir , toolchain_module_include_dir )
420
-
421
275
def build_using_cmake (args , toolchain_bin , build_dir , targets ):
422
276
swiftc_exec = os .path .join (toolchain_bin , 'swiftc' )
423
277
swift_flags = []
@@ -475,7 +329,8 @@ def build_llbuild_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_f
475
329
'-DCMAKE_C_COMPILER:=clang' ,
476
330
'-DCMAKE_CXX_COMPILER:=clang++' ,
477
331
'-DCMAKE_CXX_FLAGS=-target %s' % target ,
478
- '-DLLBUILD_SUPPORT_BINDINGS:=Swift'
332
+ '-DLLBUILD_SUPPORT_BINDINGS=Swift' ,
333
+ '-DBUILD_SHARED_LIBS=NO'
479
334
]
480
335
if platform .system () == 'Darwin' :
481
336
flags .append ('-DCMAKE_OSX_ARCHITECTURES=%s' % target .split ('-' )[0 ])
@@ -496,9 +351,7 @@ def build_system_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_fl
496
351
print ('Building Swift Driver dependency: Swift System' )
497
352
system_source_dir = os .path .join (os .path .dirname (args .package_path ), 'swift-system' )
498
353
system_build_dir = os .path .join (build_dir , 'swift-system' )
499
- flags = [
500
- # requried due to swift-autolink-extract bug ("The file was not recognized as a valid object file")
501
- "-DBUILD_SHARED_LIBS=YES" ]
354
+ flags = ['-DBUILD_SHARED_LIBS=NO' ]
502
355
system_cmake_flags = base_cmake_flags + flags
503
356
system_swift_flags = swift_flags [:]
504
357
cmake_build (args , swiftc_exec , system_cmake_flags , system_swift_flags ,
@@ -509,7 +362,8 @@ def build_tsc_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flags
509
362
tsc_source_dir = os .path .join (os .path .dirname (args .package_path ), 'swift-tools-support-core' )
510
363
tsc_build_dir = os .path .join (build_dir , 'swift-tools-support-core' )
511
364
flags = [
512
- '-DSwiftSystem_DIR=' + os .path .join (os .path .join (build_dir , 'swift-system' ), 'cmake/modules' )]
365
+ '-DSwiftSystem_DIR=' + os .path .join (os .path .join (build_dir , 'swift-system' ), 'cmake/modules' ),
366
+ '-DBUILD_SHARED_LIBS=NO' ]
513
367
tsc_cmake_flags = base_cmake_flags + flags
514
368
515
369
tsc_swift_flags = swift_flags [:]
@@ -522,7 +376,7 @@ def build_yams_using_cmake(args, target, swiftc_exec, build_dir, base_cmake_flag
522
376
yams_build_dir = os .path .join (build_dir , 'yams' )
523
377
yams_cmake_flags = base_cmake_flags + [
524
378
'-DCMAKE_C_COMPILER:=clang' ,
525
- '-DBUILD_SHARED_LIBS=OFF ' ]
379
+ '-DBUILD_SHARED_LIBS=NO ' ]
526
380
527
381
if platform .system () == 'Darwin' :
528
382
yams_cmake_flags .append ('-DCMAKE_OSX_DEPLOYMENT_TARGET=%s' % macos_deployment_target )
@@ -539,7 +393,8 @@ def build_argument_parser_using_cmake(args, target, swiftc_exec, build_dir, base
539
393
print ('Building Swift Driver dependency: Argument Parser' )
540
394
parser_source_dir = os .path .join (os .path .dirname (args .package_path ), 'swift-argument-parser' )
541
395
parser_build_dir = os .path .join (build_dir , 'swift-argument-parser' )
542
- custom_flags = ['-DBUILD_TESTING=NO' , '-DBUILD_EXAMPLES=NO' ]
396
+ custom_flags = ['-DBUILD_TESTING=NO' , '-DBUILD_EXAMPLES=NO' ,
397
+ '-DBUILD_SHARED_LIBS=NO' ]
543
398
parser_cmake_flags = base_cmake_flags + custom_flags
544
399
parser_swift_flags = swift_flags [:]
545
400
cmake_build (args , swiftc_exec , parser_cmake_flags , parser_swift_flags ,
@@ -554,6 +409,7 @@ def build_swift_driver_using_cmake(args, target, swiftc_exec, build_dir, base_cm
554
409
# TODO: Enable Library Evolution
555
410
driver_swift_flags = swift_flags [:]
556
411
flags = [
412
+ '-DBUILD_SHARED_LIBS=NO' ,
557
413
'-DLLBuild_DIR=' + os .path .join (os .path .join (dependencies_dir , 'llbuild' ), 'cmake/modules' ),
558
414
'-DTSC_DIR=' + os .path .join (os .path .join (dependencies_dir , 'swift-tools-support-core' ), 'cmake/modules' ),
559
415
'-DYams_DIR=' + os .path .join (os .path .join (dependencies_dir , 'yams' ), 'cmake/modules' ),
0 commit comments