#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

SHELL := sh -e

export GRADLE_USER_HOME = .gradle
LIBEUFIN_HOME = /usr/share/libeufin
DEV =
FULLVER = $(DEB_VERSION_UPSTREAM)$(DEV)

%:
	dh ${@} --no-parallel

override_dh_auto_test:
	true

override_dh_auto_configure:
	true

override_dh_auto_install:
	true

override_dh_auto_build:
	make build

# Override this step because it's very slow and likely
# unnecessary for us.
override_dh_strip_nondeterminism:
	true

override_dh_installsystemd:
	# Need to specify units manually, since we have multiple
	# and dh_installsystemd by default only looks for "<package>.service".
	dh_installsystemd -p libeufin-bank --no-start --no-enable --no-stop-on-upgrade --name=libeufin-bank-gc
	dh_installsystemd -p libeufin-bank --no-start --no-enable --no-stop-on-upgrade --name=libeufin-bank
	dh_installsystemd -p libeufin-nexus --no-start --no-enable --no-stop-on-upgrade --name=libeufin-nexus-ebics-submit
	dh_installsystemd -p libeufin-nexus --no-start --no-enable --no-stop-on-upgrade --name=libeufin-nexus-ebics-fetch
	dh_installsystemd -p libeufin-nexus --no-start --no-enable --no-stop-on-upgrade --name=libeufin-nexus-httpd
	dh_installsystemd -p libeufin-ebisync --no-start --no-enable --no-stop-on-upgrade --name=libeufin-ebisync-fetch
	dh_installsystemd -p libeufin-ebisync --no-start --no-enable --no-stop-on-upgrade --name=libeufin-ebisync-httpd
	# final invocation to generate daemon reload
	dh_installsystemd

get-orig-source:
	uscan --force-download --rename
