mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-31 14:20:04 +00:00
Statically link in lpeg lua library
This commit is contained in:
@@ -129,6 +129,7 @@ ExternalProject_Add(luajit
|
||||
BUILD_IN_SOURCE 1
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
set (LPEG_SRC "${PROJECT_BINARY_DIR}/lpeg-prefix/src/lpeg")
|
||||
ExternalProject_Add(lpeg
|
||||
DEPENDS luajit
|
||||
URL "https://s3.amazonaws.com/download.draios.com/dependencies/lpeg-1.0.0.tar.gz"
|
||||
@@ -136,7 +137,7 @@ ExternalProject_Add(lpeg
|
||||
BUILD_COMMAND LUA_INCLUDE=${LUAJIT_INCLUDE} ${PROJECT_SOURCE_DIR}/scripts/build-lpeg.sh
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
INSTALL_COMMAND cp lpeg.so re.lua ${PROJECT_SOURCE_DIR}/userspace/digwatch/lua)
|
||||
INSTALL_COMMAND "")
|
||||
|
||||
|
||||
|
||||
|
@@ -5,6 +5,13 @@ gcc -O2 -fPIC -I$LUA_INCLUDE -c lpcode.c -o lpcode.o
|
||||
gcc -O2 -fPIC -I$LUA_INCLUDE -c lpprint.c -o lpprint.o
|
||||
gcc -O2 -fPIC -I$LUA_INCLUDE -c lptree.c -o lptree.o
|
||||
gcc -O2 -fPIC -I$LUA_INCLUDE -c lpvm.c -o lpvm.o
|
||||
gcc -shared -o lpeg.so -L/usr/local/lib lpcap.o lpcode.o lpprint.o lptree.o lpvm.o
|
||||
|
||||
|
||||
# For building lpeg.so, which we don't need now that we're statically linking lpeg.a into digwatch
|
||||
#gcc -shared -o lpeg.so -L/usr/local/lib lpcap.o lpcode.o lpprint.o lptree.o lpvm.o
|
||||
#gcc -shared -o lpeg.so -L/usr/local/lib lpcap.o lpcode.o lpprint.o lptree.o lpvm.o
|
||||
|
||||
/usr/bin/ar cr lpeg.a lpcap.o lpcode.o lpprint.o lptree.o lpvm.o
|
||||
/usr/bin/ranlib lpeg.a
|
||||
|
||||
chmod ug+w re.lua
|
||||
|
@@ -5,10 +5,13 @@ include_directories(${PROJECT_SOURCE_DIR}/../sysdig/userspace/libscap)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/../sysdig/userspace/libsinsp)
|
||||
include_directories("${PROJECT_BINARY_DIR}/userspace/digwatch")
|
||||
include_directories("${CURL_INCLUDE_DIR}")
|
||||
include_directories("${LPEG_SRC}")
|
||||
|
||||
add_executable(digwatch formats.cpp fields.cpp rules.cpp digwatch.cpp)
|
||||
|
||||
target_link_libraries(digwatch sinsp)
|
||||
target_link_libraries(digwatch "${LPEG_SRC}/lpeg.a")
|
||||
|
||||
|
||||
set(DIGWATCH_LUA_MAIN "rule_loader.lua")
|
||||
configure_file(config_digwatch.h.in config_digwatch.h)
|
||||
|
@@ -14,6 +14,7 @@ extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lpeg.h"
|
||||
}
|
||||
|
||||
#include <sinsp.h>
|
||||
@@ -279,6 +280,7 @@ int digwatch_init(int argc, char **argv)
|
||||
// Initialize Lua interpreter
|
||||
ls = lua_open();
|
||||
luaL_openlibs(ls);
|
||||
luaopen_lpeg(ls);
|
||||
add_lua_path(ls, lua_dir);
|
||||
|
||||
rules = new digwatch_rules(inspector, ls, lua_main_filename);
|
||||
|
6
userspace/digwatch/lpeg.h
Normal file
6
userspace/digwatch/lpeg.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
int luaopen_lpeg (lua_State *L);
|
||||
|
Reference in New Issue
Block a user