#!/usr/bin/make -f
# export DH_VERBOSE=1

export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

override_dh_auto_clean:
	dh_auto_clean
	rm -rf temp

# Build the qt4 plugins and save in a temp folder
override_dh_auto_configure:
	qmake-qt4 kvantum.pro

override_dh_auto_build:
	dh_auto_build
	mkdir -p temp
	cp style/*.so temp
	
# clean up and build Qt 5 binaries
	make distclean
	/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/bin/qmake kvantum.pro
	dh_auto_build

# install the qt4 style plugin from /temp
override_dh_auto_install:
	mkdir -p debian/qt5-style-kvantum/usr/lib/$(DEB_HOST_MULTIARCH)/qt4/plugins/styles
	install -m 644 temp/*.so debian/qt5-style-kvantum/usr/lib/$(DEB_HOST_MULTIARCH)/qt4/plugins/styles
	dh_auto_install

override_dh_dwz:

override_dh_strip:
	dh_strip --no-automatic-dbgsym

%:
	dh ${@} 
