#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

BUILDPARTS:=dirs tclcheckdns tcliis tksao ds9

get-orig-source:
	sh ./debian/repack.sh

%:
	dh $@ --with autoreconf,autotools_dev

override_dh_autoreconf:
	(cd unix; autoreconf -i -f)
	(cd ds9/unix; autoreconf -i -f)
	(cd tcliis; autoreconf -i -f)
	(cd tclcheckdns; autoreconf -i -f)
	(cd tksao; autoreconf -i -f)

override_dh_auto_configure:
	unix/configure

override_dh_auto_build:
	dh_auto_build -- $(BUILDPARTS)
	chmod ugo-x ds9/unix/zvfsmntpt/library/*.tcl
	chmod ugo+x ds9/ds9
	perl -w debian/generate-man > ds9/ds9.1

override_dh_auto_test:
	DS9_HOME=ds9/unix/zvfsmntpt \
	TCLLIBPATH=lib/ \
	xvfb-run --server-args="-screen 0 1024x768x24" \
	./ds9/ds9 -quit

override_dh_installchangelogs:
	dh_installchangelogs ds9/doc/release/r7.0.html

override_dh_auto_clean:
	dh_auto_clean
