#!/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

execute_after_dh_auto_install:
	set -e; \
	vendor=$$(echo $(DEB_VENDOR) | tr A-Z a-z); \
	if ! [ -f debian/mimeapps/$$vendor.conf ]; then \
		vendor=debian; \
	fi; \
	$(MAKE) -C debian/mimeapps $$vendor.list; \
	cp -a debian/mimeapps/$$vendor.list debian/gnome-mimeapps.list
	install -m644 debian/gnome-mimeapps.list debian/tmp/usr/share/applications/gnome-mimeapps.list

override_dh_gnome_clean:
	dh_gnome_clean --no-control
