#!/usr/bin/make -f

%:
	dh $@ --with autoreconf

# do not install the plugins in a multi-arch location as that will break everyone's
# configuration.
override_dh_auto_configure:
	dh_auto_configure -- --with-moduledir="\$${prefix}/lib/lcmaps"

override_dh_makeshlibs:
	dh_makeshlibs -n

# The package installs too many files. The .a and .la files should not be shipped,
# and the package documentation directory is the wrong name for Debian.
override_dh_install:
	rm debian/lcmaps-plugins-verify-proxy/usr/lib/lcmaps/lib*.a
	rm debian/lcmaps-plugins-verify-proxy/usr/lib/lcmaps/lib*.la
	rm -rf debian/lcmaps-plugins-verify-proxy/usr/share/doc/lcmaps-plugins-verify-proxy-*/
	dh_install

override_dh_gencontrol:
	dh_gencontrol -- \
	  -Vlib:Depends=$(shell dpkg-query -W -f '$${Depends}' liblcmaps-dev \
			| sed -E 's/.*(liblcmaps[[:digit:]][[:alnum:].-]+).*/\1/')
