2020-06-25 21:29:43 +00:00
|
|
|
flake8_path = ''
|
|
|
|
if flake8_prog.found()
|
2022-10-07 07:43:33 +00:00
|
|
|
flake8_path = flake8_prog.full_path()
|
2020-06-25 21:29:43 +00:00
|
|
|
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({
|
2022-10-07 07:37:43 +00:00
|
|
|
'top_srcdir': meson.project_source_root(),
|
2022-10-07 07:31:32 +00:00
|
|
|
'top_builddir': meson.project_build_root(),
|
2022-03-29 09:43:36 +00:00
|
|
|
'flake8_path': flake8_path,
|
|
|
|
'runutf8': ' '.join(runutf8),
|
2022-10-07 07:43:33 +00:00
|
|
|
'PYTHON3': python3_prog.full_path(),
|
|
|
|
'GREP': grep_prog.full_path(),
|
|
|
|
'SED': sed_prog.full_path(),
|
|
|
|
'AWK': awk_prog.full_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
|