#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ --builddirectory=build

override_dh_auto_install:
	mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/geeqie/html
	dh_auto_install
	rm -f \
		$(CURDIR)/debian/tmp/usr/share/geeqie/template.desktop \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie-common/TODO \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie-common/README.md \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie/COPYING \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie-common/AUTHORS \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie/html/lua-api/Geeqie.tag \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie/ChangeLog \
		$(CURDIR)/debian/tmp/usr/share/doc/geeqie/ChangeLog.html
	mkdir -p $(CURDIR)/debian/geeqie-common/usr/share/doc/geeqie/html/
	cp -r $(CURDIR)/build/doc/html/* debian/geeqie-common/usr/share/doc/geeqie/html/
	# Remove executable flag from bash-completion file
	chmod -x $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/geeqie

override_dh_compress:
	# Readme is shown from program, do not compress it
	dh_compress -pgeeqie -XREADME -XAUTHORS -XCOPYING usr/share/doc/geeqie/changelog.Debian
	dh_compress -pgeeqie-common -XREADME -XAUTHORS -XCOPYING usr/share/doc/geeqie-common/changelog.Debian
