From 0a9e0b24205c0aa70ebc6d78a7b12847ab3168f2 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Mon, 30 Dec 2019 18:35:26 -0800 Subject: [PATCH] Building the tip without mercurial now allows for manually setting a version with the version option --- meson.build | 12 ++++++++++-- meson_options.txt | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 meson_options.txt diff --git a/meson.build b/meson.build index aeb283f..be1679d 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('wofi', 'c', version : run_command('hg', 'identify').stdout().strip(), default_options : ['buildtype=release', 'warning_level=2']) +project('wofi', 'c', default_options : ['buildtype=release', 'warning_level=2']) cc = meson.get_compiler('c') inc = include_directories('inc') @@ -8,7 +8,15 @@ threads = dependency('threads') wayland = dependency('wayland-client') dl = cc.find_library('dl') -add_project_arguments('-D_GNU_SOURCE', '-DVERSION="' + meson.project_version() + '"', language : 'c') +hg = find_program('hg', native : true, required : false) + +version = get_option('version') + +if hg.found() + version = run_command(hg, 'identify').stdout().strip() +endif + +add_project_arguments('-D_GNU_SOURCE', '-DVERSION="' + version + '"', language : 'c') add_project_link_arguments('-rdynamic', language : 'c') executable(meson.project_name(), diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..636de2d --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('version', type : 'string', value : 'hg', description : 'The version to use if mercurial cannot be found')