From bcf82d42bc92e65a2a7f8c867bbe5c64d54eb6af Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Tue, 5 May 2026 19:30:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20arm64=20?= =?UTF-8?q?=E5=8F=AF=E6=89=A7=E8=A1=8C=E6=96=87=E4=BB=B6=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=B5=8C=E5=85=A5=E6=9E=84=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSYS2 CLANGARM64 环境下使用 llvm-windres,需使用 LLVM target triple (aarch64-w64-mingw32) 而非 GNU BFD 格式 (pe-aarch64)。新增双格式变量 并增强 windres 检测逻辑,通过 --version 输出区分 GNU/LLVM 工具。 --- Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4cc6a56..9a3fb03 100644 --- a/Makefile +++ b/Makefile @@ -35,13 +35,15 @@ ifeq ($(TARGET_ARCH),arm64) APPIMAGE_ARCH := aarch64 DEB_ARCH := arm64 RPM_ARCH := aarch64 -WINDOWS_WINDRES_FORMAT := pe-aarch64 +WINDOWS_WINDRES_FORMAT_BFD := pe-aarch64 +WINDOWS_WINDRES_FORMAT_LLVM := aarch64-w64-mingw32 WINDOWS_RESOURCE := rsrc_windows_arm64.syso else APPIMAGE_ARCH := x86_64 DEB_ARCH := amd64 RPM_ARCH := x86_64 -WINDOWS_WINDRES_FORMAT := pe-x86-64 +WINDOWS_WINDRES_FORMAT_BFD := pe-x86-64 +WINDOWS_WINDRES_FORMAT_LLVM := x86_64-w64-mingw32 WINDOWS_RESOURCE := rsrc_windows_amd64.syso endif @@ -177,13 +179,16 @@ _desktop-prepare-embedfs: _desktop-prepare-windows-resource: _check-windows-target-arch @printf 'Preparing Windows $(TARGET_ARCH) executable icon...\n' - @if [ "$(TARGET_ARCH)" = "arm64" ] && [ "$(WINDRES)" = "windres" ] && command -v llvm-windres >/dev/null 2>&1; then \ + @WINDRES_CMD="$(WINDRES)"; \ + WINDRES_FMT="$(WINDOWS_WINDRES_FORMAT_BFD)"; \ + if command -v llvm-windres >/dev/null 2>&1; then \ WINDRES_CMD=llvm-windres; \ - else \ - WINDRES_CMD="$(WINDRES)"; \ + WINDRES_FMT="$(WINDOWS_WINDRES_FORMAT_LLVM)"; \ + elif "$$WINDRES_CMD" --version 2>&1 | grep -qi LLVM; then \ + WINDRES_FMT="$(WINDOWS_WINDRES_FORMAT_LLVM)"; \ fi; \ command -v "$$WINDRES_CMD" >/dev/null 2>&1 || { printf 'Missing windres tool: %s\n' "$$WINDRES_CMD"; exit 1; }; \ - cd backend/cmd/desktop && "$$WINDRES_CMD" -O coff -F $(WINDOWS_WINDRES_FORMAT) -i icon_windows.rc -o $(WINDOWS_RESOURCE) + cd backend/cmd/desktop && "$$WINDRES_CMD" -O coff -F "$$WINDRES_FMT" -i icon_windows.rc -o $(WINDOWS_RESOURCE) # ============================================ # 发布资产