#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/default.mk
include /usr/share/rustc/architecture.mk
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export PATH := /usr/share/cargo/bin:$(PATH)
export CARGO=/usr/share/cargo/bin/cargo
export CARGO_HOME=$(CURDIR)/debian/cargo_home
export DEB_CARGO_CRATE=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)

#testsuite_failing_archs := armhf
#ifneq (,$(filter $(DEB_HOST_ARCH),$(testsuite_failing_archs)))
#  fail_param := || true
#endif

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/cargo_registry

# Use the Debian crates to build
override_dh_auto_configure:
	$(CARGO) prepare-debian debian/cargo_registry --link-from-system
	rm -f $(CURDIR)/plugins/webengineurlinterceptor/adblock/Cargo.lock
	dh_auto_configure

override_dh_auto_test:
#	- xvfb-run -- dh_auto_test --no-parallel $(fail_param)
