#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
export QT_SELECT := qt5
export DEBIAN_VERSION = $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/.*: //p')

%:
	dh $@ --with autoreconf,python2,python3,pkgkde_symbolshelper

override_dh_auto_configure:
	dh_auto_configure -- \
	    --enable-static \
	    --enable-languages="python cpp qt" \
	    --infodir=/usr/share/info

override_dh_install:
	dh_install --list-missing -X.la -Xinfo/dir

override_dh_makeshlibs:
	dh_makeshlibs -V

# python-pyme needs an epoch number because previous versions had an
# epoch.  If we ever add an epoch to the source package, remove this
# stanza.
override_dh_gencontrol-arch:
	dh_gencontrol
	dpkg-gencontrol -ppython-pyme \
	-v1:$(DEBIAN_VERSION) \
	-Tdebian/python-pyme.substvars \
	-Pdebian/python-pyme \
	-Odebian/python-pyme/DEBIAN/control
	# and add an epoch to the generated dbgsym as well:
	sed -i -e 's/^Version: /Version: 1:/' \
	-e 's/^Depends: python-pyme (= /Depends: python-pyme (= 1:/' \
	-e 's/^Source: gpgme1.0$$/Source: gpgme1.0 ($(DEBIAN_VERSION))/' \
	debian/.debhelper/python-pyme/dbgsym-root/DEBIAN/control

override_dh_installdocs:
	dh_installdocs -X.md5
