diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 9548aa21bbaf..2ee011d4b09d 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -23,13 +23,6 @@ jobs: - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - name: Set up Cygwin - uses: cygwin/cygwin-install-action@f61179d72284ceddc397ed07ddb444d82bf9e559 # v5 - with: - packages: make - install-dir: C:\cygwin64 - add-to-path: false - - name: Download Crystal source uses: actions/checkout@v4 @@ -48,6 +41,16 @@ jobs: libs/yaml.lib libs/xml2.lib key: win-libs-${{ hashFiles('.github/workflows/win.yml', 'etc/win-ci/*.ps1') }}-msvc + - name: Set up MSYS2 + if: steps.cache-libs.outputs.cache-hit != 'true' + id: msys2 + uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0 + with: + msystem: MSYS + update: true + path-type: inherit + install: >- + make - name: Build libgc if: steps.cache-libs.outputs.cache-hit != 'true' run: .\etc\win-ci\build-gc.ps1 -BuildTree deps\gc -Version 8.2.8 -AtomicOpsVersion 7.8.2 @@ -59,7 +62,7 @@ jobs: run: .\etc\win-ci\build-pcre2.ps1 -BuildTree deps\pcre2 -Version 10.45 - name: Build libiconv if: steps.cache-libs.outputs.cache-hit != 'true' - run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv -Version 1.18 + run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv -Version 1.18 -Msys2Root ${{ steps.msys2.outputs.msys2-location }} - name: Build libffi if: steps.cache-libs.outputs.cache-hit != 'true' run: .\etc\win-ci\build-ffi.ps1 -BuildTree deps\ffi -Version 3.4.7 @@ -102,13 +105,6 @@ jobs: - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - name: Set up Cygwin - uses: cygwin/cygwin-install-action@f61179d72284ceddc397ed07ddb444d82bf9e559 # v5 - with: - packages: make - install-dir: C:\cygwin64 - add-to-path: false - - name: Download Crystal source uses: actions/checkout@v4 @@ -136,6 +132,16 @@ jobs: dlls/yaml.dll dlls/libxml2.dll key: win-dlls-${{ hashFiles('.github/workflows/win.yml', 'etc/win-ci/*.ps1') }}-msvc + - name: Set up MSYS2 + if: steps.cache-dlls.outputs.cache-hit != 'true' + id: msys2 + uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0 + with: + msystem: MSYS + update: true + path-type: inherit + install: >- + make - name: Build libgc if: steps.cache-dlls.outputs.cache-hit != 'true' run: .\etc\win-ci\build-gc.ps1 -BuildTree deps\gc -Version 8.2.8 -AtomicOpsVersion 7.8.2 -Dynamic @@ -147,7 +153,7 @@ jobs: run: .\etc\win-ci\build-pcre2.ps1 -BuildTree deps\pcre2 -Version 10.45 -Dynamic - name: Build libiconv if: steps.cache-dlls.outputs.cache-hit != 'true' - run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv -Version 1.18 -Dynamic + run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv -Version 1.18 -Msys2Root ${{ steps.msys2.outputs.msys2-location }} -Dynamic - name: Build libffi if: steps.cache-dlls.outputs.cache-hit != 'true' run: .\etc\win-ci\build-ffi.ps1 -BuildTree deps\ffi -Version 3.4.7 -Dynamic diff --git a/etc/win-ci/build-iconv.ps1 b/etc/win-ci/build-iconv.ps1 index 541066c6327f..f962c30c225a 100644 --- a/etc/win-ci/build-iconv.ps1 +++ b/etc/win-ci/build-iconv.ps1 @@ -1,6 +1,7 @@ param( [Parameter(Mandatory)] [string] $BuildTree, [Parameter(Mandatory)] [string] $Version, + [string] $Msys2Root, [switch] $Dynamic ) @@ -12,9 +13,13 @@ tar -xzf libiconv.tar.gz mv libiconv-* $BuildTree rm libiconv.tar.gz +if ($Msys2Root -eq '') { + $Msys2Root = 'C:\msys64' +} + Run-InDirectory $BuildTree { $env:CHERE_INVOKING = 1 - & 'C:\cygwin64\bin\bash.exe' --login "$PSScriptRoot\cygwin-build-iconv.sh" "$Version" "$(if ($Dynamic) { 1 })" + & "$Msys2Root\usr\bin\bash.exe" --login "$PSScriptRoot\cygwin-build-iconv.sh" "$Version" "$(if ($Dynamic) { 1 })" if (-not $?) { Write-Host "Error: Failed to build libiconv" -ForegroundColor Red Exit 1