#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --datadir=/usr/share/games --bindir=/usr/games --without-ggi --with-sdl --with-mikmod --with-sdl-mixer

override_dh_autoreconf:
# The code uses an old gettext Makefile.in.in which needs mkinstalldirs
	cp tools/mkinstalldirs .
	dh_autoreconf
	mv mkinstalldirs tools

override_dh_autoreconf_clean:
	cp tools/mkinstalldirs .
	dh_autoreconf_clean
	mv mkinstalldirs tools

override_dh_auto_build-arch:
# Keep the pre-built manpages
# (heroes needs to touch the home directory which fails on buildds)
	cp man/*.6 .
# Make sure we don't try to rebuild doc/heroes.texi (see #816269)
	touch doc/heroes.texi
	dh_auto_build
	mv *.6 man

override_dh_fixperms-arch:
	dh_fixperms
	chown root:games debian/heroes/usr/games/heroes
	chmod g+s debian/heroes/usr/games/heroes

override_dh_install-arch:
	dh_install
	rm -rf debian/heroes/usr/share/games/heroes

override_dh_auto_test:
	srcdir=$(CURDIR)/tests VERBOSE=1 dh_auto_test
