#!/usr/bin/make -f

export CARGO_HOME = $(CURDIR)/debian/cargo-home
CARGO_NET_OFFLINE = true
export CARGO_NET_OFFLINE
export CARGO_PROFILE_RELEASE_DEBUG = 1

%:
	dh $@ --buildsystem=none

override_dh_auto_configure:
	mkdir -p debian/vendor
	tar -xJf debian/vendor.tar.xz -C debian/vendor

override_dh_auto_build:
	cargo build --offline --locked --release

override_dh_auto_test:
	cargo test --offline --locked

override_dh_fixperms:
	dh_fixperms
	find debian/chainsaw/usr/share/chainsaw -type f -exec chmod 0644 {} +

override_dh_auto_clean:
	cargo clean
	rm -rf debian/cargo-home debian/vendor
