#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -std=gnu17
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
include /usr/share/dpkg/pkg-info.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-gpgme \
		--enable-ssl \
		--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

execute_after_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 $(DEB_VERSION) -c 'User Manuals' \
		debian/sylpheed.pod > debian/sylpheed.1
