Add Debian packaging and arm64 cross build

cargo-deb metadata produces a .deb with the binary, the packaged user
unit variant, man page and example config; arm64 cross-builds as a
static musl binary via an isolated rustup and rust-lld (recipe in
README). Add MIT LICENSE for the package copyright.
This commit is contained in:
Bastian Mäuser committed 2026-11-05 16:34:47 +01:00
1 parent b4e51a58f6
commit b93c0134dd
9 files changed
+189 -1

No files matched your search

+37
View File
@@ -85,6 +85,43 @@ RUST_LOG=debug btle-proximity --dry-run
Tune `rssi_lock` / `presence_timeout_secs` / `missing_after_secs` to your
room. Then install the user service (runs inside your session, Type=notify):
### Debian package
```sh
cargo install cargo-deb --version 2.12.1 # 3.x needs rustc > 1.85
cargo deb # -> target/debian/btle-proximity_*.deb
sudo apt install ./target/debian/btle-proximity_0.1.0-1_amd64.deb
systemctl --user enable --now btle-proximity
```
Installs the binary to `/usr/bin`, the user unit to
`/usr/lib/systemd/user/`, a man page and the config example to
`/usr/share/doc/btle-proximity/`. Per-user config still lives at
`~/.config/btle-proximity/config.toml`. If you previously installed via
`cargo install`, remove that copy (`cargo uninstall btle-proximity`) to
avoid PATH shadowing.
#### arm64 (aarch64)
Cross-built as a **static musl binary**, so no cross-gcc/sysroot is needed
and the result runs on any arm64 Linux (Ubuntu 24.04/26.04 included). Uses
an isolated rustup under `/tmp` so the distro cargo is not touched:
```sh
export RUSTUP_HOME=/tmp/rustup CARGO_HOME=/tmp/rustup-cargo PATH=/tmp/rustup-cargo/bin:$PATH
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.85.0 --profile minimal --no-modify-path
rustup target add aarch64-unknown-linux-musl
mkdir -p /tmp/lld-bin && ln -sf "$(rustc --print rustlib-dir)"/x86_64-unknown-linux-gnu/bin/rust-lld /tmp/lld-bin/ld.lld
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/tmp/lld-bin/ld.lld
~/.cargo/bin/cargo-deb --target aarch64-unknown-linux-musl --no-strip
# -> target/aarch64-unknown-linux-musl/debian/btle-proximity_*_arm64.deb
```
The `--no-strip` matters: the release profile already strips via the
linker, and the host `strip` cannot read aarch64 objects.
### Manual install (dev flow)
```sh
cp systemd/btle-proximity.service ~/.config/systemd/user/
systemctl --user daemon-reload