#!/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" < CFBundleNameMusyx CFBundleDisplayNameMusyx CFBundleIdentifierdev.musyx.desktop CFBundleExecutableMusyx CFBundleIconFileMusyx CFBundlePackageTypeAPPL CFBundleShortVersionString${version} CFBundleVersion${version} LSMinimumSystemVersion11.0 LSApplicationCategoryTypepublic.app-category.music NSHighResolutionCapable NSHumanReadableCopyrightUnofficial Yandex Music client. Not affiliated with Yandex. 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