diff --git a/.github/scripts/build-package.sh b/.github/scripts/build-package.sh index 2e49e9e..73101d3 100755 --- a/.github/scripts/build-package.sh +++ b/.github/scripts/build-package.sh @@ -21,12 +21,18 @@ ARGUMENTS="--syncdeps \ $([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \ $([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")" -ccache -svv || true +echo "::group::Ccache statistics before build" + ccache -svv || true +echo "::endgroup::" -if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then - makepkg-mingw $ARGUMENTS -else - makepkg $ARGUMENTS -fi +echo "::group::Build package" + if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then + makepkg-mingw $ARGUMENTS + else + makepkg $ARGUMENTS + fi +echo "::endgroup::" -ccache -svv || true +echo "::group::Ccache statistics after build" + ccache -svv || true +echo "::endgroup::" diff --git a/.github/scripts/create-repository.sh b/.github/scripts/create-repository.sh new file mode 100755 index 0000000..98f27ae --- /dev/null +++ b/.github/scripts/create-repository.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on +set -o pipefail # fail of any command in pipeline is an error + +echo "::group::Create MSYS2 packages repository" + mkdir -p repository/msys/x86_64 + mv -f mingw-w64-cross-*.pkg.* repository/msys/x86_64/ + pushd repository/msys/x86_64 + repo-add woarm64-cross.db.tar.gz *.pkg.* + popd + + mkdir -p repository/mingw/aarch64 + mv -f mingw-w64-aarch64-*.pkg.* repository/mingw/aarch64/ + pushd repository/mingw/aarch64 + repo-add woarm64-native.db.tar.gz *.pkg.* + popd +echo "::endgroup::" diff --git a/.github/scripts/download-artifacts.sh b/.github/scripts/download-artifacts.sh index ee8c01c..89837b7 100755 --- a/.github/scripts/download-artifacts.sh +++ b/.github/scripts/download-artifacts.sh @@ -5,9 +5,11 @@ set -x # echo on set -o pipefail # fail of any command in pipeline is an error RUN_ID=$1 -NEEDS=`echo "$2" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'` -for NEED in $NEEDS; do - echo "Downloading $NEED artifact." - /mingw64/bin/gh run download $RUN_ID -n $NEED +for ARG in "${@:2}"; do + NEEDS=`echo "$ARG" | /mingw64/bin/jq 'keys|join(" ")' | sed 's/"//g'` + for NEED in $NEEDS; do + echo "Downloading $NEED artifact." + /mingw64/bin/gh run download $RUN_ID -n $NEED + done done diff --git a/.github/scripts/enable-ccache.sh b/.github/scripts/enable-ccache.sh index 8a8f300..ea1444a 100755 --- a/.github/scripts/enable-ccache.sh +++ b/.github/scripts/enable-ccache.sh @@ -6,11 +6,14 @@ set -o pipefail # fail of any command in pipeline is an error DIR="`dirname ${BASH_SOURCE[0]}`/../.." DIR=`realpath $DIR` +CCACHE_DIR=$DIR/ccache if [[ -n "$GITHUB_WORKSPACE" ]]; then - echo "CCACHE_DIR=$DIR/ccache" >> "$GITHUB_ENV" + echo "CCACHE_DIR=$CCACHE_DIR" >> "$GITHUB_ENV" echo timestamp=$(date -u --iso-8601=seconds) >> "$GITHUB_OUTPUT" fi +mkdir -p $CCACHE_DIR + pushd / echo "::group::/etc/makepkg.conf" patch -p1 -b -i "$DIR/patches/ccache/0001-makepkg.patch" @@ -22,3 +25,15 @@ pushd / cat /etc/makepkg_mingw.conf echo "::endgroup::" popd + +pacman -S --noconfirm ccache + +pushd /usr/lib/ccache/bin + echo "::group::Add aarch64 toolchain to ccache" + export MSYS=winsymlinks + ln -sf /usr/bin/ccache aarch64-w64-mingw32-c++ + ln -sf /usr/bin/ccache aarch64-w64-mingw32-g++ + ln -sf /usr/bin/ccache aarch64-w64-mingw32-gcc + ln -sf /usr/bin/true makeinfo + echo "::endgroup::" +popd diff --git a/.github/scripts/pacman-workaround.sh b/.github/scripts/pacman-workaround.sh new file mode 100644 index 0000000..96e8d90 --- /dev/null +++ b/.github/scripts/pacman-workaround.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on +set -o pipefail # fail of any command in pipeline is an error + +if [ -z "$GITHUB_WORKSPACE" ]; then + DIR=`pwd` +else + DIR=`cygpath "$GITHUB_WORKSPACE"` +fi + +echo "::group::Pacman hang workaround" + while ! timeout -k 15s 10s pacman -U --noconfirm "$DIR/patches/pacman/pacman-6.1.0-4-x86_64.pkg.tar.zst" + do + echo "Command failed, retrying..." + done +echo "::endgroup::" + +echo "::group::Install patch" + pacman -S --noconfirm patch +echo "::endgroup::" + +pushd / + echo "::group::Pin pacman packages" + patch -p1 -b -i "$DIR/patches/pacman/0001-pin-packages.patch" + echo "::endgroup::" + + echo "::group::/etc/pacman.conf" + cat /etc/pacman.conf + echo "::endgroup::" +popd diff --git a/.github/scripts/setup-mingwarm64.sh b/.github/scripts/setup-mingwarm64.sh new file mode 100644 index 0000000..993bde7 --- /dev/null +++ b/.github/scripts/setup-mingwarm64.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on +set -o pipefail # fail of any command in pipeline is an error + +if [ -z "$GITHUB_WORKSPACE" ]; then + DIR=`pwd` +else + DIR=`cygpath "$GITHUB_WORKSPACE"` +fi + +echo "::group::Install patch" + pacman -S --noconfirm patch +echo "::endgroup::" + +pushd / + echo "::group::Patch MSYS2 environment" + patch -p1 -b -i "$DIR/patches/makepkg/0001-mingwarm64.patch" + if [[ "$CROSS_BUILD" = "1" ]]; then + patch -p1 -b -i "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch" + fi + if [[ "$DEBUG_BUILD" = "1" ]]; then + patch -p1 -b -i "$DIR/patches/makepkg/0003-enable-debug.patch" + fi + echo "::endgroup::" + + echo "::group::/etc/makepkg_mingw.conf" + cat /etc/makepkg_mingw.conf + echo "::endgroup::" + + echo "::group::/etc/profile" + cat /etc/profile + echo "::endgroup::" + + echo "::group::/usr/share/makepkg/tidy/strip.sh" + cat /usr/share/makepkg/tidy/strip.sh + echo "::endgroup::" +popd diff --git a/.github/scripts/setup-repository.sh b/.github/scripts/setup-repository.sh index 62a208b..2a74375 100644 --- a/.github/scripts/setup-repository.sh +++ b/.github/scripts/setup-repository.sh @@ -13,7 +13,7 @@ pushd / echo "::endgroup::" echo "::group::Add WoArm64 repository" - patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-repository.patch" + patch -p1 -b -i "$DIR/patches/pacman/0002-add-woarm64-repositories.patch" echo "::endgroup::" echo "::group::Update packages database" diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 815a75f..7c2bcb5 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -6,13 +6,6 @@ on: package_name: description: "Package name to build" type: string - needs: - description: "Parent workflow job dependencies" - type: string - dependencies: - description: "Install additional dependencies" - type: string - default: "" packages_repository: description: "MSYS2 packages repository to build from" type: string @@ -21,6 +14,17 @@ on: description: "MSYS2 packages branch to build from" type: string default: "woarm64" + runner_arch: + description: "Architecture to build on" + type: string + default: "x86_64" + needs: + description: "Parent workflow job dependencies" + type: string + dependencies: + description: "Install additional dependencies" + type: string + default: "" defaults: run: @@ -28,30 +32,96 @@ defaults: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROSS_BUILD: ${{ inputs.runner_arch == 'aarch64' && '1' || '0' }} + CLEAN_BUILD: 1 jobs: build: name: Build ${{ inputs.package_name }} - runs-on: windows-latest + runs-on: >- + ${{ fromJson(inputs.runner_arch == 'aarch64' + && '["Windows", "ARM64", "Blackhex"]' + || '["windows-latest"]') }} steps: - - uses: msys2/setup-msys2@v2 + - name: Kill hanging processes + if: ${{ inputs.runner_arch == 'aarch64' }} + shell: powershell + run: | + tasklist + taskkill /F /FI 'MODULES eq msys-2.0.dll' + tasklist + Set-Location "${{ github.workspace }}" + Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages + exit 0 + + - name: Fix Git long paths + if: ${{ inputs.runner_arch == 'aarch64' }} + shell: powershell + run: | + git config --global core.longpaths true + + - name: Fix $PATH + if: ${{ inputs.runner_arch == 'aarch64' }} + shell: powershell + run: | + Write-Output "GITHUB_PATH: $env:GITHUB_PATH" + Write-Output "C:\Program Files\Git\usr\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - uses: Windows-on-ARM-Experiments/setup-msys2@main + timeout-minutes: 10 with: - msystem: ${{ contains(inputs.packages_repository, 'MINGW') && 'MINGW64' || 'MSYS' }} - update: true - cache: true + msystem: >- + ${{ contains(inputs.packages_repository, 'MINGW') + && ((inputs.runner_arch == 'aarch64') && 'MINGWARM64' || 'MINGW64') + || 'MSYS' }} + update: ${{ inputs.runner_arch == 'x86_64' }} + cache: ${{ inputs.runner_arch == 'x86_64' }} - name: Checkout repository uses: actions/checkout@v4 - - name: Install dependencies + - name: Checkout ${{ inputs.packages_repository }} repository + uses: actions/checkout@v4 + with: + repository: ${{ inputs.packages_repository }} + ref: ${{ inputs.packages_branch }} + sparse-checkout: ${{ inputs.package_name }} + path: ${{ github.workspace }}/packages + + - name: Pacman hang workaround + if: ${{ inputs.runner_arch == 'aarch64' }} + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/pacman-workaround.sh + + - name: First MSYS2 update + if: ${{ inputs.runner_arch == 'aarch64' }} + shell: powershell + run: | + msys2 -c 'pacman -Syuu --noconfirm' + exit 0 + + - name: Second MSYS2 update + if: ${{ inputs.runner_arch == 'aarch64' }} + shell: powershell + run: | + msys2 -c 'pacman -Syuu --noconfirm' + + - name: Setup packages repository + if: ${{ inputs.runner_arch == 'aarch64' }} run: | - pacman -S --noconfirm \ - git \ - mingw-w64-x86_64-github-cli \ - mingw-w64-x86_64-jq \ - base-devel \ - ${{ contains(inputs.packages_repository, 'MINGW') && 'mingw-w64-cross-gcc mingw-w64-x86_64-ccache' || ' ccache' }} \ + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh + + - name: Install dependencies + run: >- + pacman -S --noconfirm + git + mingw-w64-x86_64-github-cli + mingw-w64-x86_64-jq + base-devel + ${{ contains(inputs.packages_repository, 'MINGW') + && 'mingw-w64-cross-mingwarm64-gcc mingw-w64-cross-mingwarm64-windows-default-manifest mingw-w64-x86_64-gcc-libs' + || 'mingw-w64-aarch64-gcc' }} ${{ inputs.dependencies }} - name: Download artifacts @@ -69,13 +139,10 @@ jobs: run: | `cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh - - name: Checkout ${{ inputs.packages_repository }} repository - uses: actions/checkout@v4 - with: - repository: ${{ inputs.packages_repository }} - ref: ${{ inputs.packages_branch }} - sparse-checkout: ${{ inputs.package_name }} - path: ${{ github.workspace }}/packages + - name: Setup MINGWARM64 environment + if: ${{ inputs.runner_arch == 'aarch64' }} + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh - name: Enable Ccache id: enable-ccache @@ -83,31 +150,29 @@ jobs: `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh - name: Restore Ccache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v4 with: path: ${{ github.workspace }}/ccache - key: main-ccache-${{ steps.enable-ccache.outputs.timestamp }} - restore-keys: main-ccache- + key: ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }} + restore-keys: ${{ inputs.package_name }}- - name: Build ${{ inputs.package_name }} working-directory: ${{ github.workspace }}/packages/${{ inputs.package_name }} run: | - ccache -svv || true `cygpath "${{ github.workspace }}"`/.github/scripts/build-package.sh ${{ inputs.packages_repository }} - ccache -svv || true - name: Save Ccache if: always() - uses: actions/cache/save@v4 + uses: actions/cache/save@v4 with: path: ${{ github.workspace }}/ccache - key: main-ccache-${{ steps.enable-ccache.outputs.timestamp }} + key: ${{ inputs.package_name }}-ccache-${{ steps.enable-ccache.outputs.timestamp }} - name: Upload ${{ inputs.package_name }} uses: actions/upload-artifact@v4 with: name: ${{ inputs.package_name }} - retention-days: 1 + retention-days: 7 path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst - name: Upload build folder @@ -115,5 +180,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ inputs.package_name }}-build - retention-days: 1 + retention-days: 3 path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/src diff --git a/.github/workflows/check-repository.yml b/.github/workflows/check-repository.yml index 4b02ed7..a459b15 100644 --- a/.github/workflows/check-repository.yml +++ b/.github/workflows/check-repository.yml @@ -5,18 +5,22 @@ on: workflow_call: jobs: - build: + build-cross: runs-on: windows-latest defaults: run: shell: msys2 {0} + env: + CROSS_BUILD: 1 + steps: - - uses: msys2/setup-msys2@v2 + - uses: Windows-on-ARM-Experiments/setup-msys2@main with: msystem: MSYS update: true + cache: true - name: Checkout repository uses: actions/checkout@v4 @@ -25,10 +29,10 @@ jobs: run: | `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh - - name: Install toolchain + - name: Install cross toolchain run: | - pacman -S mingw-w64-cross-mingwarm64-gcc --noconfirm - pacman -S mingw-w64-aarch64-cc --noconfirm + pacman -S --noconfirm mingw-w64-cross-mingwarm64-gcc + pacman -S --noconfirm --needed mingw-w64-aarch64-cc - name: Build hello-world.exe run: | @@ -37,18 +41,113 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: hello-world + name: hello-world-cross path: hello-world.exe - test: - needs: [build] + test-cross: + needs: [build-cross] + runs-on: [Windows, GCC, ARM64] + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: hello-world-cross + path: ${{ github.workspace }}\artifacts + + - name: Run hello-world.exe + run: | + ls ${{ github.workspace }}\artifacts + ${{ github.workspace }}\artifacts\hello-world.exe + + build-native: + runs-on: ["Windows", "ARM64", "Blackhex"] + + defaults: + run: + shell: msys2 {0} + + env: + CROSS_BUILD: 0 + + steps: + - name: Kill hanging processes + shell: powershell + run: | + tasklist + taskkill /F /FI 'MODULES eq msys-2.0.dll' + tasklist + Set-Location "${{ github.workspace }}" + Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages + exit 0 + + - name: Fix Git long paths + shell: powershell + run: | + git config --global core.longpaths true + + - name: Fix $PATH + shell: powershell + run: | + Write-Output "GITHUB_PATH: $env:GITHUB_PATH" + Write-Output "C:\Program Files\Git\usr\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - uses: Windows-on-ARM-Experiments/setup-msys2@main + with: + msystem: MINGWARM64 + update: false + cache: false + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Pacman hang workaround + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/pacman-workaround.sh + + - name: First MSYS2 update + shell: powershell + run: | + msys2 -c 'pacman -Syuu --noconfirm' + exit 0 + + - name: Second MSYS2 update + shell: powershell + run: | + msys2 -c 'pacman -Syuu --noconfirm' + + - name: Setup packages repository + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh + + - name: Install native toolchain + run: | + pacman -S --noconfirm mingw-w64-aarch64-gcc + pacman -S --noconfirm --needed mingw-w64-aarch64-cc + + - name: Setup MINGWARM64 environment + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh + + - name: Build hello-world.exe + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/build-hello-world.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: hello-world-native + path: hello-world.exe + + test-native: + needs: [build-native] runs-on: [Windows, GCC, ARM64] steps: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: hello-world + name: hello-world-native path: ${{ github.workspace }}\artifacts - name: Run hello-world.exe diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f288c1b..5ef69e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,11 @@ on: type: string required: false default: "woarm64" + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "woarm64" jobs: mingw-cross-toolchain: @@ -20,9 +25,18 @@ jobs: with: msys2_packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} + mingw-native-toolchain: + name: MinGW native toolchain + uses: ./.github/workflows/mingw-native-toolchain.yml + with: + mingw_packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + repository: name: Create MSYS2 repository - needs: mingw-cross-toolchain + needs: [ + mingw-cross-toolchain, + mingw-native-toolchain + ] runs-on: windows-latest defaults: @@ -33,7 +47,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: msys2/setup-msys2@v2 + - uses: Windows-on-ARM-Experiments/setup-msys2@main with: msystem: MSYS update: true @@ -50,32 +64,28 @@ jobs: - name: Download artifacts run: | - `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh ${{ github.run_id }} \ - '${{ needs.mingw-cross-toolchain.outputs.artifacts }}' + `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh \ + ${{ github.run_id }} \ + '${{ needs.mingw-cross-toolchain.outputs.artifacts }}' \ + '${{ needs.mingw-native-toolchain.outputs.artifacts }}' - - name: Setup MSYS2 packages repository + - name: Create MSYS2 packages repository run: | - mkdir aarch64 - mkdir x86_64 - - mv -f *-x86_64.pkg.tar.zst x86_64/ - - cd x86_64 - repo-add woarm64.db.tar.gz *.pkg.tar.zst + `cygpath "${{ github.workspace }}"`/.github/scripts/create-repository.sh - name: Create index.html run: | - echo "" > index.html + echo "" > repository/index.html - name: Upload woarm64-msys2-repository uses: actions/upload-pages-artifact@v3 with: name: woarm64-msys2-repository - retention-days: 1 - path: "." + retention-days: 7 + path: repository deploy: - if: github.ref == 'refs/heads/main' + #if: github.ref == 'refs/heads/main' name: Deploy MSYS2 repository needs: repository runs-on: ubuntu-latest diff --git a/.github/workflows/mingw-native-toolchain.yml b/.github/workflows/mingw-native-toolchain.yml new file mode 100644 index 0000000..91a133b --- /dev/null +++ b/.github/workflows/mingw-native-toolchain.yml @@ -0,0 +1,242 @@ +name: Build MinGW native toolchain + +on: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "woarm64" + workflow_call: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + default: "woarm64" + outputs: + artifacts: + value: ${{ toJson(jobs) }} + +jobs: + mingw-w64-libiconv: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-libiconv + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-libtre-git: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-libtre-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-libsystre: + needs: [ + mingw-w64-libtre-git + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-libsystre + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-ncurses: + needs: [ + mingw-w64-libtre-git, + mingw-w64-libsystre + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-ncurses + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-gettext: + needs: [ + mingw-w64-libiconv, + mingw-w64-libtre-git, + mingw-w64-libsystre, + mingw-w64-ncurses + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-gettext + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-headers-git: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-headers-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-crt-git: + needs: [ + mingw-w64-headers-git + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-crt-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-winpthreads-git: + needs: [ + mingw-w64-headers-git, + mingw-w64-crt-git + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-winpthreads-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-bzip2: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-bzip2 + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-zlib: + needs: [ + mingw-w64-bzip2 + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-zlib + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-zstd: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-zstd + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-gmp: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-gmp + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-mpfr: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-gmp + ] + with: + package_name: mingw-w64-mpfr + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-isl: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-gmp + ] + with: + package_name: mingw-w64-isl + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-binutils: + needs: [ + mingw-w64-libiconv, + mingw-w64-libtre-git, + mingw-w64-libsystre, + mingw-w64-ncurses, + mingw-w64-gettext, + mingw-w64-headers-git, + mingw-w64-winpthreads-git, + mingw-w64-bzip2, + mingw-w64-zlib, + mingw-w64-zstd, + mingw-w64-gmp, + mingw-w64-mpfr, + mingw-w64-isl + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-binutils + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-mpc: + needs: [ + mingw-w64-gmp, + mingw-w64-mpfr + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-mpc + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} + + mingw-w64-windows-default-manifest: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-windows-default-manifest + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + + mingw-w64-gcc: + needs: [ + mingw-w64-libiconv, + mingw-w64-libtre-git, + mingw-w64-libsystre, + mingw-w64-ncurses, + mingw-w64-gettext, + mingw-w64-headers-git, + mingw-w64-winpthreads-git, + mingw-w64-bzip2, + mingw-w64-zlib, + mingw-w64-zstd, + mingw-w64-gmp, + mingw-w64-mpfr, + mingw-w64-isl, + mingw-w64-binutils, + mingw-w64-mpc, + mingw-w64-crt-git, + mingw-w64-windows-default-manifest + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-gcc + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + needs: ${{ toJson(needs) }} diff --git a/README.md b/README.md index 6de1b55..5ed70ea 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,37 @@ # MSYS2 WoArm64 Packages Build and Repository This repository contains GitHub Actions workflows for building MinGW and MSYS2 toolchains -with `aarch64-w64-mingw32` and `aarch64-pc-msys` targets inside MSYS2 environment and as deploys -their Pacman packages repository overlay to GitHub Pages environment of this repository. It also -serves as a documentation of the necessary steps to build them. +with `aarch64-w64-mingw32` and `aarch64-pc-msys` targets inside MSYS2 environment and deploys +their Pacman packages overlay repositories to GitHub Pages environment of this repository. +It also serves as a documentation of the necessary steps to build them. -The MSYS2 packages recipes dwells in +The actual MSYS2 packages recipes dwells in `woarm64` branches of [Windows-on-ARM-Experiments/MSYS2-packages](https://github.com/Windows-on-ARM-Experiments/MSYS2-packages) -repository. Please report any issue related to packages build to this repository's issues though. -The actual GCC, binutils, and MinGW source code with the necessary `aarch64-w64-mingw32` target -changes are located at [ZacWalk/gcc-woarm64](https://github.com/ZacWalk/gcc-woarm64), -[ZacWalk/binutils-woarm64](https://github.com/ZacWalk/binutils-woarm64), -and [ZacWalk/mingw-woarm64](https://github.com/ZacWalk/mingw-woarm64), resp. Please report -any issues related to outputs of the toolchain binaries to -[ZacWalk/mingw-woarm64-build](https://github.com/ZacWalk/mingw-woarm64-build) repository's issues -though. - -## Packages Repository Usage - -Add the following to the `/etc/pacman.conf` before any other package repository specification: +and [Windows-on-ARM-Experiments/MINGW-packages](https://github.com/Windows-on-ARM-Experiments/MINGW-packages) +repositories. Please report any issue related to packages build to this repository's +[issues list](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/issues). +The actual GCC, binutils, and MinGW source codes with the necessary `aarch64-w64-mingw32` target +changes are located at [Windows-on-ARM-Experiments/gcc-woarm64](https://github.com/Windows-on-ARM-Experiments/gcc-woarm64), +[Windows-on-ARM-Experiments/binutils-woarm64](https://github.com/Windows-on-ARM-Experiments/binutils-woarm64), +and [Windows-on-ARM-Experiments/mingw-woarm64](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64), +resp. Please report any issues related to outputs of the toolchain binaries to +[Windows-on-ARM-Experiments/mingw-woarm64-build](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build) +repository's +[issues list](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/issues). + +## Packages Repositories Usage + +Add the following to the `/etc/pacman.conf` before any other package repositories specification: ```ini -[woarm64] -Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/$arch +[woarm64-cross] +Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/msys/x86_64 +SigLevel = Optional + +[woarm64-native] +Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/mingw/aarch64 SigLevel = Optional + ``` Run: @@ -37,21 +45,42 @@ to update packages definitions. Run: ```bash -pacman -S mingw-w64-cross-gcc +pacman -S mingw-w64-cross-mingwarm64-gcc +``` + +to install `x86_64-pc-msys` host MinGW cross toolchain with `aarch64-w64-mingw32` target support. + +Run: + +```bash +pacman -S mingw-w64-aarch64-gcc ``` -to install x64 host MinGW compiler with `aarch64-w64-mingw32` target support. +to instal native `aarch64-w64-mingw32` host, `aarch64-w64-mingw32` target MinGW toolchain. ## Building Packages Locally -In case one would like to build all the packages locally, there is a `build.sh` script. It expects -that all the dependency repositories are cloned in the parent folder of this repository's folder. +In case one would like to build all the cross-compilation toolchain packages locally, there is +a `build-cross.sh` script. It expects that the +[Windows-on-ARM-Experiments/MSYS2-packages](https://github.com/Windows-on-ARM-Experiments/MSYS2-packages) +package recipes repository is already cloned in the parent folder of this repository's folder and +it must be executed from `MSYS` environment. + +In case one would like to build all the native toolchain packages locally, there is +a `build-native.sh` script. It expects that the +[Windows-on-ARM-Experiments/MINGW-packages](https://github.com/Windows-on-ARM-Experiments/MINGW-packages) +package recipes repositories is already cloned in the parent folder of this repository's folder and +it must be executed from `MINGWARM64` environment. + +Until the `MINGWARM64` environment will be available in the upstream MSYS2 installation, one can +patch the MSYS2 installation to add the `MINGWARM64` environment using +[`.github/scripts/setup-mingwarm64.sh`](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/scripts/setup-mingwarm64.sh) +script. -## Dependencies Chart +## MingGW Cross-Compilation Toolchain CI -The color of the blocks indicates whether the package recipes exist and/or succeed to build -and install. It does not reflect whether they actually work or do not contain severe bugs -to resolve. +The [mingw-cross-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/workflows/mingw-cross-toolchain.yml) +workflow builds `x86_64-pc-msys` host, `aarch64-w64-mingw32` target cross-compilation toolchain packages: ```mermaid %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% @@ -67,203 +96,206 @@ flowchart LR subgraph Legend direction LR - EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW + EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW end - binutils["` - binutils - host: x86_64-pc-msys - target: x86_64-pc-msys - `"]:::EXIST - - gcc["` - gcc - host: x86_64-pc-msys - target: x86_64-pc-msys - `"]:::EXIST - - msys2-runtime-devel["` - msys2-runtime-devel - host: x86_64-pc-msys - target: aarch64-pc-msys + mingw-w64-cross-mingwarm64-headers["` + mingw-w64-mingwarm64-headers + host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-binutils["` + mingw-w64-cross-mingwarm64-binutils["` mingw-w64-cross-binutils host: x86_64-pc-msys target: aarch64-w64-mingw32 `"]:::DONE - - mingw-w64-cross-gcc["` - mingw-w64-cross-gcc - host: x86_64-pc-msys - target: aarch64-w64-mingw32 - `"]:::DONE - mingw-w64-cross-gcc-stage1["` - mingw-w64-cross-gcc-stage1 + mingw-w64-cross-mingwarm64-gcc-stage1["` + mingw-w64-cross-mingwarm64-gcc-stage1 host: x86_64-pc-msys target: aarch64-w64-mingw32 - `"]:::DONE + `"]:::NEW_DONE - mingw-w64-cross-crt["` - mingw-w64-cross-crt + mingw-w64-cross-mingwarm64-crt["` + mingw-w64-cross-mingwarm64-crt host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-headers["` - mingw-w64-cross-headers + mingw-w64-cross-mingwarm64-windows-default-manifest["` + mingw-w64-cross-windows-default-manifest host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-winpthreads["` - mingw-w64-cross-winpthreads + mingw-w64-cross-mingwarm64-winpthreads["` + mingw-w64-cross-mingwarm64-winpthreads host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-windows-default-manifest["` - mingw-w64-cross-windows-default-manifest - host: aarch64-w64-mingw32 + mingw-w64-cross-mingwarm64-gcc["` + mingw-w64-cross-mingwarm64-gcc + host: x86_64-pc-msys + target: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-zlib["` - mingw-w64-cross-zlib + mingw-w64-cross-mingwarm64-zlib["` + mingw-w64-cross-mingwarm64-zlib host: aarch64-w64-mingw32 + `"]:::NEW_DONE + + subgraph Toolchain + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-binutils + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-crt + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-winpthreads + + mingw-w64-cross-mingwarm64-binutils --> mingw-w64-cross-mingwarm64-gcc-stage1 + + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-crt + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-windows-default-manifest + + mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-winpthreads + mingw-w64-cross-mingwarm64-winpthreads --> mingw-w64-cross-mingwarm64-gcc + mingw-w64-cross-mingwarm64-windows-default-manifest --> mingw-w64-cross-mingwarm64-gcc + end + + subgraph Software + mingw-w64-cross-mingwarm64-gcc --> mingw-w64-cross-mingwarm64-zlib + end +``` + +## MinGW Native Toolchain CI + +The [mingw-native-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/workflows/mingw-native-toolchain.yml) +workflow builds native `aarch64-w64-mingw32` toolchain packages: + +```mermaid +%%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% +flowchart LR + classDef EXIST fill:#888,color:#000,stroke:#000 + classDef DONE fill:#3c3,color:#000,stroke:#000 + classDef NEW_DONE fill:#3c3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 + classDef WIP fill:#cc3,color:#000,stroke:#000 + classDef NEW_WIP fill:#cc3,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 + classDef TODO fill:#c33,color:#000,stroke:#000 + classDef NEW_TODO fill:#c33,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 + classDef NEW fill:#fff,color:#000,stroke:#f00,stroke-width:2,stroke-dasharray:5 + + subgraph Legend + direction LR + EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW + end + + mingw-w64-libiconv["` + mingw-w64-libiconv `"]:::DONE - msys2-w32api-headers["` - msys2-w32api-headers - host: aarch64-pc-msys + mingw-w64-libtre-git["` + mingw-w64-libtre-git `"]:::DONE - msys2-w32api-runtime["` - msys2-w32api-runtime - host: x86_64-pc-msys + mingw-w64-libsystre["` + mingw-w64-libsystre `"]:::DONE - cross-binutils["` - cross-binutils - host: x86_64-pc-msys - target: aarch64-pc-msys + mingw-w64-ncurses["` + mingw-w64-ncurses `"]:::DONE - cross-gcc-stage1["` - cross-gcc-stage1 - host: x86_64-pc-msys - target: aarch64-pc-msys + mingw-w64-gettext["` + mingw-w64-gettext `"]:::DONE - cross-gcc["` - cross-gcc - host: x86_64-pc-msys - target: aarch64-pc-msys - `"]:::WIP + mingw-w64-headers-git["` + mingw-w64-headers-git + `"]:::DONE - windows-default-manifest["` - windows-default-manifest - host: aarch64-pc-msys + mingw-w64-crt-git["` + mingw-w64-crt-git `"]:::DONE - msys2-runtime["` - msys2-runtime - host: aarch64-pc-msys - `"]:::WIP + mingw-w64-winpthreads-git["` + mingw-w64-winpthreads-git + `"]:::DONE - bash["` - bash - host: aarch64-w64-mingw32 - `"]:::TODO + mingw-w64-bzip2["` + mingw-w64-bzip2 + `"]:::DONE - git4win["` - Git for Windows - host: aarch64-w64-mingw32 - `"]:::TODO + mingw-w64-zlib["` + mingw-w64-zlib + `"]:::DONE - subgraph Bootstrap - direction TB - binutils --> gcc - end - - subgraph MinGW - subgraph Stage 1 - gcc --> mingw-w64-cross-binutils + mingw-w64-zstd["` + mingw-w64-zstd + `"]:::DONE - gcc --> mingw-w64-cross-gcc-stage1 - mingw-w64-cross-binutils --> mingw-w64-cross-gcc-stage1 - mingw-w64-cross-headers --> mingw-w64-cross-gcc-stage1 - end + mingw-w64-gmp["` + mingw-w64-gmp + `"]:::DONE - subgraph Stage 2\nDependencies - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-crt - mingw-w64-cross-binutils --> mingw-w64-cross-crt - mingw-w64-cross-headers --> mingw-w64-cross-crt - - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-winpthreads - mingw-w64-cross-binutils --> mingw-w64-cross-winpthreads - mingw-w64-cross-crt --> mingw-w64-cross-winpthreads - mingw-w64-cross-headers --> mingw-w64-cross-winpthreads + mingw-w64-mpfr["` + mingw-w64-mpfr + `"]:::DONE - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-windows-default-manifest - mingw-w64-cross-binutils --> mingw-w64-cross-windows-default-manifest - end + mingw-w64-isl["` + mingw-w64-isl + `"]:::DONE - subgraph Stage 2 - gcc --> mingw-w64-cross-gcc - mingw-w64-cross-binutils --> mingw-w64-cross-gcc - mingw-w64-cross-crt --> mingw-w64-cross-gcc - mingw-w64-cross-headers --> mingw-w64-cross-gcc - mingw-w64-cross-winpthreads --> mingw-w64-cross-gcc - mingw-w64-cross-windows-default-manifest --> mingw-w64-cross-gcc + mingw-w64-binutils["` + mingw-w64-binutils + `"]:::DONE - end + mingw-w64-mpc["` + mingw-w64-mpc + `"]:::DONE - mingw-w64-cross-gcc --> mingw-w64-cross-zlib - end + mingw-w64-windows-default-manifest["` + mingw-w64-windows-default-manifest + `"]:::DONE - subgraph MSYS2 - subgraph Stage 1 - gcc --> msys2-runtime-devel + mingw-w64-gcc["` + mingw-w64-gcc + `"]:::DONE - gcc --> cross-binutils + subgraph Dependencies + mingw-w64-libiconv - cross-binutils --> cross-gcc-stage1 - gcc --> cross-gcc-stage1 - msys2-runtime-devel --> cross-gcc-stage1 - msys2-w32api-headers --> cross-gcc-stage1 - end + mingw-w64-libtre-git --> mingw-w64-libsystre + mingw-w64-libsystre --> mingw-w64-ncurses + mingw-w64-ncurses --> mingw-w64-gettext - subgraph Stage 2 Dependencies - mingw-w64-cross-gcc --> msys2-w32api-runtime - msys2-w32api-headers --> msys2-w32api-runtime + mingw-w64-gmp --> mingw-w64-mpfr + mingw-w64-gmp --> mingw-w64-isl + mingw-w64-mpfr --> mingw-w64-mpc - cross-gcc-stage1 --> windows-default-manifest - end + mingw-w64-bzip2 --> mingw-w64-zlib - subgraph Stage 2 - cross-gcc-stage1 --> cross-gcc - msys2-w32api-runtime --> cross-gcc - windows-default-manifest --> cross-gcc - end + mingw-w64-zstd + end - subgraph Application\nDependencies - cross-gcc --> msys2-runtime - mingw-w64-cross-gcc --> msys2-runtime - mingw-w64-cross-crt --> msys2-runtime - mingw-w64-cross-zlib --> msys2-runtime - end + subgraph Toolchain + mingw-w64-libiconv --> mingw-w64-binutils + mingw-w64-zlib --> mingw-w64-binutils + mingw-w64-zstd --> mingw-w64-binutils - subgraph Application - cross-gcc --> bash - msys2-runtime --> bash + mingw-w64-headers-git --> mingw-w64-binutils + mingw-w64-headers-git --> mingw-w64-crt-git + mingw-w64-headers-git --> mingw-w64-winpthreads-git - cross-gcc --> git4win - msys2-runtime --> git4win - bash --> git4win - end + mingw-w64-crt-git --> mingw-w64-winpthreads-git + + mingw-w64-mpc --> mingw-w64-gcc + mingw-w64-isl --> mingw-w64-gcc + mingw-w64-binutils --> mingw-w64-gcc + mingw-w64-gettext --> mingw-w64-gcc + mingw-w64-winpthreads-git --> mingw-w64-gcc + mingw-w64-windows-default-manifest --> mingw-w64-gcc end ``` -## MingGW Toolchain CI +## MSYS2/Cygwin Toolchain Porting + +Work on native `aarch64-pc-msys`, resp. `aarch64-pc-cygwin`, toolchain is in progress. +The current status can be visualized by the following chart: ```mermaid %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% @@ -279,89 +311,120 @@ flowchart LR subgraph Legend direction LR - EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW + EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW end - mingw-w64-cross-binutils["` - mingw-w64-cross-binutils + msys2-runtime-devel["` + msys2-runtime-devel host: x86_64-pc-msys - target: aarch64-w64-mingw32 + target: aarch64-pc-msys `"]:::DONE - mingw-w64-cross-gcc["` - mingw-w64-cross-gcc + mingw-w64-cross-mingwarm64-gcc["` + mingw-w64-cross-mingwarm64-gcc host: x86_64-pc-msys target: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-gcc-stage1["` - mingw-w64-cross-gcc-stage1 - host: x86_64-pc-msys - target: aarch64-w64-mingw32 - `"]:::DONE - - mingw-w64-cross-crt["` - mingw-w64-cross-crt + mingw-w64-cross-mingwarm64-crt["` + mingw-w64-cross-mingwarm64-crt host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-headers["` - mingw-w64-cross-headers + mingw-w64-cross-mingwarm64-zlib["` + mingw-w64-cross-mingwarm64-zlib host: aarch64-w64-mingw32 + `"]:::NEW_DONE + + msys2-w32api-headers["` + msys2-w32api-headers + host: aarch64-pc-msys `"]:::DONE - mingw-w64-cross-winpthreads["` - mingw-w64-cross-winpthreads - host: aarch64-w64-mingw32 + msys2-w32api-runtime["` + msys2-w32api-runtime + host: x86_64-pc-msys `"]:::DONE - mingw-w64-cross-windows-default-manifest["` - mingw-w64-cross-windows-default-manifest - host: aarch64-w64-mingw32 + cross-binutils["` + cross-binutils + host: x86_64-pc-msys + target: aarch64-pc-msys + `"]:::NEW_DONE + + cross-gcc-stage1["` + cross-gcc-stage1 + host: x86_64-pc-msys + target: aarch64-pc-msys + `"]:::NEW_DONE + + cross-gcc["` + cross-gcc + host: x86_64-pc-msys + target: aarch64-pc-msys + `"]:::NEW_WIP + + windows-default-manifest["` + windows-default-manifest + host: aarch64-pc-msys `"]:::DONE - mingw-w64-cross-zlib["` - mingw-w64-cross-zlib - host: aarch64-w64-mingw32 + msys2-runtime["` + msys2-runtime + host: aarch64-pc-msys + `"]:::WIP + + bash["` + bash + host: aarch64-w64-mingw32 `"]:::TODO + git4win["` + Git for Windows + host: aarch64-w64-mingw32 + `"]:::TODO + + subgraph Stage 1 - mingw-w64-cross-binutils --> mingw-w64-cross-gcc-stage1 - mingw-w64-cross-headers --> mingw-w64-cross-gcc-stage1 + cross-binutils --> cross-gcc-stage1 + msys2-runtime-devel --> cross-gcc-stage1 + msys2-w32api-headers --> cross-gcc-stage1 end - subgraph Stage 2\nDependencies - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-crt - mingw-w64-cross-binutils --> mingw-w64-cross-crt - mingw-w64-cross-headers --> mingw-w64-cross-crt - - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-winpthreads - mingw-w64-cross-binutils --> mingw-w64-cross-winpthreads - mingw-w64-cross-crt --> mingw-w64-cross-winpthreads - mingw-w64-cross-headers --> mingw-w64-cross-winpthreads + subgraph Stage 2 Dependencies + mingw-w64-cross-mingwarm64-gcc --> msys2-w32api-runtime + msys2-w32api-headers --> msys2-w32api-runtime - mingw-w64-cross-gcc-stage1 --> mingw-w64-cross-windows-default-manifest - mingw-w64-cross-binutils --> mingw-w64-cross-windows-default-manifest + cross-gcc-stage1 --> windows-default-manifest end subgraph Stage 2 - mingw-w64-cross-binutils --> mingw-w64-cross-gcc - mingw-w64-cross-crt --> mingw-w64-cross-gcc - mingw-w64-cross-headers --> mingw-w64-cross-gcc - mingw-w64-cross-winpthreads --> mingw-w64-cross-gcc - mingw-w64-cross-windows-default-manifest --> mingw-w64-cross-gcc + cross-gcc-stage1 --> cross-gcc + msys2-w32api-runtime --> cross-gcc + windows-default-manifest --> cross-gcc end - subgraph Software - mingw-w64-cross-gcc --> mingw-w64-cross-zlib - end -``` + subgraph Application\nDependencies + cross-gcc-stage1 --> msys2-runtime + mingw-w64-cross-mingwarm64-gcc --> msys2-runtime + mingw-w64-cross-mingwarm64-crt --> msys2-runtime + mingw-w64-cross-mingwarm64-zlib --> msys2-runtime + end -## MSYS2 Toolchain CI + subgraph Application + cross-gcc --> bash + msys2-runtime --> bash + + cross-gcc --> git4win + msys2-runtime --> git4win + bash --> git4win + end +``` -TODO +## Detailed MSYS2 Tooolchian Packages Dependencies Chart -## MSYS2/Cygwin Toolchain Porting +Relevant for `x86-64-pc-msys` host, `aarch64-pc-msys` and `aarch64-w64-mingw32` target +cross-compilation option: ```mermaid %%{init: {"flowchart": {"htmlLabels": false, 'nodeSpacing': 30, 'rankSpacing': 30}} }%% @@ -380,28 +443,67 @@ flowchart LR EXIST:::EXIST ~~~ TODO:::TODO ~~~ WIP:::WIP ~~~ DONE:::DONE ~~~ NEW:::NEW end + binutils["` + binutils + host: x86_64-pc-msys + target: x86_64-pc-msys + `"]:::EXIST + + gcc["` + gcc + host: x86_64-pc-msys + target: x86_64-pc-msys + `"]:::EXIST + msys2-runtime-devel["` msys2-runtime-devel host: x86_64-pc-msys target: aarch64-pc-msys `"]:::DONE + + mingw-w64-cross-mingwarm64-binutils["` + mingw-w64-cross-mingwarm64-binutils + host: x86_64-pc-msys + target: aarch64-w64-mingw32 + `"]:::DONE - mingw-w64-cross-gcc["` - mingw-w64-cross-gcc + mingw-w64-cross-mingwarm64-gcc["` + mingw-w64-cross-mingwarm64-gcc host: x86_64-pc-msys target: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-crt["` - mingw-w64-cross-crt + mingw-w64-cross-mingwarm64-gcc-stage1["` + mingw-w64-cross-mingwarm64-gcc-stage1 + host: x86_64-pc-msys + target: aarch64-w64-mingw32 + `"]:::NEW_DONE + + mingw-w64-cross-mingwarm64-crt["` + mingw-w64-cross-mingwarm64-crt host: aarch64-w64-mingw32 `"]:::DONE - mingw-w64-cross-zlib["` - mingw-w64-cross-zlib + mingw-w64-cross-mingwarm64-headers["` + mingw-w64-cross-mingwarm64-headers host: aarch64-w64-mingw32 `"]:::DONE + mingw-w64-cross-mingwarm64-winpthreads["` + mingw-w64-cross-mingwarm64-winpthreads + host: aarch64-w64-mingw32 + `"]:::DONE + + mingw-w64-cross-mingwarm64-windows-default-manifest["` + mingw-w64-cross-mingwarm64-windows-default-manifest + host: aarch64-w64-mingw32 + `"]:::DONE + + mingw-w64-cross-mingwarm64-zlib["` + mingw-w64-cross-mingwarm64-zlib + host: aarch64-w64-mingw32 + `"]:::NEW_DONE + msys2-w32api-headers["` msys2-w32api-headers host: aarch64-pc-msys @@ -416,19 +518,19 @@ flowchart LR cross-binutils host: x86_64-pc-msys target: aarch64-pc-msys - `"]:::DONE + `"]:::NEW_DONE cross-gcc-stage1["` cross-gcc-stage1 host: x86_64-pc-msys target: aarch64-pc-msys - `"]:::DONE + `"]:::NEW_DONE cross-gcc["` cross-gcc host: x86_64-pc-msys target: aarch64-pc-msys - `"]:::WIP + `"]:::NEW_WIP windows-default-manifest["` windows-default-manifest @@ -450,39 +552,83 @@ flowchart LR host: aarch64-w64-mingw32 `"]:::TODO - - subgraph Stage 1 - cross-binutils --> cross-gcc-stage1 - msys2-runtime-devel --> cross-gcc-stage1 - msys2-w32api-headers --> cross-gcc-stage1 + subgraph Bootstrap + direction TB + binutils --> gcc end + + subgraph MinGW + subgraph Stage 1 + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-binutils + gcc --> mingw-w64-cross-mingwarm64-binutils - subgraph Stage 2 Dependencies - mingw-w64-cross-gcc --> msys2-w32api-runtime - msys2-w32api-headers --> msys2-w32api-runtime + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-gcc-stage1 + mingw-w64-cross-mingwarm64-binutils --> mingw-w64-cross-mingwarm64-gcc-stage1 + gcc --> mingw-w64-cross-mingwarm64-gcc-stage1 + end - cross-gcc-stage1 --> windows-default-manifest - end + subgraph Stage 2\nDependencies + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-crt + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-crt + + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-winpthreads + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-winpthreads + mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-winpthreads - subgraph Stage 2 - cross-gcc-stage1 --> cross-gcc - msys2-w32api-runtime --> cross-gcc - windows-default-manifest --> cross-gcc - end + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-windows-default-manifest + end - subgraph Application\nDependencies - cross-gcc --> msys2-runtime - mingw-w64-cross-gcc --> msys2-runtime - mingw-w64-cross-crt --> msys2-runtime - mingw-w64-cross-zlib --> msys2-runtime + subgraph Stage 2 + mingw-w64-cross-mingwarm64-headers --> mingw-w64-cross-mingwarm64-gcc + mingw-w64-cross-mingwarm64-crt --> mingw-w64-cross-mingwarm64-gcc + mingw-w64-cross-mingwarm64-winpthreads --> mingw-w64-cross-mingwarm64-gcc + mingw-w64-cross-mingwarm64-windows-default-manifest --> mingw-w64-cross-mingwarm64-gcc + mingw-w64-cross-mingwarm64-gcc-stage1 --> mingw-w64-cross-mingwarm64-gcc + gcc --> mingw-w64-cross-mingwarm64-gcc + end + + subgraph MINGW Software + mingw-w64-cross-mingwarm64-gcc --> mingw-w64-cross-mingwarm64-zlib + end end - subgraph Application - cross-gcc --> bash - msys2-runtime --> bash + subgraph MSYS2 + subgraph Stage 1 + gcc --> msys2-runtime-devel - cross-gcc --> git4win - msys2-runtime --> git4win - bash --> git4win + gcc --> cross-binutils + + msys2-w32api-headers --> cross-gcc-stage1 + msys2-runtime-devel --> cross-gcc-stage1 + cross-binutils --> cross-gcc-stage1 + gcc --> cross-gcc-stage1 + end + + subgraph Stage 2 Dependencies + msys2-w32api-headers --> msys2-w32api-runtime + mingw-w64-cross-mingwarm64-gcc --> msys2-w32api-runtime + + cross-gcc-stage1 --> windows-default-manifest + + mingw-w64-cross-mingwarm64-gcc --> msys2-runtime + mingw-w64-cross-mingwarm64-zlib --> msys2-runtime + cross-gcc-stage1 --> msys2-runtime + end + + subgraph Stage 2 + cross-gcc-stage1 --> cross-gcc + msys2-w32api-runtime --> cross-gcc + msys2-runtime --> cross-gcc + windows-default-manifest --> cross-gcc + end + + subgraph MSYS2 Application + cross-gcc --> bash + msys2-runtime --> bash + + cross-gcc --> git4win + msys2-runtime --> git4win + bash --> git4win + end end ``` diff --git a/build-cross.sh b/build-cross.sh new file mode 100644 index 0000000..7f898e0 --- /dev/null +++ b/build-cross.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on + +if [[ "$MSYSTEM" != "MSYS" ]]; then + echo "This script must be run in the MSYS2 MSYS shell" + exit 1 +fi + +ROOT_DIR=`dirname ${BASH_SOURCE[0]}` +ROOT_DIR=`realpath $ROOT_DIR` +CLEAN_BUILD=${CLEAN_BUILD:-0} + +function build_package () { + PACKAGE=$1 + echo "::group::Build $PACKAGE" + pushd ../MSYS2-packages/$PACKAGE + rm -rf *.pkg.tar.zst + rm -rf src/ + if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-crt ]]; then + $ROOT_DIR/.github/scripts/pthread-headers-hack-before.sh + fi + if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-gcc ]]; then + $ROOT_DIR/.github/scripts/build-package.sh MSYS2 + pacman -R --noconfirm mingw-w64-cross-mingwarm64-gcc-stage1 || true + pacman -U --noconfirm *.pkg.tar.zst + else + INSTALL_PACKAGE=1 \ + $ROOT_DIR/.github/scripts/build-package.sh MSYS2 + fi + if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-crt ]]; then + $ROOT_DIR/.github/scripts/pthread-headers-hack-after.sh + fi + popd + echo "::endgroup::" +} + +./clean-cross.sh + +pacman -S --noconfirm \ + base-devel + +build_package mingw-w64-cross-mingwarm64-headers +build_package mingw-w64-cross-mingwarm64-binutils +build_package mingw-w64-cross-mingwarm64-gcc-stage1 +build_package mingw-w64-cross-mingwarm64-windows-default-manifest +build_package mingw-w64-cross-mingwarm64-crt +build_package mingw-w64-cross-mingwarm64-winpthreads +build_package mingw-w64-cross-mingwarm64-gcc +build_package mingw-w64-cross-mingwarm64-zlib diff --git a/build-native.sh b/build-native.sh new file mode 100644 index 0000000..2b83006 --- /dev/null +++ b/build-native.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on + +if [[ "$MSYSTEM" != "MINGWARM64" ]]; then + echo "This script must be run in the MSYS2 MINGWARM64 shell" + exit 1 +fi + +ROOT_DIR=`dirname ${BASH_SOURCE[0]}` +ROOT_DIR=`realpath $ROOT_DIR` +CLEAN_BUILD=${CLEAN_BUILD:-0} + +function build_package () { + PACKAGE=$1 + echo "::group::Build $PACKAGE" + pushd ../MINGW-packages/$PACKAGE + rm -rf *.pkg.tar.zst + rm -rf src/ + INSTALL_PACKAGE=1 \ + $ROOT_DIR/.github/scripts/build-package.sh MINGW + popd + echo "::endgroup::" +} + +./clean-native.sh + +pacman -S --noconfirm \ + base-devel \ + mingw-w64-cross-mingwarm64-gcc \ + mingw-w64-cross-mingwarm64-windows-default-manifest \ + mingw-w64-x86_64-gcc-libs + +build_package mingw-w64-libiconv +build_package mingw-w64-libtre-git +build_package mingw-w64-libsystre +build_package mingw-w64-ncurses +build_package mingw-w64-gettext +build_package mingw-w64-bzip2 +build_package mingw-w64-zlib +build_package mingw-w64-zstd +build_package mingw-w64-gmp +build_package mingw-w64-mpfr +build_package mingw-w64-isl +build_package mingw-w64-mpc + +build_package mingw-w64-headers-git +build_package mingw-w64-crt-git +build_package mingw-w64-winpthreads-git +build_package mingw-w64-binutils +build_package mingw-w64-windows-default-manifest +build_package mingw-w64-gcc diff --git a/build.sh b/build.sh deleted file mode 100644 index e53524e..0000000 --- a/build.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -set -e # exit on error -set -x # echo on - -CLEAN_BUILD=${CLEAN_BUILD:-0} - -MAKEPKG_OPTIONS="--syncdeps --rmdeps --noconfirm --noprogressbar --nocheck --force --install" -if [ "$CLEAN_BUILD" = 1 ] ; then - MAKEPKG_OPTIONS="$MAKEPKG_OPTIONS --cleanbuild" -fi - -pacman -R --noconfirm mingw-w64-cross-mingwarm64-zlib || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-gcc || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-winpthreads || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-crt || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-windows-default-manifest || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-gcc-stage1 || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-binutils || true -pacman -R --noconfirm mingw-w64-cross-mingwarm64-headers || true - -pacman -S --noconfirm base-devel - -echo "::group::Build mingw-w64-cross-mingwarm64-headers" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-headers - makepkg $MAKEPKG_OPTIONS - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-binutils" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-binutils - makepkg $MAKEPKG_OPTIONS - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-gcc-stage1" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-gcc-stage1 - makepkg $MAKEPKG_OPTIONS - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-windows-default-manifest" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-windows-default-manifest - makepkg $MAKEPKG_OPTIONS - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-crt" - .github/scripts/pthread-headers-hack-before.sh - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-crt - makepkg $MAKEPKG_OPTIONS - popd - .github/scripts/pthread-headers-hack-after.sh -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-winpthreads" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-winpthreads - makepkg $MAKEPKG_OPTIONS - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-gcc" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-gcc - makepkg ${MAKEPKG_OPTIONS//--install/} - pacman -R --noconfirm mingw-w64-cross-mingwarm64-gcc-stage1 || true - pacman -U --noconfirm *.pkg.tar.zst - popd -echo "::endgroup::" - -echo "::group::Build mingw-w64-cross-mingwarm64-zlib" - pushd ../MSYS2-packages/mingw-w64-cross-mingwarm64-zlib - makepkg $MAKEPKG_OPTIONS --skippgpcheck - popd -echo "::endgroup::" diff --git a/clean-cross.sh b/clean-cross.sh new file mode 100644 index 0000000..b194a71 --- /dev/null +++ b/clean-cross.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on + +for ENV in "common" "mingw32" "mingw64" "ucrt64" "mingwarm64"; do + PACKAGES="mingw-w64-cross-mingwarm64-zlib \ + mingw-w64-cross-$ENV-gcc \ + mingw-w64-cross-$ENV-winpthreads \ + mingw-w64-cross-$ENV-crt \ + mingw-w64-cross-$ENV-windows-default-manifest \ + mingw-w64-cross-$ENV-gcc-stage1 \ + mingw-w64-cross-$ENV-binutils \ + mingw-w64-cross-$ENV-headers" + + for PACKAGE in $PACKAGES; do + pacman -R --noconfirm --cascade $PACKAGE || true + done +done \ No newline at end of file diff --git a/clean-native.sh b/clean-native.sh new file mode 100644 index 0000000..daf778d --- /dev/null +++ b/clean-native.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on + +for ARCH in "aarch64" "x86_64"; do + PACKAGES="mingw-w64-$ARCH-gcc \ + mingw-w64-$ARCH-windows-default-manifest \ + mingw-w64-$ARCH-binutils \ + mingw-w64-$ARCH-libwinpthread-git + mingw-w64-$ARCH-winpthreads-git \ + mingw-w64-$ARCH-crt-git \ + mingw-w64-$ARCH-headers-git \ + mingw-w64-$ARCH-mpc \ + mingw-w64-$ARCH-isl \ + mingw-w64-$ARCH-mpfr \ + mingw-w64-$ARCH-gmp \ + mingw-w64-$ARCH-zstd \ + mingw-w64-$ARCH-zlib \ + mingw-w64-$ARCH-bzip2 \ + mingw-w64-$ARCH-gettext \ + mingw-w64-$ARCH-ncurses \ + mingw-w64-$ARCH-libsystre \ + mingw-w64-$ARCH-libtre-git \ + mingw-w64-$ARCH-libiconv" + + for PACKAGE in $PACKAGES; do + pacman -R --noconfirm --cascade $PACKAGE || true + done +done diff --git a/patches/ccache/0002-makepkg-mingw.patch b/patches/ccache/0002-makepkg-mingw.patch index 2bef28b..406cbab 100644 --- a/patches/ccache/0002-makepkg-mingw.patch +++ b/patches/ccache/0002-makepkg-mingw.patch @@ -9,16 +9,3 @@ # #-- If using DistCC, your MAKEFLAGS will also need modification. In addition, #-- specify a space-delimited list of hosts running in the DistCC cluster. ---- a/usr/share/makepkg/buildenv/compiler.sh -+++ b/usr/share/makepkg/buildenv/compiler.sh -@@ -34,8 +34,8 @@ - - buildenv_ccache() { - if check_buildoption "ccache" "y"; then -- if [ -d /usr/lib/ccache/bin ]; then -- export PATH="/usr/lib/ccache/bin:$PATH" -+ if [ -d ${MINGW_PREFIX:-/usr}/lib/ccache/bin ]; then -+ export PATH="${MINGW_PREFIX:-/usr}/lib/ccache/bin:$PATH" - using_ccache=1 - fi - fi diff --git a/patches/makepkg/0001-mingwarm64.patch b/patches/makepkg/0001-mingwarm64.patch new file mode 100644 index 0000000..37a4279 --- /dev/null +++ b/patches/makepkg/0001-mingwarm64.patch @@ -0,0 +1,52 @@ +--- a/etc/makepkg_mingw.conf ++++ b/etc/makepkg_mingw.conf +@@ -33,7 +33,19 @@ + ######################################################################### + # + +-if [[ "$MSYSTEM" == "MINGW64" ]]; then ++if [[ "$MSYSTEM" == "MINGWARM64" ]]; then ++ CARCH="aarch64" ++ CHOST="aarch64-w64-mingw32" ++ MINGW_CHOST="aarch64-w64-mingw32" ++ MINGW_PREFIX="/mingwarm64" ++ MINGW_PACKAGE_PREFIX="mingw-w64-aarch64" ++ CC="aarch64-w64-mingw32-gcc" ++ CXX="aarch64-w64-mingw32-g++" ++ CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1" ++ CFLAGS="-march=armv8-a -mtune=generic -O0 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong" ++ CXXFLAGS="$CFLAGS" ++ LDFLAGS="" ++elif [[ "$MSYSTEM" == "MINGW64" ]]; then + CARCH="x86_64" + CHOST="x86_64-w64-mingw32" + MINGW_CHOST="x86_64-w64-mingw32" +--- a/etc/msystem ++++ b/etc/msystem +@@ -39,6 +39,15 @@ + MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" + export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX + ;; ++ MINGWARM64) ++ MSYSTEM_PREFIX='/mingwarm64' ++ MSYSTEM_CARCH='aarch64' ++ MSYSTEM_CHOST='aarch64-w64-mingw32' ++ MINGW_CHOST="${MSYSTEM_CHOST}" ++ MINGW_PREFIX="${MSYSTEM_PREFIX}" ++ MINGW_PACKAGE_PREFIX="mingw-w64-${MSYSTEM_CARCH}" ++ export MSYSTEM_PREFIX MSYSTEM_CARCH MSYSTEM_CHOST MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX ++ ;; + CLANG32) + MSYSTEM_PREFIX='/clang32' + MSYSTEM_CARCH='i686' +--- a/usr/bin/makepkg-mingw ++++ b/usr/bin/makepkg-mingw +@@ -84,7 +84,7 @@ + fi + + # Validate or set MINGW_ARCH +-MINGW_ARCH_ALLOWED=('mingw32' 'mingw64' 'clang32' 'clang64' 'clangarm64' 'ucrt64') ++MINGW_ARCH_ALLOWED=('mingw32' 'mingw64' 'mingwarm64' 'clang32' 'clang64' 'clangarm64' 'ucrt64') + MINGW_ARCH="${MINGW_ARCH,,}" + if [[ -z "$MINGW_ARCH" ]]; then + # In case MINGW_ARCH isn't set we default to MSYSTEM, or error out diff --git a/patches/makepkg/0002-mingwarm64-cross-build.patch b/patches/makepkg/0002-mingwarm64-cross-build.patch new file mode 100644 index 0000000..0eb0c35 --- /dev/null +++ b/patches/makepkg/0002-mingwarm64-cross-build.patch @@ -0,0 +1,74 @@ +--- a/etc/makepkg_mingw.conf ++++ b/etc/makepkg_mingw.conf +@@ -44,6 +44,11 @@ + MINGW_PACKAGE_PREFIX="mingw-w64-aarch64" + CC="aarch64-w64-mingw32-gcc" + CXX="aarch64-w64-mingw32-g++" ++ RC="aarch64-w64-mingw32-windres" ++ WINDRES="aarch64-w64-mingw32-windres" ++ STRIP="aarch64-w64-mingw32-strip" ++ OBJDUMP="aarch64-w64-mingw32-objdump" ++ OBJCOPY="aarch64-w64-mingw32-objcopy" + CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1" + CFLAGS="-march=armv8-a -mtune=generic -O0 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong" + CXXFLAGS="$CFLAGS" +--- a/etc/profile ++++ b/etc/profile +@@ -49,7 +49,7 @@ + case "${MSYSTEM}" in + MINGW*|CLANG*|UCRT*) + MINGW_MOUNT_POINT="${MINGW_PREFIX}" +- PATH="${MINGW_MOUNT_POINT}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}" ++ PATH="${MINGW_MOUNT_POINT}/bin:${MINGW_MOUNT_POINT}/${MSYSTEM_CHOST}/bin:/opt/bin:/opt/${MSYSTEM_CHOST}/bin:/opt/lib/gcc/${MSYSTEM_CHOST}/15.0.0:/opt/lib/bfd-plugins:/mingw64/bin:/mingw64/${MSYSTEM_CHOST}/bin:${MSYS2_PATH}${ORIGINAL_PATH:+:${ORIGINAL_PATH}}" + PKG_CONFIG_PATH="${MINGW_MOUNT_POINT}/lib/pkgconfig:${MINGW_MOUNT_POINT}/share/pkgconfig" + PKG_CONFIG_SYSTEM_INCLUDE_PATH="${MINGW_MOUNT_POINT}/include" + PKG_CONFIG_SYSTEM_LIBRARY_PATH="${MINGW_MOUNT_POINT}/lib" +--- a/usr/share/makepkg/executable/strip.sh ++++ b/usr/share/makepkg/executable/strip.sh +@@ -30,7 +30,7 @@ + + executable_strip() { + if check_option "strip" "y"; then +- if ! type -p strip >/dev/null; then ++ if ! type -p $STRIP >/dev/null; then + error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip" + return 1 + fi +--- a/usr/share/makepkg/buildenv.sh ++++ b/usr/share/makepkg/buildenv.sh +@@ -42,5 +42,5 @@ + done + + # ensure all necessary build variables are exported +- export ${buildenv_vars[@]} CC CXX CHOST MAKEFLAGS ++ export ${buildenv_vars[@]} CC CXX RC WINDRES SRIP OBJDUMP OBJCOPY CHOST MAKEFLAGS + } +--- a/usr/share/makepkg/tidy/strip.sh ++++ b/usr/share/makepkg/tidy/strip.sh +@@ -85,7 +85,7 @@ + strip_file(){ + local binary=$1; shift + local tempfile=$(mktemp "$binary.XXXXXX") +- if strip "$@" "$binary" -o "$tempfile"; then ++ if $STRIP "$@" "$binary" -o "$tempfile"; then + cat "$tempfile" > "$binary" + fi + rm -f "$tempfile" +@@ -95,7 +95,7 @@ + local binary=$1; + + local tempfile=$(mktemp "$binary.XXXXXX") +- if strip -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then ++ if $STRIP -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$binary" -o "$tempfile"; then + cat "$tempfile" > "$binary" + fi + rm -f "$tempfile" +@@ -176,7 +176,7 @@ + case "${binary##*/}" in + *.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;; + # make sure this isn't some oddly named DLL +- *) 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' ++ *) 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' + then + mv "${binary}" "${binary}.exe" + binary+=.exe diff --git a/patches/makepkg/0003-enable-debug.patch b/patches/makepkg/0003-enable-debug.patch new file mode 100644 index 0000000..90fbd1e --- /dev/null +++ b/patches/makepkg/0003-enable-debug.patch @@ -0,0 +1,11 @@ +--- a/etc/makepkg_mingw.conf ++++ b/etc/makepkg_mingw.conf +@@ -169,7 +169,7 @@ + #-- lto: Add compile flags for building with link time optimization + #-- autodeps: Automatically add depends/provides + # +-OPTIONS=(strip docs !libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) ++OPTIONS=(!strip docs !libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) + + #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2 + INTEGRITY_CHECK=(sha256) diff --git a/patches/pacman/0001-pin-packages.patch b/patches/pacman/0001-pin-packages.patch new file mode 100644 index 0000000..304ae59 --- /dev/null +++ b/patches/pacman/0001-pin-packages.patch @@ -0,0 +1,11 @@ +--- a/etc/pacman.conf ++++ b/etc/pacman.conf +@@ -21,7 +21,7 @@ + Architecture = auto + + # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +-#IgnorePkg = ++IgnorePkg = pacman pacman-mirrors gawk + #IgnoreGroup = + + #NoUpgrade = diff --git a/patches/pacman/0001-add-woarm64-repository.patch b/patches/pacman/0002-add-woarm64-repositories.patch similarity index 57% rename from patches/pacman/0001-add-woarm64-repository.patch rename to patches/pacman/0002-add-woarm64-repositories.patch index 5931616..1b05939 100644 --- a/patches/pacman/0001-add-woarm64-repository.patch +++ b/patches/pacman/0002-add-woarm64-repositories.patch @@ -1,11 +1,15 @@ --- a/etc/pacman.conf +++ b/etc/pacman.conf -@@ -70,6 +70,10 @@ +@@ -70,6 +70,14 @@ # Server = https://repo.msys2.org/staging/ # SigLevel = Never -+[woarm64] -+Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/x86_64 ++[woarm64-cross] ++Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/msys/x86_64 ++SigLevel = Optional ++ ++[woarm64-native] ++Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/mingw/aarch64 +SigLevel = Optional + [clangarm64] diff --git a/patches/pacman/pacman-6.1.0-4-x86_64.pkg.tar.zst b/patches/pacman/pacman-6.1.0-4-x86_64.pkg.tar.zst new file mode 100644 index 0000000..2b47255 Binary files /dev/null and b/patches/pacman/pacman-6.1.0-4-x86_64.pkg.tar.zst differ