#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie

%:
	dh $@ --with autotools_dev --parallel 

override_dh_auto_configure:
	dh_auto_configure --
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--enable-gpgme \
		--enable-ipv6 \
		--enable-aspell \
		--enable-jpilot \
		--enable-ldap \
		--with-manualdir=/usr/share/doc/claws-mail \
		--with-config-dir=.claws-mail

override_dh_clean:
	$(MAKE) -C debian/manpages clean
	rm -f src/plugins/perl/tools/matcherrc2perlfilter
	dh_clean

override_dh_auto_build:
	$(MAKE) -C debian/manpages
	pod2man --center="claws-mail-perl-filter" \
		--release="3.9.3" src/plugins/perl/cm_perl.pod \
		> debian/manpages/claws-mail-perl-filter.1
	cp -p src/plugins/perl/tools/matcherrc2perlfilter.pl \
		src/plugins/perl/tools/matcherrc2perlfilter
	dh_auto_build

override_dh_strip:
	dh_strip --dbg-package=claws-mail-dbg

override_dh_compress:
	dh_compress -Xclaws-mail/tools

