#!/usr/bin/make -f
# -*- makefile -*-

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

LDFLAGS_DEFAULT = `dpkg-buildflags --get LDFLAGS`
export LDFLAGS_DEFAULT
LDFLAGS_OPTIMIZE = `dpkg-buildflags --get LDFLAGS`
export LDFLAGS_OPTIMIZE

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
			  --with-tcl=/usr/lib \
			  --with-tk=/usr/lib

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
	# Cleanup manpage
	cd debian/tmp/usr/share/man/mann && \
	  for f in *.n ; do \
	    sed -i -e'/\.so man.macros/ d' \
	    	-e's/^\.TH \([^ ]\+\) n/.TH \1 3tk/' \
	    	-e's/^\.BS//' \
	    	-e's/^\.BE//' \
		$$f; \
	  done

override_dh_auto_test:
	# Tests require X, so disable them

get-orig-source:
	wget -O tktray_1.3.9.orig.tar.gz \
		http://tktray.googlecode.com/files/tktray1.3.9.tar.gz

.PHONY: override_dh_auto_configure override_dh_auto_install override_dh_auto_test get-orig-source
