#! /usr/bin/make -f
# Build the libgcrypt package for Debian.

export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
export DEB_BUILD_MAINT_OPTIONS := hardening=+bindnow
export DEB_BUILD_OPTIONS := nodoc
export DH_OPTIONS := -Nlibgcrypt-mingw-w64-dev -Nlibgcrypt20-doc
# DEB_HOST_MULTIARCH is set by dpkg-buildpackage but not mandated by policy,
# provide fallback.
ifeq ($(origin DEB_HOST_MULTIARCH), undefined)
	export DEB_HOST_MULTIARCH = \
		$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
endif

include /usr/share/dpkg/pkg-info.mk

override_dh_auto_configure:
	# unbreak arch-only builds when texi is patched.
	if test doc/gcrypt.texi -nt doc/version.texi ; then \
		touch --reference=doc/version.texi doc/gcrypt.texi ; \
		fi
	dh_auto_configure --verbose --builddirectory=build -- \
		--enable-noexecstack \
		--enable-ld-version-script --enable-static

override_dh_auto_build-indep:
	# use current version in /usr/share/texmf/tex/texinfo/, see #803081

debian/tmp/usr/include/gcrypt.h:
	dh_auto_install --verbose --builddirectory=build

override_dh_auto_install-indep:	debian/tmp/usr/include/gcrypt.h

override_dh_auto_install-arch:
	dh_auto_install --arch --verbose --builddirectory=build
	install -m755 debian/clean-up-unmanaged-libraries \
		debian/libgcrypt20/usr/share/libgcrypt20/

override_dh_installinfo:
	dh_installinfo

%:
	dh $@ --builddirectory=build
