#!/usr/bin/make -f
%:
	dh $@ --buildsystem cargo --with bash-completion

# The hyperfine-scripts package is Architecture: all and contains no Rust code,
# so a binary-indep-only build must not run the cargo buildsystem at all
# (dh_auto_configure would fail: no Cargo lib or bin package to build).
override_dh_auto_configure-indep:
override_dh_auto_build-indep:
override_dh_auto_test-indep:
override_dh_auto_install-indep:

override_dh_auto_test-arch:
	dh_auto_test -- test --all || true

override_dh_installman-arch:
	help2man \
		--name hyperfine \
		--no-info \
		debian/hyperfine/usr/bin/hyperfine > debian/hyperfine.1
	dh_installman -O--buildsystem=cargo

override_dh_dwz:
	# Don't do anything. fails because of the
	# https://github.com/rust-lang/rust/issues/66118

override_dh_auto_install-arch:
	dh_auto_install --destdir=debian/hyperfine

override_dh_install:
	dh_install
	set -e; for f in scripts/*.py; do \
		n=$$(basename $$f .py | tr '_' '-'); \
		install -D -m 755 $$f debian/hyperfine-scripts/usr/bin/hyperfine-$$n; \
	done
