File: rules

package info (click to toggle)
prometheus-postfix-exporter 0.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 260 kB
  • sloc: sh: 100; makefile: 15
file content (25 lines) | stat: -rwxr-xr-x 880 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
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

BUILDDIR := $(CURDIR)/build

BINNAME := $(DEB_SOURCE)
WHATIS := "$(BINNAME) \\- Prometheus exporter for Postfix metrics"

%:
	dh $@ --buildsystem=golang --builddirectory=$(BUILDDIR)

override_dh_auto_build:
	dh_auto_build -- -tags nosystemd
	# Rename the binary to match the debian package.
	mv -v $(BUILDDIR)/bin/postfix_exporter $(BUILDDIR)/bin/$(BINNAME)
	$(BUILDDIR)/bin/$(BINNAME) --help-man > $(BUILDDIR)/$(BINNAME).1
	# Remove build user/build date/go version headers, which is ugly.
	sed -i -e '/^  /d' $(BUILDDIR)/$(BINNAME).1
	# Fix whatis entry.
	sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n'$(WHATIS) $(BUILDDIR)/$(BINNAME).1
	# Remove default values as they create unwieldy long lines.
	sed -i 's/\\fB--\(.*\)=".*"\\fR/\\fB--\1\\fR/' $(BUILDDIR)/$(BINNAME).1

override_dh_auto_install:
	dh_auto_install -- --no-source