diff options
author | Ryszard Knop <ryszard.knop@intel.com> | 2022-08-23 14:41:57 +0200 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2022-08-24 13:53:31 +0300 |
commit | 1298b5f0e1b3e010657ffba41d2e775fab028e08 (patch) | |
tree | b70dd2a0108854c226e5aa962327e9317c60e438 | |
parent | 9785abfeda278fd7e160ad69f95b26c3922502fe (diff) |
igt: Allow overriding the commit hash in the version string
By default, the latest Git commit hash is always used to create the
version string embedded in libigt - if libigt changes, most targets are
marked as "dirty" and need to be relinked. This makes it difficult to
easily compare two IGT builds on binaries alone.
This commit introduces a new Meson option, -Dversion_hash="your text!",
which allows overriding this hash, for instance under CI builds.
Signed-off-by: Ryszard Knop <ryszard.knop@intel.com>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
-rw-r--r-- | lib/meson.build | 8 | ||||
-rw-r--r-- | meson_options.txt | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/meson.build b/lib/meson.build index 98c2803b9..6910c061e 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -168,9 +168,15 @@ else srcdir = join_paths(meson.source_root(), 'tests') endif +if get_option('version_hash') != '' + vcs_command = ['echo', get_option('version_hash')] +else + vcs_command = [ 'git', 'log', '-n1', '--pretty=format:g%h' ] +endif + lib_version = vcs_tag(input : 'version.h.in', output : 'version.h', fallback : 'NO-GIT', - command : [ 'git', 'log', '-n1', '--pretty=format:g%h' ] ) + command : vcs_command ) lib_intermediates = [] foreach f: lib_sources diff --git a/meson_options.txt b/meson_options.txt index bed63efa8..d978813b4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -51,6 +51,10 @@ option('use_rpath', value : false, description : 'Set runpath on installed executables for libigt.so') +option('version_hash', + type : 'string', + description : 'Override the Git commit hash embedded in the binaries') + option('srcdir', type : 'string', description : 'Override the source code path embedded inside target binaries (optional)') |