Lua cleanup

Deleted two files we NEVER want to allow ANYONE to use.

Updated the howto markdown document.
This commit is contained in:
Gregory A Lundberg 2016-11-07 14:09:14 -06:00
parent f9e36df155
commit 15b7f75b3c
7 changed files with 3 additions and 88 deletions

View file

@ -164,7 +164,6 @@
<ClCompile Include="..\..\src\lua\ldump.cpp" />
<ClCompile Include="..\..\src\lua\lfunc.cpp" />
<ClCompile Include="..\..\src\lua\lgc.cpp" />
<ClCompile Include="..\..\src\lua\linit.cpp" />
<ClCompile Include="..\..\src\lua\liolib.cpp" />
<ClCompile Include="..\..\src\lua\llex.cpp" />
<ClCompile Include="..\..\src\lua\lmathlib.cpp" />
@ -207,7 +206,6 @@
<ClInclude Include="..\..\src\lua\ltable.h" />
<ClInclude Include="..\..\src\lua\ltm.h" />
<ClInclude Include="..\..\src\lua\lua.h" />
<ClInclude Include="..\..\src\lua\lua.hpp" />
<ClInclude Include="..\..\src\lua\luaconf.h" />
<ClInclude Include="..\..\src\lua\lualib.h" />
<ClInclude Include="..\..\src\lua\lundump.h" />

View file

@ -50,9 +50,6 @@
<ClCompile Include="..\..\src\lua\lgc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lua\linit.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\lua\liolib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -175,9 +172,6 @@
<ClInclude Include="..\..\src\lua\lua.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\lua\lua.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\lua\luaconf.h">
<Filter>Header Files</Filter>
</ClInclude>

View file

@ -331,7 +331,6 @@ set(libwesnoth-lua_STAT_SRC
lua/ltablib.cpp
lua/lstrlib.cpp
lua/loadlib.cpp
lua/linit.cpp
lua/lutf8lib.cpp
)
# We explicitly want lua compiled as C++ version, so this line is required:

View file

@ -33,7 +33,6 @@ loslib.cpp
ltablib.cpp
lstrlib.cpp
loadlib.cpp
linit.cpp
lutf8lib.cpp
""")
env_lua = env.Clone(

View file

@ -1,68 +0,0 @@
/*
** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $
** Initialization of libraries for lua.c and other clients
** See Copyright Notice in lua.h
*/
#define linit_c
#define LUA_LIB
/*
** If you embed Lua in your program and need to open the standard
** libraries, call luaL_openlibs in your program. If you need a
** different set of libraries, copy this file to your project and edit
** it to suit your needs.
**
** You can also *preload* libraries, so that a later 'require' can
** open the library, which is already linked to the application.
** For that, do the following code:
**
** luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
** lua_pushcfunction(L, luaopen_modname);
** lua_setfield(L, -2, modname);
** lua_pop(L, 1); // remove _PRELOAD table
*/
#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/*
** these libs are loaded by lua.c and are readily available to any Lua
** program
*/
static const luaL_Reg loadedlibs[] = {
{"_G", luaopen_base},
{LUA_LOADLIBNAME, luaopen_package},
{LUA_COLIBNAME, luaopen_coroutine},
{LUA_TABLIBNAME, luaopen_table},
{LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_UTF8LIBNAME, luaopen_utf8},
{LUA_DBLIBNAME, luaopen_debug},
#if defined(LUA_COMPAT_BITLIB)
{LUA_BITLIBNAME, luaopen_bit32},
#endif
{NULL, NULL}
};
LUALIB_API void luaL_openlibs (lua_State *L) {
const luaL_Reg *lib;
/* "require" functions from 'loadedlibs' and set results to global table */
for (lib = loadedlibs; lib->func; lib++) {
luaL_requiref(L, lib->name, lib->func, 1);
lua_pop(L, 1); /* remove lib */
}
}

View file

@ -1,9 +0,0 @@
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

View file

@ -42,8 +42,10 @@ Change into the Lua source folder.
$ cd ~/lua-5.3.3/src
We do not need, or want, the Lua command line interpreter, the Lua compiler or the Makefile, so delete them.
We compile using C++ so cannot allow the use of "C" linkage from the provided header.
And we initialize the Lua runtime and do not want to allow the provided initialization routine.
$ rm lua.c luac.c Makefile
$ rm lua.c luac.c Makefile lua.hpp linit.c
Wesnoth requires all Lua sources to be compiled using C++.
To ensure this, rather than depend upon compiler flags, rename the files.