#!/usr/bin/make -f

# enable verbose mode
export DH_VERBOSE=1

# enable all hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@ --with autoreconf,systemd

override_dh_auto_configure:
	dh_auto_configure -- \
                --disable-dependency-tracking \
                --libdir=/usr/lib/lighttpd \
                --libexecdir="/usr/lib/lighttpd" \
                --with-attr \
                --with-fam \
                --with-gdbm \
                --with-kerberos5 \
                --with-ldap \
                --with-lua=lua5.1 \
                --with-memcache \
                --with-mysql \
                --with-openssl \
                --with-pcre \
                --with-webdav-locks \
                --with-webdav-props \
		$(shell dpkg-buildflags --export=configure)

override_dh_fixperms:
	dh_fixperms
	test -d debian/lighttpd && \
	    chmod 0750 debian/lighttpd/var/log/lighttpd && \
	    chown www-data:www-data \
	        debian/lighttpd/var/cache/lighttpd/compress \
	        debian/lighttpd/var/cache/lighttpd/uploads \
	        debian/lighttpd/var/log/lighttpd || true

override_dh_installinit:
	dh_installinit --error-handler=start_failed

override_dh_clean:
	dh_clean -- \
	    aclocal.m4 \
	    ar-lib \
	    autogen.sh \
	    compile \
	    config.* \
	    configure \
	    depcomp \
	    install-sh \
	    ltmain.sh \
	    m4/* \
	    Makefile.in \
	    missing
