#!/usr/bin/make -f

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

TIMESTAMP := $(shell date -d @$(SOURCE_DATE_EPOCH) --utc +%Y-%m-%dT%H:%M:%SZ)

LDFLAGS := -X main.version=$(DEB_VERSION)
LDFLAGS += -X main.buildTime=$(TIMESTAMP)

export DEB_VERSION_UPSTREAM

# We currently do not build the GUI as it requires Wails, which is not in Debian
export DH_GOLANG_EXCLUDES := gui

# Needed for tests
export DH_GOLANG_INSTALL_EXTRA := schema

%:
	dh $@ --buildsystem=golang --with shell_completions --without=single-binary

override_dh_auto_build:
	dh_auto_build -- -ldflags '$(LDFLAGS)'

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp -- --no-source

execute_before_dh_installman:
	PATH=debian/tmp/usr/bin:$$PATH debian/gen-manpage.sh > debian/tmp/mkbrr.1
