#!/usr/bin/make -f
# -*- makefile -*-

ifneq ($(DEB_HOST_ARCH_OS),linux)
TMPCONF_OPTS= --enable-portmidi=no
else
TMPCONF_OPTS= --enable-portmidi=yes
endif

%:
	dh $@ --with autoreconf

TMPHOME := $(shell mktemp --tmpdir --directory denemo-build.XXXXXXXXXX)
export XDG_RUNTIME_DIR=$(TMPHOME)/xdg-rundir

override_dh_autoreconf:
	dh_autoreconf
	intltoolize --copy --force --automake

override_dh_auto_configure:
	dh_auto_configure -- $(TMPCONF_OPTS)

override_dh_auto_test:
ifneq ($(DEB_BUILD_ARCH),$(filter $(DEB_BUILD_ARCH),s390x hurd-i386 ppc64el))
	mkdir -p $(TMPHOME)/xdg-runtime-dir
	chmod 0700 $(TMPHOME)/xdg-runtime-dir
	GUILE_AUTO_COMPILE=0 VERBOSE=1 dh_auto_test
endif
	rm -rf $(TMPHOME)
