#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_BUILD_HARDENING=1

%:
	dh $@ --with autoreconf,python3

override_dh_auto_configure:
	dh_auto_configure -- --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
	                     pidpath=/var/run/speech-dispatcher/

override_dh_auto_install:
	dh_auto_install
	for file in $$(find debian/tmp/usr/lib/ -name "*.la"); do \
		sed -i "/dependency_libs/ s/'.*'/''/" $$file ; \
	done

override_dh_strip:
	dh_strip -pspeech-dispatcher --dbg-package=speech-dispatcher-dbg
	dh_strip -pspeech-dispatcher-flite
	dh_strip -plibspeechd2

override_dh_installinit:
	dh_installinit -a --error-handler=true

override_dh_fixperms:
	dh_fixperms
	chmod 700 $(CURDIR)/debian/speech-dispatcher/var/log/speech-dispatcher
