#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs

GS_MAJOR_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed 's/[~.].*//')

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dman=true \
		-Dx11=true

execute_before_dh_install:
	cd debian/tmp/usr/share; \
	for f in wayland-sessions/*.desktop xsessions/*.desktop applications/*.desktop; do \
		echo X-Ubuntu-Gettext-Domain=gnome-session-$(GS_MAJOR_VERSION) >> "$$f"; \
	done

execute_after_dh_auto_build:
	ninja -C obj-$(DEB_HOST_GNU_TYPE) gnome-session-$(GS_MAJOR_VERSION)-pot

execute_after_dh_auto_clean:
	rm -f po/gnome-session-$(GS_MAJOR_VERSION).pot

override_dh_gnome_clean:
	dh_gnome_clean --no-control
