#!/usr/bin/make -f
# Copyright © 2017-2020 IOhannes m zmölnig
# under the LGPL-2.1+

DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Forcefully enable tests (they are disabled by default on riscv64 in Ubuntu,
# see https://launchpad.net/bugs/1891686) because libsndfile1-dev wants to
# install test binaries (https://launchpad.net/bugs/1917650).
DEB_BUILD_OPTIONS := $(filter-out nocheck,$(DEB_BUILD_OPTIONS))

%:
	dh $@

override_dh_clean:
	dh_clean
	-find man/ -type l -delete

override_dh_install:
	dh_install
	find debian/libsndfile1-dev/ -name test_wrapper.sh -exec \
		sed -e 's|^\(ABS_TOP_SRCDIR\)=.*|\1=$$\(pwd\)|' -i {} +
	find debian/libsndfile1-dev/ -name pedantic-header-test.sh -exec \
		sed -e 's| -I *[^ ]*| |g' -i {} +
	find debian/libsndfile1-dev/usr/lib/ -name "*.sh" -exec \
		chmod +x {} +
