build/emacs: add target to create elpa package

This package can be created without emacs, but will only be usable in
versions of emacs supporting package.el
This commit is contained in:
David Bremner 2016-11-19 13:44:29 -04:00
parent 46a47f06a6
commit 10f8c5d205
2 changed files with 12 additions and 0 deletions

View file

@ -23,6 +23,8 @@ ifeq ($(IS_GIT),yes)
VERSION:=$(shell git --git-dir=${srcdir}/.git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/) VERSION:=$(shell git --git-dir=${srcdir}/.git describe --abbrev=7 --match '[0-9.]*'|sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
# drop the ~g$sha1 part # drop the ~g$sha1 part
ELPA_VERSION:=$(word 1,$(subst ~, ,$(VERSION))) ELPA_VERSION:=$(word 1,$(subst ~, ,$(VERSION)))
# convert git version to package.el friendly form
ELPA_VERSION:=$(subst +,snapshot,$(ELPA_VERSION))
# Write the file 'version.stamp' in case its contents differ from $(VERSION) # Write the file 'version.stamp' in case its contents differ from $(VERSION)
FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; echo $$vs) FILE_VERSION:=$(shell test -f version.stamp && read vs < version.stamp || vs=; echo $$vs)

View file

@ -24,6 +24,8 @@ emacs_sources := \
$(dir)/notmuch-company.el \ $(dir)/notmuch-company.el \
$(dir)/notmuch-draft.el $(dir)/notmuch-draft.el
elpa_sources := ${emacs_sources} $(dir)/notmuch-pkg.el
$(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
$(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
@sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \ @sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
@ -73,6 +75,14 @@ ifeq ($(HAVE_EMACS),1)
$(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $< $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
endif endif
elpa: $(ELPA_FILE)
notmuch-emacs-%.tar: ${elpa_sources}
mkdir -p .elpa-build/notmuch-${ELPA_VERSION}
cp ${elpa_sources} .elpa-build/notmuch-${ELPA_VERSION}
tar -C .elpa-build -cf $@ notmuch-${ELPA_VERSION}
rm -r .elpa-build
ifeq ($(WITH_EMACS),1) ifeq ($(WITH_EMACS),1)
ifeq ($(HAVE_EMACS),1) ifeq ($(HAVE_EMACS),1)
all: $(emacs_bytecode) all: $(emacs_bytecode)