fix: 修复 Windows arm64 可执行文件图标嵌入构建失败
MSYS2 CLANGARM64 环境下使用 llvm-windres,需使用 LLVM target triple (aarch64-w64-mingw32) 而非 GNU BFD 格式 (pe-aarch64)。新增双格式变量 并增强 windres 检测逻辑,通过 --version 输出区分 GNU/LLVM 工具。
This commit is contained in:
17
Makefile
17
Makefile
@@ -35,13 +35,15 @@ ifeq ($(TARGET_ARCH),arm64)
|
|||||||
APPIMAGE_ARCH := aarch64
|
APPIMAGE_ARCH := aarch64
|
||||||
DEB_ARCH := arm64
|
DEB_ARCH := arm64
|
||||||
RPM_ARCH := aarch64
|
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
|
WINDOWS_RESOURCE := rsrc_windows_arm64.syso
|
||||||
else
|
else
|
||||||
APPIMAGE_ARCH := x86_64
|
APPIMAGE_ARCH := x86_64
|
||||||
DEB_ARCH := amd64
|
DEB_ARCH := amd64
|
||||||
RPM_ARCH := x86_64
|
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
|
WINDOWS_RESOURCE := rsrc_windows_amd64.syso
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -177,13 +179,16 @@ _desktop-prepare-embedfs:
|
|||||||
|
|
||||||
_desktop-prepare-windows-resource: _check-windows-target-arch
|
_desktop-prepare-windows-resource: _check-windows-target-arch
|
||||||
@printf 'Preparing Windows $(TARGET_ARCH) executable icon...\n'
|
@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; \
|
WINDRES_CMD=llvm-windres; \
|
||||||
else \
|
WINDRES_FMT="$(WINDOWS_WINDRES_FORMAT_LLVM)"; \
|
||||||
WINDRES_CMD="$(WINDRES)"; \
|
elif "$$WINDRES_CMD" --version 2>&1 | grep -qi LLVM; then \
|
||||||
|
WINDRES_FMT="$(WINDOWS_WINDRES_FORMAT_LLVM)"; \
|
||||||
fi; \
|
fi; \
|
||||||
command -v "$$WINDRES_CMD" >/dev/null 2>&1 || { printf 'Missing windres tool: %s\n' "$$WINDRES_CMD"; exit 1; }; \
|
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)
|
||||||
|
|
||||||
# ============================================
|
# ============================================
|
||||||
# 发布资产
|
# 发布资产
|
||||||
|
|||||||
Reference in New Issue
Block a user