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

include /usr/share/dpkg/architecture.mk
DATADIR = /usr/lib/$(DEB_HOST_MULTIARCH)/espeak-ng-data

%:
	dh $@

override_dh_autoreconf:
ifneq ($(SOURCE_DATE_EPOCH),)
	# Fix their time after being patched by debian/patches/privacy
	touch -t $(shell date +"%Y%m%d%H%M.%S" --date=@$(SOURCE_DATE_EPOCH)) README.md docs/building.md docs/languages/gmw/lb.md
endif
	dh_autoreconf ./autogen.sh

override_dh_auto_configure:
	dh_auto_configure -- --without-speechplayer

override_dh_auto_build:
	dh_auto_build -- DATADIR=$(DATADIR)
	LC_ALL=C.UTF-8 $(MAKE) docs

override_dh_auto_install:
	dh_auto_install -- DATADIR=$(DATADIR)

override_dh_auto_test:
	dh_auto_test --no-parallel

override_dh_install:
	dh_install
	mkdir $(CURDIR)/debian/espeak-ng-data-udeb
	[ ! -d $(CURDIR)/debian/espeak-ng-data/usr ] || cp -al $(CURDIR)/debian/espeak-ng-data/usr $(CURDIR)/debian/espeak-ng-data-udeb
	rm -fr $(CURDIR)/debian/espeak-ng-data-udeb/usr/share