#!/usr/bin/make -f

# export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export QT_SELECT = qt5

# Define install target dir
INSTALLDIR = $(CURDIR)/debian/tmp

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

execute_before_dh_auto_configure:
	cp -rp /usr/lib/lazarus/*/lcl/interfaces/qt5/cbindings/* .
	quilt setup --sourcedir debian/patches debian/patches/series
	quilt push -a

%:
	dh $@

override_dh_auto_configure:
	qmake

override_dh_auto_install:
	# Now install the lib
	dh_auto_install --destdir=$(INSTALLDIR)
	# If we don't have a multiarch-Qt, copy lib to multiarch path anyway
	$(CURDIR)/debian/fix-multiarch.sh TARGET=$(INSTALLDIR) HOST_MULTIARCH=$(DEB_HOST_MULTIARCH)
