@@ -74,7 +74,7 @@ def get_libs(configured):
74
74
print ("extracting linking information from dummy project" )
75
75
with open (configured / "CMakeFiles" / "codeql-swift-artifacts.dir" / "link.txt" ) as link :
76
76
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
78
78
ret = Libs ([], [], [], [])
79
79
for l in libs :
80
80
if l .endswith (".a" ):
@@ -114,38 +114,6 @@ def create_static_lib(tgt, libs):
114
114
return tgt
115
115
116
116
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
-
149
117
def copy_includes (src , tgt ):
150
118
print ("copying includes" )
151
119
for dir , exts in (("include" , ("h" , "def" , "inc" )), ("stdlib" , ("h" ,))):
@@ -159,7 +127,7 @@ def copy_includes(src, tgt):
159
127
160
128
def export_sdk (tgt , swift_source_tree , swift_build_tree ):
161
129
print ("assembling sdk" )
162
- srcdir = swift_build_tree / "lib" / "swift"
130
+ srcdir = swift_build_tree / "lib" / "swift"
163
131
tgtdir = tgt / "usr" / "lib" / "swift"
164
132
if get_platform () == "linux" :
165
133
srcdir /= "linux"
@@ -181,11 +149,11 @@ def export_stdlibs(exported_dir, swift_build_tree):
181
149
ext = 'so'
182
150
lib_dir = swift_build_tree / 'lib/swift' / platform
183
151
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' ]
189
157
for stdlib in stdlibs :
190
158
lib_path = lib_dir / stdlib
191
159
if lib_path .exists ():
@@ -198,9 +166,8 @@ def export_stdlibs(exported_dir, swift_build_tree):
198
166
def export_libs (exported_dir , libs , swift_build_tree ):
199
167
print ("exporting libraries" )
200
168
exportedlibs = [
201
- create_static_lib (exported_dir , libs ),
202
- create_shared_lib (exported_dir , libs )
203
- ]
169
+ create_static_lib (exported_dir , libs ),
170
+ ]
204
171
205
172
for l in exportedlibs :
206
173
l .rename (exported_dir / l .name )
@@ -213,10 +180,12 @@ def export_headers(exported_dir, swift_source_tree, llvm_build_tree, swift_build
213
180
llvm_source_tree = swift_source_tree .parent / 'llvm-project/llvm'
214
181
clang_source_tree = swift_source_tree .parent / 'llvm-project/clang'
215
182
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 ]
217
185
for h in header_dirs :
218
186
copy_includes (h , exported_dir )
219
187
188
+
220
189
def zip_dir (src , tgt ):
221
190
tgt = get_tgt (tgt , f"swift-prebuilt-{ get_platform ()} .zip" )
222
191
print (f"compressing { src .name } to { tgt } " )
0 commit comments