[babl/wip/msvc] build: Make GIT check and dist work on MSVC builds
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl/wip/msvc] build: Make GIT check and dist work on MSVC builds
- Date: Wed, 22 Jan 2020 09:55:30 +0000 (UTC)
commit 9b9b3ae0184096d40d742ac140a2c62e9d31ddd0
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jan 22 17:52:59 2020 +0800
build: Make GIT check and dist work on MSVC builds
Replace shell script calls with Python scripts, so that things work even
without a *nix shell available
babl/meson.build | 9 ++-------
check-is-git.py | 5 +++++
copy-git-version-h.py | 11 +++++++++++
meson.build | 3 ++-
4 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/babl/meson.build b/babl/meson.build
index e2bfd2858..fb2ac8445 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -69,9 +69,8 @@ babl_version_h = configure_file(
# 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
+ run_command(check_is_git).returncode() == 0
)
if is_git_repo
@@ -85,12 +84,8 @@ if is_git_repo
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' ]
- )]
- )
+ meson.add_dist_script([ copy_git_version_h.path(), meson.current_build_dir() ])
else
git_version_h = files('git-version.h')
diff --git a/check-is-git.py b/check-is-git.py
new file mode 100644
index 000000000..14e36bb42
--- /dev/null
+++ b/check-is-git.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python3
+import os
+import sys
+
+sys.exit(not os.path.isdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), '.git')))
diff --git a/copy-git-version-h.py b/copy-git-version-h.py
new file mode 100644
index 000000000..5c4bca829
--- /dev/null
+++ b/copy-git-version-h.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+import os
+import shutil
+import sys
+
+builddir = sys.argv[1]
+distdir = os.environ['MESON_DIST_ROOT']
+git_version_h_filename = 'git-version.h'
+
+shutil.copyfile(os.path.join(builddir, git_version_h_filename),
+ os.path.join(distdir, 'babl', git_version_h_filename))
diff --git a/meson.build b/meson.build
index 8d7ba3360..f55389319 100644
--- a/meson.build
+++ b/meson.build
@@ -426,7 +426,8 @@ 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)
+check_is_git = find_program('check-is-git.py')
+copy_git_version_h = find_program('copy-git-version-h.py')
w3m_bin = find_program('w3m', required: false, native: true)
################################################################################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]