File: rules

package info (click to toggle)
prometheus-libvirt-exporter 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 152 kB
  • sloc: sh: 90; makefile: 20
file content (31 lines) | stat: -rwxr-xr-x 985 bytes parent folder | download
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: