#!/usr/bin/make -f

# DH_VERBOSE := 1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

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

%:
	dh $@ --buildsystem=cmake --without autoreconf

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE="Release" \
		-DBUILD_DIVSUFSORT64=YES \
		-DCMAKE_LIBRARY_ARCHITECTURE=${DEB_HOST_MULTIARCH}

not_override_dh_install_since_there_is_no_static_lib:
	dh_install
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --movedev debian/tmp/usr/include/* usr/include \
		    --movedev "debian/tmp/usr/lib/*/pkgconfig/*.pc" usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
		    debian/tmp/usr/lib/*/*.so
	find debian -name "lib*.la" -delete
