#!/usr/bin/make -f

DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')

%:
	dh ${@}

override_dh_auto_install:
	mkdir -p debian/postinstall/usr/share/ufficiozero/postinstall
	cd resources &&	glib-compile-resources \
		--target=../debian/postinstall/usr/share/ufficiozero/postinstall/postinstall.gresource postinstall.gresource.xml \
		&& cd ..
	cp resources/*.glade debian/postinstall/usr/share/ufficiozero/postinstall
	dh_auto_install

# Inject version number in the code
override_dh_installdeb:
	dh_installdeb
	for pkg in $$(dh_listpackages -i); do \
		find debian/$$pkg -type f -exec sed -i -e s/__DEB_VERSION__/$(DEB_VERSION)/g {} +; \
	done
