#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)

include /usr/share/dpkg/architecture.mk
PERLVER := $(shell perl -MConfig -e 'print $$Config{version}')
ARCHLIB := $(shell perl -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(PERLVER) -MConfig -e 'print $$Config{vendorarch}')

TCLCONFIG=$(shell grep -Eo '/usr/lib/.+/tclConfig.sh' /usr/lib/tclConfig.sh)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --tclconfig $(TCLCONFIG) --no-usestubs

override_dh_auto_install:
	dh_auto_install
	$(RM) -v $(TMP)/$(ARCHLIB)/Tcl-hack.pod $(TMP)/usr/share/man/man3/Tcl-hack.3pm
