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 ...@@ -74,19 +74,38 @@ rm -rf build dist
74 echo "Building executable..." 74 echo "Building executable..."
75 pyinstaller ZB100ImageGenerator.spec 75 pyinstaller ZB100ImageGenerator.spec
76 76
77 # 验证构建结果 77 # 验证 .app 构建结果
78 if [ -d "dist/ZB100ImageGenerator.app" ]; then 78 if [ ! -d "dist/ZB100ImageGenerator.app" ]; then
79 echo "================================" 79 echo "================================"
80 echo "Build successful!" 80 echo "Build failed! (.app not produced)"
81 echo "Architecture: $ARCH"
82 echo "Application: dist/ZB100ImageGenerator.app"
83 echo "================================" 81 echo "================================"
82 exit 1
83 fi
84 84
85 # 显示 app 信息 85 # 打包 DMG 作为分发格式
86 ls -lh dist/ZB100ImageGenerator.app/Contents/MacOS/ 86 # 为什么必须: .app 里有嵌套 symlink (PIL/.dylibs -> __dot__dylibs),
87 else 87 # cp/NAS/SMB/微信 等传输方式可能吞掉内层 symlink 导致目标机启动失败.
88 # .dmg 是 HFS+ 镜像, symlink 原样保存, 用户挂载拖拽即用.
89 echo "Creating DMG..."
90 DMG_PATH="dist/ZB100ImageGenerator.dmg"
91 rm -f "$DMG_PATH"
92 hdiutil create \
93 -volname "ZB100ImageGenerator" \
94 -srcfolder "dist/ZB100ImageGenerator.app" \
95 -ov -format UDZO \
96 "$DMG_PATH"
97
98 if [ ! -f "$DMG_PATH" ]; then
88 echo "================================" 99 echo "================================"
89 echo "Build failed!" 100 echo "Build partially failed: .app OK but DMG creation failed"
90 echo "================================" 101 echo "================================"
91 exit 1 102 exit 1
92 fi 103 fi
104
105 echo "================================"
106 echo "Build successful!"
107 echo "Architecture: $ARCH"
108 echo " App: dist/ZB100ImageGenerator.app ($(du -sh dist/ZB100ImageGenerator.app | awk '{print $1}'))"
109 echo " DMG: $DMG_PATH ($(du -sh "$DMG_PATH" | awk '{print $1}'))"
110 echo "================================"
111 echo "分发请用 DMG, 不要直接拷贝 .app 目录 (symlink 易丢)."
......