#!/usr/bin/make -f

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
ifeq ($(DEB_HOST_ARCH_OS),hurd)
  EXTRA_CONFIGURE_ARGS += --disable-usb
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(EXTRA_CONFIGURE_ARGS) \
		--with-systemdsystemunitdir=/lib/systemd/system \
		--enable-usbdropdir=/usr/lib/pcsc/drivers \
		--enable-ipcdir=/run/pcscd \
		$(shell dpkg-buildflags --export=configure)

ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes) $(DEB_HOST_ARCH), yes i386)
   skip_packages = -Npcscd
endif

override_dh_builddeb:
	dh_builddeb ${skip_packages}

override_dh_gencontrol:
	dh_gencontrol ${skip_packages}
