local ffi = require("ffi")
--- FIXME remove absolute path
--- the load opens the file relative to CWD. That could be anywhere. So we need to know, where is knot installed.
-local clib = ffi.load("/tmp/kr/lib/knot-resolver/kres_modules/sysrepo-lua/cbindings.so")
+-- The exact path is configured during project build by meson
+local clib = ffi.load("@modules_dir@/sysrepo-lua/cbindings.so")
-------------------------------------------------------------------------------
-- FFI initialization
_KNOT_SYSREPO_FFI_INITIALIZED = true
end
--- TODO version check so that we cant load new module into an old Knot
+-- TODO version check so that we can not load new module into an old Knot
-------------------------------------------------------------------------------
-- Data convertsion helpers
# lua module: sysrepo-lua
-sysrepo_lua_src = files([
- 'ffi.lua',
- 'init.lua',
-])
+lua_config = configuration_data()
+lua_config.set('modules_dir', modules_dir)
+
+ffi = configure_file(
+ input: 'ffi.lua.in',
+ output: 'ffi.lua',
+ configuration: lua_config,
+)
+
+sysrepo_lua_src = [
+ ffi,
+ files('init.lua'),
+]
sysrepo_src = files([
'cbindings/sysrepo_clib.h',