Skip to content

Commit 16ab2cd

Browse files
committed
Merge pull request #530 from gracjan/pr-version-info
MELPA compatible version info.
2 parents 35b55b3 + f2adcc1 commit 16ab2cd

File tree

5 files changed

+30
-34
lines changed

5 files changed

+30
-34
lines changed

Makefile

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
VERSION = $(shell git describe --tags --match 'v[0-9]*' --abbrev=0 | sed 's/^v//;s/\.0*/./g')
2-
GIT_VERSION = $(shell git describe --tags --match 'v[0-9]*' --long --dirty | sed 's/^v//')
1+
2+
#
3+
# Note: Due to MELPA distributing directly from github source version
4+
# needs to be embedded in files as is without proprocessing.
5+
#
6+
# Version string is present in:
7+
# - Makefile
8+
# - haskell-mode.el
9+
# - haskell-mode.texi
10+
# - haskell-mode-pkg.el (used for marmelade)
11+
#
12+
# We should have a script that changes it everywhere it is needed and
13+
# syncs it with current git tag.
14+
#
15+
VERSION = 13.12
316

417
INSTALL_INFO = install-info
518
EMACS = emacs
@@ -9,7 +22,6 @@ EFLAGS = --eval "(add-to-list 'load-path (expand-file-name \"tests/compat\") 'ap
922
--eval '(setq byte-compile-error-on-warn t)'
1023

1124
BATCH = $(EMACS) $(EFLAGS) --batch -Q -L .
12-
SUBST_ATAT = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g;s/@GIT_VERSION@/$(GIT_VERSION)/g;s/@@VERSION@@/$(VERSION)/g;s/@VERSION@/$(VERSION)/g'
1325

1426
ELFILES = \
1527
ghc-core.el \
@@ -82,14 +94,15 @@ check: $(ELCHECKS)
8294
@echo "checks passed!"
8395

8496
clean:
85-
$(RM) $(ELCFILES) $(AUTOLOADS) $(AUTOLOADS:.el=.elc) $(PKG_TAR) haskell-mode.tmp.texi haskell-mode.info dir
97+
$(RM) $(ELCFILES) $(AUTOLOADS) $(AUTOLOADS:.el=.elc) $(PKG_TAR) haskell-mode.info dir
8698

8799
info: haskell-mode.info dir
88100

89101
dir: haskell-mode.info
90102
$(INSTALL_INFO) --dir=$@ $<
91103

92-
haskell-mode.tmp.texi: haskell-mode.texi
104+
haskell-mode.info: haskell-mode.texi
105+
# Check if chapter order is same as node order
93106
@sed -n -e '/@chapter/ s/@code{\(.*\)}/\1/' \
94107
-e 's/@chapter \(.*\)$$/* \1::/p' \
95108
-e 's/@unnumbered \(.*\)$$/* \1::/p' \
@@ -100,39 +113,28 @@ haskell-mode.tmp.texi: haskell-mode.texi
100113
diff -C 1 haskell-mode-menu-order.txt haskell-mode-content-order.txt
101114
@rm haskell-mode-menu-order.txt haskell-mode-content-order.txt
102115

103-
$(SUBST_ATAT) < haskell-mode.texi > haskell-mode.tmp.texi
104-
105-
haskell-mode.info: haskell-mode.tmp.texi
116+
# Processing proper
106117
$(MAKEINFO) $(MAKEINFO_FLAGS) -o $@ $<
107118

108-
haskell-mode.html: haskell-mode.tmp.texi
119+
haskell-mode.html: haskell-mode.texi
109120
$(MAKEINFO) $(MAKEINFO_FLAGS) --html --no-split -o $@ $<
110121

111122
# Generate ELPA-compatible package
112123
package: $(PKG_TAR)
113124
elpa: $(PKG_TAR)
114125

115-
$(PKG_TAR): $(PKG_DIST_FILES) haskell-mode-pkg.el.in
126+
$(PKG_TAR): $(PKG_DIST_FILES) haskell-mode-pkg.el
116127
rm -rf haskell-mode-$(VERSION)
117128
mkdir haskell-mode-$(VERSION)
118129
cp $(PKG_DIST_FILES) haskell-mode-$(VERSION)/
119-
$(SUBST_ATAT) < haskell-mode-pkg.el.in > haskell-mode-$(VERSION)/haskell-mode-pkg.el
120-
$(SUBST_ATAT) < haskell-mode.el > haskell-mode-$(VERSION)/haskell-mode.el
121-
(sed -n -e '/^;;; Commentary/,/^;;;/p' | egrep '^;;( |$$)' | cut -c4-) < haskell-mode.el > haskell-mode-$(VERSION)/README
130+
122131
tar cvf $@ haskell-mode-$(VERSION)
123132
rm -rf haskell-mode-$(VERSION)
124133
@echo
125-
@echo "Created ELPA compatible distribution package '$@' from $(GIT_VERSION)"
134+
@echo "Created ELPA compatible distribution package '$@' from $(VERSION)"
126135

127136
$(AUTOLOADS): $(ELFILES) haskell-mode.elc
128137
$(BATCH) \
129138
--eval '(setq make-backup-files nil)' \
130139
--eval '(setq generated-autoload-file "$(CURDIR)/$@")' \
131140
-f batch-update-autoloads "."
132-
133-
# HACK: embed version number into .elc file
134-
haskell-mode.elc: haskell-mode.el
135-
$(SUBST_ATAT) < haskell-mode.el > haskell-mode.tmp.el
136-
@$(BATCH) -f batch-byte-compile haskell-mode.tmp.el
137-
mv haskell-mode.tmp.elc haskell-mode.elc
138-
$(RM) haskell-mode.tmp.el

haskell-mode-pkg.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
(define-package "haskell-mode" "13.12" "A Haskell editing mode"
2+
'((cl-lib "0.5")))

haskell-mode-pkg.el.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

haskell-mode.el

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,18 @@
142142
;; All functions/variables start with `(literate-)haskell-'.
143143

144144
;; Version of mode.
145-
(defconst haskell-version "@VERSION@"
145+
(defconst haskell-version "13.12"
146146
"The release version of `haskell-mode'.")
147147

148-
(defconst haskell-git-version "@GIT_VERSION@"
149-
"The Git version of `haskell-mode'.")
150-
151148
;;;###autoload
152149
(defun haskell-version (&optional here)
153150
"Show the `haskell-mode` version in the echo area.
154-
With prefix argument HERE, insert it at point.
155-
When FULL is non-nil, use a verbose version string.
156-
When MESSAGE is non-nil, display a message with the version."
151+
With prefix argument HERE, insert it at point."
157152
(interactive "P")
158153
(let* ((haskell-mode-dir (ignore-errors
159154
(file-name-directory (or (locate-library "haskell-mode") ""))))
160-
(_version (format "haskell-mode version %s (%s @ %s)"
155+
(_version (format "haskell-mode version %s (%s)"
161156
haskell-version
162-
haskell-git-version
163157
haskell-mode-dir)))
164158
(if here
165159
(insert _version)

haskell-mode.texi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@c %**start of header
33
@setfilename haskell-mode.info
44
@documentencoding UTF-8
5-
@settitle Haskell Mode @@VERSION@@
5+
@settitle Haskell Mode 13.12
66
@c %**end of header
77

88
@dircategory Emacs
@@ -11,7 +11,7 @@
1111
@end direntry
1212

1313
@copying
14-
This manual is for Haskell mode, version @@GIT_VERSION@@
14+
This manual is for Haskell mode, version 13.12
1515

1616
Copyright @copyright{} 2013 Haskell Mode contributors.
1717

0 commit comments

Comments
 (0)