#!/usr/bin/make -f

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

RIVETLIB_DIR=/usr/lib/tcltk/rivet$(shell cut -d '.' -f 1 VERSION)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

%:
	dh $@ --with apache2

override_dh_auto_configure:
	. /usr/lib/tclConfig.sh; \
	dh_auto_configure -a -- --host=$(DEB_HOST_GNU_TYPE)    \
				--build=$(DEB_BUILD_GNU_TYPE)           \
				--with-tcl=/usr/lib/tcl$${TCL_VERSION}  \
				--with-apache=/usr                      \
				--with-apxs=/usr/bin/apxs               \
				--with-rivet-target-dir=$(RIVETLIB_DIR) \
				--enable-version-display
