#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
export DEB_VERSION_UPSTREAM

%:
	dh $@ --with elpa

override_dh_auto_build:
	# the DEB_VERSION_UPSTREAM specific path must be the first in
	# debian/elpa-test, so that autopkgtest test the installed files
	grep -q '^ert_load_path = /usr/share/emacs/site-lisp/elpa/jabber-${DEB_VERSION_UPSTREAM},lisp$$' debian/elpa-test
	echo ";;; set load-path for jabber-omemo-core.so -*- lexical-binding: t; -*-" > jabber-omemo-load-path.el
	echo "(add-to-list 'load-path \"/usr/lib/${DEB_HOST_MULTIARCH}/emacs-jabber\")" >> jabber-omemo-load-path.el
	ln -s /usr/share/picomemo/src src/picomemo
	HOST_ARCH_BITS=$(DEB_HOST_ARCH_BITS) $(MAKE) -C src

execute_before_dh_elpa_test:
	$(MAKE) autoload

override_dh_auto_install:
