@@ -135,6 +135,36 @@ def _build_libxml2(self, swift_host_triple, has_pthread, wasi_sysroot):
135
135
shell .call ([self .toolchain .cmake , '--install' , '.' , '--prefix' , '/' , '--component' , 'development' ],
136
136
env = {'DESTDIR' : wasi_sysroot })
137
137
138
+ def _build_foundation (self , swift_host_triple , has_pthread , wasi_sysroot ):
139
+ source_root = os .path .dirname (self .source_dir )
140
+ host_toolchain = self .native_toolchain_path (self .args .host_target )
141
+
142
+ foundation = CMakeProduct (
143
+ args = self .args ,
144
+ toolchain = self .toolchain ,
145
+ source_dir = os .path .join (
146
+ os .path .dirname (self .source_dir ), 'swift-corelibs-foundation' ),
147
+ build_dir = os .path .join (self .build_dir , 'foundation' , swift_host_triple ))
148
+ self ._append_platform_cmake_options (
149
+ foundation .cmake_options , swift_host_triple , has_pthread , wasi_sysroot , [])
150
+ foundation .cmake_options .define ('BUILD_SHARED_LIBS' , 'FALSE' )
151
+ foundation .cmake_options .define ('FOUNDATION_BUILD_TOOLS' , 'FALSE' )
152
+ foundation .cmake_options .define ('_SwiftCollections_SourceDIR' , os .path .join (source_root , 'swift-collections' ))
153
+ foundation .cmake_options .define ('_SwiftFoundation_SourceDIR' , os .path .join (source_root , 'swift-foundation' ))
154
+ foundation .cmake_options .define ('_SwiftFoundationICU_SourceDIR' , os .path .join (source_root , 'swift-foundation-icu' ))
155
+ foundation .cmake_options .define ('SwiftFoundation_MACRO' , os .path .join (host_toolchain , 'lib' , 'swift' , 'host' , 'plugins' ))
156
+
157
+ foundation .cmake_options .define ('LIBXML2_INCLUDE_DIR' , os .path .join (wasi_sysroot , 'include' , 'libxml2' ))
158
+ foundation .cmake_options .define ('LIBXML2_LIBRARY' , os .path .join (wasi_sysroot , 'lib' ))
159
+
160
+ foundation .build_with_cmake ([], self .args .build_variant , [],
161
+ prefer_native_toolchain = True )
162
+
163
+ dest_dir = self ._target_package_path (swift_host_triple )
164
+ with shell .pushd (foundation .build_dir ):
165
+ shell .call ([self .toolchain .cmake , '--install' , '.' , '--prefix' , '/usr' ],
166
+ env = {'DESTDIR' : dest_dir })
167
+
138
168
def _build_swift_testing (self , swift_host_triple , has_pthread , wasi_sysroot ):
139
169
swift_testing = CMakeProduct (
140
170
args = self .args ,
@@ -182,6 +212,7 @@ def _build_target_package(self, swift_host_triple, has_pthread,
182
212
env = {'DESTDIR' : clang_dir })
183
213
184
214
self ._build_libxml2 (swift_host_triple , has_pthread , wasi_sysroot )
215
+ self ._build_foundation (swift_host_triple , has_pthread , wasi_sysroot )
185
216
# Build swift-testing
186
217
self ._build_swift_testing (swift_host_triple , has_pthread , wasi_sysroot )
187
218
0 commit comments