void-packages/srcpkgs/MangoHud/patches/0001-meson-fallback-to-proj...

42 lines
1.2 KiB
Diff

From c6e7c2da873cf2ada7cac9cc8953c3afda7f4cd1 Mon Sep 17 00:00:00 2001
From: John Zimmermann <me@johnnynator.dev>
Date: Thu, 28 Sep 2023 13:56:04 +0200
Subject: [PATCH 1/2] meson: fallback to project_version() without git
resolves #1131
---
src/meson.build | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/meson.build b/src/meson.build
index 537ce63..0729596 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,12 +9,22 @@ else
ld_libdir_mangohud = get_option('prefix') + '/\$LIB/'
endif
+git = find_program('git', required: false)
+if git.found()
+ git_describe = run_command([git, 'describe', '--tags', '--dirty=+'], check: false)
+endif
+if git.found() and git_describe.returncode() == 0
+ describe_ver = git_describe.stdout().strip()
+else
+ describe_ver = meson.project_version()
+endif
+
conf_data = configuration_data()
conf_data.set('ld_libdir_mangohud_abs', libdir_mangohud)
conf_data.set('ld_libdir_mangohud', ld_libdir_mangohud)
conf_data.set('cpu_family', host_machine.cpu_family())
-conf_data.set('version', run_command(['git', 'describe', '--tags', '--dirty=+']).stdout().strip())
+conf_data.set('version', describe_ver)
overlay_shaders = [
'overlay.frag',
--
2.42.0