#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

get-orig-source:
	make clean
	git clean -idx
	tar cJf ../davical_$(DEB_VERSION_UPSTREAM).orig.tar.xz --exclude-vcs --exclude=.gitattributes --exclude=debian .

%:
	dh $@

override_dh_auto_build:
	make all

override_dh_install:
	dh_install
	rm debian/davical/usr/share/davical/htdocs/.htaccess || true
	rm -f debian/davical/usr/share/doc/davical/examples/apache-davical.conf \
	      debian/davical/usr/share/doc/davical/examples/example-config.php
	sed -i -e '1s|^#!/usr/bin/env perl|#!/usr/bin/perl|' debian/davical/usr/share/davical/dba/update-davical-database

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog

override_dh_installdocs:
	dh_installdocs
	find debian/davical-doc/ -name '*.md5' -delete
	jdupes -rl debian/davical-doc/
