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

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

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

override_dh_auto_configure:
	# Upstream has prebuilt index.db, which does not compliance with DFSG. We rebuilt it here.
	cat ${CURDIR}/debian/index.sql | sqlite3 ${CURDIR}/cppman/lib/index.db
	dh_auto_configure

override_dh_clean:
	dh_clean ${CURDIR}/cppman/lib/index.db

override_dh_fixperms:
	dh_fixperms
	# The executable bit is cleaned during build process, so we need set
	# them again.
	find debian/cppman -name *.sh -print0 | xargs --null chmod a+x

override_dh_auto_install:
	dh_auto_install
	# Fix extra-license-file and changelog
	-rm -f debian/cppman/usr/share/doc/cppman/COPYING
	-rm -f debian/cppman/usr/share/doc/cppman/ChangeLog