Blob Blame History Raw
From 906fb792e043345cfcc9f0d0d2172b03b6c194fb Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Wed, 21 Feb 2024 13:21:17 +0100
Subject: [PATCH] build: Allow building without git executable

Most relevant when building from release tarball.
The meson script already allows to not be inside a git tree by falling
back to setting revision='' when git returns no revision.
Let's go one step further and set revision='' also when git is not found;
if this were a git clone, the system would likely have git installed.
---
 src/orca/meson.build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/orca/meson.build b/src/orca/meson.build
index a994b4505..b92f4b3a8 100644
--- a/src/orca/meson.build
+++ b/src/orca/meson.build
@@ -23,8 +23,13 @@ orca_i18n_py = configure_file(
   }
 )
 
-r = run_command('git', 'rev-parse', '--short', 'HEAD', check: false)
-revision = r.stdout().strip()
+git = find_program('git', required: false)
+if git.found()
+  r = run_command('git', 'rev-parse', '--short', 'HEAD', check: false)
+  revision = r.stdout().strip()
+else
+  revision = ''
+endif
 
 r = run_command('pkg-config', '--variable=tablesdir', 'liblouis', check: false)
 louis_tables_dir = r.stdout().strip()
-- 
GitLab