#!/usr/bin/make -f
export DH_VERBOSE = 1
export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

%:
	dh $@ --with gir

override_dh_clean:
	dh_clean
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo ubuntu),ubuntu)

	@if [ -e ./debian/ubuntu/applied ]; then \
		patch -R -p1 < debian/ubuntu/show_nm-applet_in_tray.patch ; \
		rm ./debian/ubuntu/applied ; \
	fi
endif

override_dh_auto_configure:
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo ubuntu),ubuntu)
	patch -p1 < debian/ubuntu/show_nm-applet_in_tray.patch
	touch ./debian/ubuntu/applied
endif
	dh_auto_configure -- --prefix=/usr --libdir=/usr/lib

override_dh_auto_install:
	dh_auto_install
	mkdir -p "$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0"
	mv "$(CURDIR)/debian/tmp/usr/lib/girepository-1.0/Budgie-1.0.typelib" "$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0"
	rm -rf "$(CURDIR)/debian/tmp/usr/lib/girepository-1.0"

override_dh_installgsettings:
	# install override but budgie has to take precedence over
	# gnome-shell defaults
	dh_installgsettings --priority=15

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog-announcement.txt
