#!/usr/bin/make -f
#export DH_VERBOSE=1

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

ifeq ($(DEB_HOST_ARCH_OS), linux)
	GPK_CONFIGURE_FLAGS = -Dsystemd=true
else
	GPK_CONFIGURE_FLAGS = -Dsystemd=false
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(GPK_CONFIGURE_FLAGS)

override_dh_install:
	# we don't ship the gpk-prefs .desktop file, since this tool can be accessed through the main application
	# and we might want to have users use software-properties instead if it is available.
	rm debian/tmp/usr/share/applications/gpk-prefs.desktop

	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	xvfb-run dh_auto_test
endif

override_dh_installdocs:
	dh_installdocs
	mkdir -p debian/gnome-packagekit/usr/share/doc/gnome-packagekit
	appstreamcli metainfo-to-news $(CURDIR)/*/data/metainfo/org.gnome.Packages.metainfo.xml \
		$(CURDIR)/debian/gnome-packagekit/usr/share/doc/gnome-packagekit/NEWS
