Define lua_pushglobaltable only if it's not already defined

This fixes compatibility with moonjit, a luajit replacement that lies about which API level it implements.

Also link more stuff statically on linux.
This commit is contained in:
Tamás Bálint Misius 2021-08-09 07:17:16 +02:00
parent eac92d1b04
commit b5d1712123
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
3 changed files with 8 additions and 0 deletions

View File

@ -234,6 +234,10 @@ if copt_platform == 'win'
configure_file(input: input_and_output[0], output: input_and_output[1], copy: true) configure_file(input: input_and_output[0], output: input_and_output[1], copy: true)
endforeach endforeach
endif endif
elif copt_platform == 'lin'
if uopt_static != 'none'
project_link_args = [ '-static-libgcc', '-static-libstdc++' ]
endif
endif endif
if copt_platform == 'mac' and uopt_lua == 'luajit' if copt_platform == 'mac' and uopt_lua == 'luajit'

View File

@ -19,11 +19,13 @@ void tpt_lua_getmainthread(lua_State *L)
#else #else
# ifndef lua_pushglobaltable // * Thank you moonjit
// Implement function added in lua 5.2 that we now use // Implement function added in lua 5.2 that we now use
void lua_pushglobaltable(lua_State *L) void lua_pushglobaltable(lua_State *L)
{ {
lua_pushvalue(L, LUA_GLOBALSINDEX); lua_pushvalue(L, LUA_GLOBALSINDEX);
} }
# endif
void tpt_lua_setmainthread(lua_State *L) void tpt_lua_setmainthread(lua_State *L)
{ {

View File

@ -17,7 +17,9 @@ LUALIB_API void tpt_lua_getmainthread(lua_State *L);
#if LUA_VERSION_NUM >= 502 #if LUA_VERSION_NUM >= 502
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
#else #else
# ifndef lua_pushglobaltable // * Thank you moonjit
LUALIB_API void (lua_pushglobaltable) (lua_State *L); LUALIB_API void (lua_pushglobaltable) (lua_State *L);
# endif
#endif #endif
int luaL_tostring(lua_State *L, int n); int luaL_tostring(lua_State *L, int n);