#!/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

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang --with shell_completions

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

override_dh_auto_install:
	dh_auto_install -- --no-source

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