#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@ --parallel --with gnome --with translations

override_dh_auto_configure:
	meson builddir --libexecdir=lib/${DEB_HOST_MULTIARCH} \
	               --prefix=/usr \
	               --sysconfdir=/etc \
	               -Dgvfs_pkgs=gvfs-backends,python-gi,gir1.2-glib-2.0 \
	               -Dboto_pkgs=python-boto \
	               -Dcloudfiles_pkgs=python-cloudfiles \
	               -Dswiftclient_pkgs=python-swiftclient

override_dh_auto_build:
	ninja -v -C builddir

override_dh_auto_install:
	DESTDIR=$(CURDIR)/debian/tmp ninja -v -C builddir install

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_auto_test:
	rm -rf $(CURDIR)/debian/tmp-home
	mkdir -p $(CURDIR)/debian/tmp-home
	HOME=$(CURDIR)/debian/tmp-home dh_auto_test
	fusermount -u $(CURDIR)/debian/tmp-home/.gvfs || true
	rm -rf $(CURDIR)/debian/tmp-home

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(CURDIR)/debian/tmp-home
