[babl] Fix git-version.h handling
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] Fix git-version.h handling
- Date: Wed, 24 Jul 2019 11:35:31 +0000 (UTC)
commit cff554329e5930f93cab919926833021adc58ad1
Author: Félix Piédallu <felix piedallu me>
Date: Wed Jul 24 12:58:54 2019 +0200
Fix git-version.h handling
babl/git-version.h.in | 3 ++-
babl/meson.build | 52 +++++++++++++++++++++------------------------------
meson.build | 12 ++++++------
3 files changed, 29 insertions(+), 38 deletions(-)
---
diff --git a/babl/git-version.h.in b/babl/git-version.h.in
index d517ef7..a9f87e2 100644
--- a/babl/git-version.h.in
+++ b/babl/git-version.h.in
@@ -1,5 +1,6 @@
#ifndef __GIT_VERSION_H__
#define __GIT_VERSION_H__
+
#define BABL_GIT_VERSION "@BABL_GIT_VERSION@"
-#define BABL_GIT_LAST_COMMIT_YEAR "@BABL_GIT_LAST_COMMIT_YEAR@"
+
#endif /* __GIT_VERSION_H__ */
diff --git a/babl/meson.build b/babl/meson.build
index 0510ebd..b2a2d4e 100644
--- a/babl/meson.build
+++ b/babl/meson.build
@@ -42,40 +42,30 @@ 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.
-if test_bin.found() and git_bin.found()
- if run_command(
- [test_bin.path(), '-d', join_paths(meson.source_root(), '.git')]
- ).returncode() == 0
- # git repo and git is available
- git_version = run_command([git_bin.path(), 'describe', '--always']
- ).stdout().strip()
- git_last_commit_year = run_command([git_bin.path(),
- 'log', '-n1', '--date=format:%Y', '--pretty=%cd']
- ).stdout().strip()
- endif
-else
- # Not a git repo so expect git-version.h to exist
- if test_bin.found() and git_bin.found() and
- run_command(
- [test_bin.path(), '-f', 'git-version.h']
- ).returncode() == 0
- git_version_h = 'git-version.h'
- else
- git_version = 'Unknown, shouldn\'t happen'
- git_last_commit_year = 0
- endif
-endif
-if not is_variable('git_version_h')
- git_conf = configuration_data()
- git_conf.set('BABL_GIT_VERSION', git_version)
- git_conf.set('BABL_GIT_LAST_COMMIT_YEAR', git_last_commit_year)
- git_version_h = configure_file(
- input: 'git-version.h.in',
+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
+ git_version_h = vcs_tag(
+ input : 'git-version.h.in',
output: 'git-version.h',
- configuration: git_conf,
+ replace_string: '@BABL_GIT_VERSION@',
+ command: [ git_bin.path(), 'describe', '--always' ],
)
-endif
+ meson.add_dist_script(
+ [ 'sh', '-c', ' '.join(
+ [ 'cp', git_version_h.full_path(), '${MESON_DIST_ROOT}/babl' ]
+ )]
+ )
+
+else
+ git_version_h = files('git-version.h')
+
+endif
babl_sources = [
'babl-cache.c',
diff --git a/meson.build b/meson.build
index 983b723..adc5d82 100644
--- a/meson.build
+++ b/meson.build
@@ -183,7 +183,7 @@ if cc.has_argument('-mmmx') and get_option('enable-mmx')
'Define to 1 if MMX assembly is available.')
# sse assembly
- if cc.has_argument('-msse') and get_option('enable-sse')
+ if cc.has_argument('-msse') and get_option('enable-sse')
if cc.compiles('asm ("movntps %xmm0, 0");')
add_project_arguments('-msse', language: 'c')
message('sse assembly available')
@@ -251,7 +251,7 @@ if not platform_win32
endif
foreach header: check_headers
if cc.has_header(header[1])
- conf.set(header[0], 1, description:
+ conf.set(header[0], 1, description:
'Define to 1 if the <@0@> header is available'.format(header[1]))
endif
endforeach
@@ -261,12 +261,12 @@ endforeach
# general
check_functions = [
['HAVE_GETTIMEOFDAY', 'gettimeofday', '<sys/time.h>'],
- ['HAVE_RINT', 'rint' , '<math.h>'],
+ ['HAVE_RINT', 'rint' , '<math.h>'],
['HAVE_SRANDOM', 'srandom' , '<stdlib.h>'],
]
foreach func: check_functions
if cc.has_function(func[1], prefix: '#include ' + func[2])
- conf.set(func[0], 1, description:
+ conf.set(func[0], 1, description:
'Define to 1 if the @0@() function is available'.format(func[1]))
endif
endforeach
@@ -288,7 +288,7 @@ endif
if get_option('with-lcms')
lcms = dependency('lcms2', required: true, native: false)
if lcms.found()
- conf.set('HAVE_LCMS', 1, description:
+ conf.set('HAVE_LCMS', 1, description:
'Define to 1 if liblcms2 is available')
endif
else
@@ -302,7 +302,7 @@ if platform_android
else
log = []
endif
-if platform_win32
+if platform_win32
dl = []
else
dl = cc.find_library('dl', required: false)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]