meson: add 'system-lua' project option to toggle the bundled lua

By default system-lua=false, so the bundled version is built.

The default_library for the lua subproject is also set to static
now, so that we don't need to install liblua and mess up the system.
For existing build trees, this needs to be switched manually now with
-Dlua:default_library=static (or just wipe the build dir and start clean)
This commit is contained in:
George Kiagiadakis 2021-01-23 19:11:38 +02:00
parent a3a787c5c8
commit 40ce5f0d5f
2 changed files with 14 additions and 11 deletions

View file

@ -1,7 +1,7 @@
project('wireplumber', ['c', 'cpp'],
version : '0.3.50',
license : 'MIT',
meson_version : '>= 0.51.0',
meson_version : '>= 0.54.0',
default_options : [
'warning_level=1',
'buildtype=debugoptimized',
@ -40,19 +40,20 @@ gio_dep = dependency('gio-2.0', version : '== ' + gobject_dep.version())
giounix_dep = dependency('gio-unix-2.0', version : '== ' + gobject_dep.version())
pipewire_dep = dependency('libpipewire-0.3', version: '>= 0.3.20')
lua_dep = dependency('lua', version: ['>=5.3.0', '<5.4.0'], required: false)
if not lua_dep.found()
if get_option('system-lua')
lua_dep = dependency('lua', version: ['>=5.3.0', '<5.4.0'], required: false)
if not lua_dep.found()
lua_dep = dependency('lua5.3', required: false)
if not lua_dep.found()
lua_dep = dependency('lua-5.3', required: false)
if not lua_dep.found()
lua_dep = dependency('lua53', required: false)
if not lua_dep.found()
lua_proj = subproject('lua')
lua_dep = lua_proj.get_variable('lua_dep')
endif
endif
lua_dep = dependency('lua53', required: false)
if not lua_dep.found()
lua_dep = dependency('lua-5.3', required: true , allow_fallback: false)
endif
endif
endif
else
lua_proj = subproject('lua', default_options: ['default_library=static'])
lua_dep = lua_proj.get_variable('lua_dep')
endif
gnome = import('gnome')

View file

@ -2,3 +2,5 @@ option('introspection', type : 'feature', value : 'auto',
description : 'Generate gobject-introspection bindings')
option('doc', type : 'feature', value : 'auto',
description: 'Enable documentation.')
option('system-lua', type : 'boolean', value : 'false',
description : 'Use lua from the system instead of the bundled one')