summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules90
1 files changed, 48 insertions, 42 deletions
diff --git a/debian/rules b/debian/rules
index 3e7b051..d2bfc83 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,20 +7,18 @@
export SHELL = /bin/sh -e
-DISTRO:=$(shell (lsb_release -is 2>/dev/null || echo Debian) | sed s:Debian:Debian/GNU:)
-
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto future=+lfs
# Extra hardening flags (level 3):
# https://developers.redhat.com/articles/2022/09/17/gccs-new-fortification-level
# https://fedoraproject.org/wiki/Changes/Add_FORTIFY_SOURCE%3D3_to_distribution_build_flags
export DEB_CPPFLAGS_MAINT_APPEND = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions
-DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/buildtools.mk # for ${CC}
include /usr/share/dpkg/pkg-info.mk
+include /usr/share/dpkg/vendor.mk
# list of packages we build (cache it to avoid extra execs)
export POSTFIX_PACKAGES_2BUILD ?= $(shell dh_listpackages)
@@ -36,13 +34,30 @@ maps = cdb ldap lmdb mysql pcre pgsql sqlite
# sed ERE for postfix-files to select files for the doc package
docfiles-re = \$$(sample|readme|html)_directory
+# common defines
CCARGS = \
-DDEBIAN \
+ -DMYORIGIN_FROM_FILE
+CONFARGS = \
+ CC="${CC}" \
+ DEBUG='' \
+ OPT="${CPPFLAGS} ${CFLAGS} ${LDFLAGS}"
+AUXLIBS =
+
+# shared libs and dynamic modules
+# can add SHLIB_CFLAGS SHLIB_SUFFIX
+CONFARGS += \
+ PLUGIN_LD="${CC} -shared ${LDFLAGS}" \
+ SHLIB_RPATH="-Wl,-rpath,${prvlibdir} ${LDFLAGS}" \
+ shlib_directory=${prvlibdir} \
+ shared=yes pie=yes dynamicmaps=yes
+
+# optional stuff
+CCARGS += \
-DHAS_PCRE=2 $(shell pcre2-config --cflags) \
-DHAS_LDAP \
-DUSE_LDAP_SASL \
-DHAS_SQLITE \
- -DMYORIGIN_FROM_FILE \
-DHAS_CDB \
-DHAS_LMDB \
-DHAS_MYSQL -I/usr/include/mysql \
@@ -53,12 +68,7 @@ CCARGS = \
-DUSE_CYRUS_SASL \
-DUSE_TLS \
-CONFARGS = \
- DEBUG='' \
- OPT="${CPPFLAGS} ${CFLAGS} ${LDFLAGS}" \
- PLUGIN_LD="${CC} -shared ${CPPFLAGS} ${CFLAGS} ${LDFLAGS}" \
- SHLIB_RPATH="-Wl,-rpath,${prvlibdir} ${LDFLAGS}" \
- AUXLIBS="${AUXLIBS}" \
+CONFARGS += \
AUXLIBS_CDB="-lcdb" \
AUXLIBS_LDAP="-lldap -llber" \
AUXLIBS_LMDB="-llmdb" \
@@ -67,11 +77,12 @@ CONFARGS = \
AUXLIBS_PGSQL="-lpq" \
AUXLIBS_SQLITE="-lsqlite3" \
-AUXLIBS = -lssl -lcrypto -lsasl2 -lpthread
+AUXLIBS += -lssl -lcrypto -lsasl2 -lpthread
ifneq (,$(filter ${package}-mongodb,${POSTFIX_PACKAGES_2BUILD}))
maps += mongodb
-CCARGS += -DHAS_MONGODB -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
+CCARGS += -DHAS_MONGODB \
+ -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0
CONFARGS += AUXLIBS_MONGODB="-lmongoc-1.0 -lbson-1.0"
endif
@@ -80,13 +91,11 @@ endif
override_dh_auto_configure:
- touch .makefiles-made
${MAKE} \
CCARGS="${CCARGS}" \
${CONFARGS} \
- shared=yes pie=yes dynamicmaps=yes \
+ AUXLIBS="${AUXLIBS}" \
daemon_directory=${daemondir} \
- shlib_directory=${prvlibdir} \
manpage_directory=/usr/share/man \
readme_directory=${docdir} \
html_directory=${docdir}/html \
@@ -103,8 +112,8 @@ override_dh_auto_build-arch:
sed -i 's@\s\+-ffile-prefix-map=\S\+=.\s\+@ @g' conf/makedefs.out
sed -i 's@SHLIB_ENV = LD_LIBRARY_PATH=\S\+@SHLIB_ENV = /debian-build-path/lib@g' conf/makedefs.out
- sed "s:@@DISTRO@@:$(DISTRO):g" < debian/main.cf.in > conf/main.cf.debian
- sed "s:@@DISTRO@@:$(DISTRO):g" < conf/main.cf > conf/main.cf.dist
+ sed "s:@DEB_VENDOR@:${DEB_VENDOR}:g" < debian/main.cf.in > conf/main.cf.debian
+ sed "s:@DEB_VENDOR@:${DEB_VENDOR}:g" < conf/main.cf > conf/main.cf.dist
override_dh_auto_build-indep:
@@ -211,30 +220,31 @@ override_dh_install-arch:
sed 's/@MULTIARCH@/${DEB_HOST_MULTIARCH}/' debian/configure-instance.in > \
${base}${prvlibdir}/configure-instance.sh
chmod 0755 ${base}${prvlibdir}/configure-instance.sh
- install -m0755 \
- debian/postfix-add-filter \
- debian/postfix-add-policy \
- -t ${base}/usr/sbin/
+ echo ${package}:Provides=default-mta \
+ >> debian/${package}.substvars
+ install -m0644 debian/postfix.ufw.profile -DT ${base}/etc/ufw/applications.d/postfix
+ install -m0644 debian/rsyslog.conf -DT ${base}/etc/rsyslog.d/postfix.conf
+ install -m0644 debian/postfix.insserv.conf -DT ${base}/etc/insserv.conf.d/postfix
+ for file in \
+ /etc/ppp/ip-up.d/postfix /etc/ppp/ip-down.d/postfix \
+ /etc/network/if-up.d/postfix /etc/network/ip-down.d/postfix \
+ /etc/resolvconf/update-libc.d/postfix \
+ /usr/lib/networkd-dispatcher/routable.d/postfix \
+ /usr/lib/networkd-dispatcher/off.d/postfix \
+ /usr/lib/NetworkManager/dispatcher.d/postfix \
+ ; do \
+ install -m0755 debian/update-resolvconf -DT ${base}$$file; \
+ done
+ $(if $(filter ${DEB_VENDOR},Ubuntu),\
+ install -m0644 debian/postfix.apport -DT ${base}/usr/share/apport/package-hooks/postfix.py)
install -m0755 auxiliary/collate/collate.pl -T ${base}/usr/sbin/postfix-collate
txt2man -t postfix-collate -r postfix-$(DEB_VERSION_UPSTREAM) \
-d '$(shell date -d @$(SOURCE_DATE_EPOCH))' -s 1 \
auxiliary/collate/README \
> ${base}/usr/share/man/man1/postfix-collate.1
install -m0755 auxiliary/qshape/qshape.pl -T ${base}/usr/sbin/qshape
- dh_installman -p ${package} debian/*.8
- install -m0644 debian/postfix.ufw.profile -DT ${base}/etc/ufw/applications.d/postfix
- install -m0644 debian/rsyslog.conf -DT ${base}/etc/rsyslog.d/postfix.conf
- install -m0644 debian/postfix.insserv.conf -DT ${base}/etc/insserv.conf.d/postfix
- install -m0755 debian/ip-up.d -DT ${base}/etc/ppp/ip-up.d/postfix
- install -m0755 debian/ip-down.d -DT ${base}/etc/ppp/ip-down.d/postfix
- install -m0755 debian/ip-up.d -DT ${base}/etc/network/if-up.d/postfix
- install -m0755 debian/ip-down.d -DT ${base}/etc/network/if-down.d/postfix
- install -m0755 debian/ip-up.d -DT ${base}/usr/lib/networkd-dispatcher/routable.d/postfix
- install -m0755 debian/ip-down.d -DT ${base}/usr/lib/networkd-dispatcher/off.d/postfix
- install -m0755 debian/update-libc.d -DT ${base}/etc/resolvconf/update-libc.d/postfix
- if dpkg-vendor --is ubuntu; then \
- install -m0644 debian/postfix.apport -DT ${base}/usr/share/apport/package-hooks/postfix.py; \
- fi
+ install -m0755 debian/postfix-add-filter debian/postfix-add-policy -t ${base}/usr/sbin/
+ dh_installman -p ${package} debian/postfix-add-filter.8 debian/postfix-add-policy.8
install -m0755 debian/postfix_groups.pl -t ${base}${prvlibdir}/
override_dh_installsystemd:
@@ -243,14 +253,10 @@ override_dh_installsystemd:
install -m0755 debian/postfix-instance-generator \
-Dt ${base}/$(shell pkg-config --variable=systemdsystemgeneratordir systemd)/
-execute_before_dh_gencontrol:
- echo ${package}:Provides=default-mta \
- >> debian/${package}.substvars
-
-override_dh_auto_clean:
- [ ! -f .makefiles-made ] || ${MAKE} tidy
- rm -f .makefiles-made
+clean:
+ [ ! -f conf/makedefs.out ] || ${MAKE} tidy
+ dh_clean conf/main.cf.debian conf/main.cf.dist
# Below here is fairly generic really