#!/usr/bin/make -f

DEB_HOST_ARCH_OS        ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
# see #842978
DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

%:
	dh $@

override_dh_installchangelogs:
	dh_installchangelogs doc/NEWS

# autoconf/make contain *.mk~ files that are needed for the build
override_dh_prep:
	dh_prep -Xmk~

override_dh_clean:
	dh_clean -Xmk~

override_dh_auto_build:
	dh_auto_build -- LD=$(DEB_HOST_GNU_TYPE)-ld

# upstream tests fail with non-C locales
# Functions msgsnd, msgrcv, msgget, msgctl are not yet implemented on GNU/Hurd
override_dh_auto_test:
ifeq (hurd,$(DEB_HOST_ARCH_OS))
	mv tests/018-remote-format .
	mv tests/019-remote-cksum .
	dh_auto_test
	mv ./018-remote-format ./tests
	mv ./019-remote-cksum ./tests
else
	dh_auto_test
endif
