#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p' | sed 's,~,,')

%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-gpgme \
		--enable-ssl \
		--enable-jpilot \
		--enable-ldap \
		--enable-ipv6 \
		--enable-gtkspell \
		--enable-oniguruma \
		--with-plugindir=/usr/lib/$(DEB_HOST_MULTIARCH)/sylpheed/plugins \
		--with-manualdir=/usr/share/doc/sylpheed-doc/manual \
		--with-faqdir=/usr/share/doc/sylpheed-doc/FAQ

override_dh_auto_install:
	dh_auto_install
	$(MAKE) -C plugin/attachment_tool \
		DESTDIR=$(CURDIR)/debian/tmp install-plugin
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la
	pod2man --release $(VERSION) -c 'User Manuals' \
		debian/sylpheed.pod > debian/sylpheed.1
 
override_dh_strip:
	dh_strip --dbg-package=sylpheed-dbg

