Fix rockspec and serial.c module.

This commit is contained in:
Diego Nehab 2015-08-21 22:31:29 -03:00
parent 9322eacefd
commit b211838648
3 changed files with 6 additions and 25 deletions

View File

@ -50,13 +50,12 @@ local function make_plat(plat)
} }
local modules = { local modules = {
["socket.core"] = { ["socket.core"] = {
sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", "src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c", "src/compat.c" },
"src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c" },
defines = defines[plat], defines = defines[plat],
incdir = "/src" incdir = "/src"
}, },
["mime.core"] = { ["mime.core"] = {
sources = { "src/mime.c" }, sources = { "src/mime.c", "src/compat.c" },
defines = defines[plat], defines = defines[plat],
incdir = "/src" incdir = "/src"
}, },
@ -73,14 +72,12 @@ local function make_plat(plat)
if plat == "unix" or plat == "macosx" then if plat == "unix" or plat == "macosx" then
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c" modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
modules["socket.unix"] = { modules["socket.unix"] = {
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" },
"src/usocket.c", "src/unix.c" },
defines = defines[plat], defines = defines[plat],
incdir = "/src" incdir = "/src"
} }
modules["socket.serial"] = { modules["socket.serial"] = {
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/serial.c" },
"src/io.c", "src/usocket.c", "src/serial.c" },
defines = defines[plat], defines = defines[plat],
incdir = "/src" incdir = "/src"
} }

View File

@ -1,6 +1,6 @@
#include "compat.h" #include "compat.h"
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM==501 #if LUA_VERSION_NUM==501
/* /*
** Adapted from Lua 5.2 ** Adapted from Lua 5.2
*/ */

View File

@ -54,15 +54,6 @@ static luaL_Reg serial_methods[] = {
{NULL, NULL} {NULL, NULL}
}; };
/* our socket creation function */
/* this is an ad-hoc module that returns a single function
* as such, do not include other functions in this array. */
static luaL_Reg func[] = {
{"serial", global_create},
{NULL, NULL}
};
/*-------------------------------------------------------------------------*\ /*-------------------------------------------------------------------------*\
* Initializes module * Initializes module
\*-------------------------------------------------------------------------*/ \*-------------------------------------------------------------------------*/
@ -71,14 +62,7 @@ LUASOCKET_API int luaopen_socket_serial(lua_State *L) {
auxiliar_newclass(L, "serial{client}", serial_methods); auxiliar_newclass(L, "serial{client}", serial_methods);
/* create class groups */ /* create class groups */
auxiliar_add2group(L, "serial{client}", "serial{any}"); auxiliar_add2group(L, "serial{client}", "serial{any}");
#if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE)
lua_pushcfunction(L, global_create); lua_pushcfunction(L, global_create);
(void) func;
#else
/* set function into socket namespace */
luaL_openlib(L, "socket", func, 0);
lua_pushcfunction(L, global_create);
#endif
return 1; return 1;
} }