Files
musyx/tool/bundle-macos.sh
T
Yuriy Panov 60156aba94 feat: media keys, device recovery, settings and a macOS app bundle
- Media keys and Now Playing (souvlaki): title, artist, album, cover and
  position published on track and state changes; play/pause/toggle,
  next/previous and seeking from the OS controls
- Audio engine reopens the default output when the device changes or
  disappears, reloading the current track at the same position; with no
  device it keeps looking and resumes when one appears. Underruns are
  ignored rather than treated as device loss
- Settings screen: streaming quality (Best, Balanced <=192 kbps, Data
  saver <=128 kbps), appearance (system/light/dark), clear cover cache;
  quality, appearance and volume persist as JSON in the config folder
- Bitrate cap chooses the best variant within it, or the smallest above
- Lyrics failures get a retry button
- App icon drawn by tool/make_icon.py; tool/bundle-macos.sh builds an
  ad-hoc signed Musyx.app (--install copies it to /Applications)
- Release profile: thin LTO and stripped symbols
2026-10-15 16:28:07 +06:00

61 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds Musyx.app (release, ad-hoc signed) into target/release/bundle/.
# tool/bundle-macos.sh # build the bundle
# tool/bundle-macos.sh --install # and copy it to /Applications
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && pwd)"
cd "$root"
version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
bundle="target/release/bundle/Musyx.app"
cargo build --release -p musyx
rm -rf "$bundle"
mkdir -p "$bundle/Contents/MacOS" "$bundle/Contents/Resources"
cp target/release/musyx "$bundle/Contents/MacOS/Musyx"
# Icon: every size macOS asks for, from the 1024px master.
iconset="$(mktemp -d)/Musyx.iconset"
mkdir -p "$iconset"
master="crates/musyx/assets/icon/musyx.png"
for size in 16 32 128 256 512; do
sips -z "$size" "$size" "$master" --out "$iconset/icon_${size}x${size}.png" >/dev/null
double=$((size * 2))
sips -z "$double" "$double" "$master" --out "$iconset/icon_${size}x${size}@2x.png" >/dev/null
done
iconutil -c icns "$iconset" -o "$bundle/Contents/Resources/Musyx.icns"
cat > "$bundle/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>Musyx</string>
<key>CFBundleDisplayName</key><string>Musyx</string>
<key>CFBundleIdentifier</key><string>dev.musyx.desktop</string>
<key>CFBundleExecutable</key><string>Musyx</string>
<key>CFBundleIconFile</key><string>Musyx</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>${version}</string>
<key>CFBundleVersion</key><string>${version}</string>
<key>LSMinimumSystemVersion</key><string>11.0</string>
<key>LSApplicationCategoryType</key><string>public.app-category.music</string>
<key>NSHighResolutionCapable</key><true/>
<key>NSHumanReadableCopyright</key><string>Unofficial Yandex Music client. Not affiliated with Yandex.</string>
</dict>
</plist>
PLIST
# Ad-hoc signature: enough to run locally. Each new build is a new identity to the
# keychain, so macOS may ask once to allow access to the saved sign-in.
codesign --force --deep --sign - "$bundle"
echo "Built $bundle ($version)"
if [[ "${1:-}" == "--install" ]]; then
rm -rf "/Applications/Musyx.app"
cp -R "$bundle" /Applications/
echo "Installed /Applications/Musyx.app"
fi