Skip to content

Commit 29ff368

Browse files
committed
Add new make package target for creating ELPA packages
This new target generates a package distribution file haskell-mode-<release-version>.tar (where <release-version> is inferred by `git describe --tags --abbrev=0`) according to the guidelines described in http://www.gnu.org/software/emacs/manual/html_node/elisp/Packaging.html which can then be installed directly via `M-x package-install-file` (or uploaded to Marmalade) This addresses #156 and #92
1 parent db10caa commit 29ff368

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

Makefile

+23-6
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ ELFILES = \
3333
inf-haskell.el
3434

3535
ELCFILES = $(ELFILES:.el=.elc)
36-
# AUTOLOADS = $(PACKAGE)-startup.el
3736
AUTOLOADS = haskell-site-file.el
38-
DIST_FILES = $(ELFILES) $(ELCFILES) $(AUTOLOADS) logo.svg Makefile README.md NEWS
37+
DIST_FILES = $(ELFILES) $(ELCFILES) $(AUTOLOADS) haskell-mode-pkg.el.in logo.svg Makefile README.md NEWS
3938
DIST_FILES_EX = examples/init.el examples/fontlock.hs examples/indent.hs
40-
TGZ = haskell-mode-$(GIT_VERSION).tar.gz
39+
DIST_TGZ = haskell-mode-$(GIT_VERSION).tar.gz
40+
41+
PKG_DIST_FILES = $(ELFILES) logo.svg
42+
PKG_TAR = haskell-mode-$(VERSION).tar
4143

4244
%.elc: %.el
4345
@$(BATCH) -f batch-byte-compile $<
@@ -53,7 +55,22 @@ clean:
5355

5456
info: # No Texinfo file, sorry.
5557

56-
dist: $(TGZ)
58+
# Generate snapshot distribution
59+
dist: $(DIST_TGZ)
60+
61+
# Generate ELPA-compatible package
62+
package: $(PKG_TAR)
63+
64+
$(PKG_TAR): $(PKG_DIST_FILES) haskell-mode-pkg.el.in
65+
@echo "VERSION = $(VERSION)"
66+
@echo "GIT_VERSION = $(GIT_VERSION)"
67+
rm -rf haskell-mode-$(VERSION)
68+
mkdir haskell-mode-$(VERSION)
69+
cp $(PKG_DIST_FILES) haskell-mode-$(VERSION)/
70+
sed -e 's/@VERSION@/$(VERSION)/g' < haskell-mode-pkg.el.in > haskell-mode-$(VERSION)/haskell-mode-pkg.el
71+
sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g;s/@VERSION@/$(VERSION)/g' < haskell-mode.el > haskell-mode-$(VERSION)/haskell-mode.el #NO_DIST
72+
tar cvf $@ haskell-mode-$(VERSION)
73+
rm -rf haskell-mode-$(VERSION)
5774

5875
$(AUTOLOADS): $(ELFILES) haskell-mode.elc
5976
[ -f $@ ] || echo ' ' >$@
@@ -66,7 +83,7 @@ haskell-mode.elc: haskell-mode.el
6683
mv haskell-mode.tmp.elc haskell-mode.elc #NO_DIST
6784
$(RM) haskell-mode.tmp.el #NO_DIST
6885

69-
$(TGZ): $(DIST_FILES)
86+
$(DIST_TGZ): $(DIST_FILES)
7087
rm -rf haskell-mode-$(GIT_VERSION)
7188
mkdir haskell-mode-$(GIT_VERSION)
7289
cp -p $(DIST_FILES) haskell-mode-$(GIT_VERSION)
@@ -78,5 +95,5 @@ $(TGZ): $(DIST_FILES)
7895
printf "g/NO_DIST/d\nw\n" | ed -s haskell-mode-$(GIT_VERSION)/Makefile #NO_DIST
7996
printf ',s/@VERSION@/$(VERSION)/\nw\n' | ed -s haskell-mode-$(GIT_VERSION)/haskell-mode.el #NO_DIST
8097

81-
tar cvzf $(TGZ) haskell-mode-$(GIT_VERSION)
98+
tar cvzf $@ haskell-mode-$(GIT_VERSION)
8299
rm -rf haskell-mode-$(GIT_VERSION)

haskell-mode-pkg.el.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(define-package "haskell-mode" "@VERSION@" "A Haskell editing mode")

0 commit comments

Comments
 (0)