fix: v0.12.5 —— 修 Windows 链接器被 Git Bash 抢、macOS 只部署需要的插件
安装包 / Linux aarch64 (push) Canceled after 0s
安装包 / Linux x86_64 (push) Canceled after 0s
安装包 / Windows x86_64 (push) Canceled after 0s
安装包 / macOS arm64 (Apple Silicon) (push) Canceled after 0s
安装包 / macOS x86_64 (Intel) (push) Canceled after 0s
安装包 / 发布到 Release (push) Canceled after 0s
安装包 / Linux aarch64 (push) Canceled after 0s
安装包 / Linux x86_64 (push) Canceled after 0s
安装包 / Windows x86_64 (push) Canceled after 0s
安装包 / macOS arm64 (Apple Silicon) (push) Canceled after 0s
安装包 / macOS x86_64 (Intel) (push) Canceled after 0s
安装包 / 发布到 Release (push) Canceled after 0s
- Windows:Git Bash 的 /usr/bin/link.exe 会先于 MSVC 的 link.exe 被 nmake 找到, 把 cl.exe 所在目录放到 PATH 最前面;同时给 MSVC 加 /utf-8, 修掉 C4566 和潜在的中文串码 - macOS:macdeployqt 之后删掉 virtualkeyboard / platforminputcontexts / printsupport / iconengines / imageformats / tls / bearer 这些用不到的插件, 它们会把 /opt/homebrew 的一堆 dylib 拖进来 - bundle-libs.sh:改写失败不再静默吞掉,检查时跳过 otool 的文件名行, 失败时打印「文件 <- 依赖」方便定位
This commit is contained in:
@@ -135,6 +135,18 @@ jobs:
|
|||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd 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
|
qmake ../VoiletMark.pro CONFIG+=release
|
||||||
nmake release || nmake
|
nmake release || nmake
|
||||||
if [ -f release/VoiletMark.exe ]; then
|
if [ -f release/VoiletMark.exe ]; then
|
||||||
@@ -236,6 +248,18 @@ jobs:
|
|||||||
grep -q arm64 /tmp/arch.txt
|
grep -q arm64 /tmp/arch.txt
|
||||||
|
|
||||||
"$QT_PREFIX/bin/macdeployqt" VoiletMark.app -always-overwrite
|
"$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
|
otool -L VoiletMark.app/Contents/MacOS/VoiletMark | head -30
|
||||||
|
|
||||||
- name: 收 Homebrew 依赖 + ad-hoc 签名
|
- name: 收 Homebrew 依赖 + ad-hoc 签名
|
||||||
@@ -292,6 +316,15 @@ jobs:
|
|||||||
|
|
||||||
macdeployqt VoiletMark.app -always-overwrite
|
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 签名
|
- name: 收依赖 + ad-hoc 签名
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
一个轻量的跨平台 Markdown 编辑器,基于 **Qt 5 / C++17** 构建。
|
一个轻量的跨平台 Markdown 编辑器,基于 **Qt 5 / C++17** 构建。
|
||||||
|
|
||||||
当前版本 **0.12.4**。
|
当前版本 **0.12.5**。
|
||||||
|
|
||||||
## 界面
|
## 界面
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ PR 或手动运行时编译,并打出下面这些安装包。
|
|||||||
|
|
||||||
### 发 Release
|
### 发 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
|
- 不打 tag:**Actions → 安装包 → Run workflow**,勾上 **publish**,会用 `v<版本>` 当 tag
|
||||||
- 普通推送 / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的
|
- 普通推送 / PR 只上传 artifact,不发 Release——「发布到 Release」显示 skipped 是正常的
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,11 +1,14 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = VoiletMark
|
TARGET = VoiletMark
|
||||||
VERSION = 0.12.4
|
VERSION = 0.12.5
|
||||||
|
|
||||||
QT += core gui widgets
|
QT += core gui widgets
|
||||||
|
|
||||||
CONFIG += c++17 warn_on
|
CONFIG += c++17 warn_on
|
||||||
|
|
||||||
|
# 源码是 UTF-8(含中文和 ▾ 之类的符号),MSVC 默认按本地代码页会串码 / 报 C4566
|
||||||
|
msvc: QMAKE_CXXFLAGS += /utf-8
|
||||||
|
|
||||||
# 让 main.cpp 里的 QStringLiteral(VM_VERSION) 拿到版本号字符串
|
# 让 main.cpp 里的 QStringLiteral(VM_VERSION) 拿到版本号字符串
|
||||||
DEFINES += VM_VERSION=\\\"$$VERSION\\\"
|
DEFINES += VM_VERSION=\\\"$$VERSION\\\"
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ fi
|
|||||||
frameworks=$app/Contents/Frameworks
|
frameworks=$app/Contents/Frameworks
|
||||||
mkdir -p "$frameworks"
|
mkdir -p "$frameworks"
|
||||||
|
|
||||||
|
list_macho() {
|
||||||
|
find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -print
|
||||||
|
}
|
||||||
|
|
||||||
round=0
|
round=0
|
||||||
while [ "$round" -lt 12 ]; do
|
while [ "$round" -lt 12 ]; do
|
||||||
round=$((round + 1))
|
round=$((round + 1))
|
||||||
@@ -26,21 +30,31 @@ while [ "$round" -lt 12 ]; do
|
|||||||
if [ ! -f "$frameworks/$base" ]; then
|
if [ ! -f "$frameworks/$base" ]; then
|
||||||
cp "$dep" "$frameworks/$base"
|
cp "$dep" "$frameworks/$base"
|
||||||
chmod 755 "$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
|
changed=1
|
||||||
fi
|
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
|
esac
|
||||||
done < <(otool -L "$file" | tail -n +2 | awk '{print $1}')
|
done < <(otool -L "$file" 2>/dev/null | tail -n +2 | awk '{print $1}')
|
||||||
done < <(find "$app" -type f \( -perm -111 -o -name '*.dylib' \) -print)
|
done < <(list_macho)
|
||||||
|
|
||||||
[ "$changed" -eq 1 ] || break
|
[ "$changed" -eq 1 ] || break
|
||||||
done
|
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 ' ')
|
remaining=$(mktemp)
|
||||||
if [ "$left" -ne 0 ]; then
|
while IFS= read -r file; do
|
||||||
echo "还有 $left 个 Homebrew 依赖没处理:" >&2
|
otool -L "$file" 2>/dev/null | tail -n +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
|
| 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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
rm -f "$remaining"
|
||||||
|
echo "Homebrew 依赖已经收进 app"
|
||||||
|
|||||||
Reference in New Issue
Block a user