#!/usr/bin/make -f

%:
	dh $@ --with python3

override_dh_auto_configure:
# make sure docs are generated and the manifest is built
	$(MAKE) locale
	dh_auto_configure --buildsystem pybuild

override_dh_auto_build:
# force usage of setup.py over Makefile
	dh_auto_build --buildsystem pybuild

override_dh_installchangelogs:
# install custom changelog
	dh_installchangelogs doc/changelog.txt


ROOTDIR=$(CURDIR)/debian/linkchecker
LOCALEDIR=$(ROOTDIR)/usr/share/locale
ETCDIR=$(ROOTDIR)/etc

ROOTDIRWEB=$(CURDIR)/debian/linkchecker-web
HTMLDIRWEB=$(ROOTDIRWEB)/usr/share/linkchecker/lconline
CGIDIRWEB=$(ROOTDIRWEB)/usr/lib/cgi-bin
ETCDIRWEB=$(ROOTDIRWEB)/etc

override_dh_auto_install-arch:
	dh_auto_install --buildsystem pybuild
# install bash_completion script
	install -m 644 config/linkchecker-completion $(ROOTDIR)/usr/share/bash-completion/completions/

override_dh_auto_install-indep:
	dh_auto_install --buildsystem pybuild
# install CGI files in web package
	install -m 644 cgi-bin/lconline/*.html $(HTMLDIRWEB)
	install -m 644 cgi-bin/lconline/*.de $(HTMLDIRWEB)
	install -m 644 cgi-bin/lconline/*.en $(HTMLDIRWEB)
	install -m 644 cgi-bin/lconline/*.js $(HTMLDIRWEB)
	install -m 644 cgi-bin/lconline/*.css $(HTMLDIRWEB)
	install -m 644 cgi-bin/lconline/*.ico $(HTMLDIRWEB)
	install -m 755 cgi-bin/lc.wsgi $(CGIDIRWEB)
# apache configuration
	install -m 644 config/linkchecker.apache2.conf $(ETCDIRWEB)/apache2/conf-available/linkchecker-web.conf

# clean generated files
override_dh_clean:
	dh_clean doc/html/*.qch doc/html/*.qhc _LinkChecker_configdata.py

# do not run test suite when building
override_dh_auto_test:
