#!/usr/bin/make -f

lib_pkgs := calligra-libs

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

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

%:
	dh $@ --parallel --with kde --with sodeps

override_dh_auto_configure:
	dh_auto_configure -Skde -- -DKDE4_BUILD_TESTS=OFF

override_dh_auto_install:
	dh_auto_install
	# Remove symlinks of private libraries
	find debian/tmp/usr/lib -maxdepth 1 -name '*private*.so' -type l -delete
	rm -f debian/tmp/usr/lib/librcps_plan.so
	# image/openraster is provided by shared-mime-info >= 0.70
	# (and squeeze has 0.71)
	rm -f debian/tmp/usr/share/mime/packages/krita_ora.xml
ifeq (,$(filter %-dev, $(shell dh_listpackages)))
	# No -dev stuff, so remove their content to shorten the output
	# of dh_install --list-missing
	rm -rf debian/tmp/usr/include
	rm -rf debian/tmp/usr/share/kde4/apps/cmake
	find debian/tmp/usr/lib -maxdepth 1 -name '*.so' -type l -delete
endif

override_dh_install:
	dh_install --list-missing

override_dh_strip:
	dh_strip --dbg-package=calligra-dbg

override_dh_shlibdeps:
	dh_shlibdeps $(addprefix -p,$(lib_pkgs)) -- -xkde-runtime -xkdepim-runtime
	dh_shlibdeps --remaining-packages

.PHONY: override_dh_auto_test

