├── .github ├── scripts │ ├── build-hello-world.sh │ ├── build-package.sh │ ├── clean-cross.sh │ ├── clean-native.sh │ ├── create-repository.sh │ ├── download-artifacts.sh │ ├── enable-ccache.sh │ ├── install-artifacts.sh │ ├── install-dependencies.sh │ ├── pthread-headers-hack-after.sh │ ├── pthread-headers-hack-before.sh │ ├── setup-mingwarm64.sh │ └── setup-repository.sh └── workflows │ ├── build-package.yml │ ├── check-repository.yml │ ├── main.yml │ ├── mingw-cross-toolchain.yml │ └── mingw-native-toolchain.yml ├── .gitignore ├── README.md ├── build-cross.sh ├── build-native-with-cross.sh ├── build-native-with-native.sh ├── config.sh └── patches ├── ccache ├── 0001-makepkg.patch └── 0002-makepkg-mingw.patch ├── makepkg ├── 0001-mingwarm64.patch ├── 0002-mingwarm64-cross-build.patch └── 0003-enable-debug.patch └── pacman ├── 0001-add-woarm64-cross-repository.patch └── 0002-add-woarm64-native-repository.patch /.github/scripts/build-hello-world.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | # Sanity check of the GCC binary and its version. 6 | aarch64-w64-mingw32-gcc --version 7 | 8 | # Create a simple "Hello, World!" program binary. 9 | echo '#include 10 | int main() { 11 | printf("Hello, World!\n"); 12 | return 0; 13 | } 14 | ' > hello-world.c 15 | aarch64-w64-mingw32-gcc -o hello-world.exe hello-world.c 16 | -------------------------------------------------------------------------------- /.github/scripts/build-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | PACKAGE_REPOSITORY=$1 6 | 7 | ARGUMENTS="--syncdeps \ 8 | --rmdeps \ 9 | --noconfirm \ 10 | --noprogressbar \ 11 | --nocheck \ 12 | --skippgpcheck \ 13 | --force \ 14 | $([ "$NO_EXTRACT" = 1 ] && echo "--noextract" || echo "") \ 15 | $([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \ 16 | $([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")" 17 | 18 | if command -v ccache &> /dev/null; then 19 | echo "::group::Ccache statistics before build" 20 | ccache -svv || true 21 | echo "::endgroup::" 22 | fi 23 | 24 | echo "::group::Build package" 25 | if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then 26 | makepkg-mingw $ARGUMENTS 27 | else 28 | makepkg $ARGUMENTS 29 | fi 30 | echo "::endgroup::" 31 | 32 | if command -v ccache &> /dev/null; then 33 | echo "::group::Ccache statistics after build" 34 | ccache -svv || true 35 | echo "::endgroup::" 36 | fi 37 | -------------------------------------------------------------------------------- /.github/scripts/clean-cross.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | for ENV in "common" "mingw32" "mingw64" "ucrt64" "mingwarm64"; do 6 | PACKAGES=" \ 7 | mingw-w64-cross-$ENV-zlib \ 8 | mingw-w64-cross-$ENV-gcc \ 9 | mingw-w64-cross-$ENV-winpthreads \ 10 | mingw-w64-cross-$ENV-crt \ 11 | mingw-w64-cross-$ENV-windows-default-manifest \ 12 | mingw-w64-cross-$ENV-gcc-stage1 \ 13 | mingw-w64-cross-$ENV-binutils \ 14 | mingw-w64-cross-$ENV-headers" 15 | 16 | for PACKAGE in $PACKAGES; do 17 | pacman -R --noconfirm --cascade $PACKAGE || true 18 | done 19 | done -------------------------------------------------------------------------------- /.github/scripts/clean-native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | for ARCH in "aarch64" "x86_64"; do 6 | PACKAGES=" \ 7 | mingw-w64-$ARCH-gcc \ 8 | mingw-w64-$ARCH-windows-default-manifest \ 9 | mingw-w64-$ARCH-binutils \ 10 | mingw-w64-$ARCH-libwinpthread-git 11 | mingw-w64-$ARCH-winpthreads-git \ 12 | mingw-w64-$ARCH-crt-git \ 13 | mingw-w64-$ARCH-headers-git \ 14 | mingw-w64-$ARCH-tools-git \ 15 | mingw-w64-$ARCH-libmangle-git \ 16 | mingw-w64-$ARCH-mpc \ 17 | mingw-w64-$ARCH-isl \ 18 | mingw-w64-$ARCH-mpfr \ 19 | mingw-w64-$ARCH-gmp \ 20 | mingw-w64-$ARCH-zstd \ 21 | mingw-w64-$ARCH-ninja \ 22 | mingw-w64-$ARCH-zlib \ 23 | mingw-w64-$ARCH-bzip2 \ 24 | mingw-w64-$ARCH-ncurses \ 25 | mingw-w64-$ARCH-gettext \ 26 | mingw-w64-$ARCH-libsystre \ 27 | mingw-w64-$ARCH-libtre \ 28 | mingw-w64-$ARCH-libiconv \ 29 | mingw-w64-$ARCH-gperf \ 30 | autotools-wrappers \ 31 | mingw-w64-$ARCH-autotools \ 32 | mingw-w64-$ARCH-pkgconf \ 33 | mingw-w64-$ARCH-libtool" 34 | 35 | for PACKAGE in $PACKAGES; do 36 | pacman -R --noconfirm --cascade $PACKAGE || true 37 | done 38 | done 39 | -------------------------------------------------------------------------------- /.github/scripts/create-repository.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | echo "::group::Create MSYS2 packages repository" 6 | mkdir -p repository/x86_64 7 | mv -f mingw-w64-cross-*.pkg.* repository/x86_64/ 8 | pushd repository/x86_64 9 | repo-add woarm64.db.tar.gz *.pkg.* 10 | popd 11 | 12 | mkdir -p repository/aarch64 13 | mv -f mingw-w64-aarch64-*.pkg.* repository/aarch64/ 14 | pushd repository/aarch64 15 | repo-add woarm64-native.db.tar.gz *.pkg.* 16 | popd 17 | echo "::endgroup::" 18 | -------------------------------------------------------------------------------- /.github/scripts/download-artifacts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | RUN_ID=$1 6 | 7 | for ARG in "${@:2}"; do 8 | NEEDS=`echo "$ARG" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'` 9 | for NEED in $NEEDS; do 10 | echo "Downloading $NEED artifact." 11 | /mingw64/bin/gh run download $RUN_ID -n $NEED 12 | done 13 | done 14 | -------------------------------------------------------------------------------- /.github/scripts/enable-ccache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | DIR="`dirname ${BASH_SOURCE[0]}`/../.." 6 | DIR=`realpath $DIR` 7 | CCACHE_DIR=$DIR/ccache 8 | if [[ -n "$GITHUB_WORKSPACE" ]]; then 9 | echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV" 10 | echo timestamp=$(date -u --iso-8601=seconds) >> "$GITHUB_OUTPUT" 11 | fi 12 | 13 | apply_patch () { 14 | if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then 15 | echo "Patch $1 is already applied" 16 | else 17 | patch -p1 -b -i "$1" 18 | fi 19 | } 20 | 21 | mkdir -p $CCACHE_DIR 22 | 23 | pushd / 24 | echo "::group::/etc/makepkg.conf" 25 | apply_patch "$DIR/patches/ccache/0001-makepkg.patch" 26 | cat /etc/makepkg.conf 27 | echo "::endgroup::" 28 | 29 | echo "::group::/etc/makepkg_mingw.conf" 30 | apply_patch "$DIR/patches/ccache/0002-makepkg-mingw.patch" 31 | cat /etc/makepkg_mingw.conf 32 | echo "::endgroup::" 33 | popd 34 | 35 | pacman -S --noconfirm ccache 36 | 37 | pushd /usr/lib/ccache/bin 38 | echo "::group::Add aarch64 toolchain to ccache" 39 | export MSYS=winsymlinks 40 | ln -sf /usr/bin/ccache aarch64-w64-mingw32-c++ 41 | ln -sf /usr/bin/ccache aarch64-w64-mingw32-g++ 42 | ln -sf /usr/bin/ccache aarch64-w64-mingw32-gcc 43 | if [[ "$FLAVOR" = "CROSS" ]]; then 44 | ln -sf /usr/bin/true makeinfo 45 | fi 46 | echo "::endgroup::" 47 | popd 48 | -------------------------------------------------------------------------------- /.github/scripts/install-artifacts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | pacman -U --noconfirm *.pkg.tar.zst 6 | -------------------------------------------------------------------------------- /.github/scripts/install-dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | DEPENDENCIES=$1 6 | 7 | case $FLAVOR in 8 | "CROSS") 9 | pacman -S --noconfirm \ 10 | git \ 11 | base-devel \ 12 | $DEPENDENCIES 13 | ;; 14 | "NATIVE_WITH_CROSS") 15 | pacman -S --noconfirm \ 16 | git \ 17 | base-devel \ 18 | mingw-w64-cross-mingwarm64-gcc \ 19 | mingw-w64-cross-mingwarm64-windows-default-manifest \ 20 | mingw-w64-x86_64-gcc-libs \ 21 | $DEPENDENCIES 22 | ;; 23 | "NATIVE_WITH_NATIVE") 24 | pacman -S --noconfirm \ 25 | git \ 26 | base-devel \ 27 | mingw-w64-aarch64-gcc \ 28 | $DEPENDENCIES 29 | ;; 30 | *) 31 | echo "Unknown flavor: $FLAVOR" 32 | exit 1 33 | ;; 34 | esac 35 | -------------------------------------------------------------------------------- /.github/scripts/pthread-headers-hack-after.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | pacman -R --noconfirm mingw-w64-cross-mingw64-winpthreads || true 6 | rm -rf /opt/aarch64-w64-mingw32/include/pthread_signal.h 7 | rm -rf /opt/aarch64-w64-mingw32/include/pthread_unistd.h 8 | rm -rf /opt/aarch64-w64-mingw32/include/pthread_time.h 9 | -------------------------------------------------------------------------------- /.github/scripts/pthread-headers-hack-before.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | pacman -S --noconfirm mingw-w64-cross-mingw64-winpthreads 6 | cp /opt/x86_64-w64-mingw32/include/pthread_signal.h /opt/aarch64-w64-mingw32/include/ 7 | cp /opt/x86_64-w64-mingw32/include/pthread_unistd.h /opt/aarch64-w64-mingw32/include/ 8 | cp /opt/x86_64-w64-mingw32/include/pthread_time.h /opt/aarch64-w64-mingw32/include/ 9 | -------------------------------------------------------------------------------- /.github/scripts/setup-mingwarm64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source `dirname ${BASH_SOURCE[0]}`/../../config.sh 4 | 5 | if [ -z "$GITHUB_WORKSPACE" ]; then 6 | DIR=`pwd` 7 | else 8 | DIR=`cygpath "$GITHUB_WORKSPACE"` 9 | fi 10 | 11 | apply_patch () { 12 | if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then 13 | echo "Patch $1 is already applied" 14 | else 15 | patch -p1 -b -i "$1" 16 | fi 17 | } 18 | 19 | echo "::group::Install patch" 20 | pacman -S --noconfirm patch 21 | echo "::endgroup::" 22 | 23 | pushd / 24 | echo "::group::Patch MSYS2 environment" 25 | apply_patch "$DIR/patches/makepkg/0001-mingwarm64.patch" 26 | if [[ "$FLAVOR" != "NATIVE_WITH_NATIVE" ]]; then 27 | apply_patch "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch" 28 | fi 29 | if [[ "$DEBUG_BUILD" = "1" ]]; then 30 | apply_patch "$DIR/patches/makepkg/0003-enable-debug.patch" 31 | fi 32 | echo "::endgroup::" 33 | 34 | echo "::group::/etc/makepkg_mingw.conf" 35 | cat /etc/makepkg_mingw.conf 36 | echo "::endgroup::" 37 | 38 | echo "::group::/etc/profile" 39 | cat /etc/profile 40 | echo "::endgroup::" 41 | 42 | echo "::group::/usr/share/makepkg/tidy/strip.sh" 43 | cat /usr/share/makepkg/tidy/strip.sh 44 | echo "::endgroup::" 45 | popd 46 | -------------------------------------------------------------------------------- /.github/scripts/setup-repository.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e # exit on error 4 | set -x # echo on 5 | set -o pipefail # fail of any command in pipeline is an error 6 | 7 | DIR="`dirname ${BASH_SOURCE[0]}`/../.." 8 | DIR=`realpath $DIR` 9 | 10 | apply_patch () { 11 | if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then 12 | echo "Patch $1 is already applied" 13 | else 14 | patch -p1 -b -i "$1" 15 | fi 16 | } 17 | 18 | echo "::group::Install patch" 19 | pacman -S --noconfirm patch 20 | echo "::endgroup::" 21 | 22 | pushd / 23 | echo "::group::Add WoArm64 repository" 24 | if [[ "$FLAVOR" = "NATIVE_WITH_NATIVE" ]]; then 25 | apply_patch "$DIR/patches/pacman/0002-add-woarm64-native-repository.patch" 26 | else 27 | apply_patch "$DIR/patches/pacman/0001-add-woarm64-cross-repository.patch" 28 | fi 29 | echo "::endgroup::" 30 | 31 | echo "::group::Update packages database" 32 | pacman -Sy --noconfirm 33 | echo "::endgroup::" 34 | popd 35 | -------------------------------------------------------------------------------- /.github/workflows/build-package.yml: -------------------------------------------------------------------------------- 1 | name: Build MSYS2 package 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | package_name: 7 | description: "Package name to build" 8 | type: string 9 | packages_repository: 10 | description: "MSYS2 packages repository to build from" 11 | type: string 12 | default: "Windows-on-ARM-Experiments/MSYS2-packages" 13 | packages_branch: 14 | description: "MSYS2 packages branch to build from" 15 | type: string 16 | default: "woarm64" 17 | runner_arch: 18 | description: "Architecture to build on" 19 | type: string 20 | default: "x86_64" 21 | build_with_native: 22 | description: "Build with native MinGW toolchain" 23 | type: boolean 24 | default: false 25 | needs: 26 | description: "Parent workflow job dependencies" 27 | type: string 28 | dependencies: 29 | description: "Install additional dependencies" 30 | type: string 31 | default: "" 32 | 33 | defaults: 34 | run: 35 | shell: msys2 {0} 36 | 37 | env: 38 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | FLAVOR: ${{ (inputs.runner_arch == 'aarch64') && (inputs.build_with_native && 'NATIVE_WITH_NATIVE' || 'NATIVE_WITH_CROSS') || 'CROSS' }} 40 | CLEAN_BUILD: 1 41 | 42 | jobs: 43 | build: 44 | name: Build ${{ inputs.package_name }} 45 | timeout-minutes: 720 46 | runs-on: >- 47 | ${{ fromJson(inputs.runner_arch == 'aarch64' 48 | && '["Windows", "ARM64", "MSYS2"]' 49 | || '["windows-latest"]') }} 50 | 51 | steps: 52 | - name: Kill hanging processes 53 | if: inputs.runner_arch == 'aarch64' 54 | shell: powershell 55 | run: | 56 | taskkill /F /FI 'MODULES eq msys-2.0.dll' 57 | Set-Location "${{ github.workspace }}" 58 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages 59 | exit 0 60 | 61 | - uses: Windows-on-ARM-Experiments/setup-msys2@main 62 | timeout-minutes: 10 63 | with: 64 | msystem: >- 65 | ${{ contains(inputs.packages_repository, 'MINGW') 66 | && ((inputs.runner_arch == 'aarch64') && 'MINGWARM64' || 'MINGW64') 67 | || 'MSYS' }} 68 | path-type: minimal 69 | update: true 70 | cache: true 71 | 72 | - name: Checkout repository 73 | uses: actions/checkout@v4 74 | 75 | - name: Checkout ${{ inputs.packages_repository }} repository 76 | uses: actions/checkout@v4 77 | with: 78 | repository: ${{ inputs.packages_repository }} 79 | ref: ${{ ((inputs.runner_arch == 'aarch64') && !inputs.build_with_native) && format('{0}-cross', inputs.packages_branch) || inputs.packages_branch }} 80 | sparse-checkout: ${{ inputs.package_name }} 81 | path: ${{ github.workspace }}/packages 82 | 83 | - name: Setup packages repository 84 | if: inputs.runner_arch == 'aarch64' 85 | run: | 86 | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh 87 | 88 | - name: Install dependencies 89 | run: >- 90 | `cygpath "${{ github.workspace }}"`/.github/scripts/install-dependencies.sh \ 91 | "git mingw-w64-x86_64-github-cli mingw-w64-x86_64-jq ${{ inputs.dependencies }}" 92 | 93 | - name: Download artifacts 94 | if: inputs.needs 95 | run: | 96 | `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh \ 97 | ${{ github.run_id }} \ 98 | '${{ inputs.needs }}' 99 | 100 | - name: Install artifacts 101 | if: inputs.needs 102 | run: | 103 | `cygpath "${{ github.workspace }}"`/.github/scripts/install-artifacts.sh 104 | 105 | - name: Copy missing headers for mingw-w64-cross-mingwarm64-crt 106 | if: inputs.package_name == 'mingw-w64-cross-mingwarm64-crt' 107 | run: | 108 | `cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh 109 | 110 | - name: Setup MINGWARM64 environment 111 | if: inputs.runner_arch == 'aarch64' 112 | run: | 113 | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh 114 | 115 | - name: Enable Ccache 116 | id: enable-ccache 117 | run: | 118 | `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh 119 | 120 | - name: Restore Ccache 121 | uses: actions/cache/restore@v4 122 | with: 123 | path: ${{ github.workspace }}/ccache 124 | key: ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }} 125 | restore-keys: ${{ inputs.package_name }}- 126 | 127 | - name: Build ${{ inputs.package_name }} 128 | timeout-minutes: 720 129 | working-directory: ${{ github.workspace }}/packages/${{ inputs.package_name }} 130 | run: | 131 | `cygpath "${{ github.workspace }}"`/.github/scripts/build-package.sh \ 132 | ${{ inputs.packages_repository }} 133 | 134 | - name: Save Ccache 135 | if: always() 136 | uses: actions/cache/save@v4 137 | with: 138 | path: ${{ github.workspace }}/ccache 139 | key: ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }} 140 | 141 | - name: Upload ${{ inputs.package_name }} 142 | uses: actions/upload-artifact@v4 143 | with: 144 | name: ${{ inputs.package_name }} 145 | retention-days: 3 146 | path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst 147 | 148 | - name: Upload build folder 149 | if: failure() 150 | uses: actions/upload-artifact@v4 151 | with: 152 | name: ${{ inputs.package_name }}-build 153 | retention-days: 1 154 | path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/src 155 | -------------------------------------------------------------------------------- /.github/workflows/check-repository.yml: -------------------------------------------------------------------------------- 1 | name: Check MSYS2 repository 2 | 3 | on: 4 | workflow_dispatch: 5 | workflow_call: 6 | 7 | jobs: 8 | build-cross: 9 | runs-on: windows-latest 10 | 11 | defaults: 12 | run: 13 | shell: msys2 {0} 14 | 15 | env: 16 | FLAVOR: CROSS 17 | 18 | steps: 19 | - uses: msys2/setup-msys2@v2 20 | timeout-minutes: 10 21 | with: 22 | msystem: MSYS 23 | path-type: minimal 24 | update: true 25 | cache: true 26 | 27 | - name: Checkout repository 28 | uses: actions/checkout@v4 29 | 30 | - name: Setup packages repository 31 | run: | 32 | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh 33 | 34 | - name: Install cross toolchain 35 | run: | 36 | pacman -S --noconfirm mingw-w64-cross-mingwarm64-gcc 37 | pacman -S --noconfirm --needed mingw-w64-aarch64-cc 38 | 39 | - name: Build hello-world.exe 40 | run: | 41 | `cygpath "${{ github.workspace }}"`/.github/scripts/build-hello-world.sh 42 | 43 | - name: Upload artifacts 44 | uses: actions/upload-artifact@v4 45 | with: 46 | name: hello-world-cross 47 | path: hello-world.exe 48 | 49 | test-cross: 50 | needs: [build-cross] 51 | runs-on: [Windows, GCC, ARM64] 52 | 53 | steps: 54 | - name: Download artifacts 55 | uses: actions/download-artifact@v4 56 | with: 57 | name: hello-world-cross 58 | path: ${{ github.workspace }}\artifacts 59 | 60 | - name: Run hello-world.exe 61 | run: | 62 | ${{ github.workspace }}\artifacts\hello-world.exe 63 | 64 | build-native: 65 | runs-on: ["Windows", "ARM64", "MSYS2"] 66 | 67 | defaults: 68 | run: 69 | shell: msys2 {0} 70 | 71 | env: 72 | FLAVOR: NATIVE_WITH_NATIVE 73 | 74 | steps: 75 | - name: Kill hanging processes 76 | shell: powershell 77 | run: | 78 | taskkill /F /FI 'MODULES eq msys-2.0.dll' 79 | Set-Location "${{ github.workspace }}" 80 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages 81 | exit 0 82 | 83 | - uses: Windows-on-ARM-Experiments/setup-msys2@main 84 | timeout-minutes: 10 85 | with: 86 | msystem: MINGWARM64 87 | path-type: minimal 88 | update: true 89 | cache: true 90 | 91 | - name: Checkout repository 92 | uses: actions/checkout@v4 93 | 94 | - name: Setup packages repository 95 | run: | 96 | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh 97 | 98 | - name: Install native toolchain 99 | run: | 100 | pacman -S --noconfirm mingw-w64-aarch64-gcc 101 | pacman -S --noconfirm --needed mingw-w64-aarch64-cc 102 | 103 | - name: Setup MINGWARM64 environment 104 | run: | 105 | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh 106 | 107 | - name: Build hello-world.exe 108 | run: | 109 | `cygpath "${{ github.workspace }}"`/.github/scripts/build-hello-world.sh 110 | 111 | - name: Upload artifacts 112 | uses: actions/upload-artifact@v4 113 | with: 114 | name: hello-world-native 115 | path: hello-world.exe 116 | 117 | test-native: 118 | needs: [build-native] 119 | runs-on: [Windows, GCC, ARM64] 120 | 121 | steps: 122 | - name: Download artifacts 123 | uses: actions/download-artifact@v4 124 | with: 125 | name: hello-world-native 126 | path: ${{ github.workspace }}\artifacts 127 | 128 | - name: Run hello-world.exe 129 | run: | 130 | ${{ github.workspace }}\artifacts\hello-world.exe 131 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build MinGW and MSYS2 toolchains 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | workflow_dispatch: 9 | inputs: 10 | msys2_packages_branch: 11 | description: "MSYS2-packages branch to build" 12 | type: string 13 | required: false 14 | default: "woarm64" 15 | mingw_packages_branch: 16 | description: "MINGW-packages branch to build" 17 | type: string 18 | required: false 19 | default: "woarm64" 20 | build_cross: 21 | description: "Build cross-compilation MinGW toolchain" 22 | type: choice 23 | options: 24 | - true 25 | - false 26 | required: false 27 | default: 'true' 28 | build_native: 29 | description: "Build native MinGW toolchain" 30 | type: choice 31 | options: 32 | - true 33 | - false 34 | required: false 35 | default: 'true' 36 | build_native_with_native: 37 | description: "Build native MinGW toolchain with native MinGW toolchain" 38 | type: choice 39 | options: 40 | - true 41 | - false 42 | required: false 43 | default: 'true' 44 | 45 | jobs: 46 | mingw-cross-toolchain: 47 | if: inputs.build_cross != 'false' 48 | name: MinGW cross-compilation toolchain 49 | uses: ./.github/workflows/mingw-cross-toolchain.yml 50 | with: 51 | msys2_packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 52 | 53 | mingw-native-toolchain: 54 | if: inputs.build_native != 'false' 55 | name: MinGW native toolchain 56 | uses: ./.github/workflows/mingw-native-toolchain.yml 57 | with: 58 | mingw_packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 59 | build_with_native: ${{ inputs.build_native_with_native || 'true' }} 60 | 61 | repository: 62 | name: Create MSYS2 repository 63 | needs: [ 64 | mingw-cross-toolchain, 65 | mingw-native-toolchain 66 | ] 67 | runs-on: windows-latest 68 | 69 | defaults: 70 | run: 71 | shell: msys2 {0} 72 | 73 | env: 74 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 75 | 76 | steps: 77 | - uses: msys2/setup-msys2@v2 78 | timeout-minutes: 10 79 | with: 80 | msystem: MSYS 81 | path-type: minimal 82 | update: true 83 | cache: true 84 | 85 | - name: Checkout repository 86 | uses: actions/checkout@v4 87 | 88 | - name: Install dependencies 89 | run: | 90 | pacman -S --noconfirm \ 91 | git \ 92 | mingw-w64-x86_64-github-cli \ 93 | mingw-w64-x86_64-jq 94 | 95 | - name: Download artifacts 96 | run: | 97 | `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh \ 98 | ${{ github.run_id }} \ 99 | '${{ needs.mingw-cross-toolchain.outputs.artifacts }}' \ 100 | '${{ needs.mingw-native-toolchain.outputs.artifacts }}' 101 | 102 | - name: Create MSYS2 packages repository 103 | run: | 104 | `cygpath "${{ github.workspace }}"`/.github/scripts/create-repository.sh 105 | 106 | - name: Create index.html 107 | run: | 108 | echo "" > repository/index.html 109 | 110 | - name: Upload woarm64-msys2-repository 111 | uses: actions/upload-pages-artifact@v3 112 | with: 113 | name: woarm64-msys2-repository 114 | retention-days: 1 115 | path: repository 116 | 117 | deploy: 118 | if: github.ref == 'refs/heads/main' 119 | name: Deploy MSYS2 repository 120 | needs: repository 121 | runs-on: ubuntu-latest 122 | 123 | permissions: 124 | contents: read 125 | pages: write 126 | id-token: write 127 | 128 | environment: 129 | name: github-pages 130 | url: ${{steps.deployment.outputs.page_url}} 131 | 132 | defaults: 133 | run: 134 | shell: bash {0} 135 | 136 | steps: 137 | - name: Setup GitHub Pages 138 | uses: actions/configure-pages@v4 139 | 140 | - name: Deploy to GitHub Pages 141 | id: deployment 142 | uses: actions/deploy-pages@v4 143 | with: 144 | artifact_name: woarm64-msys2-repository 145 | 146 | check: 147 | name: Check MSYS2 repository 148 | needs: deploy 149 | uses: ./.github/workflows/check-repository.yml 150 | -------------------------------------------------------------------------------- /.github/workflows/mingw-cross-toolchain.yml: -------------------------------------------------------------------------------- 1 | name: Build MinGW cross-compilation toolchain 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | msys2_packages_branch: 7 | description: "MSYS2-packages branch to build" 8 | type: string 9 | required: false 10 | default: "woarm64" 11 | workflow_call: 12 | inputs: 13 | msys2_packages_branch: 14 | description: "MSYS2-packages branch to build" 15 | type: string 16 | default: "woarm64" 17 | outputs: 18 | artifacts: 19 | value: ${{ toJson(jobs) }} 20 | 21 | jobs: 22 | mingw-w64-cross-mingwarm64-headers: 23 | uses: ./.github/workflows/build-package.yml 24 | with: 25 | package_name: mingw-w64-cross-mingwarm64-headers 26 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 27 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 28 | 29 | mingw-w64-cross-mingwarm64-binutils: 30 | needs: mingw-w64-cross-mingwarm64-headers 31 | uses: ./.github/workflows/build-package.yml 32 | with: 33 | package_name: mingw-w64-cross-mingwarm64-binutils 34 | needs: ${{ toJson(needs) }} 35 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 36 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 37 | 38 | mingw-w64-cross-mingwarm64-gcc-stage1: 39 | needs: [ 40 | mingw-w64-cross-mingwarm64-headers, 41 | mingw-w64-cross-mingwarm64-binutils 42 | ] 43 | uses: ./.github/workflows/build-package.yml 44 | with: 45 | package_name: mingw-w64-cross-mingwarm64-gcc-stage1 46 | needs: ${{ toJson(needs) }} 47 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 48 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 49 | 50 | mingw-w64-cross-mingwarm64-windows-default-manifest: 51 | needs: [ 52 | mingw-w64-cross-mingwarm64-binutils, 53 | mingw-w64-cross-mingwarm64-gcc-stage1 54 | ] 55 | uses: ./.github/workflows/build-package.yml 56 | with: 57 | package_name: mingw-w64-cross-mingwarm64-windows-default-manifest 58 | needs: ${{ toJson(needs) }} 59 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 60 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 61 | 62 | mingw-w64-cross-mingwarm64-crt: 63 | needs: [ 64 | mingw-w64-cross-mingwarm64-headers, 65 | mingw-w64-cross-mingwarm64-binutils, 66 | mingw-w64-cross-mingwarm64-gcc-stage1 67 | ] 68 | uses: ./.github/workflows/build-package.yml 69 | with: 70 | package_name: mingw-w64-cross-mingwarm64-crt 71 | needs: ${{ toJson(needs) }} 72 | dependencies: mingw-w64-cross-mingw64-winpthreads 73 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 74 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 75 | 76 | mingw-w64-cross-mingwarm64-winpthreads: 77 | needs: [ 78 | mingw-w64-cross-mingwarm64-headers, 79 | mingw-w64-cross-mingwarm64-binutils, 80 | mingw-w64-cross-mingwarm64-gcc-stage1, 81 | mingw-w64-cross-mingwarm64-crt 82 | ] 83 | uses: ./.github/workflows/build-package.yml 84 | with: 85 | package_name: mingw-w64-cross-mingwarm64-winpthreads 86 | needs: ${{ toJson(needs) }} 87 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 88 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 89 | 90 | mingw-w64-cross-mingwarm64-gcc: 91 | needs: [ 92 | mingw-w64-cross-mingwarm64-headers, 93 | mingw-w64-cross-mingwarm64-binutils, 94 | mingw-w64-cross-mingwarm64-gcc-stage1, 95 | mingw-w64-cross-mingwarm64-windows-default-manifest, 96 | mingw-w64-cross-mingwarm64-crt, 97 | mingw-w64-cross-mingwarm64-winpthreads 98 | ] 99 | uses: ./.github/workflows/build-package.yml 100 | with: 101 | package_name: mingw-w64-cross-mingwarm64-gcc 102 | needs: ${{ toJson(needs) }} 103 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 104 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 105 | 106 | mingw-w64-cross-mingwarm64-zlib: 107 | needs: [ 108 | mingw-w64-cross-mingwarm64-headers, 109 | mingw-w64-cross-mingwarm64-binutils, 110 | mingw-w64-cross-mingwarm64-windows-default-manifest, 111 | mingw-w64-cross-mingwarm64-crt, 112 | mingw-w64-cross-mingwarm64-winpthreads, 113 | mingw-w64-cross-mingwarm64-gcc 114 | ] 115 | 116 | uses: ./.github/workflows/build-package.yml 117 | with: 118 | package_name: mingw-w64-cross-mingwarm64-zlib 119 | needs: ${{ toJson(needs) }} 120 | packages_repository: Windows-on-ARM-Experiments/MSYS2-packages 121 | packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} 122 | -------------------------------------------------------------------------------- /.github/workflows/mingw-native-toolchain.yml: -------------------------------------------------------------------------------- 1 | name: Build MinGW native toolchain 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | mingw_packages_branch: 7 | description: "MINGW-packages branch to build" 8 | type: string 9 | required: false 10 | default: "woarm64" 11 | build_with_native: 12 | description: "Build with native MinGW toolchain" 13 | type: choice 14 | options: 15 | - true 16 | - false 17 | required: false 18 | default: 'true' 19 | workflow_call: 20 | inputs: 21 | mingw_packages_branch: 22 | description: "MINGW-packages branch to build" 23 | type: string 24 | default: "woarm64" 25 | build_with_native: 26 | description: "Build with native MinGW toolchain" 27 | type: string 28 | required: false 29 | default: 'true' 30 | outputs: 31 | artifacts: 32 | value: ${{ toJson(jobs) }} 33 | 34 | jobs: 35 | mingw-w64-libiconv: 36 | uses: ./.github/workflows/build-package.yml 37 | with: 38 | package_name: mingw-w64-libiconv 39 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 40 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 41 | runner_arch: aarch64 42 | build_with_native: ${{ inputs.build_with_native != 'false' }} 43 | 44 | mingw-w64-libtre: 45 | uses: ./.github/workflows/build-package.yml 46 | with: 47 | package_name: mingw-w64-libtre 48 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 49 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 50 | runner_arch: aarch64 51 | build_with_native: ${{ inputs.build_with_native != 'false' }} 52 | 53 | mingw-w64-libsystre: 54 | needs: [ 55 | mingw-w64-libtre 56 | ] 57 | uses: ./.github/workflows/build-package.yml 58 | with: 59 | package_name: mingw-w64-libsystre 60 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 61 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 62 | runner_arch: aarch64 63 | build_with_native: ${{ inputs.build_with_native != 'false' }} 64 | needs: ${{ toJson(needs) }} 65 | 66 | mingw-w64-gettext: 67 | needs: [ 68 | mingw-w64-libiconv, 69 | mingw-w64-libtre, 70 | mingw-w64-libsystre 71 | ] 72 | uses: ./.github/workflows/build-package.yml 73 | with: 74 | package_name: mingw-w64-gettext 75 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 76 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 77 | runner_arch: aarch64 78 | build_with_native: ${{ inputs.build_with_native != 'false' }} 79 | needs: ${{ toJson(needs) }} 80 | 81 | mingw-w64-ncurses: 82 | needs: [ 83 | mingw-w64-libiconv, 84 | mingw-w64-libtre, 85 | mingw-w64-libsystre, 86 | mingw-w64-gettext 87 | ] 88 | uses: ./.github/workflows/build-package.yml 89 | with: 90 | package_name: mingw-w64-ncurses 91 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 92 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 93 | runner_arch: aarch64 94 | build_with_native: ${{ inputs.build_with_native != 'false' }} 95 | needs: ${{ toJson(needs) }} 96 | 97 | mingw-w64-headers-git: 98 | uses: ./.github/workflows/build-package.yml 99 | with: 100 | package_name: mingw-w64-headers-git 101 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 102 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 103 | runner_arch: aarch64 104 | build_with_native: ${{ inputs.build_with_native != 'false' }} 105 | 106 | mingw-w64-crt-git: 107 | needs: [ 108 | mingw-w64-headers-git 109 | ] 110 | uses: ./.github/workflows/build-package.yml 111 | with: 112 | package_name: mingw-w64-crt-git 113 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 114 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 115 | runner_arch: aarch64 116 | build_with_native: ${{ inputs.build_with_native != 'false' }} 117 | needs: ${{ toJson(needs) }} 118 | 119 | mingw-w64-winpthreads-git: 120 | needs: [ 121 | mingw-w64-headers-git, 122 | mingw-w64-crt-git 123 | ] 124 | uses: ./.github/workflows/build-package.yml 125 | with: 126 | package_name: mingw-w64-winpthreads-git 127 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 128 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 129 | runner_arch: aarch64 130 | build_with_native: ${{ inputs.build_with_native != 'false' }} 131 | needs: ${{ toJson(needs) }} 132 | 133 | mingw-w64-bzip2: 134 | uses: ./.github/workflows/build-package.yml 135 | with: 136 | package_name: mingw-w64-bzip2 137 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 138 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 139 | runner_arch: aarch64 140 | build_with_native: ${{ inputs.build_with_native != 'false' }} 141 | 142 | mingw-w64-zlib: 143 | needs: [ 144 | mingw-w64-bzip2 145 | ] 146 | uses: ./.github/workflows/build-package.yml 147 | with: 148 | package_name: mingw-w64-zlib 149 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 150 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 151 | runner_arch: aarch64 152 | build_with_native: ${{ inputs.build_with_native != 'false' }} 153 | needs: ${{ toJson(needs) }} 154 | 155 | mingw-w64-zstd: 156 | uses: ./.github/workflows/build-package.yml 157 | with: 158 | package_name: mingw-w64-zstd 159 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 160 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 161 | runner_arch: aarch64 162 | build_with_native: ${{ inputs.build_with_native != 'false' }} 163 | 164 | mingw-w64-gmp: 165 | uses: ./.github/workflows/build-package.yml 166 | with: 167 | package_name: mingw-w64-gmp 168 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 169 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 170 | runner_arch: aarch64 171 | build_with_native: ${{ inputs.build_with_native != 'false' }} 172 | 173 | mingw-w64-mpfr: 174 | uses: ./.github/workflows/build-package.yml 175 | needs: [ 176 | mingw-w64-gmp 177 | ] 178 | with: 179 | package_name: mingw-w64-mpfr 180 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 181 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 182 | runner_arch: aarch64 183 | build_with_native: ${{ inputs.build_with_native != 'false' }} 184 | needs: ${{ toJson(needs) }} 185 | 186 | mingw-w64-isl: 187 | uses: ./.github/workflows/build-package.yml 188 | needs: [ 189 | mingw-w64-gmp 190 | ] 191 | with: 192 | package_name: mingw-w64-isl 193 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 194 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 195 | runner_arch: aarch64 196 | build_with_native: ${{ inputs.build_with_native != 'false' }} 197 | needs: ${{ toJson(needs) }} 198 | 199 | mingw-w64-binutils: 200 | needs: [ 201 | mingw-w64-libiconv, 202 | mingw-w64-libtre, 203 | mingw-w64-libsystre, 204 | mingw-w64-ncurses, 205 | mingw-w64-gettext, 206 | mingw-w64-headers-git, 207 | mingw-w64-winpthreads-git, 208 | mingw-w64-bzip2, 209 | mingw-w64-zlib, 210 | mingw-w64-zstd, 211 | mingw-w64-gmp, 212 | mingw-w64-mpfr, 213 | mingw-w64-isl 214 | ] 215 | uses: ./.github/workflows/build-package.yml 216 | with: 217 | package_name: mingw-w64-binutils 218 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 219 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 220 | runner_arch: aarch64 221 | build_with_native: ${{ inputs.build_with_native != 'false' }} 222 | needs: ${{ toJson(needs) }} 223 | 224 | mingw-w64-mpc: 225 | needs: [ 226 | mingw-w64-gmp, 227 | mingw-w64-mpfr 228 | ] 229 | uses: ./.github/workflows/build-package.yml 230 | with: 231 | package_name: mingw-w64-mpc 232 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 233 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 234 | runner_arch: aarch64 235 | build_with_native: ${{ inputs.build_with_native != 'false' }} 236 | needs: ${{ toJson(needs) }} 237 | 238 | mingw-w64-windows-default-manifest: 239 | uses: ./.github/workflows/build-package.yml 240 | with: 241 | package_name: mingw-w64-windows-default-manifest 242 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 243 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 244 | runner_arch: aarch64 245 | build_with_native: ${{ inputs.build_with_native != 'false' }} 246 | 247 | mingw-w64-gcc: 248 | needs: [ 249 | mingw-w64-libiconv, 250 | mingw-w64-libtre, 251 | mingw-w64-libsystre, 252 | mingw-w64-ncurses, 253 | mingw-w64-gettext, 254 | mingw-w64-headers-git, 255 | mingw-w64-winpthreads-git, 256 | mingw-w64-bzip2, 257 | mingw-w64-zlib, 258 | mingw-w64-zstd, 259 | mingw-w64-gmp, 260 | mingw-w64-mpfr, 261 | mingw-w64-isl, 262 | mingw-w64-binutils, 263 | mingw-w64-mpc, 264 | mingw-w64-crt-git, 265 | mingw-w64-windows-default-manifest 266 | ] 267 | uses: ./.github/workflows/build-package.yml 268 | with: 269 | package_name: mingw-w64-gcc 270 | packages_repository: Windows-on-ARM-Experiments/MINGW-packages 271 | packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} 272 | runner_arch: aarch64 273 | build_with_native: ${{ inputs.build_with_native != 'false' }} 274 | needs: ${{ toJson(needs) }} 275 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.code-workspace 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MSYS2 WoArm64 Packages Build and Repository 2 | 3 | This repository contains GitHub Actions workflows for building MinGW and MSYS2 toolchains 4 | with `aarch64-w64-mingw32` and `aarch64-pc-msys` targets inside MSYS2 environment and deploys 5 | their Pacman packages overlay repositories to GitHub Pages environment of this repository. 6 | It also serves as a documentation of the necessary steps to build them. 7 | 8 | The actual MSYS2 packages recipes dwells in `woarm64` branches of 9 | [Windows-on-ARM-Experiments/MSYS2-packages](https://github.com/Windows-on-ARM-Experiments/MSYS2-packages) 10 | and [Windows-on-ARM-Experiments/MINGW-packages](https://github.com/Windows-on-ARM-Experiments/MINGW-packages) 11 | repositories. Please report any issue related to packages build to this repository's 12 | [issues list](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/issues). 13 | The actual GCC, binutils, and MinGW source codes with the necessary `aarch64-w64-mingw32` target 14 | changes are located at [Windows-on-ARM-Experiments/gcc-woarm64](https://github.com/Windows-on-ARM-Experiments/gcc-woarm64), 15 | [Windows-on-ARM-Experiments/binutils-woarm64](https://github.com/Windows-on-ARM-Experiments/binutils-woarm64), 16 | and [Windows-on-ARM-Experiments/mingw-woarm64](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64), 17 | resp. Please report any issues related to outputs of the toolchain binaries to 18 | [Windows-on-ARM-Experiments/mingw-woarm64-build](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build) 19 | repository's 20 | [issues list](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/issues). 21 | 22 | ## Packages Repositories Usage 23 | 24 | Add the following to the `/etc/pacman.conf` before any other package repositories specification: 25 | 26 | ```ini 27 | [woarm64] 28 | Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/msys/x86_64 29 | SigLevel = Optional 30 | 31 | [woarm64-native] 32 | Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/mingw/aarch64 33 | SigLevel = Optional 34 | ``` 35 | 36 | Run: 37 | 38 | ```bash 39 | pacman -Sy 40 | ``` 41 | 42 | to update packages definitions. 43 | 44 | Run: 45 | 46 | ```bash 47 | pacman -S mingw-w64-cross-mingwarm64-gcc 48 | ``` 49 | 50 | to install `x86_64-pc-msys` host MinGW cross toolchain with `aarch64-w64-mingw32` target support. 51 | 52 | Run: 53 | 54 | ```bash 55 | pacman -S mingw-w64-aarch64-gcc 56 | ``` 57 | 58 | to instal native `aarch64-w64-mingw32` host, `aarch64-w64-mingw32` target MinGW toolchain. 59 | 60 | ## Building Packages Locally 61 | 62 | In case one would like to build all the cross-compilation toolchain packages locally, there is 63 | a `build-cross.sh` script. It expects that the 64 | [Windows-on-ARM-Experiments/MSYS2-packages](https://github.com/Windows-on-ARM-Experiments/MSYS2-packages) 65 | package recipes repository is already cloned in the parent folder of this repository's folder and 66 | it must be executed from `MSYS` environment. 67 | 68 | In case one would like to build all the native toolchain packages locally, there is 69 | a `build-native.sh` script. It expects that the 70 | [Windows-on-ARM-Experiments/MINGW-packages](https://github.com/Windows-on-ARM-Experiments/MINGW-packages) 71 | package recipes repositories is already cloned in the parent folder of this repository's folder and 72 | it must be executed from `MINGWARM64` environment. 73 | 74 | Until the `MINGWARM64` environment will be available in the upstream MSYS2 installation, one can 75 | patch the MSYS2 installation to add the `MINGWARM64` environment using 76 | [`.github/scripts/setup-mingwarm64.sh`](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/scripts/setup-mingwarm64.sh) 77 | script. 78 | 79 | ## MingGW Cross-Compilation Toolchain CI 80 | 81 | The [mingw-cross-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/workflows/mingw-cross-toolchain.yml) 82 | workflow builds `x86_64-pc-msys` host, `aarch64-w64-mingw32` target cross-compilation toolchain packages: 83 | 84 | ```mermaid 85 | %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% 86 | flowchart LR 87 | classDef EXIST fill:#888,color:#000,stroke:#000 88 | classDef DONE fill:#3c3,color:#000,stroke:#000 89 | classDef NEW_DONE fill:#3c3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 90 | classDef WIP fill:#cc3,color:#000,stroke:#000 91 | classDef NEW_WIP fill:#cc3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 92 | classDef TODO fill:#c33,color:#000,stroke:#000 93 | classDef NEW_TODO fill:#c33,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 94 | classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 95 | 96 | subgraph Legend 97 | direction LR 98 | EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW 99 | end 100 | 101 | mingw-w64-cross-mingwarm64-headers["` 102 | mingw-w64-mingwarm64-headers 103 | host: aarch64-w64-mingw32 104 | `"]:::DONE 105 | 106 | mingw-w64-cross-mingwarm64-binutils["` 107 | mingw-w64-cross-binutils 108 | host: x86_64-pc-msys 109 | target: aarch64-w64-mingw32 110 | `"]:::DONE 111 | 112 | mingw-w64-cross-mingwarm64-gcc-stage1["` 113 | mingw-w64-cross-mingwarm64-gcc-stage1 114 | host: x86_64-pc-msys 115 | target: aarch64-w64-mingw32 116 | `"]:::NEW_DONE 117 | 118 | mingw-w64-cross-mingwarm64-crt["` 119 | mingw-w64-cross-mingwarm64-crt 120 | host: aarch64-w64-mingw32 121 | `"]:::DONE 122 | 123 | mingw-w64-cross-mingwarm64-windows-default-manifest["` 124 | mingw-w64-cross-windows-default-manifest 125 | host: aarch64-w64-mingw32 126 | `"]:::DONE 127 | 128 | mingw-w64-cross-mingwarm64-winpthreads["` 129 | mingw-w64-cross-mingwarm64-winpthreads 130 | host: aarch64-w64-mingw32 131 | `"]:::DONE 132 | 133 | mingw-w64-cross-mingwarm64-gcc["` 134 | mingw-w64-cross-mingwarm64-gcc 135 | host: x86_64-pc-msys 136 | target: aarch64-w64-mingw32 137 | `"]:::DONE 138 | 139 | mingw-w64-cross-mingwarm64-zlib["` 140 | mingw-w64-cross-mingwarm64-zlib 141 | host: aarch64-w64-mingw32 142 | `"]:::NEW_DONE 143 | 144 | subgraph Toolchain 145 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-binutils 146 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-crt 147 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-winpthreads 148 | 149 | mingw-w64-cross-mingwarm64-binutils --> mingw-w64-cross-mingwarm64-gcc-stage1 150 | 151 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-crt 152 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-windows-default-manifest 153 | 154 | mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-winpthreads 155 | mingw-w64-cross-mingwarm64-winpthreads --> mingw-w64-cross-mingwarm64-gcc 156 | mingw-w64-cross-mingwarm64-windows-default-manifest --> mingw-w64-cross-mingwarm64-gcc 157 | end 158 | 159 | subgraph Software 160 | mingw-w64-cross-mingwarm64-gcc --> mingw-w64-cross-mingwarm64-zlib 161 | end 162 | ``` 163 | 164 | ## MinGW Native Toolchain CI 165 | 166 | The [mingw-native-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/workflows/mingw-native-toolchain.yml) 167 | workflow builds native `aarch64-w64-mingw32` toolchain packages: 168 | 169 | ```mermaid 170 | %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% 171 | flowchart LR 172 | classDef EXIST fill:#888,color:#000,stroke:#000 173 | classDef DONE fill:#3c3,color:#000,stroke:#000 174 | classDef NEW_DONE fill:#3c3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 175 | classDef WIP fill:#cc3,color:#000,stroke:#000 176 | classDef NEW_WIP fill:#cc3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 177 | classDef TODO fill:#c33,color:#000,stroke:#000 178 | classDef NEW_TODO fill:#c33,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 179 | classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 180 | 181 | subgraph Legend 182 | direction LR 183 | EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW 184 | end 185 | 186 | mingw-w64-libiconv["` 187 | mingw-w64-libiconv 188 | `"]:::DONE 189 | 190 | mingw-w64-libtre["` 191 | mingw-w64-libtre 192 | `"]:::DONE 193 | 194 | mingw-w64-libsystre["` 195 | mingw-w64-libsystre 196 | `"]:::DONE 197 | 198 | mingw-w64-ncurses["` 199 | mingw-w64-ncurses 200 | `"]:::DONE 201 | 202 | mingw-w64-gettext["` 203 | mingw-w64-gettext 204 | `"]:::DONE 205 | 206 | mingw-w64-headers-git["` 207 | mingw-w64-headers-git 208 | `"]:::DONE 209 | 210 | mingw-w64-crt-git["` 211 | mingw-w64-crt-git 212 | `"]:::DONE 213 | 214 | mingw-w64-winpthreads-git["` 215 | mingw-w64-winpthreads-git 216 | `"]:::DONE 217 | 218 | mingw-w64-bzip2["` 219 | mingw-w64-bzip2 220 | `"]:::DONE 221 | 222 | mingw-w64-zlib["` 223 | mingw-w64-zlib 224 | `"]:::DONE 225 | 226 | mingw-w64-zstd["` 227 | mingw-w64-zstd 228 | `"]:::DONE 229 | 230 | mingw-w64-gmp["` 231 | mingw-w64-gmp 232 | `"]:::DONE 233 | 234 | mingw-w64-mpfr["` 235 | mingw-w64-mpfr 236 | `"]:::DONE 237 | 238 | mingw-w64-isl["` 239 | mingw-w64-isl 240 | `"]:::DONE 241 | 242 | mingw-w64-binutils["` 243 | mingw-w64-binutils 244 | `"]:::DONE 245 | 246 | mingw-w64-mpc["` 247 | mingw-w64-mpc 248 | `"]:::DONE 249 | 250 | mingw-w64-windows-default-manifest["` 251 | mingw-w64-windows-default-manifest 252 | `"]:::DONE 253 | 254 | mingw-w64-gcc["` 255 | mingw-w64-gcc 256 | `"]:::DONE 257 | 258 | subgraph Dependencies 259 | mingw-w64-libiconv 260 | 261 | mingw-w64-libtre --> mingw-w64-libsystre 262 | mingw-w64-libsystre --> mingw-w64-ncurses 263 | mingw-w64-ncurses --> mingw-w64-gettext 264 | 265 | mingw-w64-gmp --> mingw-w64-mpfr 266 | mingw-w64-gmp --> mingw-w64-isl 267 | mingw-w64-mpfr --> mingw-w64-mpc 268 | 269 | mingw-w64-bzip2 --> mingw-w64-zlib 270 | 271 | mingw-w64-zstd 272 | end 273 | 274 | subgraph Toolchain 275 | mingw-w64-libiconv --> mingw-w64-binutils 276 | mingw-w64-zlib --> mingw-w64-binutils 277 | mingw-w64-zstd --> mingw-w64-binutils 278 | 279 | mingw-w64-headers-git --> mingw-w64-binutils 280 | mingw-w64-headers-git --> mingw-w64-crt-git 281 | mingw-w64-headers-git --> mingw-w64-winpthreads-git 282 | 283 | mingw-w64-crt-git --> mingw-w64-winpthreads-git 284 | 285 | mingw-w64-mpc --> mingw-w64-gcc 286 | mingw-w64-isl --> mingw-w64-gcc 287 | mingw-w64-binutils --> mingw-w64-gcc 288 | mingw-w64-gettext --> mingw-w64-gcc 289 | mingw-w64-winpthreads-git --> mingw-w64-gcc 290 | mingw-w64-windows-default-manifest --> mingw-w64-gcc 291 | end 292 | ``` 293 | 294 | ## MSYS2/Cygwin Toolchain Porting 295 | 296 | Work on native `aarch64-pc-msys`, resp. `aarch64-pc-cygwin`, toolchain is in progress. 297 | First iteration taken is to provide `x86_64-pc-msys` host, `aarch64-pc-msys` target cross-toolchain 298 | that will then eventually build the `aarch64-pc-msys` native toolchain. The current status of the 299 | cross-toolchain can be visualized by the following chart: 300 | 301 | ```mermaid 302 | %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% 303 | flowchart LR 304 | classDef EXIST fill:#888,color:#000,stroke:#000 305 | classDef DONE fill:#3c3,color:#000,stroke:#000 306 | classDef NEW_DONE fill:#3c3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 307 | classDef WIP fill:#cc3,color:#000,stroke:#000 308 | classDef NEW_WIP fill:#cc3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 309 | classDef TODO fill:#c33,color:#000,stroke:#000 310 | classDef NEW_TODO fill:#c33,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 311 | classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 312 | 313 | subgraph Legend 314 | direction LR 315 | EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW 316 | end 317 | 318 | msys2-runtime-devel["` 319 | msys2-runtime-devel 320 | host: x86_64-pc-msys 321 | target: aarch64-pc-msys 322 | `"]:::DONE 323 | 324 | mingw-w64-cross-mingwarm64-gcc["` 325 | mingw-w64-cross-mingwarm64-gcc 326 | host: x86_64-pc-msys 327 | target: aarch64-w64-mingw32 328 | `"]:::DONE 329 | 330 | mingw-w64-cross-mingwarm64-crt["` 331 | mingw-w64-cross-mingwarm64-crt 332 | host: aarch64-w64-mingw32 333 | `"]:::DONE 334 | 335 | mingw-w64-cross-mingwarm64-zlib["` 336 | mingw-w64-cross-mingwarm64-zlib 337 | host: aarch64-w64-mingw32 338 | `"]:::NEW_DONE 339 | 340 | msys2-w32api-headers["` 341 | msys2-w32api-headers 342 | host: aarch64-pc-msys 343 | `"]:::DONE 344 | 345 | msys2-w32api-runtime["` 346 | msys2-w32api-runtime 347 | host: x86_64-pc-msys 348 | `"]:::DONE 349 | 350 | cross-binutils["` 351 | cross-binutils 352 | host: x86_64-pc-msys 353 | target: aarch64-pc-msys 354 | `"]:::NEW_DONE 355 | 356 | cross-gcc-stage1["` 357 | cross-gcc-stage1 358 | host: x86_64-pc-msys 359 | target: aarch64-pc-msys 360 | `"]:::NEW_DONE 361 | 362 | cross-gcc["` 363 | cross-gcc 364 | host: x86_64-pc-msys 365 | target: aarch64-pc-msys 366 | `"]:::NEW_WIP 367 | 368 | windows-default-manifest["` 369 | windows-default-manifest 370 | host: aarch64-pc-msys 371 | `"]:::DONE 372 | 373 | msys2-runtime["` 374 | msys2-runtime 375 | host: aarch64-pc-msys 376 | `"]:::WIP 377 | 378 | bash["` 379 | bash 380 | host: aarch64-pc-msys 381 | `"]:::TODO 382 | 383 | git4win["` 384 | Git for Windows 385 | host: aarch64-pc-msys 386 | `"]:::TODO 387 | 388 | 389 | subgraph Stage 1 390 | cross-binutils --> cross-gcc-stage1 391 | msys2-runtime-devel --> cross-gcc-stage1 392 | msys2-w32api-headers --> cross-gcc-stage1 393 | end 394 | 395 | subgraph Stage 2 Dependencies 396 | mingw-w64-cross-mingwarm64-gcc --> msys2-w32api-runtime 397 | msys2-w32api-headers --> msys2-w32api-runtime 398 | 399 | cross-gcc-stage1 --> windows-default-manifest 400 | end 401 | 402 | subgraph Stage 2 403 | cross-gcc-stage1 --> cross-gcc 404 | msys2-w32api-runtime --> cross-gcc 405 | windows-default-manifest --> cross-gcc 406 | end 407 | 408 | subgraph Application\nDependencies 409 | cross-gcc-stage1 --> msys2-runtime 410 | mingw-w64-cross-mingwarm64-gcc --> msys2-runtime 411 | mingw-w64-cross-mingwarm64-crt --> msys2-runtime 412 | mingw-w64-cross-mingwarm64-zlib --> msys2-runtime 413 | end 414 | 415 | subgraph Application 416 | cross-gcc --> bash 417 | msys2-runtime --> bash 418 | 419 | cross-gcc --> git4win 420 | msys2-runtime --> git4win 421 | bash --> git4win 422 | end 423 | ``` 424 | 425 | ## Detailed MSYS2 Toolchian Packages Dependencies Chart 426 | 427 | Relevant for `x86-64-pc-msys` host, `aarch64-pc-msys` and `aarch64-w64-mingw32` target 428 | cross-compilation option: 429 | 430 | ```mermaid 431 | %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% 432 | flowchart LR 433 | classDef EXIST fill:#888,color:#000,stroke:#000 434 | classDef DONE fill:#3c3,color:#000,stroke:#000 435 | classDef NEW_DONE fill:#3c3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 436 | classDef WIP fill:#cc3,color:#000,stroke:#000 437 | classDef NEW_WIP fill:#cc3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 438 | classDef TODO fill:#c33,color:#000,stroke:#000 439 | classDef NEW_TODO fill:#c33,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 440 | classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 441 | 442 | subgraph Legend 443 | direction LR 444 | EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW 445 | end 446 | 447 | binutils["` 448 | binutils 449 | host: x86_64-pc-msys 450 | target: x86_64-pc-msys 451 | `"]:::EXIST 452 | 453 | gcc["` 454 | gcc 455 | host: x86_64-pc-msys 456 | target: x86_64-pc-msys 457 | `"]:::EXIST 458 | 459 | msys2-runtime-devel["` 460 | msys2-runtime-devel 461 | host: x86_64-pc-msys 462 | target: aarch64-pc-msys 463 | `"]:::DONE 464 | 465 | mingw-w64-cross-mingwarm64-binutils["` 466 | mingw-w64-cross-mingwarm64-binutils 467 | host: x86_64-pc-msys 468 | target: aarch64-w64-mingw32 469 | `"]:::DONE 470 | 471 | mingw-w64-cross-mingwarm64-gcc["` 472 | mingw-w64-cross-mingwarm64-gcc 473 | host: x86_64-pc-msys 474 | target: aarch64-w64-mingw32 475 | `"]:::DONE 476 | 477 | mingw-w64-cross-mingwarm64-gcc-stage1["` 478 | mingw-w64-cross-mingwarm64-gcc-stage1 479 | host: x86_64-pc-msys 480 | target: aarch64-w64-mingw32 481 | `"]:::NEW_DONE 482 | 483 | mingw-w64-cross-mingwarm64-crt["` 484 | mingw-w64-cross-mingwarm64-crt 485 | host: aarch64-w64-mingw32 486 | `"]:::DONE 487 | 488 | mingw-w64-cross-mingwarm64-headers["` 489 | mingw-w64-cross-mingwarm64-headers 490 | host: aarch64-w64-mingw32 491 | `"]:::DONE 492 | 493 | mingw-w64-cross-mingwarm64-winpthreads["` 494 | mingw-w64-cross-mingwarm64-winpthreads 495 | host: aarch64-w64-mingw32 496 | `"]:::DONE 497 | 498 | mingw-w64-cross-mingwarm64-windows-default-manifest["` 499 | mingw-w64-cross-mingwarm64-windows-default-manifest 500 | host: aarch64-w64-mingw32 501 | `"]:::DONE 502 | 503 | mingw-w64-cross-mingwarm64-zlib["` 504 | mingw-w64-cross-mingwarm64-zlib 505 | host: aarch64-w64-mingw32 506 | `"]:::NEW_DONE 507 | 508 | msys2-w32api-headers["` 509 | msys2-w32api-headers 510 | host: aarch64-pc-msys 511 | `"]:::DONE 512 | 513 | msys2-w32api-runtime["` 514 | msys2-w32api-runtime 515 | host: x86_64-pc-msys 516 | `"]:::DONE 517 | 518 | cross-binutils["` 519 | cross-binutils 520 | host: x86_64-pc-msys 521 | target: aarch64-pc-msys 522 | `"]:::NEW_DONE 523 | 524 | cross-gcc-stage1["` 525 | cross-gcc-stage1 526 | host: x86_64-pc-msys 527 | target: aarch64-pc-msys 528 | `"]:::NEW_DONE 529 | 530 | cross-gcc["` 531 | cross-gcc 532 | host: x86_64-pc-msys 533 | target: aarch64-pc-msys 534 | `"]:::NEW_WIP 535 | 536 | windows-default-manifest["` 537 | windows-default-manifest 538 | host: aarch64-pc-msys 539 | `"]:::DONE 540 | 541 | msys2-runtime["` 542 | msys2-runtime 543 | host: aarch64-pc-msys 544 | `"]:::WIP 545 | 546 | bash["` 547 | bash 548 | host: aarch64-pc-msys 549 | `"]:::TODO 550 | 551 | git4win["` 552 | Git for Windows 553 | host: aarch64-pc-msys 554 | `"]:::TODO 555 | 556 | subgraph Bootstrap 557 | direction TB 558 | binutils --> gcc 559 | end 560 | 561 | subgraph MinGW 562 | subgraph Stage 1 563 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-binutils 564 | gcc --> mingw-w64-cross-mingwarm64-binutils 565 | 566 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-gcc-stage1 567 | mingw-w64-cross-mingwarm64-binutils --> mingw-w64-cross-mingwarm64-gcc-stage1 568 | gcc --> mingw-w64-cross-mingwarm64-gcc-stage1 569 | end 570 | 571 | subgraph Stage 2\nDependencies 572 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-crt 573 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-crt 574 | 575 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-winpthreads 576 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-winpthreads 577 | mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-winpthreads 578 | 579 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-windows-default-manifest 580 | end 581 | 582 | subgraph Stage 2 583 | mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-gcc 584 | mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-gcc 585 | mingw-w64-cross-mingwarm64-winpthreads --> mingw-w64-cross-mingwarm64-gcc 586 | mingw-w64-cross-mingwarm64-windows-default-manifest --> mingw-w64-cross-mingwarm64-gcc 587 | mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-gcc 588 | gcc --> mingw-w64-cross-mingwarm64-gcc 589 | end 590 | 591 | subgraph MINGW Software 592 | mingw-w64-cross-mingwarm64-gcc --> mingw-w64-cross-mingwarm64-zlib 593 | end 594 | end 595 | 596 | subgraph MSYS2 597 | subgraph Stage 1 598 | gcc --> msys2-runtime-devel 599 | 600 | gcc --> cross-binutils 601 | 602 | msys2-w32api-headers --> cross-gcc-stage1 603 | msys2-runtime-devel --> cross-gcc-stage1 604 | cross-binutils --> cross-gcc-stage1 605 | gcc --> cross-gcc-stage1 606 | end 607 | 608 | subgraph Stage 2 Dependencies 609 | msys2-w32api-headers --> msys2-w32api-runtime 610 | mingw-w64-cross-mingwarm64-gcc --> msys2-w32api-runtime 611 | 612 | cross-gcc-stage1 --> windows-default-manifest 613 | 614 | mingw-w64-cross-mingwarm64-gcc --> msys2-runtime 615 | mingw-w64-cross-mingwarm64-zlib --> msys2-runtime 616 | cross-gcc-stage1 --> msys2-runtime 617 | end 618 | 619 | subgraph Stage 2 620 | cross-gcc-stage1 --> cross-gcc 621 | msys2-w32api-runtime --> cross-gcc 622 | msys2-runtime --> cross-gcc 623 | windows-default-manifest --> cross-gcc 624 | end 625 | 626 | subgraph MSYS2 Application 627 | cross-gcc --> bash 628 | msys2-runtime --> bash 629 | 630 | cross-gcc --> git4win 631 | msys2-runtime --> git4win 632 | bash --> git4win 633 | end 634 | end 635 | ``` 636 | -------------------------------------------------------------------------------- /build-cross.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export FLAVOR=CROSS 4 | export CLEAN_BUILD=1 5 | 6 | source `dirname ${BASH_SOURCE[0]}`/config.sh 7 | 8 | if [[ "$MSYSTEM" != "MSYS" ]]; then 9 | echo "This script must be run in the MSYS2 MSYS shell" 10 | exit 1 11 | fi 12 | 13 | ROOT_DIR=`dirname ${BASH_SOURCE[0]}` 14 | ROOT_DIR=`realpath $ROOT_DIR` 15 | 16 | function build_package () { 17 | PACKAGE=$1 18 | REPOSITORY=${2:-MSYS2} 19 | echo "::group::Build $PACKAGE" 20 | pushd ../$REPOSITORY-packages/$PACKAGE 21 | if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-crt ]]; then 22 | $ROOT_DIR/.github/scripts/pthread-headers-hack-before.sh 23 | fi 24 | if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-gcc ]]; then 25 | $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY 26 | pacman -R --noconfirm mingw-w64-cross-mingwarm64-gcc-stage1 || true 27 | pacman -U --noconfirm *.pkg.tar.zst 28 | else 29 | INSTALL_PACKAGE=1 \ 30 | $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY 31 | fi 32 | if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-crt ]]; then 33 | $ROOT_DIR/.github/scripts/pthread-headers-hack-after.sh 34 | fi 35 | popd 36 | echo "::endgroup::" 37 | } 38 | 39 | .github/scripts/clean-cross.sh 40 | .github/scripts/install-dependencies.sh 41 | .github/scripts/enable-ccache.sh 42 | 43 | build_package mingw-w64-cross-mingwarm64-headers 44 | build_package mingw-w64-cross-mingwarm64-binutils 45 | build_package mingw-w64-cross-mingwarm64-gcc-stage1 46 | build_package mingw-w64-cross-mingwarm64-windows-default-manifest 47 | build_package mingw-w64-cross-mingwarm64-crt 48 | build_package mingw-w64-cross-mingwarm64-winpthreads 49 | build_package mingw-w64-cross-mingwarm64-gcc 50 | build_package mingw-w64-cross-mingwarm64-zlib 51 | -------------------------------------------------------------------------------- /build-native-with-cross.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export FLAVOR=NATIVE_WITH_CROSS 4 | export CLEAN_BUILD=1 5 | 6 | source `dirname ${BASH_SOURCE[0]}`/config.sh 7 | 8 | if [[ "$MSYSTEM" != "MINGWARM64" ]]; then 9 | echo "This script must be run in the MSYS2 MINGWARM64 shell" 10 | exit 1 11 | fi 12 | 13 | ROOT_DIR=`dirname ${BASH_SOURCE[0]}` 14 | ROOT_DIR=`realpath $ROOT_DIR` 15 | 16 | function build_package () { 17 | PACKAGE=$1 18 | REPOSITORY=${2:-MINGW} 19 | echo "::group::Build $PACKAGE" 20 | pushd ../$REPOSITORY-packages/$PACKAGE 21 | INSTALL_PACKAGE=1 \ 22 | $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY 23 | popd 24 | echo "::endgroup::" 25 | } 26 | 27 | .github/scripts/setup-repository.sh 28 | .github/scripts/setup-mingwarm64.sh 29 | 30 | .github/scripts/clean-native.sh 31 | .github/scripts/install-dependencies.sh 32 | .github/scripts/enable-ccache.sh 33 | 34 | build_package mingw-w64-libiconv 35 | build_package mingw-w64-libtre 36 | build_package mingw-w64-libsystre 37 | build_package mingw-w64-gettext 38 | build_package mingw-w64-ncurses 39 | build_package mingw-w64-bzip2 40 | build_package mingw-w64-zlib 41 | build_package mingw-w64-zstd 42 | build_package mingw-w64-gmp 43 | build_package mingw-w64-mpfr 44 | build_package mingw-w64-isl 45 | build_package mingw-w64-mpc 46 | 47 | build_package mingw-w64-headers-git 48 | build_package mingw-w64-crt-git 49 | build_package mingw-w64-winpthreads-git 50 | build_package mingw-w64-binutils 51 | build_package mingw-w64-windows-default-manifest 52 | build_package mingw-w64-gcc 53 | -------------------------------------------------------------------------------- /build-native-with-native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export FLAVOR=NATIVE_WITH_NATIVE 4 | export CLEAN_BUILD=1 5 | 6 | source `dirname ${BASH_SOURCE[0]}`/config.sh 7 | 8 | if [[ "$MSYSTEM" != "MINGWARM64" ]]; then 9 | echo "This script must be run in the MSYS2 MINGWARM64 shell" 10 | exit 1 11 | fi 12 | 13 | ROOT_DIR=`dirname ${BASH_SOURCE[0]}` 14 | ROOT_DIR=`realpath $ROOT_DIR` 15 | 16 | function build_package () { 17 | PACKAGE=$1 18 | REPOSITORY=${2:-MINGW} 19 | echo "::group::Build $PACKAGE" 20 | pushd ../$REPOSITORY-packages/$PACKAGE 21 | INSTALL_PACKAGE=1 \ 22 | $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY 23 | popd 24 | echo "::endgroup::" 25 | } 26 | 27 | .github/scripts/setup-repository.sh 28 | .github/scripts/setup-mingwarm64.sh 29 | 30 | .github/scripts/clean-native.sh 31 | .github/scripts/install-dependencies.sh 32 | .github/scripts/enable-ccache.sh 33 | 34 | build_package mingw-w64-libiconv 35 | build_package mingw-w64-libtre 36 | build_package mingw-w64-libsystre 37 | build_package mingw-w64-gettext 38 | build_package mingw-w64-ncurses 39 | build_package mingw-w64-bzip2 40 | build_package mingw-w64-zlib 41 | build_package mingw-w64-zstd 42 | build_package mingw-w64-gmp 43 | build_package mingw-w64-mpfr 44 | build_package mingw-w64-isl 45 | build_package mingw-w64-mpc 46 | 47 | build_package mingw-w64-headers-git 48 | build_package mingw-w64-crt-git 49 | build_package mingw-w64-winpthreads-git 50 | build_package mingw-w64-binutils 51 | build_package mingw-w64-windows-default-manifest 52 | build_package mingw-w64-gcc 53 | -------------------------------------------------------------------------------- /config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e # exit on error 4 | set -x # echo on 5 | set -o pipefail # fail of any command in pipeline is an error 6 | 7 | FLAVOR=${FLAVOR:-NATIVE_WITH_NATIVE} 8 | 9 | CLEAN_BUILD=${CLEAN_BUILD:-0} 10 | INSTALL_PACKAGE=${INSTALL_PACKAGE:-0} 11 | NO_EXTRACT=${NO_EXTRACT:-0} 12 | -------------------------------------------------------------------------------- /patches/ccache/0001-makepkg.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/makepkg.conf 2 | +++ b/etc/makepkg.conf 3 | @@ -63,7 +63,7 @@ 4 | #-- check: Run the check() function if present in the PKGBUILD 5 | #-- sign: Generate PGP signature file 6 | # 7 | -BUILDENV=(!distcc color !ccache check !sign) 8 | +BUILDENV=(!distcc color ccache check !sign) 9 | # 10 | #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, 11 | #-- specify a space-delimited list of hosts running in the DistCC cluster. 12 | -------------------------------------------------------------------------------- /patches/ccache/0002-makepkg-mingw.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/makepkg_mingw.conf 2 | +++ b/etc/makepkg_mingw.conf 3 | @@ -137,7 +137,7 @@ 4 | #-- check: Run the check() function if present in the PKGBUILD 5 | #-- sign: Generate PGP signature file 6 | # 7 | -BUILDENV=(!distcc color !ccache check !sign) 8 | +BUILDENV=(!distcc color ccache check !sign) 9 | # 10 | #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, 11 | #-- specify a space-delimited list of hosts running in the DistCC cluster. 12 | -------------------------------------------------------------------------------- /patches/makepkg/0001-mingwarm64.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/makepkg_mingw.conf 2 | +++ b/etc/makepkg_mingw.conf 3 | @@ -33,7 +33,20 @@ 4 | ######################################################################### 5 | # 6 | 7 | -if [[ "$MSYSTEM" == "MINGW64" ]]; then 8 | +if [[ "$MSYSTEM" == "MINGWARM64" ]]; then 9 | + CARCH="aarch64" 10 | + CHOST="aarch64-w64-mingw32" 11 | + MINGW_CHOST="aarch64-w64-mingw32" 12 | + MINGW_PREFIX="/mingwarm64" 13 | + MINGW_PACKAGE_PREFIX="mingw-w64-aarch64" 14 | + CC="gcc" 15 | + CXX="g++" 16 | + CPPFLAGS= 17 | + CFLAGS="-march=armv8-a -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1" 18 | + CXXFLAGS="$CFLAGS -static-libstdc++" 19 | + LDFLAGS="" 20 | + RUSTFLAGS="-Cforce-frame-pointers=yes" 21 | +elif [[ "$MSYSTEM" == "MINGW64" ]]; then 22 | CARCH="x86_64" 23 | CHOST="x86_64-w64-mingw32" 24 | MINGW_CHOST="x86_64-w64-mingw32" 25 | --- a/etc/msystem 26 | +++ b/etc/msystem 27 | @@ -39,6 +39,15 @@ 28 | MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" 29 | export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX 30 | ;; 31 | + MINGWARM64) 32 | + MSYSTEM_PREFIX='/mingwarm64' 33 | + MSYSTEM_CARCH='aarch64' 34 | + MSYSTEM_CHOST='aarch64-w64-mingw32' 35 | + MINGW_CHOST="${MSYSTEM_CHOST}" 36 | + MINGW_PREFIX="${MSYSTEM_PREFIX}" 37 | + MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" 38 | + export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX 39 | + ;; 40 | CLANG64) 41 | MSYSTEM_PREFIX='/clang64' 42 | MSYSTEM_CARCH='x86_64' 43 | --- a/usr/bin/makepkg-mingw 44 | +++ b/usr/bin/makepkg-mingw 45 | @@ -84,7 +84,7 @@ 46 | fi 47 | 48 | # Validate or set MINGW_ARCH 49 | -MINGW_ARCH_ALLOWED=('mingw32' 'mingw64' 'clang64' 'clangarm64' 'ucrt64') 50 | +MINGW_ARCH_ALLOWED=('mingw32' 'mingw64' 'mingwarm64' 'clang64' 'clangarm64' 'ucrt64') 51 | MINGW_ARCH="${MINGW_ARCH,,}" 52 | if [[ -z "$MINGW_ARCH" ]]; then 53 | # In case MINGW_ARCH isn't set we default to MSYSTEM, or error out -------------------------------------------------------------------------------- /patches/makepkg/0002-mingwarm64-cross-build.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/makepkg_mingw.conf 2 | +++ b/etc/makepkg_mingw.conf 3 | @@ -44,8 +44,14 @@ 4 | MINGW_CHOST="aarch64-w64-mingw32" 5 | MINGW_PREFIX="/mingwarm64" 6 | MINGW_PACKAGE_PREFIX="mingw-w64-aarch64" 7 | - CC="gcc" 8 | - CXX="g++" 9 | + CC="aarch64-w64-mingw32-gcc" 10 | + CXX="aarch64-w64-mingw32-g++" 11 | + RC="aarch64-w64-mingw32-windres" 12 | + WINDRES="aarch64-w64-mingw32-windres" 13 | + RANLIB="aarch64-w64-mingw32-ranlib" 14 | + STRIP="aarch64-w64-mingw32-strip" 15 | + OBJDUMP="aarch64-w64-mingw32-objdump" 16 | + OBJCOPY="aarch64-w64-mingw32-objcopy" 17 | CPPFLAGS= 18 | CFLAGS="-march=armv8-a -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1" 19 | CXXFLAGS="$CFLAGS" 20 | --- a/etc/profile 21 | +++ b/etc/profile 22 | @@ -49,7 +49,7 @@ 23 | case "${MSYSTEM}" in 24 | MINGW*|CLANG*|UCRT*) 25 | MINGW_MOUNT_POINT="${MINGW_PREFIX}" 26 | - PATH="${MINGW_MOUNT_POINT}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}" 27 | + PATH="${MINGW_MOUNT_POINT}/bin:${MINGW_MOUNT_POINT}/${MSYSTEM_CHOST}/bin:/opt/bin:/opt/${MSYSTEM_CHOST}/bin:/opt/lib/gcc/${MSYSTEM_CHOST}/15.0.1:/opt/lib/bfd-plugins:/mingw64/bin:/mingw64/${MSYSTEM_CHOST}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}" 28 | PKG_CONFIG_PATH="${MINGW_MOUNT_POINT}/lib/pkgconfig:${MINGW_MOUNT_POINT}/share/pkgconfig" 29 | PKG_CONFIG_SYSTEM_INCLUDE_PATH="${MINGW_MOUNT_POINT}/include" 30 | PKG_CONFIG_SYSTEM_LIBRARY_PATH="${MINGW_MOUNT_POINT}/lib" 31 | --- a/usr/share/makepkg/executable/strip.sh 32 | +++ b/usr/share/makepkg/executable/strip.sh 33 | @@ -30,7 +30,7 @@ 34 | 35 | executable_strip() { 36 | if check_option "strip" "y"; then 37 | - if ! type -p strip >/dev/null; then 38 | + if ! type -p $STRIP >/dev/null; then 39 | error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip" 40 | return 1 41 | fi 42 | --- a/usr/share/makepkg/buildenv.sh 43 | +++ b/usr/share/makepkg/buildenv.sh 44 | @@ -42,5 +42,5 @@ 45 | done 46 | 47 | # ensure all necessary build variables are exported 48 | - export ${buildenv_vars[@]} CC CXX CHOST MAKEFLAGS 49 | + export ${buildenv_vars[@]} CC CXX RC WINDRES RANLIB SRIP OBJDUMP OBJCOPY CHOST MAKEFLAGS 50 | } 51 | --- a/usr/share/makepkg/tidy/strip.sh 52 | +++ b/usr/share/makepkg/tidy/strip.sh 53 | @@ -85,7 +85,7 @@ 54 | strip_file(){ 55 | local binary=$1; shift 56 | local tempfile=$(mktemp "$binary.XXXXXX") 57 | - if strip "$@" "$binary" -o "$tempfile"; then 58 | + if $STRIP "$@" "$binary" -o "$tempfile"; then 59 | cat "$tempfile" > "$binary" 60 | fi 61 | rm -f "$tempfile" 62 | @@ -95,7 +95,7 @@ 63 | local binary=$1; 64 | 65 | local tempfile=$(mktemp "$binary.XXXXXX") 66 | - if strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then 67 | + if $STRIP -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then 68 | cat "$tempfile" > "$binary" 69 | fi 70 | rm -f "$tempfile" 71 | @@ -176,7 +176,7 @@ 72 | case "${binary##*/}" in 73 | *.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;; 74 | # make sure this isn't some oddly named DLL 75 | - *) if LANG=en_US.UTF-8 LC_ALL=C objdump -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0' 76 | + *) if LANG=en_US.UTF-8 LC_ALL=C $OBJDUMP -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0' 77 | then 78 | mv "${binary}" "${binary}.exe" 79 | binary+=.exe -------------------------------------------------------------------------------- /patches/makepkg/0003-enable-debug.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/makepkg_mingw.conf 2 | +++ b/etc/makepkg_mingw.conf 3 | @@ -169,7 +169,7 @@ 4 | #-- lto: Add compile flags for building with link time optimization 5 | #-- autodeps: Automatically add depends/provides 6 | # 7 | -OPTIONS=(strip docs !libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) 8 | +OPTIONS=(!strip docs !libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) 9 | 10 | #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2 11 | INTEGRITY_CHECK=(sha256) -------------------------------------------------------------------------------- /patches/pacman/0001-add-woarm64-cross-repository.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/pacman.conf 2 | +++ b/etc/pacman.conf 3 | @@ -70,6 +70,10 @@ 4 | # Server = https://repo.msys2.org/staging/ 5 | # SigLevel = Never 6 | 7 | +[woarm64] 8 | +Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/x86_64 9 | +SigLevel = Optional 10 | + 11 | [clangarm64] 12 | Include = /etc/pacman.d/mirrorlist.mingw 13 | -------------------------------------------------------------------------------- /patches/pacman/0002-add-woarm64-native-repository.patch: -------------------------------------------------------------------------------- 1 | --- a/etc/pacman.conf 2 | +++ b/etc/pacman.conf 3 | @@ -70,6 +70,10 @@ 4 | # Server = https://repo.msys2.org/staging/ 5 | # SigLevel = Never 6 | 7 | +[woarm64-native] 8 | +Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/aarch64 9 | +SigLevel = Optional 10 | + 11 | [clangarm64] 12 | Include = /etc/pacman.d/mirrorlist.mingw 13 | 14 | --------------------------------------------------------------------------------