#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Warning on all
export DEB_CFLAGS_MAINT_APPEND  := -Wall
# More hardening
export DEB_BUILD_MAINT_OPTIONS  := hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--prefix=/usr \
		--includedir=/usr/include \
		--sysconfdir=/etc/c-icap \
		--localstatedir=/var \
		--with-pcre \
		--with-openssl \
		--with-zlib \
		--with-bzlib \
		--with-brotli

override_dh_fixperms:
	dh_fixperms
	chmod 0644 debian/c-icap/etc/c-icap/*

override_dh_install:
	/usr/bin/chrpath -d debian/tmp/usr/bin/c-icap
	/usr/bin/chrpath -d debian/tmp/usr/bin/c-icap-client
	/usr/bin/chrpath -d debian/tmp/usr/bin/c-icap-mkbdb
	dh_install
	rm $(CURDIR)/debian/c-icap/usr/lib/*/c_icap/*.la
