#!/usr/bin/make -f

#export DH_VERBOSE = 1

#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

include /usr/share/dpkg/architecture.mk

# Disable because the test seems to hang.
export SKIP_RHBZ1285847_SH=1
export SKIP_TEST_VIRT_SYSPREP_SCRIPT_SH=1
export SKIP_TEST_VIRT_BUILDER_SH=1

#TEST_ARCHITECTURES := i386 amd64 arm64 riscv64 ppc64el

%:
	dh $@

override_dh_auto_test:
ifneq "" "$(findstring $(DEB_HOST_ARCH),$(TEST_ARCHITECTURES))"
	printenv
	unset XDG_RUNTIME_DIR; \
		if ! test -w /dev/kvm; then \
			export LIBGUESTFS_BACKEND_SETTINGS=force_tcg; \
		fi; \
		export LIBGUESTFS_DEBUG=1 LIBGUESTFS_TRACE=1; \
		$(MAKE) check
endif

override_dh_auto_install:
	dh_auto_install
	sed -i -e '1s,.*,#!/usr/bin/perl,' debian/guestfs-tools/usr/bin/virt-win-reg
