#!/usr/bin/make -f
export DH_VERBOSE=1

PKG_DIR = debian/gtkhash
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --with-gtk=3.0 --enable-mhash --enable-nautilus --enable-thunar --enable-nemo

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_makeshlibs:
	dh_makeshlibs -Xlibgtkhash-properties

override_dh_install:
	dh_install --list-missing

override_dh_auto_install:
	dh_auto_install
	# Make sure there will be no *.la file
	find debian -name "*.la" -delete

override_dh_autoreconf:
	mv m4/glib-gettext.m4 m4/glib-gettext.m4.old
	# Replace glib-gettext.m4 with a newest file
	cp /usr/share/aclocal/glib-gettext.m4 m4/
	dh_autoreconf --as-needed

# Replace the upstream M4 files.
override_dh_clean:
	dh_clean
	# Restore upstream glib-gettext.m4
	[ ! -f m4/glib-gettext.m4.old ] || mv m4/glib-gettext.m4.old m4/glib-gettext.m4
