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

BUILDPARTS:=dirs tclcheckdns tkmpeg tkhtml tcliis rice hcompress plio xmlrpc saotk ds9

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

%:
	dh $@ --with autoreconf,autotools_dev

make.include:
	ln -sf make.linux make.include

override_dh_autoreconf:
	(cd htmlwidget; autoreconf -i -f)
	(cd tkmpeg1.0; autoreconf -i -f)
	(cd tcliis1.0; autoreconf -i -f)
	(cd tclcheckdns1.1; autoreconf -i -f)

override_dh_auto_build: make.include
	dh_auto_build -- $(BUILDPARTS)
	cp xmlrpc-0.3/xmlrpc.tcl ds9/zipdir/zvfsmntpt/src
	chmod ugo-x ds9/zipdir/zvfsmntpt/src/*.tcl
	perl -w debian/generate-man > ds9/ds9.1

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

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

override_dh_auto_clean: make.include
	dh_auto_clean
