Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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-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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

由于 Windows 的消费者面对的大部分是 Arm64 这个称呼,应该考虑直接使用 arm64 这个名称。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件还预编译了安卓,所以改名不必要

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ---------------------------------------------------------------
# Workflow File : build-on-Windows.yml
# Workflow File : build-on-Windows-x64x86.yml
# File Authors : 曾奥然 <ccmywish@qq.com>
# Contributors : Nul None <nul@none.org>
# Contributors : NewbieXvwu <newbiexvwu@gmail.com>
# |
# 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" ]
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理

curl -L https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-aarch64-windows.exe -o chsrc.exe
```

</details>
Expand Down
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {''}

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
5 changes: 4 additions & 1 deletion src/recipe/os/pacman/MSYS2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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
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-21>
#
# chsrc installer for Windows
# ---------------------------------------------------------------
Expand Down Expand Up @@ -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"
Expand Down
Loading