#!/usr/bin/make -f include /usr/share/dpkg/pkg-info.mk # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DH_GOLANG_INSTALL_EXTRA := fixtures/ BUILDDIR := $(CURDIR)/build METAPKG := github.com/prometheus/common BINNAME := prometheus-bind-exporter BRANCH := debian/sid USER := team+pkg-go@tracker.debian.org BUILD_DATE = $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' \ +%Y%m%d-%H:%M:%S) GO_VERSION = $(shell go version | sed 's/go version \(\S*\).*/\1/') GCCGO = $(strip $(shell go version | grep gccgo)) VERSION = $(shell echo '$(DEB_VERSION_UPSTREAM)' | tr '~' '-') BUILDFLAGS = -ldflags \ " -X $(METAPKG)/version.Version=$(VERSION)\ -X $(METAPKG)/version.Revision=$(DEB_VERSION)\ -X $(METAPKG)/version.Branch=$(BRANCH)\ -X $(METAPKG)/version.BuildUser=$(USER)\ -X $(METAPKG)/version.BuildDate=$(BUILD_DATE)\ -X $(METAPKG)/version.GoVersion=$(GO_VERSION)" %: dh $@ --buildsystem=golang --with=golang \ --builddirectory=$(BUILDDIR) WHATIS := "$(BINNAME) \\- Prometheus exporter for Bind metrics" execute_after_dh_auto_build: mv -v $(BUILDDIR)/bin/bind_exporter \ $(BUILDDIR)/bin/$(BINNAME) # Build bash completion scripts. mkdir -vp $(BUILDDIR)/bash_completion.d $(BUILDDIR)/bin/$(BINNAME) --completion-script-bash > \ $(BUILDDIR)/bash_completion.d/$(BINNAME) # Build man pages. mkdir -vp $(BUILDDIR)/man $(BUILDDIR)/bin/$(BINNAME) --help-man > \ $(BUILDDIR)/man/$(BINNAME).1 # Remove build information headers, and fix whatis entry. sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS) \ $(BUILDDIR)/man/$(BINNAME).1 override_dh_auto_install: dh_auto_install -- --no-source