Add aarch64 wine with msys2
Enables support Wine with MSYS2 and arm64ex at our linux-aarch64 runners.
Core motivation lies here:
- Windows x86-64 runners are limited.
- Aarch64 hardware emulation is slower at x86-64 but x86-64 emulation under Aarch64 works faster.
- We have no Windows Aarch64 hardware at the moment.
- Reducing costs by usage Windows machines.
- Licensing issues with Windows to use real hardware like raspberry pi 5 for CI-purposes.
Uses the following components:
- Wine bindist from https://gitlab.haskell.org/gulin.serge/ci-wine-msys2-arm64ec/-/packages (custom patches are applied from https://gitlab.winehq.org/jhol/wine/-/commit/f4ee66ef58d4e4b66ea3b11328d1bd2dda3da927 and https://github.com/AndreRH/wine/commit/263c34123886c6a0f3d9982e595443b679bf11e4 rebased over
Wine-10.4
version, it required rebasing). - FEX bindist from https://launchpad.net/~fex-emu/+archive/ubuntu/fex (enables arm64ex virtualization for Wine environments). Needed to give a chance for Wine to run x86-64 code at aarch64 hardware same way how Windows 11 does.
- MSYS2 bindist https://github.com/msys2/msys2-installer/releases. Needed to create GHC Windows environment where GHC build process itself can be executed.
- Git-For-Windows Aarch64 bindist (installed from MSYS2 manually added repository according to https://gitforwindows.org/install-inside-msys2-proper.html). Uses Aarch64 version because it is notable faster than MSYS2's one. MSYS2 origin has only x86-64 git.
- Install https://github.com/mstorsjo/llvm-mingw Aarch64 Clang 19.7 for Linux and Windows environments. MSYS2 uses 20 but GHC does not support it at the moment.
As well it installs additional packages into MSYS2 environment:
"base-devel"
"mingw-w64-clang-aarch64-python"
"mingw-w64-clang-aarch64-python-pip"
"mingw-w64-clang-aarch64-pkgconf"
"mingw-w64-clang-aarch64-git"
"mingw-w64-clang-aarch64-git-lfs"
"mingw-w64-clang-aarch64-git-credential-manager"
"automake-wrapper"
"autoconf-wrapper"
"gmp"
"gmp-devel"
"unzip"
They are required to install GHC x86-64 Windows bindist with cabal x86-64.
This image is useful at following scenarios:
- Cross-compile Haskell code from Linux Aarch64 into Windows Aarch64 and test its execution under Wine.
- Cross-compile Haskell GHC itself from Linux Aarch64 into Windows Aarch64 and run it under Wine with installed Cabal.
- Cross-compile Haskell GHC itself from Windows x86-64 into Windows Aarch64.
- Compile and run GHC Windows Aarch64 by using GHC bindist from ghc#24603 (comment 601980) or ghc#24603 (comment 602054) (the last is better, it has enabled stack checks and Windows AV does not recognize it as a malware :-))
- Compile GHC JS Backend for Windows Aarch64 by usage Windows Aarch64 bindists and test it
Further steps could be but not limited at:
- Prepare MSYS2 + Wine x86-64 configuration to run tests for Windows platform without needing actual usage of Windows machines.
- Use this image to develop Windows Aarch64 (and later x86-64) in Docker environment.
It takes ~1h to build the image but most time spent on signature verifications (~50%). It is enabled for now, but can be disabled to speed up the process. I've applied a decision to leave these checks ON just to make sure that we have installed actually what requested.
To run MSYS2 environment do the following:
/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/env.exe -i HOME="$HOME" c:/msys64/usr/bin/bash.exe -l
Edited by Serge S. Gulin