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

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

# Path to package source directory. Needed so that we can call get-orig-source
# from within any working directory.
PKGDIR := $(dir $(firstword $(MAKEFILE_LIST)))..


%:
	dh $@ --with python2 --buildsystem=pybuild


override_dh_auto_build:
	dh_auto_build
	
	cd docs && a2x --xsltproc-opts=--nonet -f manpage gitinspector.txt
	cd docs && a2x --xsltproc-opts=--nonet -f xhtml gitinspector.txt


override_dh_auto_install:
	dh_auto_install
	# We don't need to install a copy of the GPL-3, we have it locally
	rm -f $(CURDIR)/debian/gitinspector/usr/share/doc/gitinspector/LICENSE.txt


# Remove upstream's convenience copies of minified jQuery libraries, we don't
# need them as they are all available in the Archive
get-orig-source:
	uscan \
		--noconf \
		--force-download \
		--download-current-version \
		--check-dirname-level=0 \
		--destdir=$(CURDIR) \
		--repack \
		--copyright-file=$(PKGDIR)/debian/files-excluded \
		--compression=xz \
		$(PKGDIR)
	rm -f gitinspector-*.tar.gz


override_dh_auto_clean:
	dh_auto_clean
	
	rm -f docs/gitinspector.xml
	rm -f docs/gitinspector.1
	rm -f docs/gitinspector.html
