1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
export DH_GOPKG := github.com/kumina/libvirt_exporter
BUILDDIR := $(CURDIR)/build
override_dh_auto_install:
dh_auto_install -- --no-source
%:
dh $@ --buildsystem=golang --with=golang \
--builddirectory=$(BUILDDIR)
BINNAME := $(DEB_SOURCE)
WHATIS := "$(BINNAME) \\- Prometheus exporter for libvirt metrics"
override_dh_auto_build:
dh_auto_build
# Rename the binary to match the debian package.
cp -v $(BUILDDIR)/bin/libvirt_exporter $(BUILDDIR)/bin/$(BINNAME)
rm -f $(BUILDDIR)/bin/libvirt_exporter
build/bin/$(BINNAME) --help-man > build/$(BINNAME).1
# Remove build user/build date/go version headers, which is ugly.
sed -i -e '/^ /d' build/$(BINNAME).1
# Fix whatis entry.
sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS) build/$(BINNAME).1
sed -i "s/\.TH libvirt_exporter/\.TH $(BINNAME)/g" build/$(BINNAME).1
sed -i "s/\\\fBlibvirt_exporter/\\\fB$(BINNAME)/g" build/$(BINNAME).1
override_dh_auto_install:
|