#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_configure:
	find vendor/ -name .cargo-checksum.json | xargs sed -i 's/"files":{[^}]*}/"files":{}/'
	sed 's|/usr/local|/usr|' -i resources/xwayland-satellite.service

override_dh_auto_build:
	cargo build --frozen --release --features systemd

override_dh_auto_install:
	install -Dm755 target/release/xwayland-satellite debian/xwayland-satellite/usr/bin/xwayland-satellite
	install -Dm644 resources/xwayland-satellite.service debian/xwayland-satellite/usr/lib/systemd/user/xwayland-satellite.service

override_dh_auto_test:
	export XDG_RUNTIME_DIR=$$(mktemp -d); \
	cargo test --all --exclude niri-visual-tests --frozen || echo "Tests failed, but continuing..."
