#!/usr/bin/make -f
VERSION=2.3.1

%:
	dh $@ --with elpa --parallel

override_dh_auto_build:
	make elpa VERSION=$(VERSION)
	tar --delete --file magit-$(VERSION).tar magit-$(VERSION)/COPYING
	@echo git-commit-$(VERSION).el > debian/elpa-git-commit.elpa
	@echo magit-$(VERSION).tar > debian/elpa-magit.elpa
	@echo magit-popup-$(VERSION).tar > debian/elpa-magit-popup.elpa
	@echo with-editor-$(VERSION).tar > debian/elpa-with-editor.elpa

override_dh_auto_install:
	@echo do not run make install

override_dh_clean:
	dh_clean
	rm -f debian/elpa-git-commit.elpa debian/elpa-magit.elpa debian/elpa-magit-popup.elpa debian/elpa-with-editor.elpa


override_dh_auto_test:
	@echo Testing disabled, discussion in comment below.

# "make test" runs a test suite, which works fine on a development
# environment, but not on the autobuilders.  To get it to work on the
# autobuilders requires a few tweaks, as of 2.2.1:

# - The upstream tarball does not contain /t/magit-tests.el; for
#   convenience this is included in
#   debian/patch/*-upstream-repo-files.patch

# - The testing routines require git to be installed, so you need a
#   build dependency on git

# - There is one more mysterious error with a non-ASCII filename that
#   occurs only in a minimal chroot environment
