#!/usr/bin/make -f

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

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-threads \
		--with-tcl=/usr/lib \
		--with-tclinclude=/usr/include/tcl \

override_dh_auto_install:
	dh_auto_install --destdir=$(CURDIR)/debian/tclcurl

	mkdir $(CURDIR)/debian/tclcurl/usr/lib/tcltk
	mv $(CURDIR)/debian/tclcurl/usr/lib/$(DEB_HOST_MULTIARCH)/TclCurl* \
		$(CURDIR)/debian/tclcurl/usr/lib/tcltk
	rm -rf \
		$(CURDIR)/debian/tclcurl/usr/share/man/mann \
		$(CURDIR)/debian/tclcurl/usr/bin \
		$(CURDIR)/debian/tclcurl/usr/include \
		$(CURDIR)/debian/tclcurl/usr/lib/$(DEB_HOST_MULTIARCH)

	chmod 644 \
		$(CURDIR)/tests/*.tcl \
		$(CURDIR)/tests/multi/double.tcl \
		$(CURDIR)/tests/multi/single.tcl

override_dh_auto_test:

override_dh_makeshlibs:
	dh_makeshlibs
	tcltk-depends
