Skip to content

Commit c70b56b

Browse files
committed
configure: META.in template with no hardcoded version number
1 parent de87915 commit c70b56b

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ Makefile.config
2626
/src/glob_lexer.ml
2727
/ocamlbuild.byte
2828
/ocamlbuild.native
29+
30+
# generated from META.in
31+
META

META renamed to META.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#%% see META rule in Makefile
12
# Specification for the "ocamlbuild" library
23
requires = "unix"
3-
version = "0.9.0"
4+
version = "%%VERSION%%"
45
description = "ocamlbuild support library"
56
archive(byte) = "ocamlbuildlib.cma"
67
archive(native) = "ocamlbuildlib.cmxa"

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,22 @@ endif
229229
echo ']' >> ocamlbuild.install
230230
echo >> ocamlbuild.install
231231

232-
install-lib-basics:
232+
install-lib-basics: META
233233
mkdir -p $(INSTALL_LIBDIR)/ocamlbuild
234234
$(CP) META src/signatures.mli $(INSTALL_LIBDIR)/ocamlbuild
235235

236-
install-lib-basics-opam:
236+
install-lib-basics-opam: META
237237
echo ' "META"' >> ocamlbuild.install
238238
echo ' "src/signatures.mli" {"signatures.mli"}' >> ocamlbuild.install
239239

240+
# %%FOO%% are configuration variables (only %%VERSION%% currently),
241+
# and #%% comments are removed before installation
242+
META: META.in VERSION
243+
@cat META.in \
244+
| sed s/%%VERSION%%/$$(cat VERSION)/ META.in \
245+
| grep -v "#%%.*" \
246+
> META
247+
240248
install-lib-byte:
241249
mkdir -p $(INSTALL_LIBDIR)/ocamlbuild
242250
$(CP) $(INSTALL_LIB) $(INSTALL_LIBDIR)/ocamlbuild
@@ -261,7 +269,7 @@ else
261269
install-lib: install-lib-basics install-lib-byte
262270
endif
263271

264-
install-lib-findlib:
272+
install-lib-findlib: META
265273
ifeq ($(OCAML_NATIVE), true)
266274
ocamlfind install ocamlbuild \
267275
META src/signatures.mli $(INSTALL_LIB) $(INSTALL_LIB_OPT)

howto/release.adoc

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,11 @@ release number, so any occurence of +NEXT_RELEASE+ in the development
9393
repository should be replaced by this version number. There is at
9494
least one such occurence in the 'Changes' file.
9595

96-
Furthermore, the version coded is hardcoded in some parts of the
97-
codebase and needs to be updated:
98-
99-
- the 'VERSION' file contains the current version number, with no
100-
ending newline
101-
102-
- the 'META' file contains the current version number to inform ocamlfind
103-
104-
You can use +git grep+ to look for all occurrences of +NEXT_RELEASE+
105-
and a given version number, from the root of the repository:
106-
107-
----
108-
git grep NEXT_RELEASE
109-
git grep -F "0.9"
110-
----
96+
Furthermore, the version number is written in the 'VERSION' file (no
97+
ending newline), and it is used to derive the version number at
98+
installation time -- for example ocamlfind's 'META' file is generated
99+
from the 'META.in' template. This 'VERSION' file should thus be
100+
updated.
111101

112102
== Doing the release ==
113103

0 commit comments

Comments
 (0)