@@ -80,6 +80,61 @@ def _append_platform_cmake_options(self, cmake_options, swift_host_triple, has_p
8080 cmake_options .define ('CMAKE_RANLIB' , os .path .join (
8181 native_toolchain_path , 'bin' , 'llvm-ranlib' ))
8282
83+ def _build_libxml2 (self , swift_host_triple , has_pthread , wasi_sysroot ):
84+ libxml2 = CMakeProduct (
85+ args = self .args ,
86+ toolchain = self .toolchain ,
87+ source_dir = os .path .join (
88+ os .path .dirname (self .source_dir ), 'libxml2' ),
89+ build_dir = os .path .join (self .build_dir , 'libxml2' , swift_host_triple ))
90+ self ._append_platform_cmake_options (
91+ libxml2 .cmake_options , swift_host_triple , has_pthread , wasi_sysroot , [])
92+ libxml2 .cmake_options .define ('LIBXML2_WITH_C14N' , 'FALSE' )
93+ libxml2 .cmake_options .define ('LIBXML2_WITH_CATALOG' , 'FALSE' )
94+ libxml2 .cmake_options .define ('LIBXML2_WITH_DEBUG' , 'FALSE' )
95+ libxml2 .cmake_options .define ('LIBXML2_WITH_DOCB' , 'FALSE' )
96+ libxml2 .cmake_options .define ('LIBXML2_WITH_FTP' , 'FALSE' )
97+ libxml2 .cmake_options .define ('LIBXML2_WITH_HTML' , 'FALSE' )
98+ libxml2 .cmake_options .define ('LIBXML2_WITH_HTTP' , 'FALSE' )
99+ libxml2 .cmake_options .define ('LIBXML2_WITH_ICONV' , 'FALSE' )
100+ libxml2 .cmake_options .define ('LIBXML2_WITH_ICU' , 'FALSE' )
101+ libxml2 .cmake_options .define ('LIBXML2_WITH_ISO8859X' , 'FALSE' )
102+ libxml2 .cmake_options .define ('LIBXML2_WITH_LEGACY' , 'FALSE' )
103+ libxml2 .cmake_options .define ('LIBXML2_WITH_LZMA' , 'FALSE' )
104+ libxml2 .cmake_options .define ('LIBXML2_WITH_MEM_DEBUG' , 'FALSE' )
105+ libxml2 .cmake_options .define ('LIBXML2_WITH_MODULES' , 'FALSE' )
106+ libxml2 .cmake_options .define ('LIBXML2_WITH_OUTPUT' , 'TRUE' )
107+ libxml2 .cmake_options .define ('LIBXML2_WITH_PATTERN' , 'FALSE' )
108+ libxml2 .cmake_options .define ('LIBXML2_WITH_PROGRAMS' , 'FALSE' )
109+ libxml2 .cmake_options .define ('LIBXML2_WITH_PUSH' , 'TRUE' )
110+ libxml2 .cmake_options .define ('LIBXML2_WITH_PYTHON' , 'FALSE' )
111+ libxml2 .cmake_options .define ('LIBXML2_WITH_READER' , 'FALSE' )
112+ libxml2 .cmake_options .define ('LIBXML2_WITH_REGEXPS' , 'TRUE' )
113+ libxml2 .cmake_options .define ('LIBXML2_WITH_RUN_DEBUG' , 'FALSE' )
114+ libxml2 .cmake_options .define ('LIBXML2_WITH_SAX1' , 'FALSE' )
115+ libxml2 .cmake_options .define ('LIBXML2_WITH_SCHEMAS' , 'FALSE' )
116+ libxml2 .cmake_options .define ('LIBXML2_WITH_SCHEMATRON' , 'FALSE' )
117+ libxml2 .cmake_options .define ('LIBXML2_WITH_TESTS' , 'FALSE' )
118+ libxml2 .cmake_options .define ('LIBXML2_WITH_TREE' , 'TRUE' )
119+ libxml2 .cmake_options .define ('LIBXML2_WITH_VALID' , 'TRUE' )
120+ libxml2 .cmake_options .define ('LIBXML2_WITH_WRITER' , 'FALSE' )
121+ libxml2 .cmake_options .define ('LIBXML2_WITH_XINCLUDE' , 'FALSE' )
122+ libxml2 .cmake_options .define ('LIBXML2_WITH_XPATH' , 'TRUE' )
123+ libxml2 .cmake_options .define ('LIBXML2_WITH_XPTR' , 'FALSE' )
124+ libxml2 .cmake_options .define ('LIBXML2_WITH_ZLIB' , 'FALSE' )
125+ libxml2 .cmake_options .define ('BUILD_SHARED_LIBS' , 'FALSE' )
126+
127+ cmake_thread_enabled = 'TRUE' if has_pthread else 'FALSE'
128+ libxml2 .cmake_options .define ('LIBXML2_WITH_THREAD_ALLOC' , cmake_thread_enabled )
129+ libxml2 .cmake_options .define ('LIBXML2_WITH_THREADS' , cmake_thread_enabled )
130+ libxml2 .cmake_options .define ('HAVE_PTHREAD_H' , cmake_thread_enabled )
131+
132+ libxml2 .build_with_cmake ([], self .args .build_variant , [],
133+ prefer_native_toolchain = True )
134+ with shell .pushd (libxml2 .build_dir ):
135+ shell .call ([self .toolchain .cmake , '--install' , '.' , '--prefix' , '/' , '--component' , 'development' ],
136+ env = {'DESTDIR' : wasi_sysroot })
137+
83138 def _build_swift_testing (self , swift_host_triple , has_pthread , wasi_sysroot ):
84139 swift_testing = CMakeProduct (
85140 args = self .args ,
@@ -125,6 +180,8 @@ def _build_target_package(self, swift_host_triple, has_pthread,
125180 shell .call ([self .toolchain .cmake , '--install' , '.' ,
126181 '--component' , 'clang_rt.builtins-wasm32' ],
127182 env = {'DESTDIR' : clang_dir })
183+
184+ self ._build_libxml2 (swift_host_triple , has_pthread , wasi_sysroot )
128185 # Build swift-testing
129186 self ._build_swift_testing (swift_host_triple , has_pthread , wasi_sysroot )
130187
0 commit comments