#!/usr/bin/make -f

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

ifneq (0.6,$(DEB_VERSION_UPSTREAM))
$(info Packaging a new upstream version? Please remove:)
$(info * Covenant/refs/{Donut,PeNet.dll})
$(info * debian/source/include-binaries)
$(info * debian/patches/Fixed-missing-DonutCore-nuget-package.patch)
$(info * this message from debian/rules)
$(info Thanks!)
$(error This message was fatal)
endif

%:
	dh $@ --with kaboxer --buildsystem=kaboxer --sourcedir=Covenant

override_dh_install:
	dh_install
	# embed Data as data.orig to install them in ~/.local/covenant/data if
	# necessary
	mkdir -p $(CURDIR)/debian/covenant-kbx/usr/share/covenant-kbx
	cd Covenant/Data && tar --gzip -c -f $(CURDIR)/debian/covenant-kbx/usr/share/covenant-kbx/data.tar.gz .
	# create a file 'version' to manage database upgrade / removal
	echo $(DEB_VERSION_UPSTREAM) > $(CURDIR)/debian/covenant-kbx/usr/share/covenant-kbx/version
	# install icon
	mkdir -p $(CURDIR)/debian/covenant-kbx/usr/share/icons/hicolor/scalable/apps
	cp $(CURDIR)/debian/kaboxer-covenant.svg $(CURDIR)/debian/covenant-kbx/usr/share/icons/hicolor/scalable/apps
