#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export CARGO_TERM_COLOR = never

%:
	dh $@

override_dh_auto_configure:
	# Cargo is the authoritative build system; no generated configure step.

override_dh_auto_build:
	cargo build --release --locked

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cargo test --locked
endif

override_dh_auto_install:
	install -D -m0755 target/release/rust-proxy debian/rustproxy/usr/bin/rust-proxy
	install -D -m0640 debian/rustproxy.environment debian/rustproxy/etc/rustproxy/environment
	install -D -m0644 grafana/rustproxy-overview.json debian/rustproxy/usr/share/rustproxy/grafana/rustproxy-overview.json
	install -D -m0644 grafana/README.md debian/rustproxy/usr/share/doc/rustproxy/grafana/README.md
