#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,defs
export DEB_CPPFLAGS_MAINT_APPEND = -DBUILD_DATE='"$(shell date --utc --date=@${SOURCE_DATE_EPOCH} +%Y-%m-%d)"'

%:
	dh $@ --with bash-completion

override_dh_auto_install:
	dh_auto_install --max-parallel=1 -- \
		SETUP_BINARIES=crispy-doom-setup \
		DOC_FILES="README.md" \
		execgamesdir=/usr/games \
		appdatadir=/usr/share/metainfo
	# avoid clashing with chocolate-doom (contents is currently identical)
	mv debian/crispy-doom/usr/share/man/man5/default.cfg.5 \
	   debian/crispy-doom/usr/share/man/man5/crispy_default.cfg.5
	sed -i 's/Exec=crispy-setup/Exec=crispy-doom-setup/' \
            debian/crispy-doom/usr/share/applications/crispy-setup.desktop
	# superfluous docs
	rm debian/crispy-doom/usr/share/doc/crispy-doom/CMDLINE.doom \
	      debian/crispy-doom/usr/share/doc/crispy-doom/INSTALL.doom \
	      debian/crispy-doom/usr/share/doc/crispy-doom/NOT-BUGS.md
