mirror of https://github.com/GNOME/gimp.git
meson: parse lua version when the binary is unversioned.
I had the case on my machine where `lua` was version 5.4.4 and the lua-lgi test succeeded fine, but then the demo plug-in would fail to run with the error message from #11876. Let's parse the output of `lua -v` to detect the version ourselves and therefore be able to output proper error messages for packagers not to assume that the Lua interpreter they are using will work fine.
This commit is contained in:
parent
1c08f08e97
commit
9c3884c605
31
meson.build
31
meson.build
|
@ -1126,12 +1126,35 @@ if get_option('lua').allowed()
|
||||||
lua = find_program(lua_bin, required: false)
|
lua = find_program(lua_bin, required: false)
|
||||||
|
|
||||||
if lua.found() and meson.can_run_host_binaries()
|
if lua.found() and meson.can_run_host_binaries()
|
||||||
|
if lua_bin == 'lua'
|
||||||
|
is_supported_lua = false
|
||||||
|
lua_cmd = run_command(lua, '-v', check: false)
|
||||||
|
if lua_cmd.returncode() == 0
|
||||||
|
message('Found Lua: @0@'.format(lua_cmd.stdout().strip()))
|
||||||
|
lua_stdout = lua_cmd.stdout().split()
|
||||||
|
if lua_stdout[0].to_lower() == lua_bin
|
||||||
|
message('Parsed Lua version: @0@'.format(lua_stdout[1]))
|
||||||
|
# We only want any lua version 5.1.x
|
||||||
|
if lua_stdout[1].version_compare('>=5.1.0') and lua_stdout[1].version_compare('<5.2.0')
|
||||||
|
is_supported_lua = true
|
||||||
|
else
|
||||||
|
warning('Unsupported Lua version (!= 5.1): @0@'.format(lua_stdout[1]))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
warning('Failed to run `lua -v`')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
is_supported_lua = true
|
||||||
|
endif
|
||||||
|
|
||||||
|
if is_supported_lua
|
||||||
have_lua_lgi = run_command(lua, '-e',
|
have_lua_lgi = run_command(lua, '-e',
|
||||||
'''
|
'''
|
||||||
local lgi = require 'lgi'
|
local lgi = require 'lgi'
|
||||||
''',
|
''',
|
||||||
check: false
|
check: false).returncode() == 0
|
||||||
).returncode() == 0
|
endif
|
||||||
|
|
||||||
if have_lua_lgi
|
if have_lua_lgi
|
||||||
break
|
break
|
||||||
|
@ -1142,8 +1165,8 @@ if get_option('lua').allowed()
|
||||||
have_lua = get_option('lua').enabled() or have_lua_lgi
|
have_lua = get_option('lua').enabled() or have_lua_lgi
|
||||||
if have_lua and not have_lua_lgi
|
if have_lua and not have_lua_lgi
|
||||||
lua_warning = '''
|
lua_warning = '''
|
||||||
Neither Luajit nor Lua, with lua-lgi support, was found. Or you are
|
Neither Luajit nor Lua 5.1, with lua-lgi support, was found.
|
||||||
cross-compiling so we couldn't test lua-lgi support.
|
Or you are cross-compiling so we couldn't test lua-lgi support.
|
||||||
Lua plug-ins will be installed anyway but you should make sure that
|
Lua plug-ins will be installed anyway but you should make sure that
|
||||||
luajit or lua and that LGI are available at installation, otherwise
|
luajit or lua and that LGI are available at installation, otherwise
|
||||||
installed plug-ins won't be usable.
|
installed plug-ins won't be usable.
|
||||||
|
|
Loading…
Reference in New Issue