#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DH_ALWAYS_EXCLUDE=.la:/pypff.a
export SKIP_PYTHON_TESTS=1

%:
	dh $@ --with python3 --buildsystem=autoconf

override_dh_auto_configure:
	dh_auto_configure -- --enable-python

# Upstream's tests recompile three files in a different environment
# resulting in another linker run during the install phase producing
# deviating binaries for builds run with tests and without.
# Saving the affected object files before the tests and restoring them
# thereafter inhibits reproducibility failures visible only at
# https://tests.reproducible-builds.org
override_dh_auto_test:
	mv pfftools/info_handle.o pfftools/info_handle.o~
	mv pfftools/pfftools_output.o pfftools/pfftools_output.o~
	mv pfftools/pfftools_signal.o pfftools/pfftools_signal.o~
	dh_auto_test
	mv pfftools/info_handle.o~ pfftools/info_handle.o
	mv pfftools/pfftools_output.o~ pfftools/pfftools_output.o
	mv pfftools/pfftools_signal.o~ pfftools/pfftools_signal.o

# Clean also remnants of build done during dh_auto_test
execute_after_dh_auto_clean:
	rm -rf tests/test_*.dir
