9571a621 by 柴进

:package: build_mac_universal.sh 输出 .dmg, 绕开 NAS 吞 symlink 的坑

背景: lehe 机器启动崩是因为 SMB 传输吃掉了 PIL/.dylibs -> __dot__dylibs
内层 symlink, 导致 libtiff dlopen 断链.

修复: 构建脚本新增 hdiutil create 步骤打包 DMG (UDZO 压缩). DMG 是
HFS+ 镜像, symlink 完整保留, 用户挂载 -> 拖拽到 Applications 即用.

以后发 DMG, 不要直接拷贝 .app 目录.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a8148856
......@@ -74,19 +74,38 @@ rm -rf build dist
echo "Building executable..."
pyinstaller ZB100ImageGenerator.spec
# 验证构建结果
if [ -d "dist/ZB100ImageGenerator.app" ]; then
# 验证 .app 构建结果
if [ ! -d "dist/ZB100ImageGenerator.app" ]; then
echo "================================"
echo "Build successful!"
echo "Architecture: $ARCH"
echo "Application: dist/ZB100ImageGenerator.app"
echo "Build failed! (.app not produced)"
echo "================================"
exit 1
fi
# 显示 app 信息
ls -lh dist/ZB100ImageGenerator.app/Contents/MacOS/
else
# 打包 DMG 作为分发格式
# 为什么必须: .app 里有嵌套 symlink (PIL/.dylibs -> __dot__dylibs),
# cp/NAS/SMB/微信 等传输方式可能吞掉内层 symlink 导致目标机启动失败.
# .dmg 是 HFS+ 镜像, symlink 原样保存, 用户挂载拖拽即用.
echo "Creating DMG..."
DMG_PATH="dist/ZB100ImageGenerator.dmg"
rm -f "$DMG_PATH"
hdiutil create \
-volname "ZB100ImageGenerator" \
-srcfolder "dist/ZB100ImageGenerator.app" \
-ov -format UDZO \
"$DMG_PATH"
if [ ! -f "$DMG_PATH" ]; then
echo "================================"
echo "Build failed!"
echo "Build partially failed: .app OK but DMG creation failed"
echo "================================"
exit 1
fi
echo "================================"
echo "Build successful!"
echo "Architecture: $ARCH"
echo " App: dist/ZB100ImageGenerator.app ($(du -sh dist/ZB100ImageGenerator.app | awk '{print $1}'))"
echo " DMG: $DMG_PATH ($(du -sh "$DMG_PATH" | awk '{print $1}'))"
echo "================================"
echo "分发请用 DMG, 不要直接拷贝 .app 目录 (symlink 易丢)."
......