#!/usr/bin/make -f

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

export DH_GOLANG_EXCLUDES := iphlpapi

export VERSION=$(shell dpkg-parsechangelog --show-field Version)
export DATE=$(shell date --date="@$${SOURCE_DATE_EPOCH}" +%Y-%m-%d)

%:
	dh $@ --buildsystem=golang --with=golang

override_dh_auto_build:
	dh_auto_build -- -buildvcs=false -ldflags "-X main.version=$${VERSION} -X main.date=$${DATE}"

override_dh_auto_install:
	dh_auto_install -- --no-source

override_dh_install:
	dh_install
	install -d $(CURDIR)/debian/vip-manager2/etc/patroni
	install -m 664 debian/vip.in $(CURDIR)/debian/vip-manager2/etc/patroni/vip.in

override_dh_installsystemd:
	dh_installsystemd --name vip-manager
