#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DCMAKE_INSTALL_PREFIX=/usr -DUSEQT4=0 -DUSEQT5=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=1

override_dh_auto_build:
	dh_auto_build -- doc

# That's a bit hackish but solved the lintian error about private cmake files
override_dh_install:
	dh_install
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --override 's/libQt5[CGX][oreuiml]\+5-dev/qtbase5-dev/' \
		    --override 's/libquazip5-1-dev/libquazip5-dev/' \
		    --exclude-la \
                    --movedev debian/tmp/usr/include/odsstream usr/include \
                    --movedev debian/tmp/usr/lib/*/cmake usr/lib/$(DEB_HOST_MULTIARCH) \
                    debian/tmp/usr/lib/*/*.so
