Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build-on-Windows-Arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Windows-Arm64.yml
# File Authors : NewbieXvwu <newbiexvwu@gmail.com>
# Contributors : Nul None <nul@none.org>
# |
# 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
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 来使用
# --------------------------------------------------------------
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
! ---------------------------------------------------------- -->

<div align="center">
Expand Down Expand Up @@ -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
```

</details>
Expand Down
6 changes: 4 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 环境
Expand Down Expand Up @@ -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 {''}

Expand Down
1 change: 1 addition & 0 deletions src/chsrc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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贡献者:
Expand Down
7 changes: 5 additions & 2 deletions src/framework/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* ------------------------------------------------------------*/
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions src/recipe/os/pacman/MSYS2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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, "请针对你的架构下载安装此目录下的文件:",
Expand Down
4 changes: 3 additions & 1 deletion tool/download-pre-on-GitHub.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# ---------------------------------------------------------------
# File Name : download-pre-on-GitHub.ps1
# File Authors : Aoran Zeng <ccmywish@qq.com>
# Contributors : NewbieXvwu <newbiexvwu@gmail.com>
# 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
Expand All @@ -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'
Expand Down
6 changes: 4 additions & 2 deletions tool/installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# | ChatGPT <https://chatgpt.com/>
# | 曾奥然 <ccmywish@qq.com>
# Contributors : GitHub Copilot <https://github.com/copilot>
# | NewbieXvwu <newbiexvwu@gmail.com>
# |
# Created On : <2024-10-26>
# Last Modified : <2026-01-06>
# Last Modified : <2026-07-22>
#
# chsrc installer for Windows
# ---------------------------------------------------------------
Expand Down Expand Up @@ -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"
Expand Down