#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__ */
# 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',
'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')
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
# 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
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
else
log = []
endif
-if platform_win32
+if platform_win32
dl = []
else
dl = cc.find_library('dl', required: false)