File: rules

package info (click to toggle)
prometheus-phpfpm-exporter 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 300 kB
  • sloc: sh: 52; makefile: 35; php: 23
file content (42 lines) | stat: -rwxr-xr-x 1,637 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
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

MAINTAINER_EMAIL := $(shell sed -n 's/^Maintainer:.*<\(.*\)>/\1/p' debian/control)
SOURCE_TIMESTAMP = $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' +%Y%m%d-%H:%M:%S)

# Populate the "Build context" section in prometheus/common/version/info.go
METAPKG := github.com/prometheus/common
BUILDFLAGS = -ldflags \
  " -X $(METAPKG)/version.Version=$(DEB_VERSION_UPSTREAM)\
    -X $(METAPKG)/version.Revision=$(DEB_VERSION)\
    -X $(METAPKG)/version.BuildUser=$(MAINTAINER_EMAIL)\
    -X $(METAPKG)/version.BuildDate=$(SOURCE_TIMESTAMP)"

BINNAME := $(DEB_SOURCE)
MAN_WHATIS := $(BINNAME) \\- Prometheus exporter for PHP-FPM statistics
MAN_PROG := $(shell echo $(BINNAME) | tr [:lower:] [:upper:])
MAN_MONTH = $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' '+%B %Y')

# Enable verbose build to see all GO* flags echoed by 'go env' and more
#export DH_VERBOSE=1

%:
	dh $@ --builddir=debian/build

override_dh_auto_build:
	dh_auto_build -- $(BUILDFLAGS)

execute_before_dh_installman:
	debian/build/bin/$(BINNAME) --help-man > debian/build/$(BINNAME).1
	# Fix man page title header and footer
	sed -i '/^.TH .*/c.TH $(MAN_PROG) "1" "$(MAN_MONTH)" "$(DEB_SOURCE) $(DEB_VERSION_UPSTREAM)" "Prometheus"/' \
        debian/build/$(BINNAME).1
	# Populate man page whatis line
	sed -i '/^.SH "NAME"/,+1c.SH "NAME"\n$(MAN_WHATIS)' debian/build/$(BINNAME).1

override_dh_auto_install:
	# The upstream name is too generic for Debian, so use the package name
	# instead, which is more unique
	mv -v debian/build/bin/phpfpm_exporter debian/build/bin/$(BINNAME)
	dh_auto_install -- --no-source