#!/usr/bin/make -f

GOPKG = github.com/dundee/gdu/v5
VERSION ?= $(shell dpkg-parsechangelog -SVersion)

DH_GOLANG_BUILDPKG := github.com/dundee/gdu/v5/cmd/gdu
CGO_ENABLED := 0

GO_LDFLAGS += -X '$(GOPKG)/build.Version=$(VERSION)'
GO_LDFLAGS += -X '$(GOPKG)/build.User=debian'
GO_LDFLAGS += -X '$(GOPKG)/build.Time=$(shell TZ=Etc/UTC date +'%F_%T' -d @$(SOURCE_DATE_EPOCH))'

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

override_dh_auto_install:
	dh_auto_install -- --no-source

override_dh_auto_build:
	dh_auto_build -O--buildsystem=golang -- -ldflags "$(GO_LDFLAGS)"
