#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_configure:
	dh_testdir
	dh_auto_configure -- --enable-mt

	# Regenerate the testsuite instead of reusing the prebuilt one: the CVE
	# patches add tests/symlink-tar-abs.at and change tests/CVE-2019-14866.at.
	touch tests/package.m4
	rm -f tests/testsuite
	$(MAKE) -C tests ./testsuite

override_dh_install:
	dh_install
	rm -rf debian/cpio/usr/libexec
	rm -rf debian/cpio/usr/share/man/man8/rmt.8
	mv debian/cpio/usr/bin/mt debian/cpio/usr/bin/mt-gnu
	mv debian/cpio/usr/share/man/man1/mt.1 \
	  debian/cpio/usr/share/man/man1/mt-gnu.1
	install -Dm 644 NEWS README -t debian/cpio/usr/share/doc/cpio/
	gzip -9nv debian/cpio/usr/share/doc/cpio/*
