#!/usr/bin/make -f

# resolve DEB_DISTRIBUTION
include /usr/share/dpkg/pkg-info.mk

# resolve if release is experimental
DEB_SUITE_EXP = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

# use local fork of debcargo and dh-cargo
PATH := $(CURDIR)/debian/dh-cargo/bin:$(PATH)
PERL5LIB = $(CURDIR)/debian/dh-cargo/lib
export PATH PERL5LIB

%:
	dh $@ --buildsystem cargo

# check also ignored-by-default tests that use local crate quickcheck-ext
override_dh_auto_test:
	dh_auto_test -- --no-fail-fast $(if $(DEB_SUITE_EXP),|| true)

# avoid cleaning unless source is patched
override_dh_auto_clean:
	grep -q '"core"' Cargo.toml || dh_auto_clean
