Use version from git

This commit is contained in:
Martin Lund 2024-10-25 19:35:13 +02:00
parent 330e99381e
commit ab678e6c88
5 changed files with 17 additions and 5 deletions

3
src/git-version.h.in Normal file
View file

@ -0,0 +1,3 @@
#pragma once
#define GIT_VERSION "@GIT_VERSION@"

View file

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "git-version.h"
#include "config.h"
#include "options.h"
#include "configfile.h"
@ -101,7 +102,7 @@ int main(int argc, char *argv[])
error_enter_session_mode();
/* Print launch hints */
tio_printf("tio v%s", VERSION);
tio_printf("tio %s", GIT_VERSION);
if (interactive_mode)
{
tio_printf("Press ctrl-%c q to quit", option.prefix_key);

View file

@ -1,5 +1,10 @@
# Generate git version header
git_version_h = vcs_tag(command : ['git', 'describe', '--tags', '--always', '--dirty'],
input : 'git-version.h.in',
output :'git-version.h',
replace_string:'@GIT_VERSION@')
config_h = configuration_data()
config_h.set_quoted('VERSION', meson.project_version())
config_h.set('BAUDRATE_CASES', baudrate_cases)
configure_file(output: 'config.h', configuration: config_h)
@ -21,7 +26,8 @@ tio_sources = [
'xymodem.c',
'script.c',
'fs.c',
'readline.c'
'readline.c',
git_version_h
]

View file

@ -23,6 +23,7 @@
#include <regex.h>
#include <getopt.h>
#include <errno.h>
#include "git-version.h"
#include "config.h"
#include "misc.h"
#include "print.h"
@ -1085,7 +1086,7 @@ void options_parse(int argc, char *argv[])
break;
case 'v':
printf("tio v%s\n", VERSION);
printf("tio %s\n", GIT_VERSION);
exit(EXIT_SUCCESS);
break;

View file

@ -22,6 +22,7 @@
#if defined(__linux__)
#include <linux/serial.h>
#endif
#include "git-version.h"
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
@ -1090,7 +1091,7 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
break;
case KEY_V:
tio_printf("tio v%s", VERSION);
tio_printf("tio %s", GIT_VERSION);
break;
case KEY_X: