Skip to content

Commit

Permalink
wip: libs as external project from falcosecurity/libs
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
  • Loading branch information
leogr committed Feb 8, 2021
1 parent 6408270 commit 18c9ea5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ if(NOT MINIMAL_BUILD)
include(gRPC)
endif()

# sysdig
include(sysdig)
# libs
include(libs)

# Installation
install(FILES falco.yaml DESTINATION "${FALCO_ETC_DIR}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#
cmake_minimum_required(VERSION 3.5.1)

project(sysdig-repo NONE)
project(libs-repo NONE)

include(ExternalProject)
message(STATUS "Driver version: ${SYSDIG_VERSION}")
message(STATUS "Driver version: ${LIBS_VERSION}")

ExternalProject_Add(
sysdig
URL "https://github.com/draios/sysdig/archive/${SYSDIG_VERSION}.tar.gz"
URL_HASH "${SYSDIG_CHECKSUM}"
libs
URL "https://github.com/falcosecurity/libs/archive/${LIBS_VERSION}.tar.gz"
URL_HASH "${LIBS_CHECKSUM}"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
File renamed without changes.
File renamed without changes.
40 changes: 20 additions & 20 deletions cmake/modules/sysdig.cmake → cmake/modules/libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# specific language governing permissions and limitations under the License.
#

set(SYSDIG_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/sysdig-repo")
set(SYSDIG_CMAKE_WORKING_DIR "${CMAKE_BINARY_DIR}/sysdig-repo")
set(LIBS_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/libs-repo")
set(LIBS_CMAKE_WORKING_DIR "${CMAKE_BINARY_DIR}/libs-repo")

# this needs to be here at the top
if(USE_BUNDLED_DEPS)
Expand All @@ -23,36 +23,36 @@ if(USE_BUNDLED_DEPS)
set(USE_BUNDLED_JQ ON)
endif()

file(MAKE_DIRECTORY ${SYSDIG_CMAKE_WORKING_DIR})
file(MAKE_DIRECTORY ${LIBS_CMAKE_WORKING_DIR})

# The sysdig git reference (branch name, commit hash, or tag) To update sysdig version for the next release, change the
# default below In case you want to test against another sysdig version just pass the variable - ie., `cmake
# -DSYSDIG_VERSION=dev ..`
if(NOT SYSDIG_VERSION)
set(SYSDIG_VERSION "5c0b863ddade7a45568c0ac97d037422c9efb750")
set(SYSDIG_CHECKSUM "SHA256=9de717b3a4b611ea6df56afee05171860167112f74bb7717b394bcc88ac843cd")
# The falcosecurity/libs git reference (branch name, commit hash, or tag) To update falcosecurity/libs version for the next release, change the
# default below In case you want to test against another falcosecurity/libs version just pass the variable - ie., `cmake
# -DLIBS_VERSION=dev ..`
if(NOT LIBS_VERSION)
set(LIBS_VERSION "81ffd301f28ee57368987b9215fe249a0b71e512")
set(LIBS_CHECKSUM "SHA256=be7711e1687a466055cdc21a97714ee36b1efee3877836271e737b7d6db72e8b")
endif()
set(PROBE_VERSION "${SYSDIG_VERSION}")
set(PROBE_VERSION "${LIBS_VERSION}")

# cd /path/to/build && cmake /path/to/source
execute_process(COMMAND "${CMAKE_COMMAND}" -DSYSDIG_VERSION=${SYSDIG_VERSION} -DSYSDIG_CHECKSUM=${SYSDIG_CHECKSUM}
${SYSDIG_CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${SYSDIG_CMAKE_WORKING_DIR})
execute_process(COMMAND "${CMAKE_COMMAND}" -DLIBS_VERSION=${LIBS_VERSION} -DLIBS_CHECKSUM=${LIBS_CHECKSUM}
${LIBS_CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${LIBS_CMAKE_WORKING_DIR})

# todo(leodido, fntlnz) > use the following one when CMake version will be >= 3.13

# execute_process(COMMAND "${CMAKE_COMMAND}" -B ${SYSDIG_CMAKE_WORKING_DIR} WORKING_DIRECTORY
# "${SYSDIG_CMAKE_SOURCE_DIR}")
# execute_process(COMMAND "${CMAKE_COMMAND}" -B ${LIBS_CMAKE_WORKING_DIR} WORKING_DIRECTORY
# "${LIBS_CMAKE_SOURCE_DIR}")

execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${SYSDIG_CMAKE_WORKING_DIR}")
set(SYSDIG_SOURCE_DIR "${SYSDIG_CMAKE_WORKING_DIR}/sysdig-prefix/src/sysdig")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${LIBS_CMAKE_WORKING_DIR}")
set(LIBS_SOURCE_DIR "${LIBS_CMAKE_WORKING_DIR}/libs-prefix/src/libs")

# jsoncpp
set(JSONCPP_SRC "${SYSDIG_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp")
set(JSONCPP_SRC "${LIBS_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp")
set(JSONCPP_INCLUDE "${JSONCPP_SRC}")
set(JSONCPP_LIB_SRC "${JSONCPP_SRC}/jsoncpp.cpp")

# Add driver directory
add_subdirectory("${SYSDIG_SOURCE_DIR}/driver" "${PROJECT_BINARY_DIR}/driver")
add_subdirectory("${LIBS_SOURCE_DIR}/driver" "${PROJECT_BINARY_DIR}/driver")

# Add libscap directory
add_definitions(-D_GNU_SOURCE)
Expand All @@ -61,10 +61,10 @@ add_definitions(-DNOCURSESUI)
if(MUSL_OPTIMIZED_BUILD)
add_definitions(-DMUSL_OPTIMIZED)
endif()
add_subdirectory("${SYSDIG_SOURCE_DIR}/userspace/libscap" "${PROJECT_BINARY_DIR}/userspace/libscap")
add_subdirectory("${LIBS_SOURCE_DIR}/userspace/libscap" "${PROJECT_BINARY_DIR}/userspace/libscap")

# Add libsinsp directory
add_subdirectory("${SYSDIG_SOURCE_DIR}/userspace/libsinsp" "${PROJECT_BINARY_DIR}/userspace/libsinsp")
add_subdirectory("${LIBS_SOURCE_DIR}/userspace/libsinsp" "${PROJECT_BINARY_DIR}/userspace/libsinsp")
add_dependencies(sinsp tbb b64 luajit)

# explicitly disable the tests of this dependency
Expand Down
6 changes: 3 additions & 3 deletions scripts/ignored-calls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
parentdir="$(dirname "$scriptdir")"
sysdigdir="${parentdir}/build/sysdig-repo/sysdig-prefix/src/sysdig"
cat "${sysdigdir}/userspace/libscap/syscall_info_table.c" | grep EF_DROP_SIMPLE_CONS | sed -e 's/.*\"\(.*\)\".*/\1/' | sort > /tmp/ignored_syscall_info_table.txt
cat "${sysdigdir}/driver/event_table.c" | grep EF_DROP_SIMPLE_CONS | sed -e 's/[^\"]*\"\([^\"]*\)\".*/\1/' | sort | uniq > /tmp/ignored_driver_event_table.txt
libsdir="${parentdir}/build/libs-repo/libs-prefix/src/libs"
cat "${libsdir}/userspace/libscap/syscall_info_table.c" | grep EF_DROP_SIMPLE_CONS | sed -e 's/.*\"\(.*\)\".*/\1/' | sort > /tmp/ignored_syscall_info_table.txt
cat "${libsdir}/driver/event_table.c" | grep EF_DROP_SIMPLE_CONS | sed -e 's/[^\"]*\"\([^\"]*\)\".*/\1/' | sort | uniq > /tmp/ignored_driver_event_table.txt

cat /tmp/ignored_driver_event_table.txt /tmp/ignored_syscall_info_table.txt | sort | uniq | tr '\n' ', '

12 changes: 6 additions & 6 deletions userspace/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ if(MINIMAL_BUILD)
"${NJSON_INCLUDE}"
"${TBB_INCLUDE_DIR}"
"${STRING_VIEW_LITE_INCLUDE}"
"${SYSDIG_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp"
"${SYSDIG_SOURCE_DIR}/userspace/libscap"
"${SYSDIG_SOURCE_DIR}/userspace/libsinsp"
"${LIBS_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp"
"${LIBS_SOURCE_DIR}/userspace/libscap"
"${LIBS_SOURCE_DIR}/userspace/libsinsp"
"${PROJECT_BINARY_DIR}/userspace/engine")
else()
target_include_directories(
Expand All @@ -48,9 +48,9 @@ else()
"${CURL_INCLUDE_DIR}"
"${TBB_INCLUDE_DIR}"
"${STRING_VIEW_LITE_INCLUDE}"
"${SYSDIG_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp"
"${SYSDIG_SOURCE_DIR}/userspace/libscap"
"${SYSDIG_SOURCE_DIR}/userspace/libsinsp"
"${LIBS_SOURCE_DIR}/userspace/libsinsp/third-party/jsoncpp"
"${LIBS_SOURCE_DIR}/userspace/libscap"
"${LIBS_SOURCE_DIR}/userspace/libsinsp"
"${PROJECT_BINARY_DIR}/userspace/engine")
endif()

Expand Down
2 changes: 1 addition & 1 deletion userspace/falco/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(
event_drops.cpp
statsfilewriter.cpp
falco.cpp
"${SYSDIG_SOURCE_DIR}/userspace/libsinsp/fields_info.cpp"
"${LIBS_SOURCE_DIR}/userspace/libsinsp/fields_info.cpp"
)

set(
Expand Down

0 comments on commit 18c9ea5

Please sign in to comment.