diff --git a/.github/workflows/build-on-Windows-Arm64.yml b/.github/workflows/build-on-Windows-Arm64.yml new file mode 100644 index 00000000..333d2393 --- /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-22> +# +# 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 提供原生 Arm64 的 clang 工具链 + msystem: CLANGARM64 + update: true + install: | + mingw-w64-clang-aarch64-clang + mingw-w64-clang-aarch64-make + + - name: 为 Arm64 构建 + run: | + mingw32-make.exe build-in-ci-release-mode + mv chsrc-ci-release.exe chsrc-arm64-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-arm64-windows.exe diff --git a/Makefile b/Makefile index 9797adab..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 来使用 # -------------------------------------------------------------- @@ -60,7 +61,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..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> ! ---------------------------------------------------------- -->
@@ -192,6 +193,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 (WoA, Windows on Arm) +curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-arm64-windows.exe -o chsrc.exe ``` diff --git a/justfile b/justfile index 19875242..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 环境 @@ -48,7 +49,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/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/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: diff --git a/src/recipe/os/pacman/MSYS2.c b/src/recipe/os/pacman/MSYS2.c index 9746c0de..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, "2025-08-10"); + 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); @@ -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, "请针对你的架构下载安装此目录下的文件:", 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 ebdcfd26..1af5bf2f 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-22> # # chsrc installer for Windows # --------------------------------------------------------------- @@ -155,8 +156,9 @@ function Set_URL { $script:arch = "x86" } } + 12 { $script:arch = "arm64" } 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"