diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 74624eb..b03c388 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -135,6 +135,18 @@ jobs: mkdir -p build cd build + # Git Bash 的 /usr/bin 里也有个 link.exe(coreutils 的硬链接工具), + # 必须把 MSVC 的 bin 放到 PATH 最前面,nmake 才会用真正的 link.exe + cl_path=$(command -v cl.exe || command -v cl || true) + if [ -z "$cl_path" ]; then + echo "PATH 里找不到 cl.exe" >&2 + exit 1 + fi + msvc_bin=$(dirname "$cl_path") + export PATH="$msvc_bin:$PATH" + echo "cl: $(command -v cl)" + echo "link: $(command -v link)" + qmake ../VoiletMark.pro CONFIG+=release nmake release || nmake if [ -f release/VoiletMark.exe ]; then @@ -236,6 +248,18 @@ jobs: grep -q arm64 /tmp/arch.txt "$QT_PREFIX/bin/macdeployqt" VoiletMark.app -always-overwrite + + # 只留平台插件和样式插件;虚拟键盘 / 打印 / 图片格式这些用不到, + # 留着只会把 Homebrew 的 dylib 拖进来 + rm -rf VoiletMark.app/Contents/PlugIns/virtualkeyboard \ + VoiletMark.app/Contents/PlugIns/platforminputcontexts \ + VoiletMark.app/Contents/PlugIns/printsupport \ + VoiletMark.app/Contents/PlugIns/iconengines \ + VoiletMark.app/Contents/PlugIns/imageformats \ + VoiletMark.app/Contents/PlugIns/networkinformation \ + VoiletMark.app/Contents/PlugIns/tls \ + VoiletMark.app/Contents/PlugIns/bearer + otool -L VoiletMark.app/Contents/MacOS/VoiletMark | head -30 - name: 收 Homebrew 依赖 + ad-hoc 签名 @@ -292,6 +316,15 @@ jobs: macdeployqt VoiletMark.app -always-overwrite + rm -rf VoiletMark.app/Contents/PlugIns/virtualkeyboard \ + VoiletMark.app/Contents/PlugIns/platforminputcontexts \ + VoiletMark.app/Contents/PlugIns/printsupport \ + VoiletMark.app/Contents/PlugIns/iconengines \ + VoiletMark.app/Contents/PlugIns/imageformats \ + VoiletMark.app/Contents/PlugIns/networkinformation \ + VoiletMark.app/Contents/PlugIns/tls \ + VoiletMark.app/Contents/PlugIns/bearer + - name: 收依赖 + ad-hoc 签名 run: | set -euo pipefail diff --git a/README.md b/README.md index 41a48e9..eb774fa 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 一个轻量的跨平台 Markdown 编辑器,基于 **Qt 5 / C++17** 构建。 -当前版本 **0.12.4**。 +当前版本 **0.12.5**。 ## 界面 @@ -231,7 +231,7 @@ PR 或手动运行时编译,并打出下面这些安装包。 ### 发 Release -- 打 tag:`git tag v0.12.4 && git push origin v0.12.4`(同步到 GitHub 时把 tag 一起推过去) +- 打 tag:`git tag v0.12.5 && git push origin v0.12.4`(同步到 GitHub 时把 tag 一起推过去) - 不打 tag:**Actions → 安装包 → Run workflow**,勾上 **publish**,会用 `v<版本>` 当 tag - 普通推送 / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的 diff --git a/VoiletMark.pro b/VoiletMark.pro index e13eb06..8a5ccab 100644 --- a/VoiletMark.pro +++ b/VoiletMark.pro @@ -1,11 +1,14 @@ TEMPLATE = app TARGET = VoiletMark -VERSION = 0.12.4 +VERSION = 0.12.5 QT += core gui widgets CONFIG += c++17 warn_on +# 源码是 UTF-8(含中文和 ▾ 之类的符号),MSVC 默认按本地代码页会串码 / 报 C4566 +msvc: QMAKE_CXXFLAGS += /utf-8 + # 让 main.cpp 里的 QStringLiteral(VM_VERSION) 拿到版本号字符串 DEFINES += VM_VERSION=\\\"$$VERSION\\\" diff --git a/packaging/macos/bundle-libs.sh b/packaging/macos/bundle-libs.sh index 2cda616..12b256e 100755 --- a/packaging/macos/bundle-libs.sh +++ b/packaging/macos/bundle-libs.sh @@ -13,6 +13,10 @@ fi frameworks=$app/Contents/Frameworks mkdir -p "$frameworks" +list_macho() { + find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -print +} + round=0 while [ "$round" -lt 12 ]; do round=$((round + 1)) @@ -26,21 +30,31 @@ while [ "$round" -lt 12 ]; do if [ ! -f "$frameworks/$base" ]; then cp "$dep" "$frameworks/$base" chmod 755 "$frameworks/$base" - install_name_tool -id "@executable_path/../Frameworks/$base" "$frameworks/$base" >/dev/null 2>&1 || true + install_name_tool -id "@executable_path/../Frameworks/$base" "$frameworks/$base" 2>/dev/null || true changed=1 fi - install_name_tool -change "$dep" "@executable_path/../Frameworks/$base" "$file" >/dev/null 2>&1 || true + if ! install_name_tool -change "$dep" "@executable_path/../Frameworks/$base" "$file" 2>/dev/null; then + echo "改写引用失败: $file <- $dep" >&2 + fi ;; esac - done < <(otool -L "$file" | tail -n +2 | awk '{print $1}') - done < <(find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -print) + done < <(otool -L "$file" 2>/dev/null | tail -n +2 | awk '{print $1}') + done < <(list_macho) [ "$changed" -eq 1 ] || break done -left=$(find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -exec otool -L {} + 2>/dev/null | grep -E '^[[:space:]]*(/opt/homebrew|/usr/local)/' | wc -l | tr -d ' ') -if [ "$left" -ne 0 ]; then - echo "还有 $left 个 Homebrew 依赖没处理:" >&2 - find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -exec otool -L {} + 2>/dev/null | grep -E '^[[:space:]]*(/opt/homebrew|/usr/local)/' | head -20 >&2 +remaining=$(mktemp) +while IFS= read -r file; do + otool -L "$file" 2>/dev/null | tail -n +2 \ + | awk -v f="$file" '$1 ~ /^\/(opt\/homebrew|usr\/local)\// { print f ": " $1 }' +done < <(list_macho) > "$remaining" + +if [ -s "$remaining" ]; then + echo "还有 Homebrew 依赖没处理:" >&2 + head -30 "$remaining" >&2 + rm -f "$remaining" exit 1 fi +rm -f "$remaining" +echo "Homebrew 依赖已经收进 app"