#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/architecture.mk

# aligned_overflow makes the sender walk a 2 GiB file byte by byte, which
# takes longer than the test's hard-coded 240s on the riscv64 buildds
# (#1153316).  The overflow it covers is not architecture-specific, so the
# test still runs everywhere else.  Keep in sync with d/tests/upstream-tests*.
ifeq ($(DEB_HOST_ARCH),riscv64)
export RSYNC_EXCLUDE = aligned_overflow
endif

%:
	dh $@

# Disable ASM optimizations (--disable-md5-asm).
# This is not needed because the ASM-optimized implementation
# available is the MD5 hash, which is actually a no-op because we link
# against OpenSSL and rsync ends up using that library's
# implementation of the hash.  Even then, the final binary ends up
# with the ASM-optimized version included, which makes it become
# CET-incompatible.
# Don't use bundled zlib (with-included-zlib=no).
override_dh_auto_configure:
	mkdir -p zlib popt
	touch zlib/dummy.in
	touch popt/dummy.in
	dh_auto_configure -- --with-included-zlib=no --disable-md5-asm --with-rrsync

execute_before_dh_auto_clean:
	rm -rf zlib popt

override_dh_installsystemd:
	dh_installsystemd --no-enable
