diff --git a/include/version.h.in b/include/version.h.in index 96ced3b..5c8287e 100644 --- a/include/version.h.in +++ b/include/version.h.in @@ -1,3 +1,2 @@ #pragma once -#define GIT_HASH "@GIT_HASH@" -#define GIT_COMMITS "@GIT_COMMITS@" \ No newline at end of file +#define GIT_HASH "@VCS_TAG@" \ No newline at end of file diff --git a/meson.build b/meson.build index 9df8566..a86723a 100644 --- a/meson.build +++ b/meson.build @@ -28,13 +28,12 @@ git = find_program('git') git_hash = run_command(git, 'rev-parse', '--short', 'HEAD', check: false).stdout().strip() git_commits = run_command(git, 'rev-list', '--count', 'HEAD', check: false).stdout().strip() -version_h = configure_file( +version_h = vcs_tag( input : 'include/version.h.in', output : 'version.h', - configuration : { - 'GIT_HASH' : git_hash, - 'GIT_COMMITS' : git_commits, - } + command : ['git', 'describe', '--always', '--long', '--dirty'], + replace_string : '@VCS_TAG@', + fallback : 'unknown', ) executable( diff --git a/src/main.c b/src/main.c index f3ace82..6a6ef61 100644 --- a/src/main.c +++ b/src/main.c @@ -102,8 +102,8 @@ static void *display_thread(void *arg) { lcd_set_contrast(&lcd, lcd_contrast); lcd_write_buf(&lcd, 0, 14, "linuxSmartie"); - lcd_writef(&lcd, 0, 2, "Ver. hash %s", GIT_HASH); - lcd_writef(&lcd, 0, 3, "Commit no. %s", GIT_COMMITS); + lcd_writef(&lcd, 0, 2, "git hash:"); + lcd_writef(&lcd, 0, 3, "%s", GIT_HASH); lcd_flush_buf(&lcd); lcd_clear_buf(&lcd); struct timespec next; @@ -181,7 +181,7 @@ static void *display_thread(void *arg) { } int main(void) { - applog(LOG_START, "linuxSmartie r%s (%s) starting", GIT_COMMITS, GIT_HASH); + applog(LOG_START, "linuxSmartie %s starting", GIT_HASH); applog(LOG_DBG, "Compiled with %s", C_STD); /* see if another instance is up, quit if it is */