From 8f8e586a965c5bbfcfb711696cae570456825bdd Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Tue, 21 Jul 2026 22:38:50 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20WoA=20(Windows=20ARM64?= =?UTF-8?q?)=20=E7=9A=84=20GitHub=20Action=20=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 build-on-Windows-ARM64.yml: 使用 windows-11-arm runner + MSYS2 CLANGARM64 工具链编译原生 aarch64 版 chsrc-aarch64-windows.exe - 重命名 build-on-Windows.yml -> build-on-Windows-x64x86.yml 以区分 - Makefile/justfile: Windows 下 clang 的 target triple 改为按架构自适应, 不再硬编码 x86_64,使 CLANGARM64 下也能正确编译 - installer.ps1: 识别 ARM64 (架构值 12) 并映射到 aarch64 - README: 增加 ARM64/WoA 手动下载说明 --- .github/workflows/build-on-Windows-ARM64.yml | 55 +++++++++++++++++++ ...indows.yml => build-on-Windows-x64x86.yml} | 8 +-- Makefile | 6 +- README.md | 3 + justfile | 3 +- tool/installer.ps1 | 6 +- 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build-on-Windows-ARM64.yml rename .github/workflows/{build-on-Windows.yml => build-on-Windows-x64x86.yml} (92%) diff --git a/.github/workflows/build-on-Windows-ARM64.yml b/.github/workflows/build-on-Windows-ARM64.yml new file mode 100644 index 00000000..bddc20f3 --- /dev/null +++ b/.github/workflows/build-on-Windows-ARM64.yml @@ -0,0 +1,55 @@ +# --------------------------------------------------------------- +# Workflow File : build-on-Windows-ARM64.yml +# File Authors : NewbieXvwu +# Contributors : Nul None +# | +# Created On : <2026-07-21> +# Last Modified : <2026-07-21> +# +# Build chsrc on Windows (ARM64/WoA) and upload it to GitHub: the 'pre' release +# --------------------------------------------------------------- + +name: 构建于 Windows ARM64 + +on: + push: + branches: [ "gh-build" ] + +jobs: + build-and-upload: + # windows-11-arm 为原生 WoA (Windows on ARM) runner,已 GA + runs-on: windows-11-arm + defaults: + run: + shell: msys2 {0} + + steps: + + - name: 检出代码 + uses: actions/checkout@v6 + + - name: 安装 Clang (CLANGARM64) + uses: msys2/setup-msys2@v2 + with: + # CLANGARM64 提供原生 AArch64 的 clang 工具链 + msystem: CLANGARM64 + update: true + install: | + mingw-w64-clang-aarch64-clang + mingw-w64-clang-aarch64-make + + - name: 为 arm64 (AArch64) 构建 + run: | + mingw32-make.exe build-in-ci-release-mode + mv chsrc-ci-release.exe chsrc-aarch64-windows.exe + + - name: List files + run: ls *.exe + + - name: 上传至 'pre' release + uses: softprops/action-gh-release@v2 + # if: startsWith(github.ref, 'refs/tags/') + with: + tag_name: pre + files: | + chsrc-aarch64-windows.exe diff --git a/.github/workflows/build-on-Windows.yml b/.github/workflows/build-on-Windows-x64x86.yml similarity index 92% rename from .github/workflows/build-on-Windows.yml rename to .github/workflows/build-on-Windows-x64x86.yml index 182f4e62..fdf3042a 100644 --- a/.github/workflows/build-on-Windows.yml +++ b/.github/workflows/build-on-Windows-x64x86.yml @@ -1,15 +1,15 @@ # --------------------------------------------------------------- -# Workflow File : build-on-Windows.yml +# Workflow File : build-on-Windows-x64x86.yml # File Authors : 曾奥然 -# Contributors : Nul None +# Contributors : NewbieXvwu # | # Created On : <2023-09-14> -# Last Modified : <2025-09-12> +# Last Modified : <2026-07-21> # # Build chsrc on Windows and upload it to GitHub: the 'pre' release # --------------------------------------------------------------- -name: 构建于 Windows +name: 构建于 Windows x64x86 on: push: branches: [ "gh-build" ] diff --git a/Makefile b/Makefile index 9797adab..9dfeabf4 100755 --- a/Makefile +++ b/Makefile @@ -60,7 +60,11 @@ endif CFLAGS += -Iinclude -Ilib ifeq ($(On-Windows), 1) - CLANG_FLAGS = -target x86_64-pc-windows-gnu + # 依据 MSYS2 环境的目标架构选择 clang 的 target triple + # MSYSTEM_CARCH 由 MSYS2 提供: x86_64 (MINGW64/UCRT64/CLANG64) / i686 (MINGW32) / aarch64 (CLANGARM64) + # 非 MSYS2 环境 (独立 LLVM) 下回退到 x86_64 + Windows-Clang-Arch = $(if $(MSYSTEM_CARCH),$(MSYSTEM_CARCH),x86_64) + CLANG_FLAGS = -target $(Windows-Clang-Arch)-pc-windows-gnu endif ifeq ($(CC), clang) diff --git a/README.md b/README.md index 601d0249..6f2be9e9 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,9 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-windo # x86 curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x86-windows.exe -o chsrc.exe + +# arm64/aarch64 (WoA, Windows on ARM) +curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-aarch64-windows.exe -o chsrc.exe ``` diff --git a/justfile b/justfile index 19875242..0d1ad521 100644 --- a/justfile +++ b/justfile @@ -48,7 +48,8 @@ DEBUGGER := if os() == 'windows' { CFLAGS_chk_Clang := if os() == 'windows' { if CC == 'clang' { - '-target x86_64-pc-windows-gnu' + # arch() 返回当前架构 (x86_64 / aarch64),以适配原生 WoA 环境 + '-target ' + arch() + '-pc-windows-gnu' } else {''} } else {''} diff --git a/tool/installer.ps1 b/tool/installer.ps1 index ebdcfd26..d92c8059 100644 --- a/tool/installer.ps1 +++ b/tool/installer.ps1 @@ -6,9 +6,10 @@ # | ChatGPT # | 曾奥然 # Contributors : GitHub Copilot +# | NewbieXvwu # | # Created On : <2024-10-26> -# Last Modified : <2026-01-06> +# Last Modified : <2026-07-21> # # chsrc installer for Windows # --------------------------------------------------------------- @@ -155,8 +156,9 @@ function Set_URL { $script:arch = "x86" } } + 12 { $script:arch = "aarch64" } default { - Output_Error "Unsupported architecture '$cpuArchitecture'. Only x86 or x64 architectures are supported." + Output_Error "Unsupported architecture '$cpuArchitecture'. Only x86, x64 or ARM64 architectures are supported." } } Output_Info "Get my CPU architecture: $script:arch" From 40d7cd3f1d0a24a22ff4643161b510d44a2d2626 Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Tue, 21 Jul 2026 23:00:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=94=AF=E6=8C=81=20WoA=20(Windows=20ARM64?= =?UTF-8?q?)=20=E7=9A=84=20CPU=20=E6=9E=B6=E6=9E=84=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chsrc_get_cpuarch() 的 Windows 分支: - 增加 PROCESSOR_ARCHITECTURE_ARM64 分支,映射为 aarch64, 避免原生 ARM64 构建走到 default 分支报错退出 - 改用 GetNativeSystemInfo,使 x64 版在 WoA 上模拟运行时 也能报告真实的原生架构,而非被模拟的 x86_64 --- src/framework/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/framework/core.c b/src/framework/core.c index d0ce5832..b80a7fe8 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -9,9 +9,10 @@ * | @Yangmoooo * | @BingChunMoLi * | @Mikachu2333 + * | @NewbieXvwu * | * Created On : <2023-08-29> - * Last Modified : <2026-05-22> + * Last Modified : <2026-07-21> * * chsrc framework * ------------------------------------------------------------*/ @@ -1989,12 +1990,14 @@ chsrc_get_cpuarch () #if XY_Build_On_Windows SYSTEM_INFO info; - GetSystemInfo (&info); + GetNativeSystemInfo (&info); WORD num = info.wProcessorArchitecture; switch (num) { case PROCESSOR_ARCHITECTURE_AMD64: ret = "x86_64"; break; + case PROCESSOR_ARCHITECTURE_ARM64: + ret = "aarch64"; break; case PROCESSOR_ARCHITECTURE_ARM: ret = "arm"; break; case PROCESSOR_ARCHITECTURE_INTEL: From 388c5243fc3f6f61b103caa3b906acbed4a9950e Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Tue, 21 Jul 2026 23:00:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=A1=A5=E5=85=A8=20MSYS2=20=E6=8D=A2?= =?UTF-8?q?=E6=BA=90=E7=9A=84=20mirrorlist=20=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原先只备份 mingw32/mingw64/msys,遗漏了 ucrt64/clang64/clangarm64 (clangarm64 为 WoA 上使用的环境)。sed 替换本就通过 mirrorlist* 通配 覆盖了这些文件,此处补齐备份以保证可完整还原。 --- src/recipe/os/pacman/MSYS2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 9746c0de..fa4e6f58 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -10,7 +10,7 @@ os_msys2_prelude () chef_prep_this (os_msys2, s); chef_set_recipe_created_on (this, "2023-09-06"); - chef_set_recipe_last_updated (this, "2025-08-10"); + chef_set_recipe_last_updated (this, "2026-07-21"); chef_set_sources_last_updated (this, "2025-06-20"); chef_set_chef (this, NULL); @@ -47,6 +47,9 @@ os_msys2_setsrc (char *option) chsrc_backup ("/etc/pacman.d/mirrorlist.mingw32"); chsrc_backup ("/etc/pacman.d/mirrorlist.mingw64"); + chsrc_backup ("/etc/pacman.d/mirrorlist.ucrt64"); + chsrc_backup ("/etc/pacman.d/mirrorlist.clang64"); + chsrc_backup ("/etc/pacman.d/mirrorlist.clangarm64"); chsrc_backup ("/etc/pacman.d/mirrorlist.msys"); char *prev = xy_strcat (3, "请针对你的架构下载安装此目录下的文件:", From 9e0c406c178eabe6779c7164b1c834767ed971ef Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Wed, 22 Jul 2026 14:22:31 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=BF=98=E5=8E=9F=20build-on-Windows=20wor?= =?UTF-8?q?kflow=20=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D=EF=BC=88=E5=85=B6?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E7=BC=96=E8=AF=91=20Android=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E9=9C=80=E6=8C=89=E6=9E=B6=E6=9E=84=E5=8C=BA=E5=88=86?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{build-on-Windows-x64x86.yml => build-on-Windows.yml} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{build-on-Windows-x64x86.yml => build-on-Windows.yml} (92%) diff --git a/.github/workflows/build-on-Windows-x64x86.yml b/.github/workflows/build-on-Windows.yml similarity index 92% rename from .github/workflows/build-on-Windows-x64x86.yml rename to .github/workflows/build-on-Windows.yml index fdf3042a..182f4e62 100644 --- a/.github/workflows/build-on-Windows-x64x86.yml +++ b/.github/workflows/build-on-Windows.yml @@ -1,15 +1,15 @@ # --------------------------------------------------------------- -# Workflow File : build-on-Windows-x64x86.yml +# Workflow File : build-on-Windows.yml # File Authors : 曾奥然 -# Contributors : NewbieXvwu +# Contributors : Nul None # | # Created On : <2023-09-14> -# Last Modified : <2026-07-21> +# Last Modified : <2025-09-12> # # Build chsrc on Windows and upload it to GitHub: the 'pre' release # --------------------------------------------------------------- -name: 构建于 Windows x64x86 +name: 构建于 Windows on: push: branches: [ "gh-build" ] From fb4aa713a0d6ebcf6ce64717dd6db64591847844 Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Wed, 22 Jul 2026 14:22:56 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=A7=84=E8=8C=83=20Windows=20Arm64=20?= =?UTF-8?q?=E5=91=BD=E5=90=8D=EF=BC=8C=E4=BA=A7=E7=89=A9=E6=9B=B4=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=20chsrc-arm64-windows.exe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ws-ARM64.yml => build-on-Windows-Arm64.yml} | 18 +++++++++--------- README.md | 7 ++++--- tool/download-pre-on-GitHub.ps1 | 4 +++- tool/installer.ps1 | 6 +++--- 4 files changed, 19 insertions(+), 16 deletions(-) rename .github/workflows/{build-on-Windows-ARM64.yml => build-on-Windows-Arm64.yml} (70%) diff --git a/.github/workflows/build-on-Windows-ARM64.yml b/.github/workflows/build-on-Windows-Arm64.yml similarity index 70% rename from .github/workflows/build-on-Windows-ARM64.yml rename to .github/workflows/build-on-Windows-Arm64.yml index bddc20f3..333d2393 100644 --- a/.github/workflows/build-on-Windows-ARM64.yml +++ b/.github/workflows/build-on-Windows-Arm64.yml @@ -1,15 +1,15 @@ # --------------------------------------------------------------- -# Workflow File : build-on-Windows-ARM64.yml +# Workflow File : build-on-Windows-Arm64.yml # File Authors : NewbieXvwu # Contributors : Nul None # | # Created On : <2026-07-21> -# Last Modified : <2026-07-21> +# Last Modified : <2026-07-22> # -# Build chsrc on Windows (ARM64/WoA) and upload it to GitHub: the 'pre' release +# Build chsrc on Windows (Arm64/WoA) and upload it to GitHub: the 'pre' release # --------------------------------------------------------------- -name: 构建于 Windows ARM64 +name: 构建于 Windows Arm64 on: push: @@ -17,7 +17,7 @@ on: jobs: build-and-upload: - # windows-11-arm 为原生 WoA (Windows on ARM) runner,已 GA + # windows-11-arm 为原生 WoA (Windows on Arm) runner,已 GA runs-on: windows-11-arm defaults: run: @@ -31,17 +31,17 @@ jobs: - name: 安装 Clang (CLANGARM64) uses: msys2/setup-msys2@v2 with: - # CLANGARM64 提供原生 AArch64 的 clang 工具链 + # CLANGARM64 提供原生 Arm64 的 clang 工具链 msystem: CLANGARM64 update: true install: | mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-make - - name: 为 arm64 (AArch64) 构建 + - name: 为 Arm64 构建 run: | mingw32-make.exe build-in-ci-release-mode - mv chsrc-ci-release.exe chsrc-aarch64-windows.exe + mv chsrc-ci-release.exe chsrc-arm64-windows.exe - name: List files run: ls *.exe @@ -52,4 +52,4 @@ jobs: with: tag_name: pre files: | - chsrc-aarch64-windows.exe + chsrc-arm64-windows.exe diff --git a/README.md b/README.md index 6f2be9e9..de13f6f9 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ ! Doc Authors : @ccmywish ! Contributors : @Mikachu2333 ! | @BingChunMoLi + ! | @NewbieXvwu ! | ! Created On : <2023-12-28> - ! Last Modified : <2026-02-24> + ! Last Modified : <2026-07-22> ! ---------------------------------------------------------- -->
@@ -193,8 +194,8 @@ curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-windo # x86 curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x86-windows.exe -o chsrc.exe -# arm64/aarch64 (WoA, Windows on ARM) -curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-aarch64-windows.exe -o chsrc.exe +# Arm64 (WoA, Windows on Arm) +curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-arm64-windows.exe -o chsrc.exe ``` diff --git a/tool/download-pre-on-GitHub.ps1 b/tool/download-pre-on-GitHub.ps1 index 06e2757a..63a00ca4 100644 --- a/tool/download-pre-on-GitHub.ps1 +++ b/tool/download-pre-on-GitHub.ps1 @@ -3,8 +3,9 @@ # --------------------------------------------------------------- # File Name : download-pre-on-GitHub.ps1 # File Authors : Aoran Zeng +# Contributors : NewbieXvwu # Created On : <2023-09-21> -# Last Modified : <2025-08-07> +# Last Modified : <2026-07-22> # # Download all files from the `pre` release on GitHub: # https://github.com/RubyMetric/chsrc/releases/tag/pre @@ -20,6 +21,7 @@ $destination = (Resolve-Path $destination).Path $names = @( 'chsrc-x64-windows.exe' 'chsrc-x86-windows.exe' + 'chsrc-arm64-windows.exe' 'chsrc-aarch64-macos' 'chsrc-x64-macos' diff --git a/tool/installer.ps1 b/tool/installer.ps1 index d92c8059..1af5bf2f 100644 --- a/tool/installer.ps1 +++ b/tool/installer.ps1 @@ -9,7 +9,7 @@ # | NewbieXvwu # | # Created On : <2024-10-26> -# Last Modified : <2026-07-21> +# Last Modified : <2026-07-22> # # chsrc installer for Windows # --------------------------------------------------------------- @@ -156,9 +156,9 @@ function Set_URL { $script:arch = "x86" } } - 12 { $script:arch = "aarch64" } + 12 { $script:arch = "arm64" } default { - Output_Error "Unsupported architecture '$cpuArchitecture'. Only x86, x64 or ARM64 architectures are supported." + Output_Error "Unsupported architecture '$cpuArchitecture'. Only x86, x64 or Arm64 architectures are supported." } } Output_Info "Get my CPU architecture: $script:arch" From f1ed4e8cb1caf4f2f574618c0cfc5e0ef23215e5 Mon Sep 17 00:00:00 2001 From: NewbieXvwu Date: Wed, 22 Jul 2026 14:23:08 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=99=BB=E8=AE=B0=E8=B4=A1=E7=8C=AE?= =?UTF-8?q?=E8=80=85=20@NewbieXvwu=20=E8=87=B3=E7=9B=B8=E5=85=B3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B4=E4=B8=8E=20MSYS2=20recipe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 ++- justfile | 3 ++- src/chsrc-main.c | 1 + src/recipe/os/pacman/MSYS2.c | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9dfeabf4..6943fbea 100755 --- a/Makefile +++ b/Makefile @@ -7,9 +7,10 @@ # Contributors : @Yangmoooo # | @sanchuanhehe # | @G_I_Y +# | @NewbieXvwu # | # Created On : <2023-08-28> -# Last Modified : <2026-03-21> +# Last Modified : <2026-07-22> # # 请阅读 ./doc/01-开发与构建.md 来使用 # -------------------------------------------------------------- diff --git a/justfile b/justfile index 0d1ad521..b3041df8 100644 --- a/justfile +++ b/justfile @@ -5,9 +5,10 @@ # Build File : justfile # File Authors : @ccmywish # Contributors : @Mikachu2333 +# | @NewbieXvwu # | # Created On : <2025-06-18> -# Last Modified : <2025-10-15> +# Last Modified : <2026-07-22> # # 该文件主要用于在原生Windows上执行项目的基本任务,而不借助于 # GNU make 以及相应的 MSYS2、Cygwin 环境 diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 813b91fa..2885c20f 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -79,6 +79,7 @@ chsrc_register_contributors () chef_register_contributor ("@MingriLingran", "MingriLingran", "i@linran.moe", NULL); chef_register_contributor ("@usernameisnull", "MaBing", "cumt_ttr@163.com", NULL); chef_register_contributor ("@AnonTokio", "Anon Tokio", "anontokio@163.com", NULL); + chef_register_contributor ("@NewbieXvwu", "Mingzhe Jiang", "newbiexvwu@gmail.com", NULL); /** * AI贡献者: diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index fa4e6f58..82a1fbd9 100644 --- a/src/recipe/os/pacman/MSYS2.c +++ b/src/recipe/os/pacman/MSYS2.c @@ -10,12 +10,12 @@ os_msys2_prelude () chef_prep_this (os_msys2, s); chef_set_recipe_created_on (this, "2023-09-06"); - chef_set_recipe_last_updated (this, "2026-07-21"); + chef_set_recipe_last_updated (this, "2026-07-22"); chef_set_sources_last_updated (this, "2025-06-20"); chef_set_chef (this, NULL); chef_set_cooks (this, 1, "@G_I_Y"); - chef_set_sauciers (this, 2, "@ccmywish", "@hezonglun"); + chef_set_sauciers (this, 3, "@ccmywish", "@hezonglun", "@NewbieXvwu"); chef_set_os_scope (this); chef_deny_english(this);