diff --git a/.github/scripts/build-hello-world.sh b/.github/scripts/build-hello-world.sh index 26227d3..fc10d88 100755 --- a/.github/scripts/build-hello-world.sh +++ b/.github/scripts/build-hello-world.sh @@ -1,8 +1,6 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh # Sanity check of the GCC binary and its version. aarch64-w64-mingw32-gcc --version diff --git a/.github/scripts/build-package.sh b/.github/scripts/build-package.sh index 2e49e9e..18d0c3a 100755 --- a/.github/scripts/build-package.sh +++ b/.github/scripts/build-package.sh @@ -1,15 +1,9 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh PACKAGE_REPOSITORY=$1 -CLEAN_BUILD=${CLEAN_BUILD:-0} -INSTALL_PACKAGE=${INSTALL_PACKAGE:-0} -NO_EXTRACT=${NO_EXTRACT:-0} - ARGUMENTS="--syncdeps \ --rmdeps \ --noconfirm \ @@ -21,12 +15,22 @@ ARGUMENTS="--syncdeps \ $([ "$CLEAN_BUILD" = 1 ] && echo "--cleanbuild" || echo "") \ $([ "$INSTALL_PACKAGE" = 1 ] && echo "--install" || echo "")" -ccache -svv || true - -if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then - makepkg-mingw $ARGUMENTS -else - makepkg $ARGUMENTS +if command -v ccache &> /dev/null; then + echo "::group::Ccache statistics before build" + ccache -svv || true + echo "::endgroup::" fi -ccache -svv || true +echo "::group::Build package" + if [[ "$PACKAGE_REPOSITORY" == *MINGW* ]]; then + makepkg-mingw $ARGUMENTS + else + makepkg $ARGUMENTS + fi +echo "::endgroup::" + +if command -v ccache &> /dev/null; then + echo "::group::Ccache statistics after build" + ccache -svv || true + echo "::endgroup::" +fi diff --git a/.github/scripts/clean-cross.sh b/.github/scripts/clean-cross.sh new file mode 100644 index 0000000..73adb70 --- /dev/null +++ b/.github/scripts/clean-cross.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +source `dirname ${BASH_SOURCE[0]}`/../../config.sh + +for ENV in "common" "mingw32" "mingw64" "ucrt64" "mingwarm64"; do + PACKAGES=" \ + mingw-w64-cross-$ENV-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/.github/scripts/clean-native.sh b/.github/scripts/clean-native.sh new file mode 100644 index 0000000..5a5acc4 --- /dev/null +++ b/.github/scripts/clean-native.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +source `dirname ${BASH_SOURCE[0]}`/../../config.sh + +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-tools-git \ + mingw-w64-$ARCH-libmangle-git \ + mingw-w64-$ARCH-mpc \ + mingw-w64-$ARCH-isl \ + mingw-w64-$ARCH-mpfr \ + mingw-w64-$ARCH-gmp \ + mingw-w64-$ARCH-zstd \ + mingw-w64-$ARCH-ninja \ + mingw-w64-$ARCH-zlib \ + mingw-w64-$ARCH-bzip2 \ + mingw-w64-$ARCH-ncurses \ + mingw-w64-$ARCH-gettext \ + mingw-w64-$ARCH-libsystre \ + mingw-w64-$ARCH-libtre \ + mingw-w64-$ARCH-libiconv \ + mingw-w64-$ARCH-gperf \ + autotools-wrappers \ + mingw-w64-$ARCH-autotools \ + mingw-w64-$ARCH-pkgconf \ + mingw-w64-$ARCH-libtool" + + for PACKAGE in $PACKAGES; do + pacman -R --noconfirm --cascade $PACKAGE || true + done +done diff --git a/.github/scripts/create-repository.sh b/.github/scripts/create-repository.sh new file mode 100755 index 0000000..392e265 --- /dev/null +++ b/.github/scripts/create-repository.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source `dirname ${BASH_SOURCE[0]}`/../../config.sh + +echo "::group::Create MSYS2 packages repository" + mkdir -p repository/x86_64 + mv -f mingw-w64-cross-*.pkg.* repository/x86_64/ + pushd repository/x86_64 + repo-add woarm64.db.tar.gz *.pkg.* + popd + + mkdir -p repository/aarch64 + mv -f mingw-w64-aarch64-*.pkg.* repository/aarch64/ + pushd repository/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..3006306 100755 --- a/.github/scripts/download-artifacts.sh +++ b/.github/scripts/download-artifacts.sh @@ -1,13 +1,13 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh 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 || true + done done diff --git a/.github/scripts/enable-ccache.sh b/.github/scripts/enable-ccache.sh index 8a8f300..350760d 100755 --- a/.github/scripts/enable-ccache.sh +++ b/.github/scripts/enable-ccache.sh @@ -1,24 +1,47 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh 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 +apply_patch () { + if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then + echo "Patch $1 is already applied" + else + patch -p1 -b -i "$1" + fi +} + +mkdir -p $CCACHE_DIR + pushd / echo "::group::/etc/makepkg.conf" - patch -p1 -b -i "$DIR/patches/ccache/0001-makepkg.patch" + apply_patch "$DIR/patches/ccache/0001-makepkg.patch" cat /etc/makepkg.conf echo "::endgroup::" echo "::group::/etc/makepkg_mingw.conf" - patch -p1 -b -i "$DIR/patches/ccache/0002-makepkg-mingw.patch" + apply_patch "$DIR/patches/ccache/0002-makepkg-mingw.patch" 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 + if [[ "$FLAVOR" = "CROSS" ]]; then + ln -sf /usr/bin/true makeinfo + fi + echo "::endgroup::" +popd diff --git a/.github/scripts/install-artifacts.sh b/.github/scripts/install-artifacts.sh index 91f8acc..eeae763 100755 --- a/.github/scripts/install-artifacts.sh +++ b/.github/scripts/install-artifacts.sh @@ -1,7 +1,9 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh -pacman -U --noconfirm *.pkg.tar.zst +if [[ $(ls *.pkg.tar.zst 2>/dev/null) != "" ]]; then + pacman -U --noconfirm *.pkg.tar.zst +else + echo "No package file found. Skipping installation." +fi diff --git a/.github/scripts/install-dependencies.sh b/.github/scripts/install-dependencies.sh new file mode 100755 index 0000000..fd41bfe --- /dev/null +++ b/.github/scripts/install-dependencies.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source `dirname ${BASH_SOURCE[0]}`/../../config.sh + +DEPENDENCIES=$1 + +case $FLAVOR in + "CROSS") + pacman -S --noconfirm \ + git \ + base-devel \ + $DEPENDENCIES + ;; + "NATIVE_WITH_CROSS") + pacman -S --noconfirm \ + git \ + base-devel \ + mingw-w64-cross-mingwarm64-gcc \ + mingw-w64-cross-mingwarm64-windows-default-manifest \ + mingw-w64-x86_64-gcc-libs \ + $DEPENDENCIES + ;; + "NATIVE_WITH_NATIVE") + pacman -S --noconfirm \ + git \ + base-devel \ + mingw-w64-aarch64-gcc \ + $DEPENDENCIES + ;; + *) + echo "Unknown flavor: $FLAVOR" + exit 1 + ;; +esac diff --git a/.github/scripts/pthread-headers-hack-after.sh b/.github/scripts/pthread-headers-hack-after.sh index e2db55d..8c21e97 100644 --- a/.github/scripts/pthread-headers-hack-after.sh +++ b/.github/scripts/pthread-headers-hack-after.sh @@ -1,10 +1,9 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh pacman -R --noconfirm mingw-w64-cross-mingw64-winpthreads || true rm -rf /opt/aarch64-w64-mingw32/include/pthread_signal.h rm -rf /opt/aarch64-w64-mingw32/include/pthread_unistd.h rm -rf /opt/aarch64-w64-mingw32/include/pthread_time.h +rm -rf /opt/aarch64-w64-mingw32/include/pthread_compat.h diff --git a/.github/scripts/pthread-headers-hack-before.sh b/.github/scripts/pthread-headers-hack-before.sh index 099151b..805c193 100644 --- a/.github/scripts/pthread-headers-hack-before.sh +++ b/.github/scripts/pthread-headers-hack-before.sh @@ -1,10 +1,9 @@ #!/bin/bash -set -e # exit on error -set -x # echo on -set -o pipefail # fail of any command in pipeline is an error +source `dirname ${BASH_SOURCE[0]}`/../../config.sh pacman -S --noconfirm mingw-w64-cross-mingw64-winpthreads cp /opt/x86_64-w64-mingw32/include/pthread_signal.h /opt/aarch64-w64-mingw32/include/ cp /opt/x86_64-w64-mingw32/include/pthread_unistd.h /opt/aarch64-w64-mingw32/include/ cp /opt/x86_64-w64-mingw32/include/pthread_time.h /opt/aarch64-w64-mingw32/include/ +cp /opt/x86_64-w64-mingw32/include/pthread_compat.h /opt/aarch64-w64-mingw32/include/ diff --git a/.github/scripts/setup-mingwarm64.sh b/.github/scripts/setup-mingwarm64.sh new file mode 100644 index 0000000..0516470 --- /dev/null +++ b/.github/scripts/setup-mingwarm64.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +source `dirname ${BASH_SOURCE[0]}`/../../config.sh + +if [ -z "$GITHUB_WORKSPACE" ]; then + DIR=`pwd` +else + DIR=`cygpath "$GITHUB_WORKSPACE"` +fi + +apply_patch () { + if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then + echo "Patch $1 is already applied" + else + patch -p1 -b -i "$1" + fi +} + +echo "::group::Install patch" + pacman -S --noconfirm patch +echo "::endgroup::" + +pushd / + echo "::group::Patch MSYS2 environment" + apply_patch "$DIR/patches/makepkg/0001-mingwarm64.patch" + if [[ "$FLAVOR" != "NATIVE_WITH_NATIVE" ]]; then + apply_patch "$DIR/patches/makepkg/0002-mingwarm64-cross-build.patch" + fi + if [[ "$DEBUG_BUILD" = "1" ]]; then + apply_patch "$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..1018e24 100644 --- a/.github/scripts/setup-repository.sh +++ b/.github/scripts/setup-repository.sh @@ -7,13 +7,25 @@ set -o pipefail # fail of any command in pipeline is an error DIR="`dirname ${BASH_SOURCE[0]}`/../.." DIR=`realpath $DIR` -pushd / - echo "::group::Install patch" - pacman -S --noconfirm patch - echo "::endgroup::" +apply_patch () { + if patch -R -p1 --dry-run -b -i "$1" > /dev/null 2>&1; then + echo "Patch $1 is already applied" + else + patch -p1 -b -i "$1" + fi +} +echo "::group::Install patch" + pacman -S --noconfirm patch +echo "::endgroup::" + +pushd / echo "::group::Add WoArm64 repository" - patch -p1 -b -i "$DIR/patches/pacman/0001-add-woarm64-repository.patch" + if [[ "$FLAVOR" = "NATIVE_WITH_NATIVE" ]]; then + apply_patch "$DIR/patches/pacman/0002-add-woarm64-native-repository.patch" + else + apply_patch "$DIR/patches/pacman/0001-add-woarm64-cross-repository.patch" + fi echo "::endgroup::" echo "::group::Update packages database" diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 815a75f..6bf4c10 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -3,16 +3,13 @@ name: Build MSYS2 package on: workflow_call: inputs: + if: + description: "Condition allowing to skip all steps of the workflow job" + type: boolean + default: true 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,97 +18,147 @@ on: description: "MSYS2 packages branch to build from" type: string default: "woarm64" - -defaults: - run: - shell: msys2 {0} + runner_arch: + description: "Architecture to build on" + type: string + default: "x86_64" + build_with_native: + description: "Build with native MinGW toolchain" + type: boolean + default: false + needs: + description: "Parent workflow job dependencies" + type: string + dependencies: + description: "Install additional dependencies" + type: string + default: "" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FLAVOR: ${{ (inputs.runner_arch == 'aarch64') && (inputs.build_with_native && 'NATIVE_WITH_NATIVE' || 'NATIVE_WITH_CROSS') || 'CROSS' }} + CLEAN_BUILD: 1 jobs: build: - name: Build ${{ inputs.package_name }} - runs-on: windows-latest + name: ${{ inputs.if && 'Build' || 'Skip'}} ${{ inputs.package_name }} + timeout-minutes: 720 + runs-on: >- + ${{ fromJson(inputs.runner_arch == 'aarch64' + && '["Windows", "ARM64", "MSYS2"]' + || '["windows-latest"]') }} + + defaults: + run: + shell: msys2 {0} steps: - - uses: msys2/setup-msys2@v2 + - name: Kill hanging processes + if: inputs.if && inputs.runner_arch == 'aarch64' + shell: powershell + run: | + taskkill /F /FI 'MODULES eq msys-2.0.dll' + Set-Location "${{ github.workspace }}" + Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages + exit 0 + + - uses: Windows-on-ARM-Experiments/setup-msys2@main + if: inputs.if + timeout-minutes: 10 with: - msystem: ${{ contains(inputs.packages_repository, 'MINGW') && 'MINGW64' || 'MSYS' }} + msystem: >- + ${{ contains(inputs.packages_repository, 'MINGW') + && ((inputs.runner_arch == 'aarch64') && 'MINGWARM64' || 'MINGW64') + || 'MSYS' }} + path-type: minimal update: true cache: true - name: Checkout repository + if: inputs.if uses: actions/checkout@v4 - - name: Install dependencies + - name: Checkout ${{ inputs.packages_repository }} repository + if: inputs.if + uses: actions/checkout@v4 + with: + repository: ${{ inputs.packages_repository }} + ref: ${{ ((inputs.runner_arch == 'aarch64') && !inputs.build_with_native) && format('{0}-cross', inputs.packages_branch) || inputs.packages_branch }} + sparse-checkout: ${{ inputs.package_name }} + path: ${{ github.workspace }}/packages + + - name: Setup packages repository + if: inputs.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' }} \ - ${{ inputs.dependencies }} + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh + + - name: Install dependencies + if: inputs.if + run: >- + `cygpath "${{ github.workspace }}"`/.github/scripts/install-dependencies.sh \ + "git mingw-w64-x86_64-github-cli mingw-w64-x86_64-jq ${{ inputs.dependencies }}" - name: Download artifacts - if: ${{ inputs.needs }} + if: inputs.if && inputs.needs run: | - `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh ${{ github.run_id }} '${{ inputs.needs }}' + `cygpath "${{ github.workspace }}"`/.github/scripts/download-artifacts.sh \ + ${{ github.run_id }} \ + '${{ inputs.needs }}' - name: Install artifacts - if: ${{ inputs.needs }} + if: inputs.if && inputs.needs run: | `cygpath "${{ github.workspace }}"`/.github/scripts/install-artifacts.sh - name: Copy missing headers for mingw-w64-cross-mingwarm64-crt - if: ${{ inputs.package_name == 'mingw-w64-cross-mingwarm64-crt' }} + if: inputs.if && inputs.package_name == 'mingw-w64-cross-mingwarm64-crt' 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.if && inputs.runner_arch == 'aarch64' + run: | + `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh - name: Enable Ccache + if: inputs.if id: enable-ccache run: | `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh - name: Restore Ccache - uses: actions/cache/restore@v4 + if: inputs.if + 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 }} + if: inputs.if + timeout-minutes: 720 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 + `cygpath "${{ github.workspace }}"`/.github/scripts/build-package.sh \ + ${{ inputs.packages_repository }} - name: Save Ccache - if: always() - uses: actions/cache/save@v4 + if: inputs.if && always() + 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 }} + if: inputs.if uses: actions/upload-artifact@v4 with: name: ${{ inputs.package_name }} - retention-days: 1 + retention-days: 3 path: ${{ github.workspace }}/packages/${{ inputs.package_name }}/*.pkg.tar.zst - name: Upload build folder - if: failure() + if: inputs.if && failure() uses: actions/upload-artifact@v4 with: name: ${{ inputs.package_name }}-build diff --git a/.github/workflows/check-repository.yml b/.github/workflows/check-repository.yml index 4b02ed7..8e6ff2a 100644 --- a/.github/workflows/check-repository.yml +++ b/.github/workflows/check-repository.yml @@ -5,18 +5,24 @@ on: workflow_call: jobs: - build: + build-cross: runs-on: windows-latest defaults: run: shell: msys2 {0} + env: + FLAVOR: CROSS + steps: - uses: msys2/setup-msys2@v2 + timeout-minutes: 10 with: msystem: MSYS + path-type: minimal update: true + cache: true - name: Checkout repository uses: actions/checkout@v4 @@ -25,10 +31,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,21 +43,88 @@ 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: | + ${{ github.workspace }}\artifacts\hello-world.exe + + build-native: + runs-on: ["Windows", "ARM64", "MSYS2"] + + defaults: + run: + shell: msys2 {0} + + env: + FLAVOR: NATIVE_WITH_NATIVE + + steps: + - name: Kill hanging processes + shell: powershell + run: | + taskkill /F /FI 'MODULES eq msys-2.0.dll' + Set-Location "${{ github.workspace }}" + Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages + exit 0 + + - uses: Windows-on-ARM-Experiments/setup-msys2@main + timeout-minutes: 10 + with: + msystem: MINGWARM64 + path-type: minimal + update: true + cache: true + + - name: Checkout repository + uses: actions/checkout@v4 + + - 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 run: | - ls ${{ github.workspace }}\artifacts ${{ github.workspace }}\artifacts\hello-world.exe diff --git a/.github/workflows/ffmpeg.yml b/.github/workflows/ffmpeg.yml new file mode 100644 index 0000000..13bf0b5 --- /dev/null +++ b/.github/workflows/ffmpeg.yml @@ -0,0 +1,21 @@ +name: Build MinGW FFmpeg using MSYS2 toolchain + +on: + pull_request: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "four-packages" + +jobs: + mingw-w64-ffmpeg: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-ffmpeg + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'four-packages' }} + runner_arch: aarch64 + build_with_native: true diff --git a/.github/workflows/libjpeg-turbo.yml b/.github/workflows/libjpeg-turbo.yml new file mode 100644 index 0000000..a7147fe --- /dev/null +++ b/.github/workflows/libjpeg-turbo.yml @@ -0,0 +1,21 @@ +name: Build MinGW libjpeg-turbo using MSYS2 toolchain + +on: + pull_request: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "four-packages" + +jobs: + mingw-w64-libjpeg-turbo: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-libjpeg-turbo + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'four-packages' }} + runner_arch: aarch64 + build_with_native: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f288c1b..a14515b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,6 @@ on: push: branches: - main - pull_request: workflow_dispatch: inputs: msys2_packages_branch: @@ -12,17 +11,58 @@ on: type: string required: false default: "woarm64" + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "woarm64" + build_cross: + description: "Build cross-compilation MinGW toolchain" + type: choice + options: + - true + - false + required: false + default: 'true' + build_native: + description: "Build native MinGW toolchain" + type: choice + options: + - true + - false + required: false + default: 'true' + build_native_with_native: + description: "Build native MinGW toolchain with native MinGW toolchain" + type: choice + options: + - true + - false + required: false + default: 'true' jobs: mingw-cross-toolchain: + if: inputs.build_cross != 'false' name: MinGW cross-compilation toolchain uses: ./.github/workflows/mingw-cross-toolchain.yml with: msys2_packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} + mingw-native-toolchain: + if: inputs.build_native != 'false' + name: MinGW native toolchain + uses: ./.github/workflows/mingw-native-toolchain.yml + with: + mingw_packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + build_with_native: ${{ inputs.build_native_with_native || 'true' }} + repository: name: Create MSYS2 repository - needs: mingw-cross-toolchain + needs: [ + mingw-cross-toolchain, + mingw-native-toolchain + ] runs-on: windows-latest defaults: @@ -34,9 +74,12 @@ jobs: steps: - uses: msys2/setup-msys2@v2 + timeout-minutes: 10 with: msystem: MSYS + path-type: minimal update: true + cache: true - name: Checkout repository uses: actions/checkout@v4 @@ -50,32 +93,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: "." + 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-cross-toolchain.yml b/.github/workflows/mingw-cross-toolchain.yml index 6f1e0e4..0767147 100644 --- a/.github/workflows/mingw-cross-toolchain.yml +++ b/.github/workflows/mingw-cross-toolchain.yml @@ -24,7 +24,7 @@ jobs: with: package_name: mingw-w64-cross-mingwarm64-headers packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-binutils: needs: mingw-w64-cross-mingwarm64-headers @@ -33,7 +33,7 @@ jobs: package_name: mingw-w64-cross-mingwarm64-binutils needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-gcc-stage1: needs: [ @@ -45,7 +45,7 @@ jobs: package_name: mingw-w64-cross-mingwarm64-gcc-stage1 needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-windows-default-manifest: needs: [ @@ -57,7 +57,7 @@ jobs: package_name: mingw-w64-cross-mingwarm64-windows-default-manifest needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-crt: needs: [ @@ -71,7 +71,7 @@ jobs: needs: ${{ toJson(needs) }} dependencies: mingw-w64-cross-mingw64-winpthreads packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-winpthreads: needs: [ @@ -85,7 +85,7 @@ jobs: package_name: mingw-w64-cross-mingwarm64-winpthreads needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-gcc: needs: [ @@ -101,7 +101,7 @@ jobs: package_name: mingw-w64-cross-mingwarm64-gcc needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} mingw-w64-cross-mingwarm64-zlib: needs: [ @@ -118,4 +118,4 @@ jobs: package_name: mingw-w64-cross-mingwarm64-zlib needs: ${{ toJson(needs) }} packages_repository: Windows-on-ARM-Experiments/MSYS2-packages - packages_branch: ${{ github.event.inputs.msys2_packages_branch || 'woarm64' }} + packages_branch: ${{ inputs.msys2_packages_branch || 'woarm64' }} diff --git a/.github/workflows/mingw-native-toolchain.yml b/.github/workflows/mingw-native-toolchain.yml new file mode 100644 index 0000000..c23d6f0 --- /dev/null +++ b/.github/workflows/mingw-native-toolchain.yml @@ -0,0 +1,468 @@ +name: Build MinGW native toolchain + +on: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "woarm64" + build_with_native: + description: "Build with native MinGW toolchain" + type: choice + options: + - true + - false + required: false + default: 'true' + workflow_call: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + default: "woarm64" + build_with_native: + description: "Build with native MinGW toolchain" + type: string + required: false + default: 'true' + outputs: + artifacts: + value: ${{ toJson(jobs) }} + +jobs: + mingw-w64-libtool: + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-libtool + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + + mingw-w64-ninja: + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-ninja + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + + mingw-w64-pkgconf: + needs: [ + mingw-w64-ninja + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-pkgconf + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-autotools: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-autotools + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + autotools-wrappers: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: autotools-wrappers + packages_repository: Windows-on-ARM-Experiments/MSYS2-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-gperf: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-gperf + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-libiconv: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gperf + ] + with: + package_name: mingw-w64-libiconv + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-libtre: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + with: + package_name: mingw-w64-libtre + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-libsystre: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-libtre + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-libsystre + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-gettext: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gperf, + mingw-w64-libiconv, + mingw-w64-libtre, + mingw-w64-libsystre + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-gettext + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-ncurses: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gperf, + mingw-w64-libiconv, + mingw-w64-libtre, + mingw-w64-libsystre, + mingw-w64-gettext + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-ncurses + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-bzip2: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + with: + package_name: mingw-w64-bzip2 + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-zlib: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-zstd: + needs: [ + mingw-w64-ninja + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-zstd + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-gmp: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-gmp + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-mpfr: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gmp + ] + with: + package_name: mingw-w64-mpfr + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-isl: + uses: ./.github/workflows/build-package.yml + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gmp + ] + with: + package_name: mingw-w64-isl + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-mpc: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-libmangle-git: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-libmangle-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-tools-git: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-libmangle-git + ] + uses: ./.github/workflows/build-package.yml + with: + if: ${{ inputs.build_with_native != 'false' }} + package_name: mingw-w64-tools-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-headers-git: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-libmangle-git, + mingw-w64-tools-git + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-headers-git + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-crt-git: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-winpthreads-git: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-binutils: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gperf, + mingw-w64-libiconv, + mingw-w64-libtre, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-windows-default-manifest: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools + ] + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-windows-default-manifest + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} + + mingw-w64-gcc: + needs: [ + mingw-w64-libtool, + mingw-w64-pkgconf, + mingw-w64-autotools, + mingw-w64-gperf, + mingw-w64-libiconv, + mingw-w64-libtre, + 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: ${{ inputs.mingw_packages_branch || 'woarm64' }} + runner_arch: aarch64 + build_with_native: ${{ inputs.build_with_native != 'false' }} + needs: ${{ toJson(needs) }} diff --git a/.github/workflows/openblas.yml b/.github/workflows/openblas.yml new file mode 100644 index 0000000..54b05bf --- /dev/null +++ b/.github/workflows/openblas.yml @@ -0,0 +1,21 @@ +name: Build MinGW OpenBLAS using MSYS2 toolchain + +on: + pull_request: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "four-packages" + +jobs: + mingw-w64-openblas: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-openblas + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'four-packages' }} + runner_arch: aarch64 + build_with_native: true diff --git a/.github/workflows/openssl.yml b/.github/workflows/openssl.yml new file mode 100644 index 0000000..d1be43b --- /dev/null +++ b/.github/workflows/openssl.yml @@ -0,0 +1,22 @@ +name: Build MinGW OpenSSL using MSYS2 toolchain + +on: + pull_request: + workflow_dispatch: + inputs: + mingw_packages_branch: + description: "MINGW-packages branch to build" + type: string + required: false + default: "four-packages" + +jobs: + mingw-w64-openssl: + uses: ./.github/workflows/build-package.yml + with: + package_name: mingw-w64-openssl + packages_repository: Windows-on-ARM-Experiments/MINGW-packages + packages_branch: ${{ github.event.inputs.mingw_packages_branch || 'four-packages' }} + dependencies: mingw-w64-cross-zlib + runner_arch: aarch64 + build_with_native: true diff --git a/README.md b/README.md index b852617..85aa672 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ It also serves as a documentation of the necessary steps to build them. 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 +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), @@ -18,13 +19,17 @@ resp. Please report any issues related to outputs of the toolchain binaries to repository's [issues list](https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/issues). -## Packages Repository Usage +## 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 +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 ``` @@ -44,14 +49,33 @@ 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 instal native `aarch64-w64-mingw32` host, `aarch64-w64-mingw32` target MinGW toolchain. + ## Building Packages Locally In case one would like to build all the cross-compilation toolchain packages locally, there is -a `build.sh` script. It expects that the +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. + ## MingGW Cross-Compilation Toolchain CI The [mingw-cross-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/main/.github/workflows/mingw-cross-toolchain.yml) @@ -139,7 +163,7 @@ flowchart LR ## MinGW Native Toolchain CI -The [mingw-native-toolchain.yml](https://github.com/Windows-on-ARM-Experiments/msys2-woarm64-build/blob/native-mingw-toolchain/.github/workflows/mingw-native-toolchain.yml) +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 @@ -163,8 +187,8 @@ flowchart LR mingw-w64-libiconv `"]:::DONE - mingw-w64-libtre-git["` - mingw-w64-libtre-git + mingw-w64-libtre["` + mingw-w64-libtre `"]:::DONE mingw-w64-libsystre["` @@ -234,7 +258,7 @@ flowchart LR subgraph Dependencies mingw-w64-libiconv - mingw-w64-libtre-git --> mingw-w64-libsystre + mingw-w64-libtre --> mingw-w64-libsystre mingw-w64-libsystre --> mingw-w64-ncurses mingw-w64-ncurses --> mingw-w64-gettext diff --git a/build-cross.sh b/build-cross.sh new file mode 100644 index 0000000..5f7d310 --- /dev/null +++ b/build-cross.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +export FLAVOR=CROSS +export CLEAN_BUILD=1 + +source `dirname ${BASH_SOURCE[0]}`/config.sh + +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` + +function build_package () { + PACKAGE=$1 + REPOSITORY=${2:-MSYS2} + echo "::group::Build $PACKAGE" + pushd ../$REPOSITORY-packages/$PACKAGE + 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 $REPOSITORY + 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 $REPOSITORY + fi + if [[ "$PACKAGE" == mingw-w64-cross-mingwarm64-crt ]]; then + $ROOT_DIR/.github/scripts/pthread-headers-hack-after.sh + fi + popd + echo "::endgroup::" +} + +.github/scripts/clean-cross.sh +.github/scripts/install-dependencies.sh +.github/scripts/enable-ccache.sh + +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-with-cross.sh b/build-native-with-cross.sh new file mode 100644 index 0000000..00da334 --- /dev/null +++ b/build-native-with-cross.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +export FLAVOR=NATIVE_WITH_CROSS +export CLEAN_BUILD=1 + +source `dirname ${BASH_SOURCE[0]}`/config.sh + +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` + +function build_package () { + PACKAGE=$1 + REPOSITORY=${2:-MINGW} + echo "::group::Build $PACKAGE" + pushd ../$REPOSITORY-packages/$PACKAGE + INSTALL_PACKAGE=1 \ + $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY + popd + echo "::endgroup::" +} + +.github/scripts/setup-repository.sh +.github/scripts/setup-mingwarm64.sh + +.github/scripts/clean-native.sh +.github/scripts/install-dependencies.sh +.github/scripts/enable-ccache.sh + +build_package mingw-w64-libiconv +build_package mingw-w64-libtre +build_package mingw-w64-libsystre +build_package mingw-w64-gettext +build_package mingw-w64-ncurses +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-native-with-native.sh b/build-native-with-native.sh new file mode 100644 index 0000000..3d62a8f --- /dev/null +++ b/build-native-with-native.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +export FLAVOR=NATIVE_WITH_NATIVE +export CLEAN_BUILD=1 + +source `dirname ${BASH_SOURCE[0]}`/config.sh + +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` + +function build_package () { + PACKAGE=$1 + REPOSITORY=${2:-MINGW} + echo "::group::Build $PACKAGE" + pushd ../$REPOSITORY-packages/$PACKAGE + INSTALL_PACKAGE=1 \ + $ROOT_DIR/.github/scripts/build-package.sh $REPOSITORY + popd + echo "::endgroup::" +} + +.github/scripts/setup-repository.sh +.github/scripts/setup-mingwarm64.sh + +.github/scripts/clean-native.sh +.github/scripts/install-dependencies.sh +.github/scripts/enable-ccache.sh + +build_package mingw-w64-libtool +build_package mingw-w64-ninja +build_package mingw-w64-pkgconf +build_package mingw-w64-autotools +build_package autotools-wrappers MSYS2 +build_package mingw-w64-gperf +build_package mingw-w64-libiconv +build_package mingw-w64-libtre +build_package mingw-w64-libsystre +build_package mingw-w64-gettext +build_package mingw-w64-ncurses +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-libmangle-git +build_package mingw-w64-tools-git +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/config.sh b/config.sh new file mode 100644 index 0000000..ee68f4a --- /dev/null +++ b/config.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e # exit on error +set -x # echo on +set -o pipefail # fail of any command in pipeline is an error + +FLAVOR=${FLAVOR:-NATIVE_WITH_NATIVE} + +CLEAN_BUILD=${CLEAN_BUILD:-0} +INSTALL_PACKAGE=${INSTALL_PACKAGE:-0} +NO_EXTRACT=${NO_EXTRACT:-0} 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..93a046d --- /dev/null +++ b/patches/makepkg/0001-mingwarm64.patch @@ -0,0 +1,53 @@ +--- a/etc/makepkg_mingw.conf ++++ b/etc/makepkg_mingw.conf +@@ -33,7 +33,20 @@ + ######################################################################### + # + +-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="gcc" ++ CXX="g++" ++ CPPFLAGS= ++ CFLAGS="-march=armv8-a -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1" ++ CXXFLAGS="$CFLAGS -static-libstdc++" ++ LDFLAGS="" ++ RUSTFLAGS="-Cforce-frame-pointers=yes" ++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 ++ ;; + CLANG64) + MSYSTEM_PREFIX='/clang64' + MSYSTEM_CARCH='x86_64' +--- 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' 'clang64' 'clangarm64' 'ucrt64') ++MINGW_ARCH_ALLOWED=('mingw32' 'mingw64' 'mingwarm64' '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 \ No newline at end of file diff --git a/patches/makepkg/0002-mingwarm64-cross-build.patch b/patches/makepkg/0002-mingwarm64-cross-build.patch new file mode 100644 index 0000000..87561f4 --- /dev/null +++ b/patches/makepkg/0002-mingwarm64-cross-build.patch @@ -0,0 +1,79 @@ +--- a/etc/makepkg_mingw.conf ++++ b/etc/makepkg_mingw.conf +@@ -44,8 +44,14 @@ + MINGW_CHOST="aarch64-w64-mingw32" + MINGW_PREFIX="/mingwarm64" + MINGW_PACKAGE_PREFIX="mingw-w64-aarch64" +- CC="gcc" +- CXX="g++" ++ CC="aarch64-w64-mingw32-gcc" ++ CXX="aarch64-w64-mingw32-g++" ++ RC="aarch64-w64-mingw32-windres" ++ WINDRES="aarch64-w64-mingw32-windres" ++ RANLIB="aarch64-w64-mingw32-ranlib" ++ STRIP="aarch64-w64-mingw32-strip" ++ OBJDUMP="aarch64-w64-mingw32-objdump" ++ OBJCOPY="aarch64-w64-mingw32-objcopy" + CPPFLAGS= + CFLAGS="-march=armv8-a -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1" + 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.1:/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 RANLIB 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 \ No newline at end of file diff --git a/patches/makepkg/0003-enable-debug.patch b/patches/makepkg/0003-enable-debug.patch new file mode 100644 index 0000000..76bf111 --- /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) \ No newline at end of file diff --git a/patches/pacman/0001-add-woarm64-repository.patch b/patches/pacman/0001-add-woarm64-cross-repository.patch similarity index 99% rename from patches/pacman/0001-add-woarm64-repository.patch rename to patches/pacman/0001-add-woarm64-cross-repository.patch index 5931616..55fc7dc 100644 --- a/patches/pacman/0001-add-woarm64-repository.patch +++ b/patches/pacman/0001-add-woarm64-cross-repository.patch @@ -10,4 +10,4 @@ + [clangarm64] Include = /etc/pacman.d/mirrorlist.mingw - + \ No newline at end of file diff --git a/patches/pacman/0002-add-woarm64-native-repository.patch b/patches/pacman/0002-add-woarm64-native-repository.patch new file mode 100644 index 0000000..807b2b1 --- /dev/null +++ b/patches/pacman/0002-add-woarm64-native-repository.patch @@ -0,0 +1,13 @@ +--- a/etc/pacman.conf ++++ b/etc/pacman.conf +@@ -70,6 +70,10 @@ + # Server = https://repo.msys2.org/staging/ + # SigLevel = Never + ++[woarm64-native] ++Server = https://windows-on-arm-experiments.github.io/msys2-woarm64-build/aarch64 ++SigLevel = Optional ++ + [clangarm64] + Include = /etc/pacman.d/mirrorlist.mingw +