Windows: a hand-written NSIS script (per user, no administrator prompt, installs under the profile's Programs folder; one program file; a Start Menu entry named Wanderbooks with the icon; an uninstaller listed in Settings > Apps that removes only what the installer put in its own folder and never names the data folder). The installer asks the person to quit the app fully before it replaces or removes the program. An optional Authenticode signing step runs only when its secrets exist. macOS: the .app is assembled by a script (Info.plist with the bundle identifier, version, name, Documents-folder purpose string; the one program at Contents/MacOS/wanderbooks; the licences), signed with the hardened runtime and an empty entitlements file that says why, put in a dmg with an Applications shortcut, notarized and stapled when the owner's Apple identity is given and skipped with a notice when not. The program is one universal binary (lipo of the two release builds). Linux: both desktop entries name the window's app id and the icon; the rpm now installs the icon; the deb, the pacman tarball and the rpm all carry LICENSE-MIT and LICENSE-APACHE beside the notices. One version: deploy/packaging/version.sh reads crates/ledger-cli's Cargo.toml; every script takes it from there. Tests read the scripts and build a bundle with a stand-in program. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
58 lines
3.1 KiB
Bash
Executable File
58 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# The Linux packages (P11a step 3), from the release program already built
|
|
# at target/release/wanderbooks (`cargo build --release -p ledger-cli`).
|
|
#
|
|
# build-linux.sh [VERSION] [FORMATS]
|
|
#
|
|
# Puts into target/packages/VERSION/: the .deb, the AppImage and the
|
|
# pacman tarball with its PKGBUILD (cargo-packager), and the .rpm
|
|
# (cargo-generate-rpm). VERSION defaults to the program's own; a different
|
|
# one repackages the same program under that version, which is how the
|
|
# install-and-upgrade test gets its second release. FORMATS is
|
|
# cargo-packager's list (default deb,appimage,pacman); the .rpm is always
|
|
# built. Run from the repository root.
|
|
#
|
|
# The program is target/release/wanderbooks, or the file WB_PROGRAM names:
|
|
# a package must run on the oldest system it claims, and a program linked
|
|
# on a newer one (this machine's glibc) fails there with "GLIBC_2.43 not
|
|
# found". CI builds on ubuntu-24.04; `just test-linux-packages` builds in a
|
|
# Debian trixie container.
|
|
set -euo pipefail
|
|
own=$(sed -n 's/^version = "\(.*\)"/\1/p' crates/ledger-cli/Cargo.toml | head -n1)
|
|
version=${1:-$own}
|
|
formats=${2:-deb,appimage,pacman}
|
|
out="target/packages/$version"
|
|
program=${WB_PROGRAM:-target/release/wanderbooks}
|
|
test -x "$program" || { echo "build the release program first: cargo build --release -p ledger-cli" >&2; exit 1; }
|
|
rm -rf "$out"; mkdir -p "$out"
|
|
stage="target/packages/.stage-$version"
|
|
rm -rf "$stage"; mkdir -p "$stage"
|
|
cp "$program" "$stage/wanderbooks"
|
|
config=$(mktemp --suffix=.toml)
|
|
trap 'rm -f "$config"' EXIT
|
|
# cargo-packager reads paths relative to the config file, which is in /tmp
|
|
# here, so they are made absolute.
|
|
sed "s/^version = \".*\"/version = \"$version\"/
|
|
s#^out-dir = .*#out-dir = \"$PWD/$out\"#
|
|
s#\"target/release\"#\"$PWD/$stage\"#
|
|
s#\"deploy/packaging/#\"$PWD/deploy/packaging/#
|
|
s#\"LICENSE-MIT\"#\"$PWD/LICENSE-MIT\"#
|
|
s#^\"LICENSE-APACHE\"#\"$PWD/LICENSE-APACHE\"#
|
|
s#^\"THIRD-PARTY-NOTICES.txt\"#\"$PWD/THIRD-PARTY-NOTICES.txt\"#" \
|
|
deploy/packaging/packager.toml >"$config"
|
|
# The AppImage tools are themselves AppImages; run them without FUSE.
|
|
export APPIMAGE_EXTRACT_AND_RUN=1
|
|
cargo packager --config "$config" --formats "$formats" --release
|
|
assets='assets = [
|
|
{ source = "'$PWD/$stage'/wanderbooks", dest = "/usr/bin/wanderbooks", mode = "0755" },
|
|
{ source = "deploy/packaging/install-method-rpm", dest = "/usr/share/wanderbooks/install-method", mode = "0644" },
|
|
{ source = "deploy/packaging/wanderbooks-static.desktop", dest = "/usr/share/applications/wanderbooks.desktop", mode = "0644" },
|
|
{ source = "deploy/packaging/icons/512x512.png", dest = "/usr/share/icons/hicolor/512x512/apps/wanderbooks.png", mode = "0644" },
|
|
{ source = "LICENSE-MIT", dest = "/usr/share/doc/wanderbooks/LICENSE-MIT", mode = "0644" },
|
|
{ source = "LICENSE-APACHE", dest = "/usr/share/doc/wanderbooks/LICENSE-APACHE", mode = "0644" },
|
|
{ source = "THIRD-PARTY-NOTICES.txt", dest = "/usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt", mode = "0644" },
|
|
]'
|
|
cargo generate-rpm -p crates/ledger-cli --set-metadata "version=\"$version\"" --set-metadata "$assets" -o "$out/"
|
|
rm -rf "$stage"
|
|
ls -l "$out"
|