#!/usr/bin/make -f

%:
	dh $@ --with python3

clean:
	./waf distclean
	rm -fr build .lock-waf* po/.intlcache
	find Documentation -name "*.html" -delete
	find waflib -name "*.pyc" -delete
	dh $@

override_dh_auto_configure:
	PYTHONDIR=/usr/share/kupfer ./waf configure --prefix=/usr --nopyc --nopyo \
		--bindir=/usr/share/kupfer --no-runtime-deps --no-hooks

override_dh_auto_install:
	./waf install --destdir=$(CURDIR)/debian/kupfer
	install -m 0755 $(CURDIR)/build/bin/kupfer $(CURDIR)/debian/kupfer/usr/share/kupfer/kupfer-activate.sh
	mkdir -p $(CURDIR)/debian/kupfer/usr/share/icons/hicolor/16x16/apps/
	install -m 0644 $(CURDIR)/debian/hicolor/16x16/apps/kupfer.png \
                $(CURDIR)/debian/kupfer/usr/share/icons/hicolor/16x16/apps/kupfer.png
	rm -fv $(CURDIR)/debian/kupfer/usr/share/kupfer/kupfer/kupfer
	rm -fv $(CURDIR)/debian/kupfer/usr/share/gnome/help/kupfer/*/license.page
	rm -fv $(CURDIR)/debian/kupfer/usr/share/kupfer/art/COPYING

execute_before_dh_installdocs:
	make -C Documentation

# Do not build man page by ourselves now
#execute_before_dh_installman:
#	rst2man Documentation/Manpage.rst build/kupfer.1

override_dh_installchangelogs:
	dh_installchangelogs NEWS