#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed

# conflicts with old calligra-l10n
# (mostly copied from l10n-packages.mk in pkg-kde-tools)
l10npkgs_firstversion_ok := 1:2.9.11-1~
l10npkgs_prefix := calligra-l10n
l10npkgs_fixed_version_comma := (<< $(l10npkgs_firstversion_ok)),
# the list of languages in calligra-l10n < 2.9
l10npkgs_langs := bs ca cavalencia cs da de el engb es et eu fi fr gl hu it ja kk nb nds nl pl pt ptbr ru sk sv uk zhcn zhtw
l10npkgs_packages_rels := $(patsubst %,$(l10npkgs_prefix)-% $(l10npkgs_fixed_version_comma),$(l10npkgs_langs))

%:
	dh $@ --parallel --with kf5

override_dh_auto_configure:
	dh_auto_configure -Skf5 -- -DPACKAGERS_BUILD=ON -DFOUNDATION_BUILD=OFF -DBUILD_TESTING=OFF

override_dh_auto_install:
	dh_auto_install
	# remove symlinks of private libraries
	find debian/tmp -name '*.so' -type l -print -delete
	# unused tool
	rm -v debian/tmp/usr/bin/gmicparser

override_dh_install:
	dh_install --list-missing

override_dh_gencontrol:
	dh_gencontrol -pkrita-l10n -- -Vkrita:oldLangs='$(l10npkgs_packages_rels)'
	dh_gencontrol --remaining-packages

.PHONY: override_dh_auto_test
