mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-07-06 00:06:41 -04:00
build: guard git version detection against missing .git directory
When building from a release tarball, there is no .git directory
and git rev-parse would either fail or pick up a parent repository's
HEAD. Guard the git version detection with fs.is_dir('.git') so
that tarball builds produce a clean version string.
Requires importing the fs module.
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
(cherry picked from commit e5db9506b4)
This commit is contained in:
parent
7fabaa5162
commit
c770433ce3
1 changed files with 14 additions and 10 deletions
|
|
@ -18,6 +18,8 @@ add_project_arguments(
|
|||
language: 'c',
|
||||
)
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
add_project_arguments('-DDEBUG', language : 'c')
|
||||
endif
|
||||
|
|
@ -43,6 +45,7 @@ math = cc.find_library('m')
|
|||
have_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true'
|
||||
|
||||
version = '@0@'.format(meson.project_version())
|
||||
if fs.is_dir('.git')
|
||||
git = find_program('git', native: true, required: false)
|
||||
if git.found()
|
||||
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false)
|
||||
|
|
@ -55,6 +58,7 @@ if git.found()
|
|||
)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
conf_data = configuration_data()
|
||||
conf_data.set10('CAGE_HAS_XWAYLAND', have_xwayland)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue