Files
musyx/tool/bundle-macos.sh
T
Yuriy Panov ff41887f30 feat: Russian interface language
Adds an i18n module: strings stay in English in the code and are looked
up as tr("…") or trf("… {} …", args), with Russian in i18n/ru.rs.
Includes Russian plurals, genitive month names, "4,1 млн"-style
compact numbers and localised durations. A test scans the sources and
fails on any string without a Russian entry.

A Language setting (match system, English, Русский) defaults to the
system's first preferred language. Yandex's own titles (genres, Home
blocks, station names) switch with it, through a client rebuilt in that
language. Long genre names now wrap instead of spilling over the next
tile. The app bundle declares en and ru localisations.
2026-10-15 21:49:01 +06:00

71 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds Musyx.app (release, Developer ID signed) into target/release/bundle/.
# tool/bundle-macos.sh # build the bundle
# tool/bundle-macos.sh --install # and copy it to /Applications
# MUSYX_SIGN_IDENTITY picks another signing identity; "-" signs ad hoc.
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"
identity="${MUSYX_SIGN_IDENTITY:-Developer ID Application: Yuriy Panov (H33L24BGUH)}"
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>CFBundleDevelopmentRegion</key><string>en</string>
<key>CFBundleLocalizations</key><array><string>en</string><string>ru</string></array>
<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
# Developer ID with the hardened runtime and a secure timestamp, as notarization requires.
# The identity stays the same across builds, so keychain access to the saved sign-in is
# granted once. An ad-hoc signature is a new identity on every build.
if [[ "$identity" == "-" ]]; then
codesign --force --sign - "$bundle"
else
codesign --force --options runtime --timestamp --sign "$identity" "$bundle"
fi
codesign --verify --strict --verbose=2 "$bundle"
echo "Built $bundle ($version)"
if [[ "${1:-}" == "--install" ]]; then
rm -rf "/Applications/Musyx.app"
cp -R "$bundle" /Applications/
echo "Installed /Applications/Musyx.app"
fi