2020-06-25 21:29:43 +00:00
|
|
|
flake8_path = ''
|
|
|
|
if flake8_prog.found()
|
|
|
|
flake8_path = flake8_prog.path()
|
|
|
|
endif
|
|
|
|
|
2021-03-24 10:33:15 +00:00
|
|
|
if host_machine.system() == 'freebsd' or host_machine.system() == 'darwin'
|
2020-06-25 21:29:43 +00:00
|
|
|
make_prog = find_program('gmake')
|
2021-03-24 09:10:20 +00:00
|
|
|
sed_prog = find_program('gsed')
|
2021-03-24 08:36:19 +00:00
|
|
|
else
|
|
|
|
make_prog = find_program('make')
|
2021-03-24 09:10:20 +00:00
|
|
|
sed_prog = find_program('sed')
|
2021-03-24 08:36:19 +00:00
|
|
|
endif
|
2021-03-02 14:31:36 +00:00
|
|
|
|
2021-03-24 08:36:19 +00:00
|
|
|
if host_machine.system() == 'freebsd'
|
|
|
|
grep_prog = find_program('grep')
|
2022-01-22 19:30:11 +00:00
|
|
|
grep_cmd = run_command(grep_prog, '--version', check: true)
|
2021-03-02 14:31:36 +00:00
|
|
|
if grep_cmd.stdout().startswith('grep (BSD grep')
|
2021-03-24 08:45:29 +00:00
|
|
|
grep_prog = find_program('/usr/local/bin/grep', required: false)
|
|
|
|
if not grep_prog.found()
|
|
|
|
error('GNU grep not found')
|
|
|
|
endif
|
2021-03-02 14:31:36 +00:00
|
|
|
endif
|
2021-03-24 10:33:15 +00:00
|
|
|
elif host_machine.system() == 'darwin'
|
|
|
|
grep_prog = find_program('ggrep')
|
2020-06-25 21:29:43 +00:00
|
|
|
else
|
2021-03-24 08:36:19 +00:00
|
|
|
grep_prog = find_program('grep')
|
2020-06-25 21:29:43 +00:00
|
|
|
endif
|
|
|
|
|
2022-05-23 13:20:48 +00:00
|
|
|
awk_prog = find_program('awk')
|
|
|
|
|
2022-03-29 09:43:36 +00:00
|
|
|
syntax_check_conf = configuration_data({
|
|
|
|
'top_srcdir': meson.source_root(),
|
|
|
|
'top_builddir': meson.build_root(),
|
|
|
|
'flake8_path': flake8_path,
|
|
|
|
'runutf8': ' '.join(runutf8),
|
|
|
|
'PYTHON3': python3_prog.path(),
|
|
|
|
'GREP': grep_prog.path(),
|
|
|
|
'SED': sed_prog.path(),
|
2022-05-23 13:20:48 +00:00
|
|
|
'AWK': awk_prog.path(),
|
2022-03-29 09:43:36 +00:00
|
|
|
})
|
2021-03-02 14:31:36 +00:00
|
|
|
|
|
|
|
configure_file(
|
|
|
|
input: 'Makefile.in',
|
|
|
|
output: '@BASENAME@',
|
|
|
|
configuration: syntax_check_conf,
|
|
|
|
)
|
|
|
|
|
2020-06-25 21:29:43 +00:00
|
|
|
rc = run_command(
|
|
|
|
'sed', '-n',
|
2022-05-23 13:47:43 +00:00
|
|
|
's/^sc_\\([a-zA-Z0-9_-]*\\):.*/\\1/p',
|
2020-06-25 21:29:43 +00:00
|
|
|
meson.current_source_dir() / 'syntax-check.mk',
|
|
|
|
check: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
sc_tests = rc.stdout().strip().split()
|
|
|
|
|
|
|
|
|
|
|
|
# Skip syntax-check if not building from git because we get the list of files
|
|
|
|
# to check using git commands and it fails if we are not in git repository.
|
|
|
|
if git
|
|
|
|
foreach target : sc_tests
|
|
|
|
test(
|
|
|
|
target,
|
|
|
|
make_prog,
|
2022-05-23 13:47:43 +00:00
|
|
|
args: [ '-C', meson.current_build_dir(), 'sc_@0@'.format(target) ],
|
2020-06-25 21:29:43 +00:00
|
|
|
depends: [
|
|
|
|
potfiles_dep,
|
|
|
|
],
|
|
|
|
suite: 'syntax-check',
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endif
|