Skip to content

Commit 050f3e2

Browse files
authored
Merge pull request #59032 from compnerd/i-c-u-statically
build: start building static version of ICU for Windows
2 parents baa4123 + b996bb5 commit 050f3e2

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

utils/build-windows-toolchain.bat

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,29 @@ call :CloneRepositories || (exit /b)
4545

4646
md "%BuildRoot%\Library"
4747

48-
:: TODO(compnerd) build ICU from source
49-
curl.exe -sOL "https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-Win64-MSVC2017.zip" || (exit /b)
50-
"%SystemDrive%\Program Files\Git\usr\bin\unzip.exe" -o icu4c-67_1-Win64-MSVC2017.zip -d %BuildRoot%\Library\icu-67.1
51-
md %BuildRoot%\Library\icu-67.1\usr\bin
52-
copy %BuildRoot%\Library\icu-67.1\bin64\icudt67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
53-
copy %BuildRoot%\Library\icu-67.1\bin64\icuin67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
54-
copy %BuildRoot%\Library\icu-67.1\bin64\icuuc67.dll %BuildRoot%\Library\icu-67.1\usr\bin || (exit /b)
48+
:: Build ICU
49+
copy %SourceRoot%\swift-installer-scripts\shared\ICU\CMakeLists.txt %SourceRoot%\icu\icu4c\ || (exit /b)
50+
cmake ^
51+
-B %BuildRoot%\icu ^
52+
53+
-D BUILD_SHARED_LIBS=NO ^
54+
-D CMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
55+
-D CMAKE_C_COMPILER=cl ^
56+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
57+
-D CMAKE_CXX_COMPILER=cl ^
58+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
59+
-D CMAKE_MT=mt ^
60+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
61+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
62+
63+
-D CMAKE_INSTALL_PREFIX=%BuildRoot%\Library\icu-69.1\usr ^
64+
65+
-D BUILD_TOOLS=YES ^
66+
67+
-G Ninja ^
68+
-S %SourceRoot%\icu\icu4c || (exit /b)
69+
cmake --build "%BuildRoot%\icu" || (exit /b)
70+
cmake --build "%BuildRoot%\icu" --target install || (exit /b)
5571

5672
:: FIXME(compnerd) is there a way to build the sources without downloading the amalgamation?
5773
curl.exe -sOL "https://sqlite.org/2021/sqlite-amalgamation-3360000.zip" || (exit /b)
@@ -280,9 +296,10 @@ cmake ^
280296
-D CMAKE_INSTALL_PREFIX=%SDKInstallRoot%\usr ^
281297

282298
-D CURL_DIR=%BuildRoot%\Library\curl-7.77.0\usr\lib\cmake\CURL ^
283-
-D ICU_ROOT=%BuildRoot%\Library\icu-67.1 ^
284-
-D ICU_UC_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuuc67.lib ^
285-
-D ICU_I18N_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuin67.lib ^
299+
-D ICU_ROOT=%BuildRoot%\Library\icu-69.1\usr ^
300+
-D ICU_DATA_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicudt69.lib ^
301+
-D ICU_UC_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuuc69.lib ^
302+
-D ICU_I18N_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuin69.lib ^
286303
-D LIBXML2_LIBRARY=%BuildRoot%\Library\libxml2-2.9.12\usr\lib\libxml2s.lib ^
287304
-D LIBXML2_INCLUDE_DIR=%BuildRoot%\Library\libxml2-2.9.12\usr\include\libxml2 ^
288305
-D LIBXML2_DEFINITIONS="/DLIBXML_STATIC" ^
@@ -655,17 +672,6 @@ msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\runtime.wixproj ^
655672
:: TODO(compnerd) actually perform the code-signing
656673
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\runtime\runtime.msi
657674

658-
:: Package icu.msi
659-
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\icu.wixproj ^
660-
-p:RunWixToolsOutOfProc=true ^
661-
-p:OutputPath=%PackageRoot%\icu\ ^
662-
-p:IntermediateOutputPath=%PackageRoot%\icu\ ^
663-
-p:ProductVersion=67.1 ^
664-
-p:ProductVersionMajor=67 ^
665-
-p:ICU_ROOT=%BuildRoot%
666-
:: TODO(compnerd) actually perform the code-signing
667-
:: signtool sign /f Apple_CodeSign.pfx /p Apple_CodeSign_Password /tr http://timestamp.digicert.com /fd sha256 %PackageRoot%\icu\icu.msi
668-
669675
:: Package devtools.msi
670676
msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\devtools.wixproj ^
671677
-p:RunWixToolsOutOfProc=true ^
@@ -679,7 +685,6 @@ msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\devtools.wixproj
679685
move %PackageRoot%\toolchain\toolchain.msi %PackageRoot% || (exit /b)
680686
move %PackageRoot%\sdk\sdk.msi %PackageRoot% || (exit /b)
681687
move %PackageRoot%\runtime\runtime.msi %PackageRoot% || (exit /b)
682-
move %PackageRoot%\icu\icu.msi %PackageRoot% || (exit /b)
683688
move %PackageRoot%\devtools\devtools.msi %PackageRoot% || (exit /b)
684689

685690
:: Build Installer
@@ -693,8 +698,6 @@ msbuild %SourceRoot%\swift-installer-scripts\platforms\Windows\installer.wixproj
693698

694699
:: Stage Artifacts
695700
md %BuildRoot%\artifacts
696-
:: ICU Dependency for runtime libraries
697-
move %PackageRoot%\icu.msi %BuildRoot%\artifacts || (exit /b)
698701
:: Redistributable libraries for developers
699702
move %PackageRoot%\runtime.msi %BuildRoot%\artifacts || (exit /b)
700703
:: Toolchain
@@ -708,7 +711,7 @@ move %PackageRoot%\installer\installer.exe %BuildRoot%\artifacts || (exit /b)
708711

709712
:: Test Swift
710713
:: TODO(compnerd) make lit adjust the path properly
711-
path %BuildRoot%\3;%BuildRoot%\1\bin;%BuildRoot%\Library\icu-67.1\usr\bin;%PATH%;%SystemDrive%\Program Files\Git\usr\bin
714+
path %BuildRoot%\3;%BuildRoot%\1\bin;%PATH%;%SystemDrive%\Program Files\Git\usr\bin
712715
cmake --build %BuildRoot%\1 --target check-swift || (exit /b)
713716

714717
:: Test dispatch
@@ -735,9 +738,10 @@ cmake ^
735738
-D CMAKE_INSTALL_PREFIX=%SDKInstallRoot%\usr ^
736739

737740
-D CURL_DIR=%BuildRoot%\Library\curl-7.77.0\usr\lib\cmake\CURL ^
738-
-D ICU_ROOT=%BuildRoot%\Library\icu-67.1 ^
739-
-D ICU_UC_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuuc67.lib ^
740-
-D ICU_I18N_LIBRARY=%BuildRoot%\Library\icu-67.1\lib64\icuin67.lib ^
741+
-D ICU_ROOT=%BuildRoot%\Library\icu-69.1\usr ^
742+
-D ICU_DATA_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicudt69.lib ^
743+
-D ICU_I18N_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuin69.lib ^
744+
-D ICU_UC_LIBRARY_RELEASE=%BuildRoot%\Library\icu-69.1\usr\lib\sicuuc69.lib ^
741745
-D LIBXML2_LIBRARY=%BuildRoot%\Library\libxml2-2.9.12\usr\lib\libxml2s.lib ^
742746
-D LIBXML2_INCLUDE_DIR=%BuildRoot%\Library\libxml2-2.9.12\usr\include\libxml2 ^
743747
-D LIBXML2_DEFINITIONS="/DLIBXML_STATIC" ^
@@ -832,7 +836,7 @@ rd /s /q zlib libxml2 sqlite icu curl
832836
git clone --quiet --no-tags --depth 1 --branch v1.2.11 https://github.com/madler/zlib
833837
git clone --quiet --no-tags --depth 1 --branch v2.9.12 https://github.com/gnome/libxml2
834838
git clone --quiet --no-tags --depth 1 --branch version-3.36.0 https://github.com/sqlite/sqlite
835-
git clone --quiet --no-tags --depth 1 --branch maint/maint-67 https://github.com/unicode-org/icu
839+
git clone --quiet --no-tags --depth 1 --branch maint/maint-69 https://github.com/unicode-org/icu
836840
git clone --quiet --no-tags --depth 1 --branch curl-7_77_0 https://github.com/curl/curl
837841

838842
goto :eof

0 commit comments

Comments
 (0)