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

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

GPK_CONFIGURE_FLAGS = -Dtests=false

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

# Define install and build directory
INSTALLDIR = $(CURDIR)/debian/tmp

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(GPK_CONFIGURE_FLAGS)

override_dh_auto_install:
	dh_auto_install --destdir=$(INSTALLDIR)

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 $(INSTALLDIR)/usr/share/applications/gpk-prefs.desktop

	# this .desktop file refers to a binary that is no longer built, and should probably also be removed upstream
	rm $(INSTALLDIR)/usr/share/applications/gpk-install-local-file.desktop
	dh_install

override_dh_missing:
	dh_missing --fail-missing
