#!/usr/bin/make -f

export DH_VERBOSE = 1

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/rustc/architecture.mk

export CARGO_HOME=$(CURDIR)/debian/cargo_home
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export DEB_CARGO_CRATE=pack2_0.1.0

CARGO=/usr/share/cargo/bin/cargo

%:
	dh $@

execute_after_dh_auto_configure:
	rm Cargo.lock
	mkdir -p $(CURDIR)/debian/vendor
	$(CARGO) prepare-debian $(CURDIR)/debian/vendor --link-from-system --manifest-path Cargo.toml

override_dh_auto_build:
	$(CARGO) build --release

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(CARGO) test
endif

execute_after_dh_auto_clean:
	$(CARGO) clean
	rm -rf $(CURDIR)/debian/cargo_home
	rm -rf $(CURDIR)/debian/vendor

override_dh_dwz:
