diff --git a/Makefile.config.in b/Makefile.config.in index c6886852..a5a4c69b 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -42,6 +42,7 @@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ +COMMIT_ID = @COMMIT_ID@ CONFDIR = @CONFDIR@ CONFIG_NLS = @CONFIG_NLS@ DATADIRNAME = @DATADIRNAME@ diff --git a/configure.in b/configure.in index 954fae75..55e0c5b7 100644 --- a/configure.in +++ b/configure.in @@ -34,6 +34,8 @@ AC_PROG_AWK AC_PATH_PROGS(AWK, "$AWK") AC_PROG_RANLIB +AC_PATH_PROGS(COMMIT_ID, "commit-id") + CONFIG_ASCIIDOC="no" CONFIG_POD2HTML="no" CONFIG_XMLTO="no" diff --git a/src/Makefile b/src/Makefile index 7b2c3a7e..ed52d5e8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,6 +83,11 @@ ELINKSLIBS = \ $(INTLLIBS) \ util/libutil.a +# Get the GIT HEAD ID if possible +ifdef COMMIT_ID +INCLUDES += -DBUILD_ID="\"$$($(COMMIT_ID) 2> /dev/null)\"" +endif + OBJS = vernum.o vernum.o: FORCE FORCE: diff --git a/src/main/version.c b/src/main/version.c index 290c2b0b..afd61e3c 100644 --- a/src/main/version.c +++ b/src/main/version.c @@ -75,6 +75,8 @@ get_dyn_full_version(struct terminal *term, int more) if (!init_string(&string)) return NULL; add_format_to_string(&string, "ELinks %s", VERSION_STRING); + if (*build_id) + add_format_to_string(&string, " (%s)", build_id); if (more) { add_to_string(&string, "\n"); add_format_to_string(&string, _("Built on %s %s", term), diff --git a/src/vernum.c b/src/vernum.c index d7a05304..5e1dcf92 100644 --- a/src/vernum.c +++ b/src/vernum.c @@ -11,3 +11,4 @@ unsigned char *build_date = __DATE__; unsigned char *build_time = __TIME__; +unsigned char *build_id = BUILD_ID; diff --git a/src/vernum.h b/src/vernum.h index 432f4eb1..055c87f4 100644 --- a/src/vernum.h +++ b/src/vernum.h @@ -3,6 +3,6 @@ #ifndef EL__VERNUM_H #define EL__VERNUM_H -extern unsigned char *build_date, *build_time; +extern unsigned char *build_date, *build_time, *build_id; #endif /* EL__VERNUM_H */