mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-18 19:31:02 +00:00
Adding lua+sqlite functionality in the default windows binary build
This commit is contained in:
1 parent
b21a8b2193
commit
ce0826e285
4 files changed
+139321
-22
No files matched your search
@@ -20,9 +20,8 @@ PROG = mongoose
|
|||||||
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
|
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
|
||||||
|
|
||||||
# To build with Lua, download and unzip Lua 5.2.1 source code into the
|
# To build with Lua, download and unzip Lua 5.2.1 source code into the
|
||||||
# mongoose directory, and then add $(LUA_FLAGS) to CFLAGS below
|
# mongoose directory, and then add $(LUA_SOURCES) to CFLAGS
|
||||||
LUA = lua-5.2.1/src
|
LUA = lua-5.2.1/src
|
||||||
LUA_FLAGS = -I$(LUA) -L$(LUA) -llua -lm
|
|
||||||
LUA_SOURCES = $(LUA)/lapi.c $(LUA)/lcode.c $(LUA)/lctype.c \
|
LUA_SOURCES = $(LUA)/lapi.c $(LUA)/lcode.c $(LUA)/lctype.c \
|
||||||
$(LUA)/ldebug.c $(LUA)/ldo.c $(LUA)/ldump.c \
|
$(LUA)/ldebug.c $(LUA)/ldo.c $(LUA)/ldump.c \
|
||||||
$(LUA)/lfunc.c $(LUA)/lgc.c $(LUA)/llex.c \
|
$(LUA)/lfunc.c $(LUA)/lgc.c $(LUA)/llex.c \
|
||||||
@@ -39,14 +38,13 @@ LUA_OBJECTS = $(LUA_SOURCES:%.c=%.o)
|
|||||||
# Using Visual Studio 6.0. To build Mongoose:
|
# Using Visual Studio 6.0. To build Mongoose:
|
||||||
# Set MSVC variable below to where VS 6.0 is installed on your system
|
# Set MSVC variable below to where VS 6.0 is installed on your system
|
||||||
# Run "PATH_TO_VC6\bin\nmake windows"
|
# Run "PATH_TO_VC6\bin\nmake windows"
|
||||||
MSVC = e:/vc6
|
MSVC = ../vc6
|
||||||
#DBG = /Zi /Od
|
#DBG = /Zi /Od
|
||||||
DBG = /DNDEBUG /O1
|
DBG = /DNDEBUG /O1
|
||||||
CL = $(MSVC)/bin/cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL \
|
CL = $(MSVC)/bin/cl /MD /TC /nologo $(DBG) /Gz /W3 \
|
||||||
/I$(MSVC)/include /I$(LUA) /I. /I$(YASSL) /I$(YASSL)/cyassl /GA
|
/I$(MSVC)/include /I$(LUA) /I. /I$(YASSL) /I$(YASSL)/cyassl /GA
|
||||||
MSLIB = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 \
|
MSLIB = /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86 \
|
||||||
user32.lib shell32.lib comdlg32.lib ws2_32.lib advapi32.lib \
|
user32.lib shell32.lib comdlg32.lib ws2_32.lib advapi32.lib
|
||||||
cyassl.lib lua.lib
|
|
||||||
|
|
||||||
# Stock windows binary builds with Lua and YASSL library.
|
# Stock windows binary builds with Lua and YASSL library.
|
||||||
YASSL = ../cyassl-2.4.6
|
YASSL = ../cyassl-2.4.6
|
||||||
@@ -88,7 +86,8 @@ bsd:
|
|||||||
$(CC) mongoose.c main.c -o $(PROG) $(CFLAGS)
|
$(CC) mongoose.c main.c -o $(PROG) $(CFLAGS)
|
||||||
|
|
||||||
bsd_yassl:
|
bsd_yassl:
|
||||||
$(CC) mongoose.c main.c -o $(PROG) $(CFLAGS) $(YASSL_SOURCES) $(YASSL_FLAGS) -DNO_SSL_DL
|
$(CC) mongoose.c main.c -o $(PROG) $(CFLAGS) $(YASSL_SOURCES) \
|
||||||
|
$(YASSL_FLAGS) -DNO_SSL_DL
|
||||||
|
|
||||||
solaris:
|
solaris:
|
||||||
$(CC) mongoose.c main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
$(CC) mongoose.c main.c -lnsl -lsocket -o $(PROG) $(CFLAGS)
|
||||||
@@ -97,26 +96,24 @@ cocoa:
|
|||||||
$(CC) mongoose.c main.c -DUSE_COCOA $(CFLAGS) -framework Cocoa -ObjC -arch i386 -arch x86_64 -o Mongoose
|
$(CC) mongoose.c main.c -DUSE_COCOA $(CFLAGS) -framework Cocoa -ObjC -arch i386 -arch x86_64 -o Mongoose
|
||||||
V=`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`; DIR=dmg/Mongoose.app && rm -rf $$DIR && mkdir -p $$DIR/Contents/{MacOS,Resources} && install -m 644 build/mongoose_*.png $$DIR/Contents/Resources/ && install -m 644 build/Info.plist $$DIR/Contents/ && install -m 755 Mongoose $$DIR/Contents/MacOS/ && ln -fs /Applications dmg/ ; hdiutil create Mongoose_$$V.dmg -volname "Mongoose $$V" -srcfolder dmg -ov #; rm -rf dmg
|
V=`perl -lne '/define\s+MONGOOSE_VERSION\s+"(\S+)"/ and print $$1' mongoose.c`; DIR=dmg/Mongoose.app && rm -rf $$DIR && mkdir -p $$DIR/Contents/{MacOS,Resources} && install -m 644 build/mongoose_*.png $$DIR/Contents/Resources/ && install -m 644 build/Info.plist $$DIR/Contents/ && install -m 755 Mongoose $$DIR/Contents/MacOS/ && ln -fs /Applications dmg/ ; hdiutil create Mongoose_$$V.dmg -volname "Mongoose $$V" -srcfolder dmg -ov #; rm -rf dmg
|
||||||
|
|
||||||
u: $(LUA_OBJECTS)
|
u:
|
||||||
$(CC) test/unit_test.c -o unit_test -I. $(LUA_FLAGS) $(CFLAGS) -g -O0
|
$(CC) test/unit_test.c -o unit_test -I. -I$(LUA) $(LUA_SOURCES) \
|
||||||
|
$(CFLAGS) -g -O0
|
||||||
./unit_test
|
./unit_test
|
||||||
|
|
||||||
cyassl.lib:
|
w:
|
||||||
$(CL) /c /Fo$(YASSL)/ $(YASSL_SOURCES) $(YASSL_FLAGS) $(DEF)
|
$(CL) test/unit_test.c $(LUA_SOURCES) $(YASSL_SOURCES) $(YASSL_FLAGS) \
|
||||||
$(MSVC)/bin/lib $(YASSL)/*.obj /out:$@
|
$(MSLIB) /out:unit_test.exe
|
||||||
|
|
||||||
lua.lib:
|
|
||||||
$(CL) /c /Fo$(LUA)/ $(LUA_SOURCES)
|
|
||||||
$(MSVC)/bin/lib $(LUA_SOURCES:%.c=%.obj) /out:$@
|
|
||||||
|
|
||||||
w: cyassl.lib lua.lib
|
|
||||||
$(CL) test/unit_test.c $(MSLIB) /out:unit_test.exe
|
|
||||||
./unit_test.exe
|
./unit_test.exe
|
||||||
|
|
||||||
windows: cyassl.lib lua.lib
|
windows:
|
||||||
$(MSVC)/bin/rc build\res.rc
|
$(MSVC)/bin/rc build\res.rc
|
||||||
$(CL) main.c mongoose.c /DUSE_LUA $(MSLIB) build\res.res \
|
$(CL) main.c mongoose.c \
|
||||||
/out:$(PROG).exe /subsystem:windows
|
$(MSLIB) build\res.res /out:$(PROG)_1.exe /subsystem:windows
|
||||||
|
$(CL) main.c mongoose.c build/lsqlite3.c build/sqlite3.c \
|
||||||
|
$(YASSL_SOURCES) $(YASSL_FLAGS) /DNO_SSL_DL \
|
||||||
|
$(LUA_SOURCES) /DUSE_LUA /DUSE_LUA_SQLITE3 /DLUA_COMPAT_ALL \
|
||||||
|
$(MSLIB) build\res.res /out:$(PROG).exe /subsystem:windows
|
||||||
|
|
||||||
# Build for Windows under MinGW
|
# Build for Windows under MinGW
|
||||||
#MINGWDBG= -DDEBUG -O0 -ggdb
|
#MINGWDBG= -DDEBUG -O0 -ggdb
|
||||||
|
|||||||
+1885
File diff suppressed because it is too large.
Load diff
+137414
File diff suppressed because it is too large.
Load diff
@@ -3987,6 +3987,9 @@ static void prepare_lua_environment(struct mg_connection *conn, lua_State *L) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
luaL_openlibs(L);
|
luaL_openlibs(L);
|
||||||
|
#ifdef USE_LUA_SQLITE3
|
||||||
|
luaopen_lsqlite3(L);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Register "print" function which calls mg_write()
|
// Register "print" function which calls mg_write()
|
||||||
lua_pushlightuserdata(L, conn);
|
lua_pushlightuserdata(L, conn);
|
||||||
|
|||||||
Reference in new issue
Block a user