[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: liblua5.so
- From: pan shizhu <pan.shizhu@...>
- Date: Sat, 14 Feb 2009 10:32:00 +0800
On Tue, Feb 10, 2009 at 1:22 PM, Ralf Peng <ralf.peng@gmail.com> wrote:
> How to build that a dynmic lib? b/c my modsecurity installtion need
> it, thanks again.
>
Lua is an embedded language, the typical use is to build the source
together with your main program, so in most cases you don't need the
dynamic lib.
In most cases you will add/remove features to the embedded language so
it isn't quite useful to distribute a "generic" dynamic lib and the
Lua should in most cases distributed as sources instead of binaries.
I've attached a CMakeLists.txt which should help you build the dynamic
lib on Linux. If you know how to use cmake and you have a working
Linux system it should work for you.
project(LUA)
# change CFLAGS here if you want
add_definitions(-DLUA_USE_LINUX -O2 -g -Wall -Werror -std=gnu99)
include_directories(${PROJECT_SOURCE_DIR})
# static-linked library: staticlua.a
add_library(staticlua
lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c
lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c
lvm.c lzio.c lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
ltablib.c lstrlib.c loadlib.c linit.c)
target_link_libraries(staticlua m dl)
# dynamic-linked library: lua5.so
add_library(lua5 SHARED
lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c
lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c
lvm.c lzio.c lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
ltablib.c lstrlib.c loadlib.c linit.c)
target_link_libraries(lua5 m dl)
add_executable(luac luac.c print.c)
target_link_libraries(luac staticlua)
add_executable(lua lua.c)
target_link_libraries(lua lua5 dl readline ncurses)
set_target_properties(lua PROPERTIES LINK_FLAGS -Wl,-E)
install(TARGETS luac lua DESTINATION bin)
install(TARGETS lua5 DESTINATION lib)