#!/usr/bin/make -f
# -*- makefile -*-

# select all hardening flags
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export BASE=debian/squidguard
export BASEDOC=debian/squidguard-doc

%:
	dh $@

override_dh_auto_configure: 
	dh_auto_configure  --    \
		$(shell dpkg-buildflags --export=configure) \
		--with-db=/usr --with-nolog=yes \
		--with-ldap=yes --with-ldap-lib=/usr/lib \
		--with-sg-config=/etc/squidguard/squidGuard.conf \
		--with-sg-logdir=/var/log/squidguard \
		--with-sg-dbhome=/var/lib/squidguard/db

override_dh_install: 
	dh_install
	# set execute flag for some scripts
	if [ -d $(BASE)/usr/lib/squidguard ]; \
	then \
	  chmod a+x $(BASE)/usr/lib/squidguard/*; \
	fi
	# remove obsolete (old) documentation files
	if [ -d $(BASEDOC)/usr/share/doc/squidguard-doc ]; \
	then \
	  rm -f $(BASEDOC)/usr/share/doc/squidguard-doc/html/configuration.html; \
	  rm -f $(BASEDOC)/usr/share/doc/squidguard-doc/html/faq.html; \
	  rm -f $(BASEDOC)/usr/share/doc/squidguard-doc/html/installation.html; \
	fi

override_dh_clean:
	dh_clean
	debconf-updatepo
