package-macos.sh 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. # macOS package of a built LYNX.app (shown as LYNX SHARE: CFBundleName): ad-hoc signature (LYNX has no Apple Developer ID, so it is NOT notarized) and a
  3. # compressed .dmg with the app, a link to /Applications and a "read me first" note on how to open it the first time.
  4. #
  5. # usage: scripts/package-macos.sh <LYNX.app> <label> <output folder> [Demo.lynx]
  6. set -euo pipefail
  7. cd "$(dirname "$0")/.."
  8. APP="$1"; LABEL="$2"; OUTDIR="$3"; DEMO="${4:-}"
  9. NAME="LYNX-$LABEL-macos-universal"
  10. STAGE="$(mktemp -d)/LYNX"
  11. mkdir -p "$STAGE" "$OUTDIR"
  12. ditto "$APP" "$STAGE/LYNX.app"
  13. ./scripts/fetch-onnxruntime.sh macos "$STAGE/LYNX.app/Contents/Frameworks"
  14. # ad-hoc signature over the whole bundle: Apple Silicon refuses to run unsigned code, and a consistent bundle
  15. # signature turns "LYNX is damaged" into the normal "unidentified developer" prompt
  16. codesign --force --deep --sign - "$STAGE/LYNX.app"
  17. codesign --verify --deep --strict "$STAGE/LYNX.app"
  18. ln -s /Applications "$STAGE/Applications"
  19. [[ -n "$DEMO" && -f "$DEMO" ]] && cp "$DEMO" "$STAGE/Demo.lynx"
  20. cp LICENSE "$STAGE/LICENSE.txt"
  21. # third-party notices and licence texts, as in the Windows and Linux packages (round 190nk; 0.1.29's .dmg had LICENSE only)
  22. cp THIRD_PARTY.md PRIVACY.md "$STAGE/"
  23. ./scripts/collect-licenses.sh "$STAGE/licenses"
  24. cat > "$STAGE/Read me first.txt" <<'EOF'
  25. LYNX SHARE for macOS (Apple Silicon and Intel, macOS 11 or newer)
  26. 1. Drag LYNX SHARE into the Applications folder.
  27. 2. LYNX SHARE is free software from an independent developer without an Apple Developer ID, so it is not notarized by
  28. Apple. The first time, open it like this:
  29. - Control-click (or right-click) LYNX SHARE in Applications, choose Open, then Open again.
  30. - On macOS 15 Sequoia or newer: try to open LYNX SHARE once, then go to System Settings > Privacy & Security and
  31. click "Open Anyway" next to the message about LYNX.
  32. Or, in Terminal: xattr -dr com.apple.quarantine /Applications/LYNX.app
  33. After that it opens normally.
  34. 3. macOS asks for microphone access the first time you record.
  35. Source code, checksums and help: https://github.com/Ka1-S/LYNX-SHARE
  36. ---
  37. LYNX SHARE para macOS (Apple Silicon e Intel, macOS 11 ou mais novo)
  38. 1. Arraste o LYNX SHARE para a pasta Aplicativos.
  39. 2. O LYNX SHARE é software livre de um desenvolvedor independente sem Apple Developer ID, por isso não é notarizado pela
  40. Apple. Na primeira vez, abra assim:
  41. - Clique com o botão direito (ou Control-clique) no LYNX SHARE em Aplicativos, escolha Abrir e depois Abrir de novo.
  42. - No macOS 15 Sequoia ou mais novo: tente abrir o LYNX SHARE uma vez, depois vá em Ajustes do Sistema > Privacidade e
  43. Segurança e clique em "Abrir Mesmo Assim" ao lado da mensagem sobre o LYNX.
  44. Ou, no Terminal: xattr -dr com.apple.quarantine /Applications/LYNX.app
  45. Depois disso ele abre normalmente.
  46. 3. O macOS pede acesso ao microfone na primeira vez que você gravar.
  47. EOF
  48. rm -f "$OUTDIR/$NAME.dmg"
  49. # hdiutil sometimes fails with "Resource busy" on CI runners (a transient lock on the image); retry a few times
  50. for attempt in 1 2 3 4 5; do
  51. hdiutil create -volname "LYNX SHARE $LABEL" -srcfolder "$STAGE" -fs HFS+ -format UDZO -imagekey zlib-level=9 -ov \
  52. "$OUTDIR/$NAME.dmg" && break
  53. [[ $attempt -lt 5 ]] || exit 1
  54. echo "hdiutil create failed (attempt $attempt), retrying"; sleep $((attempt * 10))
  55. done
  56. hdiutil verify "$OUTDIR/$NAME.dmg"
  57. ls -la "$OUTDIR/$NAME.dmg"