#!/usr/bin/make -f

# See https://pkg-perl.alioth.debian.org/debhelper.html#Occasionally_Useful
PACKAGE = $(shell dh_listpackages)
TMP     = $(CURDIR)/debian/$(PACKAGE)

%:
	dh $@

override_dh_auto_configure:
	# Vis configure script it not generated by autoconf, so it does not
	# accept all the options given by dh_auto_configure. It *almost* works,
	# but we end up with a wrong mandir. This is a possible workaround:
	#
	# dh_auto_configure -- --mandir='$$(PREFIX)/share/man/'
	#
	# but still we're calling the configure script with a lot of options
	# it doesn't actually understand. I prefer to just run the script
	# manually, and dh_auto_configure(1) agrees (see the DESCRIPTION).
	#
	# So:
	#
	./configure --prefix=/usr

override_dh_auto_install:
	dh_auto_install

	# Remove extra license files
	rm -v $(TMP)/usr/share/doc/vis/LICENSE $(TMP)/usr/share/vis/lexers/LICENSE

override_dh_auto_test:
