From d0401b04a4ed6a1684091a84bfd262b2b2cb560f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 1 Nov 2015 17:08:38 -0500 Subject: build: Use `git describe` for version strings. When building in a git repo: - If HEAD corresponds to an annotated tag, (i.e. git_get_exact_tag() returns truthy) the current build is considered a "release" build: NVIM_VERSION_MEDIUM is directly assigned the tagged version name, and NVIM_VERSION_* defines are ignored. - If HEAD is not a tagged release, then NVIM_VERSION_MEDIUM is directly assigned the result of `git describe`. If git (or the repo) is not available: - The NVIM_VERSION_* defines are used to define NVIM_VERSION_MEDIUM. Sample outputs for `nvim --version` and `nvim +version`: Building with git @ non-tagged commit e66df14: NVIM v0.1.0-1-ge66df14 (compiled Nov 1 2015 19:10:30) Commit: e66df148f9401be17adab324a6e41d927aae20b3 Building with git @ v0.1.1 tag: NVIM v0.1.1 (compiled Nov 1 2015 19:03:52) [no "Commit:" line] Building this commit _not_ in a git repo: NVIM 0.1.0-dev (compiled Nov 1 2015 19:16:11) [no "Commit:" line] --- config/versiondef.h.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'config/versiondef.h.in') diff --git a/config/versiondef.h.in b/config/versiondef.h.in index bef099e55f..7f37ef72fb 100644 --- a/config/versiondef.h.in +++ b/config/versiondef.h.in @@ -5,8 +5,9 @@ #define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ #define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ #define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" -#define NVIM_VERSION_BUILD "@NVIM_VERSION_BUILD@" #cmakedefine NVIM_VERSION_COMMIT "@NVIM_VERSION_COMMIT@" +#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@" + #define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@" #define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@" -- cgit