File: rules

package info (click to toggle)
prometheus-postgres-exporter 0.4.7%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 352 kB
  • sloc: sh: 380; makefile: 100
file content (32 lines) | stat: -rwxr-xr-x 1,031 bytes parent folder | download | duplicates (2)
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
32
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

#export DH_VERBOSE=1
export DH_GOLANG_INSTALL_EXTRA := cmd/postgres_exporter/tests/

BUILDDIR := $(CURDIR)/build

BUILDTAGS  :=
BUILDFLAGS  = -tags "$(BUILDTAGS)" -ldflags \
  " -X main.Version=$(DEB_VERSION_UPSTREAM)"

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

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

override_dh_auto_build:
	dh_auto_build -- $(BUILDFLAGS)
	# Rename the binary to match the debian package.
	cp -v $(BUILDDIR)/bin/postgres_exporter $(BUILDDIR)/bin/$(BINNAME)
	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
	# Remove default values as they create unwieldy long lines.
	sed -i 's/\\fB--\(.*\)=".*"\\fR/\\fB--\1\\fR/' build/$(BINNAME).1

override_dh_auto_install: