#!/usr/bin/make -f

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

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@ --with kf5,pkgkde_symbolshelper --buildsystem kf5 --without build_stamp

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(CURDIR)/build-qt4

override_dh_auto_configure:
	dh_auto_configure
	dh_auto_configure --builddirectory=$(CURDIR)/build-qt4 -- -DUSE_KDE4=true

override_dh_auto_build:
	dh_auto_build
	dh_auto_build --builddirectory=$(CURDIR)/build-qt4

override_dh_auto_install:
	dh_auto_install
	dh_auto_install --builddirectory=$(CURDIR)/build-qt4
	mkdir -p $(CURDIR)/debian/kde-style-breeze-qt4/usr/lib/$(DEB_HOST_MULTIARCH)/qt4/plugins/styles/
	ln -s /usr/lib/kde4/plugins/styles/breeze.so $(CURDIR)/debian/kde-style-breeze-qt4/usr/lib/$(DEB_HOST_MULTIARCH)/qt4/plugins/styles/

override_dh_install:
	# This is required to make sure Plasma does not
	# fall back to a cursor theme from the 90's
	CURDIR=$(CURDIR) $(CURDIR)/debian/wrapperthemes.sh breeze_cursors \
	                                                   Breeze_Snow
	dh_install

override_dh_strip:
	dh_strip --dbgsym-migration='breeze-dbg (<= 4:5.5.5-1~~)'
