#!/usr/bin/make -f

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

BUILDDIR = $(CURDIR)/debian/build
DESTDIR = $(CURDIR)/debian/tmp

%:
	dh $@ \
	      --with sysuser \
	      --builddir $(BUILDDIR)

# Run configure.
#
# We want to be explicit about the user the daemon will run as, even
# though it matches the default, in case upstream changes their mind
# about the name at some point in the future.
override_dh_auto_configure:
	dh_auto_configure -- \
	                  --with-system-user=libvirtdbus

# Install files.
#
# We use debian/tmp as a staging area so that we can have full control
# over what exactly ends up in the package.
override_dh_auto_install:
	dh_auto_install --destdir=$(DESTDIR)
	# polkit 105 compatibility
	install -m 0755 -d \
	        $(DESTDIR)/var/lib/polkit-1/localauthority/10-vendor.d/
	install -m 0644 \
	        debian/polkit/libvirt-dbus.pkla \
	        $(DESTDIR)/var/lib/polkit-1/localauthority/10-vendor.d/
