mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
- rewrite Lua handling
* depend pkg checks on enable-lua switch * define STATIC_LUAPOSIX in case of static lua build to exclude unwanted code in neutrino * remove DYNAMIC_LUAPOSIX code as it's not needed in case of dynamic lua build
This commit is contained in:
37
configure.ac
37
configure.ac
@@ -95,16 +95,6 @@ TUXBOX_APPS_LIB_PKGCONFIG(AVFORMAT,libavformat)
|
|||||||
TUXBOX_APPS_LIB_PKGCONFIG(AVCODEC,libavcodec)
|
TUXBOX_APPS_LIB_PKGCONFIG(AVCODEC,libavcodec)
|
||||||
TUXBOX_APPS_LIB_PKGCONFIG(AVUTIL,libavutil)
|
TUXBOX_APPS_LIB_PKGCONFIG(AVUTIL,libavutil)
|
||||||
|
|
||||||
# either use dynamic lualib in package lua (openSUSE)
|
|
||||||
# ... or in package lua5.2 (debian-derivates)
|
|
||||||
# ... and if all fails, assume it is in the linker path (cross build)
|
|
||||||
PKG_CHECK_MODULES([LUA], [lua >= 5.2], echo "lua >= 5.2 found", [
|
|
||||||
PKG_CHECK_MODULES([LUA], [lua5.2 >= 5.2], echo "lua5.2 found", [
|
|
||||||
echo "=> lualib not found, assuming static lua in linker path..."
|
|
||||||
LUA_LIBS="-llua -ldl"
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
#TUXBOX_APPS_LIB_PKGCONFIG(CONFIGFILE,tuxbox-configfile)
|
#TUXBOX_APPS_LIB_PKGCONFIG(CONFIGFILE,tuxbox-configfile)
|
||||||
#TUXBOX_APPS_LIB_PKGCONFIG(CONNECTION,tuxbox-connection)
|
#TUXBOX_APPS_LIB_PKGCONFIG(CONNECTION,tuxbox-connection)
|
||||||
#TUXBOX_APPS_LIB_PKGCONFIG(EVENTSERVER,tuxbox-eventserver)
|
#TUXBOX_APPS_LIB_PKGCONFIG(EVENTSERVER,tuxbox-eventserver)
|
||||||
@@ -162,6 +152,23 @@ if test "$enable_upnp" = "yes"; then
|
|||||||
AC_DEFINE(ENABLE_UPNP,1,[include UPNP support - currently broken])
|
AC_DEFINE(ENABLE_UPNP,1,[include UPNP support - currently broken])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Lua - embeddable scripting language
|
||||||
|
AC_ARG_ENABLE(lua,
|
||||||
|
AS_HELP_STRING(--enable-lua,include Lua support),
|
||||||
|
,[enable_lua=no])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(ENABLE_LUA,test "$enable_lua" = "yes")
|
||||||
|
if test "$enable_lua" = "yes"; then
|
||||||
|
AC_DEFINE(ENABLE_LUA,1,[include Lua support])
|
||||||
|
PKG_CHECK_MODULES([LUA], [lua >= 5.2], echo "lua >= 5.2 found", [
|
||||||
|
PKG_CHECK_MODULES([LUA], [lua5.2 >= 5.2], echo "lua5.2 found", [
|
||||||
|
echo "=> lualib not found, assuming static lua in linker path..."
|
||||||
|
LUA_LIBS="-llua -ldl"
|
||||||
|
AC_DEFINE(STATIC_LUAPOSIX,1,[Define to 1 for static lua build.])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(cleanup,
|
AC_ARG_ENABLE(cleanup,
|
||||||
[ --enable-cleanup enable cleanup on exit],
|
[ --enable-cleanup enable cleanup on exit],
|
||||||
[AC_DEFINE(EXIT_CLEANUP,1,[enable cleanup on exit])])
|
[AC_DEFINE(EXIT_CLEANUP,1,[enable cleanup on exit])])
|
||||||
@@ -179,16 +186,6 @@ if test "$enable_testmenu" = "yes"; then
|
|||||||
AC_DEFINE(ENABLE_TEST_MENU,1,[include test menu in neutrino main menu - not recommended for general users!])
|
AC_DEFINE(ENABLE_TEST_MENU,1,[include test menu in neutrino main menu - not recommended for general users!])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(lua,
|
|
||||||
AS_HELP_STRING(--enable-lua,enable LUA support))
|
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_LUA,test "$enable_lua" = "yes")
|
|
||||||
if test "$enable_lua" = "yes"; then
|
|
||||||
AC_DEFINE(ENABLE_LUA,1,[include LUA support])
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test "$BOXTYPE" = "coolstream"; then
|
if test "$BOXTYPE" = "coolstream"; then
|
||||||
if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then
|
if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then
|
||||||
AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the <nevis_ir.h> header file.])
|
AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the <nevis_ir.h> header file.])
|
||||||
|
@@ -347,35 +347,12 @@ const luaL_Reg CLuaInstance::methods[] =
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DYNAMIC_LUAPOSIX
|
#ifdef STATIC_LUAPOSIX
|
||||||
/* hack: we link against luaposix, which is included in our
|
/* hack: we link against luaposix, which is included in our
|
||||||
* custom built lualib */
|
* custom built lualib */
|
||||||
extern "C" { LUAMOD_API int (luaopen_posix_c) (lua_State *L); }
|
extern "C" { LUAMOD_API int (luaopen_posix_c) (lua_State *L); }
|
||||||
#else
|
|
||||||
static int dolibrary (lua_State *L, const char *name)
|
|
||||||
{
|
|
||||||
int status = 0;
|
|
||||||
const char *msg = "";
|
|
||||||
lua_getglobal(L, "require");
|
|
||||||
lua_pushstring(L, name);
|
|
||||||
status = lua_pcall(L, 1, 0, 0);
|
|
||||||
if (status && !lua_isnil(L, -1))
|
|
||||||
{
|
|
||||||
msg = lua_tostring(L, -1);
|
|
||||||
if (NULL == msg)
|
|
||||||
{
|
|
||||||
msg = "(error object is not a string)";
|
|
||||||
}
|
|
||||||
fprintf(stderr, "[CLuaInstance::%s] error in dolibrary: %s (%s)\n", __func__, name,msg);
|
|
||||||
lua_pop(L, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("[CLuaInstance::%s] loaded library: %s\n", __func__, name);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* load basic functions and register our own C callbacks */
|
/* load basic functions and register our own C callbacks */
|
||||||
void CLuaInstance::registerFunctions()
|
void CLuaInstance::registerFunctions()
|
||||||
{
|
{
|
||||||
@@ -384,14 +361,6 @@ void CLuaInstance::registerFunctions()
|
|||||||
luaopen_io(lua);
|
luaopen_io(lua);
|
||||||
luaopen_string(lua);
|
luaopen_string(lua);
|
||||||
luaopen_math(lua);
|
luaopen_math(lua);
|
||||||
#ifndef DYNAMIC_LUAPOSIX
|
|
||||||
#if !HAVE_COOL_HARDWARE
|
|
||||||
luaopen_posix_c(lua);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
dolibrary(lua,"posix");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lua_newtable(lua);
|
lua_newtable(lua);
|
||||||
int methodtable = lua_gettop(lua);
|
int methodtable = lua_gettop(lua);
|
||||||
luaL_newmetatable(lua, className);
|
luaL_newmetatable(lua, className);
|
||||||
|
Reference in New Issue
Block a user