|
| 1 | +@echo off |
| 2 | +setlocal |
| 3 | + |
| 4 | +call "%~dp0\..\scripts\common.bat" loadenv || exit /b 1 |
| 5 | + |
| 6 | +:: determine whether we can use the Windows-provided ICU |
| 7 | +:: (requires Windows 10 version 1903 / build 18362 or later) |
| 8 | +for /f "tokens=4-6 delims=. " %%i in ('ver') do ( |
| 9 | + set WIN_VERSION=%%i |
| 10 | + set WIN_BUILD=%%k |
| 11 | +) |
| 12 | +if %WIN_VERSION% GTR 10 ( |
| 13 | + :: Windows 11 or later |
| 14 | + set SKIP_ICU=1 |
| 15 | +) else if %WIN_VERSION% EQU 10 ( |
| 16 | + if %WIN_BUILD% GEQ 18362 ( |
| 17 | + :: Windows 10 version 1903 / build 18362 or later |
| 18 | + set SKIP_ICU=1 |
| 19 | + ) |
| 20 | +) |
| 21 | +if defined SKIP_ICU ( |
| 22 | + echo Using system-provided ICU DLL ^(requires Windows 10 version 1903 or later^) |
| 23 | + exit /b 0 |
| 24 | +) |
| 25 | + |
| 26 | +if "%ARCH%" == "x86" ( |
| 27 | + set ICU_RELEASE_URL=https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-Win32-MSVC2019.zip |
| 28 | +) else if "%ARCH%" == "x64" ( |
| 29 | + set ICU_RELEASE_URL=https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-Win64-MSVC2019.zip |
| 30 | +) else ( |
| 31 | + echo Unknown ARCH: %ARCH% |
| 32 | + exit /b 1 |
| 33 | +) |
| 34 | + |
| 35 | +for %%a in ("%ICU_RELEASE_URL%") do ( |
| 36 | + set ICU_RELEASE_FILE=%%~nxa |
| 37 | + set ICU_RELEASE_NAME=%%~na |
| 38 | +) |
| 39 | + |
| 40 | +if not exist "%CACHE_ROOT%" (mkdir "%CACHE_ROOT%" || exit /b 1) |
| 41 | +cd "%CACHE_ROOT%" || exit /b 1 |
| 42 | + |
| 43 | +if not exist %ICU_RELEASE_FILE% ( |
| 44 | + echo. |
| 45 | + echo ### Downloading release |
| 46 | + curl -L -O# %ICU_RELEASE_URL% || exit /b 1 |
| 47 | +) |
| 48 | + |
| 49 | +if not exist %ICU_RELEASE_NAME% ( |
| 50 | + echo. |
| 51 | + echo ### Extracting release |
| 52 | + powershell Expand-Archive %ICU_RELEASE_FILE% || exit /b 1 |
| 53 | +) |
| 54 | + |
| 55 | +echo. |
| 56 | +echo ### Installing |
| 57 | +cd %ICU_RELEASE_NAME% || exit /b 1 |
| 58 | +pushd bin* || exit /b 1 |
| 59 | +xcopy /Y /F "icu*.dll" "%INSTALL_PREFIX%\lib\" || exit /b 1 |
| 60 | +popd |
| 61 | +pushd lib* || exit /b 1 |
| 62 | +xcopy /Y /F "icu*.lib" "%INSTALL_PREFIX%\lib\" || exit /b 1 |
| 63 | +popd |
| 64 | +xcopy /Y /F /S "include\*" "%INSTALL_PREFIX%\include\" || exit /b 1 |
0 commit comments