#!/bin/bash # Build the patched lan-mouse daemon into ~/.local/bin/lan-mouse-patched. # Rationale and the upstream bug are in REBUILD.md. Called by ../install.sh. set -euo pipefail # Arch extra 0.11.0-1. Pinned because the patch is against these exact line numbers; # a newer upstream may have fixed this, in which case check before repinning. commit=0d2190e787db9e482e17d4c16fb7c00ef4841bcb here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) command -v cargo >/dev/null || { echo "cargo not found -- install the 'rust' package first" >&2 exit 1 } # Build in a throwaway dir: the source tree is a build input, not something to keep. work=$(mktemp -d) trap 'rm -rf "$work"' EXIT git clone --quiet https://github.com/feschber/lan-mouse.git "$work/lan-mouse" cd "$work/lan-mouse" git checkout --quiet "$commit" git apply "$here/accelerated-deltas.patch" # GTK deliberately excluded: the daemon needs no GUI, and the signed Arch package # still provides it at /usr/bin/lan-mouse. LTO off keeps this at ~1 min. CARGO_PROFILE_RELEASE_LTO=false CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 \ cargo build --release --locked --no-default-features \ --features layer_shell_capture,wlroots_emulation install -Dm755 target/release/lan-mouse ~/.local/bin/lan-mouse-patched echo "installed ~/.local/bin/lan-mouse-patched"