Allow building without git installed
authorDebian Multimedia Maintainers <debian-multimedia@lists.debian.org>
Wed, 30 Aug 2023 09:52:26 +0000 (11:52 +0200)
committerIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Wed, 30 Aug 2023 09:52:26 +0000 (11:52 +0200)
Origin: Debian
Bug: https://github.com/jacktrip/jacktrip/issues/1184
Last-Update: 2023-08-30

Upstream runs 'git' during configure to inject commit info into the binary.
We don't have 'git' installed on our buildds.
Last-Update: 2023-08-30
Gbp-Pq: Name build-without-git.patch

meson.build

index d4d2c946440bf9a4f4ae00d1d9a145cdf4f7e027..6d22d33dbebd62eddfb0a0cc62caa45261b75a23 100644 (file)
@@ -36,12 +36,15 @@ if get_option('buildtype') == 'release'
        c_defines += ['-DNDEBUG']
 endif
 
-git_tags_cmd = run_command('git', 'describe', '--tags', check: false)
-git_hash_cmd = run_command('git', 'rev-parse', '--short', 'HEAD', check: false)
-if git_tags_cmd.returncode() == 0 and git_hash_cmd.returncode() == 0
+git = find_program('git', required: false)
+if git.found()
+  git_tags_cmd = run_command(git, 'describe', '--tags', check: false)
+  git_hash_cmd = run_command(git, 'rev-parse', '--short', 'HEAD', check: false)
+  if git_tags_cmd.returncode() == 0 and git_hash_cmd.returncode() == 0
        git_tags = git_tags_cmd.stdout().strip()
        git_hash = git_hash_cmd.stdout().strip()
        defines += ['-DJACKTRIP_BUILD_INFO=' + git_tags + '-' + git_hash]
+  endif
 endif
 
 src = [        'src/DataProtocol.cpp',