[babl] build: improve portability of git-version.h gen - use git to check if building from a git repo - rem
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] build: improve portability of git-version.h gen - use git to check if building from a git repo - rem
- Date: Sun, 28 Jun 2020 15:25:18 +0000 (UTC)
commit 914d8711bceb85cb7b7e9c8856fee53f7a006dae
Author: John Marshall <jtm home gmail com>
Date: Tue Jun 2 17:01:21 2020 +0100
build: improve portability of git-version.h gen
- use git to check if building from a git repo
- remove dependency on test program
babl/meson.build | 32 +++++++++++++++-----------------
meson.build | 1 -
2 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/babl/meson.build b/babl/meson.build
index 37d2e4d77..c9f62ce33 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -57,13 +57,11 @@ babl_version_h = configure_file(
# already exists because then we are probably working with a tarball
# in which case the git-version.h we ship is correct.
-is_git_repo = (
- test_bin.found() and
- git_bin.found() and
- run_command(test_bin, '-d', meson.source_root() / '.git').returncode() == 0
-)
-
-if is_git_repo
+if git_bin.found() and run_command(
+ git_bin,
+ 'rev-parse',
+ '--is-inside-work-tree',
+).returncode() == 0
git_version_h = vcs_tag(
input : 'git-version.h.in',
output: 'git-version.h',
@@ -71,18 +69,18 @@ if is_git_repo
command: [ git_bin.path(), 'describe', '--always' ],
)
- meson.add_dist_script(
- [ 'ninja', 'babl/git-version.h', ],
- )
- meson.add_dist_script(
- [ 'sh', '-c', ' '.join(
- [ 'cp', git_version_h.full_path(), '${MESON_DIST_ROOT}/babl' ]
- )]
- )
-
+ if env_bin.found()
+ meson.add_dist_script(
+ [ 'ninja', 'babl/git-version.h', ],
+ )
+ meson.add_dist_script(
+ [ 'sh', '-c', ' '.join(
+ [ 'cp', git_version_h.full_path(), '${MESON_DIST_ROOT}/babl' ]
+ )]
+ )
+ endif
else
git_version_h = files('git-version.h')
-
endif
babl_sources = [
diff --git a/meson.build b/meson.build
index db5960e06..4b40419d8 100644
--- a/meson.build
+++ b/meson.build
@@ -346,7 +346,6 @@ env_bin = find_program('env', required: false, native: true)
git_bin = find_program('git', required: false, native: true)
rsvg_convert_bin = find_program('rsvg-convert', required: false,
native: true)
-test_bin = find_program('test', required: false, native: true)
w3m_bin = find_program('w3m', required: false, native: true)
################################################################################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]