aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-10-03 17:22:05 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-10-03 17:22:05 +0200
commit24ea6b07ec039f5a55300bf1ff6b80fa6b471b52 (patch)
tree1936ac5688c6283470753219e1ee52e4663d44a9
parent847856f92d1298f779d515f5e38c47b23486fc87 (diff)
downloadlite-xl-using-luajit-3.tar.gz
lite-xl-using-luajit-3.zip
Add build option to disable plugin APIusing-luajit-3
This is a temporary solution to easity recover compatibility with LuaJIT. The native plugin API doesn't isn't currently compatible with LuaJIT and the compatibility layer we are using.
-rw-r--r--data/core/start.lua18
-rw-r--r--meson.build5
-rw-r--r--meson_options.txt2
-rw-r--r--src/api/system.c6
4 files changed, 22 insertions, 9 deletions
diff --git a/data/core/start.lua b/data/core/start.lua
index 330c42f5..a255bb2b 100644
--- a/data/core/start.lua
+++ b/data/core/start.lua
@@ -20,11 +20,13 @@ package.path = DATADIR .. '/?/init.lua;' .. package.path
package.path = USERDIR .. '/?.lua;' .. package.path
package.path = USERDIR .. '/?/init.lua;' .. package.path
-local dynamic_suffix = PLATFORM == "Mac OS X" and 'lib' or (PLATFORM == "Windows" and 'dll' or 'so')
-package.cpath = DATADIR .. '/?.' .. dynamic_suffix .. ";" .. USERDIR .. '/?.' .. dynamic_suffix
-package.native_plugins = {}
-package.searchers = { package.searchers[1], package.searchers[2], function(modname)
- local path = package.searchpath(modname, package.cpath)
- if not path then return nil end
- return system.load_native_plugin, path
-end }
+if system.load_native_plugin then
+ local dynamic_suffix = PLATFORM == "Mac OS X" and 'lib' or (PLATFORM == "Windows" and 'dll' or 'so')
+ package.cpath = DATADIR .. '/?.' .. dynamic_suffix .. ";" .. USERDIR .. '/?.' .. dynamic_suffix
+ package.native_plugins = {}
+ package.searchers = { package.searchers[1], package.searchers[2], function(modname)
+ local path = package.searchpath(modname, package.cpath)
+ if not path then return nil end
+ return system.load_native_plugin, path
+ end }
+end
diff --git a/meson.build b/meson.build
index 3fbd9c74..1afedce7 100644
--- a/meson.build
+++ b/meson.build
@@ -28,6 +28,11 @@ lite_cargs = []
if get_option('renderer') or host_machine.system() == 'darwin'
lite_cargs += '-DLITE_USE_SDL_RENDERER'
endif
+
+if get_option('plugin-api')
+ lite_cargs += '-DLITE_XL_USE_PLUGIN_API'
+endif
+
#===============================================================================
# Linker Settings
#===============================================================================
diff --git a/meson_options.txt b/meson_options.txt
index 1cf3e22f..14d4a5b8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,3 +2,5 @@ option('bundle', type : 'boolean', value : false, description: 'Build a macOS bu
option('source-only', type : 'boolean', value : false, description: 'Configure source files only, doesn\'t checks for dependencies')
option('portable', type : 'boolean', value : false, description: 'Portable install')
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
+option('plugin-api', type : 'boolean', value : true, description: 'Enable native plugin API')
+
diff --git a/src/api/system.c b/src/api/system.c
index bcd1b997..b23b219f 100644
--- a/src/api/system.c
+++ b/src/api/system.c
@@ -651,6 +651,7 @@ static int f_set_window_opacity(lua_State *L) {
return 1;
}
+#ifdef LITE_XL_USE_PLUGIN_API
// Symbol table for native plugin loading. Allows for a statically
// bound lua library to be used by native plugins.
typedef struct {
@@ -730,6 +731,7 @@ static int f_load_native_plugin(lua_State *L) {
return result;
}
+#endif
static const luaL_Reg lib[] = {
@@ -758,7 +760,9 @@ static const luaL_Reg lib[] = {
{ "exec", f_exec },
{ "fuzzy_match", f_fuzzy_match },
{ "set_window_opacity", f_set_window_opacity },
- { "load_native_plugin", f_load_native_plugin },
+#ifdef LITE_XL_USE_PLUGIN_API
+ { "load_native_plugin", f_load_native_plugin },
+#endif
{ NULL, NULL }
};