mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-06 18:13:46 +00:00
meson: make git executable optional (#10092)
This is useful for reproducible offline builds
This commit is contained in:
parent
b40958266a
commit
9656ba12aa
50
meson.build
50
meson.build
@ -1,7 +1,7 @@
|
||||
project('radare2', 'c', meson_version: '>=0.46.0')
|
||||
|
||||
py3_exe = import('python3').find_python()
|
||||
git_exe = find_program('git')
|
||||
git_exe = find_program('git', required: false)
|
||||
pkgconfig_mod = import('pkgconfig')
|
||||
glob_cmd = [py3_exe, '-c', 'from sys import argv; print(";".join(__import__("glob").glob(argv[1])))']
|
||||
|
||||
@ -26,28 +26,40 @@ if meson.is_subproject()
|
||||
endif
|
||||
endif
|
||||
|
||||
# Get version_commit
|
||||
version_commit = run_command(git_exe, '-C', repo, 'rev-list', '--all', '--count')
|
||||
if version_commit.returncode() != 0
|
||||
version_commit = 0
|
||||
else
|
||||
version_commit = version_commit.stdout().strip()
|
||||
version_commit = ''
|
||||
gittap = ''
|
||||
gittip = 'unknown'
|
||||
|
||||
if git_exe.found()
|
||||
# Get version_commit
|
||||
git_rev_list = run_command(git_exe, '-C', repo, 'rev-list', '--all', '--count')
|
||||
if git_rev_list.returncode() == 0
|
||||
version_commit = git_rev_list.stdout().strip()
|
||||
endif
|
||||
|
||||
# Get gittap
|
||||
git_describe = run_command(git_exe, '-C', repo, 'describe', '--tags', '--match', '[0-9]*')
|
||||
if git_describe.returncode() == 0
|
||||
gittap = git_describe.stdout().strip()
|
||||
endif
|
||||
|
||||
# Get gittip
|
||||
git_rev_parse = run_command(git_exe, '-C', repo, 'rev-parse', 'HEAD')
|
||||
if git_rev_parse.returncode() == 0
|
||||
gittip = git_rev_parse.stdout().strip()
|
||||
endif
|
||||
endif
|
||||
|
||||
# Get gittap
|
||||
gittap = run_command(git_exe, '-C', repo, 'describe', '--tags', '--match', '[0-9]*')
|
||||
if gittap.returncode() != 0
|
||||
gittap = ''
|
||||
else
|
||||
gittap = gittap.stdout().strip()
|
||||
if get_option('r2_version_commit') != ''
|
||||
version_commit = get_option('r2_version_commit')
|
||||
endif
|
||||
|
||||
# Get gittip
|
||||
gittip = run_command(git_exe, '-C', repo, 'rev-parse', 'HEAD')
|
||||
if gittip.returncode() != 0
|
||||
gittip = 'unknown'
|
||||
else
|
||||
gittip = gittip.stdout().strip()
|
||||
if get_option('r2_gittap') != ''
|
||||
gittap = get_option('r2_gittap')
|
||||
endif
|
||||
|
||||
if get_option('r2_gittip') != ''
|
||||
gittip = get_option('r2_gittip')
|
||||
endif
|
||||
|
||||
# Get current date
|
||||
|
@ -8,3 +8,6 @@ option('r2_zigns', type: 'string', value: '')
|
||||
option('r2_themes', type: 'string', value: '')
|
||||
option('r2_fortunes', type: 'string', value: '')
|
||||
option('r2_hud', type: 'string', value: '')
|
||||
option('r2_version_commit', type: 'string', value: '')
|
||||
option('r2_gittap', type: 'string', value: '')
|
||||
option('r2_gittip', type: 'string', value: '')
|
||||
|
@ -1,5 +1,9 @@
|
||||
res = run_command(py3_exe, '-c', '__import__("sys").exit(__import__("os").path.exists("capstone"))')
|
||||
if res.returncode() == 0
|
||||
if not git_exe.found()
|
||||
error('Cannot load capstone library. Either provide capstone in ./shlr/capstone or install git, so it can be downloaded')
|
||||
endif
|
||||
|
||||
message('Cloning capstone')
|
||||
git_cmd = 'clone -b next --depth 10 https://github.com/aquynh/capstone.git capstone'
|
||||
run_command(git_exe, git_cmd.split())
|
||||
|
Loading…
Reference in New Issue
Block a user