#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with=single-binary

# VERSION: upstream derives the version from "git describe" which reports
#   "unknown-version" when building from the release tarball. Report the Debian
#   package version instead.
# nbdkit: debhelper compat 14 passes --auto-features=enabled, which turns the
#   "auto" nbdkit feature on. The plugin is not packaged yet, so ask for it
#   explicitly to be left out.
# udev_group: the udev rules only tag EDL devices with uaccess, which grants
#   access to the user on the active local seat. Also grant access to the
#   plugdev group so that flashing works from ssh or other non-seat sessions,
#   matching how other Debian packages handle USB devices.
override_dh_auto_configure:
	dh_auto_configure -- \
		-DVERSION=$(DEB_VERSION) \
		-Dnbdkit=disabled \
		-Dudev_group=plugdev

# The nbdkit plugin is disabled above, so leave out its documentation.
override_dh_installdocs:
	dh_installdocs -Xnbd.md
