summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 8b8f78e114a64af3ae48c31233f2443edfe32b54 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

MAKEARGS=V=1 \
	 DESTDIR=debian/haproxy \
	 PREFIX=/usr \
	 IGNOREGIT=true \
	 MANDIR=/usr/share/man \
	 DOCDIR=/usr/share/doc/haproxy \
	 USE_PCRE2=1 \
	 USE_PCRE2_JIT=1 \
	 USE_OPENSSL=1 \
	 USE_QUIC=1 \
     USE_QUIC_OPENSSL_COMPAT=1 \
	 USE_SLZ=1 \
	 USE_LUA=1 \
	 USE_PROMEX=1 \
	 USE_OT=1 \
	 LUA_INC=/usr/include/lua5.3 \
	 EXTRA=admin/halog/halog

ifeq ($(DEB_HOST_ARCH_OS),linux)
        MAKEARGS+= TARGET=linux-glibc USE_SYSTEMD=1
        deb_systemdsystemunitdir=$(shell pkg-config --variable=systemdsystemunitdir systemd)
else ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
        MAKEARGS+= TARGET=freebsd
else
	MAKEARGS+= TARGET=generic
endif

ifneq ($(filter armel mips mipsel m68k powerpc powerpcspe sh4 riscv64,$(DEB_HOST_ARCH)),)
	MAKEARGS+= ADDLIB="-latomic -Wl,-no-as-needed -ljemalloc -Wl,-as-needed"
else
	MAKEARGS+= ADDLIB="-Wl,-no-as-needed -ljemalloc -Wl,-as-needed"
endif

MAKEARGS += DEBUG_CFLAGS="$(CFLAGS) $(CPPFLAGS)"
MAKEARGS += LDFLAGS="$(LDFLAGS)"
MAKEARGS += VERSION="$(DEB_VERSION_UPSTREAM)"
MAKEARGS += SUBVERS="-$(lastword $(subst -, ,$(DEB_VERSION)))"
MAKEARGS += VERDATE="$(shell TZ=UTC date -d "@$(SOURCE_DATE_EPOCH)" "+%Y/%m/%d")"

%:
	dh $@ --with sphinxdoc

override_dh_auto_configure:

override_dh_auto_build-arch:
	make $(MAKEARGS)
	make -C admin/systemd $(MAKEARGS)
	$(MAKE) -C doc/lua-api man

override_dh_auto_build-indep:
	# Build the HTML documentation, after patching dconv
	patch -p1 < $(CURDIR)/debian/patches/debianize-dconv.patch
	for doc in intro configuration management; do \
		python3 -B $(CURDIR)/debian/dconv/haproxy-dconv.py \
			-i $(CURDIR)/doc/$${doc}.txt \
			-o $(CURDIR)/doc/$${doc}.html ;\
	done
	patch -p1 -R < $(CURDIR)/debian/patches/debianize-dconv.patch
	$(MAKE) -C doc/lua-api html

override_dh_auto_clean:
	make -C admin/systemd clean
	$(MAKE) -C doc/lua-api clean
	dh_auto_clean

override_dh_auto_install-arch:
	make $(MAKEARGS) install
	install -m 0644 -D debian/rsyslog.conf debian/haproxy/etc/rsyslog.d/49-haproxy.conf
	install -m 0644 -D debian/logrotate.conf debian/haproxy/etc/logrotate.d/haproxy
ifneq ($(deb_systemdsystemunitdir),)
	install -m 0644 -D admin/systemd/haproxy.service debian/haproxy$(deb_systemdsystemunitdir)/haproxy.service
endif

override_dh_auto_install-indep:

override_dh_installdocs:
	dh_installdocs -Xsystemd/ -Xhalog/

override_dh_installexamples:
	dh_installexamples -X build.cfg

override_dh_installinit:
	dh_installinit --no-restart-after-upgrade --no-stop-on-upgrade

override_dh_installsystemd:
	dh_installsystemd --no-restart-after-upgrade --no-stop-on-upgrade

override_dh_strip:
	dh_strip --dbgsym-migration="haproxy-dbg"