- A daemon keeps running the copy it was started from, so after an update the old one ran until the next login and nothing said so; clients compared only the major protocol version. Every build now carries a UUID, the daemon reports it as ServerInfo.build_id under protocol 1.3, and a daemon too old to report one counts as outdated. - The window shows a notice above every page when the daemon it reached is another build, with both versions. Update now registers the copy that was opened as the service and restarts the daemon from it; Not now puts the notice away. Nothing is restarted unless the user asks, so two copies open at once cannot replace each other's daemon in turn. A newer daemon is offered as Use this version, and one the service did not start, or one reached with --socket, gets no button. - service install --start now stops a running daemon before registering and starting, so the daemon started is the program that was asked. Under systemd and Task Scheduler it used to rewrite the registration and leave the old daemon running, since starting a running service does nothing. - service status says when the daemon is another build than the program asked, and --json carries same_build. - The App Store app stops a daemon another build of the app left running and starts its own, instead of attaching to it. - Packaging sets MIDI_HARBOR_BUILD_ID once for everything a run builds, because the App Store app, its helper and each architecture are compiled separately and must agree. Packages of one release share an identifier, so neither replaces the other's daemon.
67 lines
2.9 KiB
Bash
Executable file
67 lines
2.9 KiB
Bash
Executable file
#!/bin/sh
|
|
# Builds "Midi Harbor.app" and a disk image holding it on a Mac, under target/package/macos.
|
|
# `make snapshot` and `make release` make the same through GoReleaser; this is for building one
|
|
# without Docker, or signed with a Developer ID certificate from the keychain.
|
|
#
|
|
# packaging/macos/build.sh [--app-store]
|
|
#
|
|
# --app-store builds the sandboxed App Store variant instead, under target/package/macos-app-store:
|
|
# the full program as the app and the headless build as the daemon it starts
|
|
# (specs/014-mac-app-store-mode/contracts/bundle.md), and the installer package App Store Connect
|
|
# takes when .signing/app-store.provisionprofile exists. `make appstore` runs it.
|
|
#
|
|
# Signs and notarizes as packaging/macos/bundle.sh describes. Builds universal binaries
|
|
# when the x86_64 target is installed (rustup target add x86_64-apple-darwin), and binaries for
|
|
# this Mac otherwise.
|
|
set -eu
|
|
|
|
cd "$(dirname "$0")/../.."
|
|
version=$(cat VERSION)
|
|
build=${CARGO_TARGET_DIR:-target}
|
|
# One identifier for every binary in the bundle. The app and its helper are built separately,
|
|
# and each architecture too, and the app replaces a daemon whose identifier is not its own.
|
|
MIDI_HARBOR_BUILD_ID=${MIDI_HARBOR_BUILD_ID:-$(uuidgen | tr '[:upper:]' '[:lower:]')}
|
|
export MIDI_HARBOR_BUILD_ID
|
|
universal=
|
|
if rustup target list --installed | grep -qx x86_64-apple-darwin \
|
|
&& rustup target list --installed | grep -qx aarch64-apple-darwin; then
|
|
universal=yes
|
|
else
|
|
echo "x86_64-apple-darwin is not installed; building for $(uname -m) only" >&2
|
|
fi
|
|
|
|
# build_binary <target directory> [cargo flags] builds midi-harbor into the target directory and
|
|
# prints the path of the binary to bundle, universal when both targets are installed.
|
|
build_binary() {
|
|
dir=$1
|
|
shift
|
|
if [ -n "$universal" ]; then
|
|
CARGO_TARGET_DIR="$dir" cargo build --release --target aarch64-apple-darwin "$@" >&2
|
|
CARGO_TARGET_DIR="$dir" cargo build --release --target x86_64-apple-darwin "$@" >&2
|
|
lipo -create -output "$dir/release/midi-harbor-universal" \
|
|
"$dir/aarch64-apple-darwin/release/midi-harbor" \
|
|
"$dir/x86_64-apple-darwin/release/midi-harbor"
|
|
echo "$dir/release/midi-harbor-universal"
|
|
else
|
|
CARGO_TARGET_DIR="$dir" cargo build --release "$@" >&2
|
|
echo "$dir/release/midi-harbor"
|
|
fi
|
|
}
|
|
|
|
# Build.
|
|
binary=$(build_binary "$build")
|
|
if [ "${1:-}" = --app-store ]; then
|
|
# The headless build goes to a target directory of its own, since it is the same package
|
|
# built with other features and would otherwise overwrite the full binary.
|
|
helper=$(build_binary "$build/headless" --no-default-features)
|
|
out=target/package/macos-app-store
|
|
rm -rf "$out"
|
|
mkdir -p "$out"
|
|
packaging/macos/bundle.sh --helper "$helper" "$binary" "$version" "$out"
|
|
exit 0
|
|
fi
|
|
|
|
# Bundle.
|
|
rm -rf target/package/macos
|
|
mkdir -p target/package/macos
|
|
packaging/macos/bundle.sh "$binary" "$version" target/package/macos
|