diff --git a/README.md b/README.md index cd944ab..5aff42d 100644 --- a/README.md +++ b/README.md @@ -175,9 +175,11 @@ Linking static libraries containing Objective-C categories into an executable or ## Building the Toolchain +The toolchain requires Windows 10 version 1903 or later. + ### Prerequisites -Building the toolchain require the following tools to be installed and available in the PATH. Their presence is verified when building the toolchain. +Building the toolchain requires the following tools to be installed and available in the PATH. Their presence is verified when building the toolchain. The MSYS2 installation is required to provide the Bash shell and Unix tools required to build some of the libraries, but no MinGW packages are needed. The Windows Clang installation is used to build all libraries. diff --git a/patches/libxml2-windows-icu.patch b/patches/libxml2-windows-icu.patch index 4355a91..fa8eb07 100644 --- a/patches/libxml2-windows-icu.patch +++ b/patches/libxml2-windows-icu.patch @@ -1,5 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 723e2344..c513872e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -102,7 +102,7 @@ if(LIBXML2_WITH_ICONV) + endif() + + if(LIBXML2_WITH_ICU) +- find_package(ICU REQUIRED COMPONENTS data i18n uc) ++ find_package(ICU REQUIRED COMPONENTS i18n uc) + endif() + + if(LIBXML2_WITH_LZMA) +@@ -368,9 +368,9 @@ if(LIBXML2_WITH_ICONV) + endif() + + if(LIBXML2_WITH_ICU) +- target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc) ++ target_link_libraries(LibXml2 PRIVATE ICU::i18n ICU::uc) + if(WIN32) +- set(ICU_LDFLAGS "-licudt -licuin -licuuc") ++ set(ICU_LDFLAGS "-licu") + else() + set(ICU_LDFLAGS "-licudata -licui18n -licuuc") + endif() +@@ -433,7 +433,6 @@ set_target_properties( + IMPORT_PREFIX lib + OUTPUT_NAME xml2 + POSITION_INDEPENDENT_CODE ON +- PREFIX lib + VERSION ${PROJECT_VERSION} + SOVERSION ${LIBXML_MAJOR_VERSION} + ) diff --git a/encoding.c b/encoding.c -index 52bc15ac..99232887 100644 +index 04c24e42..74305989 100644 --- a/encoding.c +++ b/encoding.c @@ -45,7 +45,7 @@ @@ -11,17 +44,3 @@ index 52bc15ac..99232887 100644 /* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */ #define ICU_PIVOT_BUF_SIZE 1024 typedef struct _uconv_t uconv_t; -diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc -index 7cc25b84..107c180b 100644 ---- a/win32/Makefile.msvc -+++ b/win32/Makefile.msvc -@@ -71,7 +71,7 @@ LIBS = $(LIBS) iconv.lib - !if "$(STATIC)" == "1" - LIBS = $(LIBS) advapi32.lib sicuuc.lib sicuin.lib sicudt.lib - !else --LIBS = $(LIBS) icuuc.lib icuin.lib icudt.lib -+LIBS = $(LIBS) icu.lib - !endif - !endif - !if "$(WITH_ZLIB)" == "1" - \ No newline at end of file diff --git a/phases/16-libxml2.bat b/phases/16-libxml2.bat index cf34f93..5d8b351 100644 --- a/phases/16-libxml2.bat +++ b/phases/16-libxml2.bat @@ -13,36 +13,32 @@ for /f "usebackq delims=" %%i in (`call %BASH% '../scripts/get-latest-github-rel :: load environment and prepare project call "%~dp0\..\scripts\common.bat" prepare_project || exit /b 1 -cd "%SRCROOT%\%PROJECT%" || exit \b 1 -cd "win32" || exit /b 1 +set BUILD_DIR="%SRCROOT%\%PROJECT%\build-%ARCH%-%BUILD_TYPE%" +if exist "%BUILD_DIR%" (rmdir /S /Q "%BUILD_DIR%" || exit /b 1) +mkdir "%BUILD_DIR%" || exit /b 1 +cd "%BUILD_DIR%" || exit /b 1 + +SET UM_INCLUDE_DIR="%WindowsSdkDir%include\%WindowsSdkVersion%um" echo. -echo ### Running configure -set CONFIGURE_OPTS= -if "%BUILD_TYPE%" == "Debug" ( - set "CONFIGURE_OPTS=cruntime=/MDd debug=yes" -) -cscript configure.js ^ - compiler=msvc ^ - icu=yes xml_debug=no ^ - %CONFIGURE_OPTS% ^ - "prefix=%INSTALL_PREFIX%" ^ - "include=%INSTALL_PREFIX%\include" ^ - "lib=%INSTALL_PREFIX%\lib" ^ - "sodir=%INSTALL_PREFIX%\lib" ^ +echo ### Running cmake +cmake .. %CMAKE_OPTIONS% ^ + -D BUILD_SHARED_LIBS=NO ^ + -D LIBXML2_WITH_LZMA=NO ^ + -D LIBXML2_WITH_PYTHON=NO ^ + -D LIBXML2_WITH_ZLIB=NO ^ + -D LIBXML2_WITH_TESTS=NO ^ + -D LIBXML2_WITH_PROGRAMS=NO ^ + -D LIBXML2_WITH_ICU=YES ^ + -D ICU_INCLUDE_DIR=%UM_INCLUDE_DIR% ^ || exit /b 1 echo. echo ### Building -:: we only build the static library -nmake /f Makefile.msvc libxmla || exit /b 1 +ninja || exit /b 1 echo. echo ### Installing -:: rename libxml2_a.lib to xml2.lib to allow linking using -lxml2 -:: (the wildcard suffix is required to suppress the "file or directory" prompt) -xcopy /Y /F "bin.msvc\libxml2_a.lib" "%INSTALL_PREFIX%\lib\xml2.lib*" || exit /b 1 -xcopy /Y /F "%SRCROOT%\%PROJECT%\include\libxml\*.h" "%INSTALL_PREFIX%\include\libxml\" || exit /b 1 -:: write pkgconfig file -call "%~dp0\..\scripts\common.bat" write_pkgconfig libxml-2.0 %TAG% -DLIBXML_STATIC -lxml2 -licu || exit /b 1 +:: libxml2-export.cmake is generated while installing libxml2 +ninja install || exit /b 1 diff --git a/phases/17-libxslt.bat b/phases/17-libxslt.bat index ecd5195..406c384 100644 --- a/phases/17-libxslt.bat +++ b/phases/17-libxslt.bat @@ -27,6 +27,7 @@ cscript configure.js ^ %CONFIGURE_OPTS% ^ "prefix=%INSTALL_PREFIX%" ^ "include=%INSTALL_PREFIX%\include" ^ + "include=%INSTALL_PREFIX%\include\libxml2" ^ "lib=%INSTALL_PREFIX%\lib" ^ "sodir=%INSTALL_PREFIX%\lib" ^ || exit /b 1