diff --git a/cagebreak.c b/cagebreak.c index 1adc5a1..4a71480 100644 --- a/cagebreak.c +++ b/cagebreak.c @@ -160,7 +160,7 @@ parse_args(struct cg_server *server, int argc, char *argv[]) { usage(stdout, argv[0]); return false; case 'v': - fprintf(stdout, "Cagebreak version 1.0.6\n"); + fprintf(stdout, "Cagebreak version " CG_VERSION "\n"); exit(0); default: usage(stderr, argv[0]); diff --git a/meson.build b/meson.build index 419e625..31a6611 100644 --- a/meson.build +++ b/meson.build @@ -101,18 +101,10 @@ else have_xwayland = false endif -version = '@0@'.format(meson.project_version()) -git = find_program('git', native: true, required: false) -if git.found() - git_commit = run_command([git, 'rev-parse', '--short', 'HEAD']) - git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD']) - if git_commit.returncode() == 0 and git_branch.returncode() == 0 - version = '@0@-@1@ (branch \'@2@\')'.format( - meson.project_version(), - git_commit.stdout().strip(), - git_branch.stdout().strip(), - ) - endif +if get_option('version_override') != '' + version = '@0@'.format(get_option('version_override')) +else + version = '@0@'.format(meson.project_version()) endif conf_data = configuration_data() diff --git a/meson_options.txt b/meson_options.txt index 5982c3d..bb96c4f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('xwayland', type: 'boolean', value: 'false', description: 'Enable support for X11 applications') option('fuzz', type: 'boolean', value: 'false', description: 'Enable building fuzzer targets') +option('version_override', type: 'string', description: 'Set the project version to the string specified. Used for creating hashes for reproducible builds.')