lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> And I want to have a monolythic executable.

Abstracted from my project.

1.  make a static luasocket library; add these 2 lines to your lua makefile

        $(AR) libluasocket.a $(LSOCKSRC)/luasocket.o
$(LSOCKSRC)/timeout.o $(LSOCKSRC)/buffer.o $(LSOCKSRC)/io.o
$(LSOCKSRC)/auxiliar.o $(LSOCKSRC)/options.o $(LSOCKSRC)/inet.o
$(LSOCKSRC)/tcp.o $(LSOCKSRC)/udp.o $(LSOCKSRC)/except.o
$(LSOCKSRC)/select.o $(LSOCKSRC)/usocket.o $(LSOCKSRC)/mime.o

(AR = archive utility, on my ubuntu hardy it is "ar cru")
(LSOCKSRC = luasocket source files location)

2.  edit lua.c

right after the includes add

LUALIB_API int luaopen_socket_core(lua_State *L);
LUALIB_API int luaopen_mime_core(lua_State *L);

and in pmain add


3.  edit makefile; append "-L . -lluasocket" to the line that compiles
lua executable

4.  do a make

that's it.

You may as well want to statically link in the lua dynamic libraries.