#!/usr/bin/make -f
# -*- makefile -*-

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dgnome-shell=$(if $(filter gnome-shell-extension-gpaste,$(shell dh_listpackages)),true,false) \
		-Dsystemd-user-unit-dir=/usr/lib/systemd/user \
		-Dvapi=false

override_dh_gencontrol:
	dh_gencontrol -- \
		-Vgnome:MinimumVersion=$(shell python3 -c "import json; \
		print(min(int(x) for x in json.load(open('src/gnome-shell/metadata.json.in', 'rt'))['shell-version']))") \
		-Vgnome:MaximumVersion=$(shell python3 -c "import json; \
		print(1+max(int(x) for x in json.load(open('src/gnome-shell/metadata.json.in', 'rt'))['shell-version']))")
