Skip to content
Snippets Groups Projects
Commit e3cd6a03 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

build: compile Lua bytecode for embedded code

parent d9c4ed61
Branches
Tags
No related merge requests found
......@@ -17,5 +17,6 @@ CFLAGS += -DPACKAGE_VERSION="\"$(MAJOR).$(MINOR)\"" -DPREFIX="\"$(PREFIX)\"" -D
RM := rm -f
LN := ln -s
XXD ?= xxd
LUAC ?= luac
INSTALL := install
PYTHON := python
......@@ -10,8 +10,9 @@ kresolved_SOURCES := \
# Embed resources
daemon/engine.o: daemon/lua/init.inc daemon/lua/config.inc
%.inc: %.lua
@$(call quiet,XXD,$<) -i < $< > $@
@echo ', 0x00' >> $@
@$(call quiet,LUAC,$<) -o $<.out $<
@$(call quiet,XXD,$<) -i - < $<.out > $@
@$(RM) $<.out
# Dependencies
kresolved_DEPEND := $(libkresolve)
......
......@@ -192,6 +192,9 @@ int engine_cmd(struct engine *engine, const char *str)
return kr_ok();
}
/* Execute byte code */
#define l_dobytecode(L, arr, len, name) \
(luaL_loadbuffer((L), (arr), (len), (name)) || lua_pcall((L), 0, LUA_MULTRET, 0))
static int engine_loadconf(struct engine *engine)
{
/* Init environment */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment