#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

# Substvars
META_FONTS = $(shell apt-cache depends "task-.*-desktop" "libreoffice*" | grep -E '\b(fonts|ttf)' | sed -e "s/^.* //" -e "/^<[^ ]\+>$$/d" | sort -u | xargs | sed -e "s/ /, /g")
META_DESKTOP_DEPENDS = $(shell apt-cache show task-desktop | grep "^Depends:" | sed -e "s/^Depends: //" -e "s/tasksel[^,]*, //")
META_DESKTOP_RECOMMENDS = $(shell apt-cache show task-desktop | grep "^Recommends:" | sed -r -e "s/^Recommends: //" -e "s/task-[[:alnum:]]+-desktop( \| |, )//g")

%:
	dh $@

override_dh_gencontrol:
	dh_gencontrol -- -Vmeta-fonts="$(META_FONTS)" -Vmeta-desktop-depends="$(META_DESKTOP_DEPENDS)" -Vmeta-desktop-recommends="$(META_DESKTOP_RECOMMENDS)"
