#!/usr/bin/make -f

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Configure without ASR (Automatic Speech Recognition) on architectures
# that don't have libsphinxbase/libpocketsphinx.
# Recheck this list with next release.
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifneq (,$(filter mips64el mipsel s390x alpha ia64 powerpc,$(DEB_HOST_ARCH)))
ASR = -Dasr=false
override_dh_install:
	dh_install -Xlibgstparlasphinx.so \
	           -Xasr.page \
	           -Xasr-setup.page
else
ASR = -Dasr=true
endif

override_dh_autoreconf:
	dh_autoreconf --as-needed

override_dh_auto_configure:
	dh_auto_configure -- -Dgtk-doc=true \
	                     -Dglade=true \
                             -Dgir=true \
	                     $(ASR)

override_dh_makeshlibs:
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/gstreamer-1.0/libgstparlasphinx

override_dh_auto_test:
# Skip tests, they fail in build environment

%:
	dh $@ --with gir
