summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules90
1 files changed, 90 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..cc7ff8e
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,90 @@
+#!/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_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
+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"
+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
+
+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"