Something went wrong. Try again.
All-in-one editor for Paper Mario (N64) mods diorama64.starhaven.dev
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940#!/bin/sh# SPDX-FileCopyrightText: 2026 Alexander Bates <alex@bates64.com>## SPDX-License-Identifier: 0BSD
# Builds the macOS disk image without macOS, which electron-builder can't:# an HFS+ volume holding the app, an Applications shortcut, and the# background, laid out by dmg-layout.py and compressed with LZFSE, like# electron-builder.yml's ULMO. Run from the cross devshell.## scripts/make-dmg.sh dist/mac-universal/Diorama64.app dist/Diorama64.dmg
set -eu
here=$(cd "$(dirname "$0")" && pwd)app=$1out=$2name=$(basename "$app" .app)
work=$(mktemp -d)trap 'rm -rf "$work"' EXIT
mkdir -p "$work/stage/.background"# One TIFF holding both resolutions, which is how Finder picks the Retina# one. Each needs its own DPI, or Finder draws the 1x one at half size.magick "$here/../build/background.png" -units PixelsPerInch -set density 72 \ \( "$here/../build/background@2x.png" -units PixelsPerInch -set density 144 \) \ -compress lzw "$work/stage/.background/background.tiff"cp -a "$app" "$work/stage/"ln -s /Applications "$work/stage/Applications"
# The volume is fixed-size, so leave room for the filesystem's own data.size=$(($(du -sm "$work/stage" | cut -f1) * 115 / 100 + 20))truncate -s "${size}M" "$work/volume.hfs"mkfs.hfsplus -v "$name" "$work/volume.hfs" >/dev/nullhfsplus "$work/volume.hfs" addall "$work/stage" -s clone_link >/dev/nullpython3 "$here/dmg-layout.py" "$work/DS_Store" "$name" "$name.app"hfsplus "$work/volume.hfs" add "$work/DS_Store" /.DS_Storedmg build "$work/volume.hfs" "$out" -c lzfse >/dev/null