@@ -74,7 +74,7 @@ def get_libs(configured):
7474 print ("extracting linking information from dummy project" )
7575 with open (configured / "CMakeFiles" / "codeql-swift-artifacts.dir" / "link.txt" ) as link :
7676 libs = link .read ().split ()
77- libs = libs [libs .index ('codeql-swift-artifacts' )+ 1 :] # skip up to -o dummy
77+ libs = libs [libs .index ('codeql-swift-artifacts' ) + 1 :] # skip up to -o dummy
7878 ret = Libs ([], [], [], [])
7979 for l in libs :
8080 if l .endswith (".a" ):
@@ -114,38 +114,6 @@ def create_static_lib(tgt, libs):
114114 return tgt
115115
116116
117- def create_shared_lib (tgt , libs ):
118- ext = "so"
119- if sys .platform != 'linux' :
120- ext = "dylib"
121- libname = f"lib{ EXPORTED_LIB } .{ ext } "
122- tgt = get_tgt (tgt , libname )
123- print (f"packaging { libname } " )
124- compiler = os .environ .get ("CC" , "clang" )
125- cmd = [compiler , "-shared" ]
126- cmd .extend (libs .linker_flags )
127-
128- if sys .platform == 'linux' :
129- cmd .append ("-Wl,--whole-archive" )
130- else :
131- cmd .append ("-Wl,-all_load" )
132-
133- cmd .append (f"-o{ tgt } " )
134- cmd .extend (libs .archive )
135-
136- if sys .platform == 'linux' :
137- cmd .append ("-Wl,--no-whole-archive" )
138- else :
139- cmd .append ("-lc++" )
140-
141- cmd .extend (libs .static )
142- cmd .extend (libs .shared )
143- run (cmd , cwd = tgt .parent )
144- if sys .platform != "linux" :
145- run (["install_name_tool" , "-id" , f"@executable_path/{ libname } " , libname ], cwd = tgt .parent )
146- return tgt
147-
148-
149117def copy_includes (src , tgt ):
150118 print ("copying includes" )
151119 for dir , exts in (("include" , ("h" , "def" , "inc" )), ("stdlib" , ("h" ,))):
@@ -159,7 +127,7 @@ def copy_includes(src, tgt):
159127
160128def export_sdk (tgt , swift_source_tree , swift_build_tree ):
161129 print ("assembling sdk" )
162- srcdir = swift_build_tree / "lib" / "swift"
130+ srcdir = swift_build_tree / "lib" / "swift"
163131 tgtdir = tgt / "usr" / "lib" / "swift"
164132 if get_platform () == "linux" :
165133 srcdir /= "linux"
@@ -181,11 +149,11 @@ def export_stdlibs(exported_dir, swift_build_tree):
181149 ext = 'so'
182150 lib_dir = swift_build_tree / 'lib/swift' / platform
183151 stdlibs = [
184- f'libswiftCore.{ ext } ' ,
185- 'libswiftCompatibility50.a' ,
186- 'libswiftCompatibility51.a' ,
187- 'libswiftCompatibilityConcurrency.a' ,
188- 'libswiftCompatibilityDynamicReplacements.a' ]
152+ f'libswiftCore.{ ext } ' ,
153+ 'libswiftCompatibility50.a' ,
154+ 'libswiftCompatibility51.a' ,
155+ 'libswiftCompatibilityConcurrency.a' ,
156+ 'libswiftCompatibilityDynamicReplacements.a' ]
189157 for stdlib in stdlibs :
190158 lib_path = lib_dir / stdlib
191159 if lib_path .exists ():
@@ -198,9 +166,8 @@ def export_stdlibs(exported_dir, swift_build_tree):
198166def export_libs (exported_dir , libs , swift_build_tree ):
199167 print ("exporting libraries" )
200168 exportedlibs = [
201- create_static_lib (exported_dir , libs ),
202- create_shared_lib (exported_dir , libs )
203- ]
169+ create_static_lib (exported_dir , libs ),
170+ ]
204171
205172 for l in exportedlibs :
206173 l .rename (exported_dir / l .name )
@@ -213,10 +180,12 @@ def export_headers(exported_dir, swift_source_tree, llvm_build_tree, swift_build
213180 llvm_source_tree = swift_source_tree .parent / 'llvm-project/llvm'
214181 clang_source_tree = swift_source_tree .parent / 'llvm-project/clang'
215182 clang_tools_build_tree = llvm_build_tree / 'tools/clang'
216- header_dirs = [ llvm_source_tree , clang_source_tree , swift_source_tree , llvm_build_tree , swift_build_tree , clang_tools_build_tree ]
183+ header_dirs = [llvm_source_tree , clang_source_tree , swift_source_tree , llvm_build_tree , swift_build_tree ,
184+ clang_tools_build_tree ]
217185 for h in header_dirs :
218186 copy_includes (h , exported_dir )
219187
188+
220189def zip_dir (src , tgt ):
221190 tgt = get_tgt (tgt , f"swift-prebuilt-{ get_platform ()} .zip" )
222191 print (f"compressing { src .name } to { tgt } " )
0 commit comments