Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
ea3524c
new(proposals): API versioning for user/kernel boundary
gnosek Aug 18, 2021
afb13cf
Apply suggestions from code review
gnosek Aug 23, 2021
92d3cd4
Review comments
gnosek Aug 23, 2021
89e1263
fix: container.privileged in containerd and crio
holyspectral Sep 2, 2021
1e9c3c7
cmake: add curl as a sinsp dependency
LucaGuerra Sep 17, 2021
a05c330
fix(driver): fix bpf probe verifier for bpf_poll_parse_fds() and bpf_…
FedeDP Sep 13, 2021
8cde184
Update driver/bpf/fillers.h
FedeDP Sep 14, 2021
747934f
fix(driver/bpf): fix verifier issues in latest clang versions
jasondellaluce Sep 16, 2021
8f5b5e8
fix(driver/bpf): fixing typos
jasondellaluce Sep 16, 2021
515ea98
Trim some useless whitespaces
FedeDP Sep 16, 2021
bb0a00a
fix(driver/bpf): enhance support to older kernels
jasondellaluce Sep 17, 2021
4d9c85e
libsinsp: fix formatter for bytebuf types
LucaGuerra Aug 4, 2021
5727c45
cleanup(libsinsp): make user agent string parametrized
LucaGuerra Aug 4, 2021
3aa7a83
fix(cmake): downgrade openssl to 1.0.2u
zuc Sep 29, 2021
01f2e2a
Add ability to return event types used by a filter
mstemm Aug 25, 2021
b5308ce
Update lua parser to be short-lived for a single filter
mstemm Aug 25, 2021
59a8145
Add ability to return all fields exported by a factory
mstemm Aug 25, 2021
a5ea367
Add notion of generic formatters/formatter factories
mstemm Aug 25, 2021
ce142f4
Use error value over lua_error() in lua callbacks
mstemm Oct 5, 2021
55b2be3
Also skip EF_OLD_VERSION events from simple consumer
mstemm Oct 7, 2021
7f84dd1
Set EF_OLD_VERSION for PPME_CONTAINER_{E,X}
mstemm Oct 7, 2021
0a34d54
Skip deprecated events in evttypes()
mstemm Oct 7, 2021
a03ccfd
Update tests to reflect skipping deprecated events
mstemm Oct 8, 2021
326b87e
RHEL 8 backports actually happened in 8.1, not 8.0
gnosek Oct 15, 2021
769210f
Classes to represent a plugin
mstemm Oct 5, 2021
1b17507
Add new "plugin event" event type
mstemm Oct 5, 2021
42921f2
Use CMAKE_CURRENT_SOURCE_DIR for common
mstemm Oct 5, 2021
f557172
libscap support for source plugins
mstemm Oct 5, 2021
13ba893
libsinsp support for plugins
mstemm Oct 5, 2021
54ab5d2
New filtercheck field evt.datetime.s
mstemm Oct 5, 2021
8ac46c8
Remove plugin_evt_processor for now
mstemm Oct 8, 2021
2cd59ea
Add a plugin API function to free allocated memory
mstemm Oct 8, 2021
97c2406
Move async extraction from plugin framework to plugin-sdk-go
mstemm Oct 8, 2021
92a8e2e
Allow for alt. list of filterchecks when creating filter/formatter
mstemm Oct 14, 2021
ca51f17
Finish moving token bucket impl from falco to libs
mstemm Oct 15, 2021
ca92a86
Split sinsp_evt_filter_check_event in two, use half in plugins
mstemm Oct 15, 2021
a9dd4cf
Divorce plugin rc from scap rc
mstemm Oct 15, 2021
922a9fe
Fix bug in plugin event size as ppm param
mstemm Oct 21, 2021
b45053d
Set plugin instance to NULL after close()
mstemm Oct 21, 2021
8b45f23
Add missing conversion from plugin rc to scap rc
mstemm Oct 21, 2021
0ccf9cf
fix: correct close cleanup
jasondellaluce Oct 22, 2021
4ec223c
update(libsinsp): update tinydir to 1.2.4
LucaGuerra Sep 21, 2021
4e76d3f
userspace: add strlcpy implementation
LucaGuerra Oct 22, 2021
21588dd
libsinsp, libscap: use common strlcpy implementation
LucaGuerra Oct 21, 2021
ed3b0e2
libsinsp, libscap: update strlcpy() use, remove redundant checks
LucaGuerra Oct 22, 2021
b62ce64
update: adding field_id to ss_plugin_extract_field
jasondellaluce Oct 26, 2021
e326ed9
refactor: remove free_mem and avoid freeing plugin-allocated memory
jasondellaluce Oct 26, 2021
5ac4b34
update: sync plugin_info.h with new memory ownership specifics
jasondellaluce Oct 26, 2021
48e61a5
update: bump plugin api version (to 0.2.0)
jasondellaluce Oct 26, 2021
804d3d1
update: remove next symbol
jasondellaluce Oct 26, 2021
492b669
docs: improve plugin exported symbols documentation
jasondellaluce Oct 27, 2021
1a8bb39
Set event types properly for plugin filterchecks
mstemm Oct 26, 2021
9491484
Fill in some error string when plugin init fails
mstemm Oct 26, 2021
a0a27a9
Properly set event type in plugin_infos()
mstemm Oct 26, 2021
ae6df6f
new(userspace/libscap): added new EV(F)_BLOCK_TYPE_V2_LARGE block typ…
FedeDP Oct 22, 2021
b9d2fcc
Use const char* / uint8_t* in Plugins API
mstemm Oct 28, 2021
6eb1a75
fix(driver/ebpf): fixed eBPF issues on clang5:
FedeDP Oct 27, 2021
3914528
update(driver/ebpf): added better explanation of switch workaround.
FedeDP Oct 28, 2021
e879601
update(driver/ebpf): only build workaround label case for BPF tracing…
FedeDP Oct 28, 2021
f994f47
Fix const warnings in libscap
mstemm Nov 1, 2021
078d395
Don't define strlcpy when already defined (musl libc)
mstemm Oct 27, 2021
cc44a90
fix: check that field is present before copying it
jasondellaluce Nov 2, 2021
c4eab4e
Do not overwrite imageID if it's already set
Oct 29, 2021
1d9e61e
expose API to set track connection status on parser
speedyguy17 Oct 12, 2021
6210e63
Set compiler flags before including the libs dirs
LucaGuerra Nov 2, 2021
f7877aa
fix(driver,userspace/libsinsp): use new PPME_CONTAINER_JSON_2_ events…
FedeDP Nov 3, 2021
396f2c9
Fix link for libraries contibutions in README.md
sachinkumarsingh092 Nov 5, 2021
d6da925
Rename docker_async_instruction to docker_lookup_request
gnosek Jul 16, 2021
52d1227
Fix comparison of `docker_lookup_request`s
gnosek Jul 16, 2021
5c1d456
Pass container_id as a const ref to docker_lookup_request ctor
gnosek Jul 16, 2021
34b9818
Move docker_lookup_request to a separate file
gnosek Jul 16, 2021
c15bf45
Pass docker socket to the async engine separately for each request
gnosek Jul 16, 2021
45941a4
Move platform-specific Docker-API code to a separate class
gnosek Jul 16, 2021
3ef1849
Remove docker_connection::build_request
gnosek Jul 16, 2021
4833879
Move docker_async_source to its own source file
gnosek Jul 16, 2021
59873aa
Pass a complete request to parse_docker_async
gnosek Jul 16, 2021
dd1088c
Move most of docker::resolve to a new method
gnosek Jul 16, 2021
8cc4e60
Move common docker bits to a base class
gnosek Jul 16, 2021
931f298
Split Linux/Windows docker implementations
gnosek Jul 16, 2021
83f460c
Split docker_async_source::parse_docker into helper methods
gnosek Jul 19, 2021
9d2082a
chore(libscap): remove unused variable sh from scap_read_init
LucaGuerra Nov 9, 2021
fcffb42
fix(userspace/libsinsp): properly use dlerror() instead of errno when…
FedeDP Nov 9, 2021
b257f5f
new(userspace/libsinsp): properly support filtering on rawarg.(rel)path.
FedeDP Nov 2, 2021
c7524e8
Add Mark Stemm as libs owner/reviewer
mstemm Nov 11, 2021
f3f4182
fix(driver): properly support AF_UNIX abstract socket addresses; see …
FedeDP Sep 27, 2021
5e01756
fix(driver): properly update dest pointer upon unix_socket_path() call.
FedeDP Sep 27, 2021
cf2527e
fix(driver): improve unix_socket_path() API making it more robust.
FedeDP Sep 27, 2021
6e80503
fix(driver): use snprintf instead of strncpy.
FedeDP Sep 27, 2021
340be86
fix(libsinsp): correct `MINIMAL_BUILD` gate for docker
leogr Nov 12, 2021
580adee
new(driver): correctly use WEXITSTATUS set of macros to retrieve proc…
FedeDP Nov 11, 2021
2258aba
fix(driver): retain backward compatibility and add a new "ret" parame…
FedeDP Nov 12, 2021
96320d1
update(driver): Add openat2 syscall
jasondellaluce Sep 9, 2021
17e55b2
fix(driver): fix driver issues for openat2
jasondellaluce Sep 10, 2021
1ed3e2a
update(driver): minor changes on openat2 support
jasondellaluce Sep 14, 2021
941b051
fix(driver/bpf): use bpf_ktime_get_boot_ns() where available to fix e…
FedeDP Oct 13, 2021
89e4b20
update(userspace/libscap): updated libscap bpf compat header.
FedeDP Oct 13, 2021
aaea60e
feat(userspace/libscap): properly freeze eBPF const maps after creati…
FedeDP Oct 13, 2021
96e6208
Restore back local "bpf_common.h"
FedeDP Oct 26, 2021
86b931d
cleanup(libsinsp): add ipaddr and ipnet, prevent assert in debug mode
LucaGuerra Aug 25, 2021
ad595e5
new(sinsp): add description field to field classes
LucaGuerra Aug 25, 2021
5d7d9b1
new(libsinsp): add description strings for filter checks
LucaGuerra Aug 25, 2021
4b12f65
change display order for filters
LucaGuerra Aug 25, 2021
c93acc5
new(libsinsp): change markdown format, introduce markdown for events
LucaGuerra Aug 25, 2021
3923969
cleanup(libsinsp): md format cleanup
LucaGuerra Aug 26, 2021
7906f7e
fix(build): switch gtest to use main branch instead of master.
FedeDP Nov 16, 2021
a358c86
fix(userspace/libsinsp): split get_all_data() function in secure() an…
FedeDP Sep 29, 2021
80ed029
fix(build): bump openssl version back to 1.1.1k.
FedeDP Oct 4, 2021
00513d0
fix(build): updated openssl to 1.1.1l.
FedeDP Oct 4, 2021
4681c38
update(userspace/libsinsp): fixed spacing.
FedeDP Oct 7, 2021
fe4bb4a
update(userspace/libsinsp): fixed spacing.
FedeDP Oct 7, 2021
824747a
update(build): define OPENSSL_LIBRARIES even when built with bundled …
FedeDP Nov 11, 2021
c48853e
fix(build): avoid quotation marks.
FedeDP Nov 11, 2021
c5a8d93
update(userspace/libsinsp): refactored get_all_data().
FedeDP Nov 11, 2021
e586e82
update(build): updated luajit to v2.1.0-beta3.
FedeDP Nov 15, 2021
4f320f3
update(build): updated luaJIT to most recent version.
FedeDP Nov 16, 2021
2c4f5f4
chore(userspace/libscap): applying patch from Falco
leogr May 11, 2021
0b30d1e
update(userspace/libscap): make probe naming more configurable, set d…
leogr May 11, 2021
3d3445e
update: rename project to "falcosecurity-libs"
leogr May 11, 2021
dfd4f8b
fix(userspace/libscap): correct SCAP_HOST_ROOT_ENV_VAR_NAME defalt value
leogr Jul 1, 2021
081f4b8
build(userspace/libscap): `SCAP_BPF_PROBE_ENV_VAR_NAME` cmake var
leogr Jul 1, 2021
9c54226
chore(userspace/libscap): generate module name from `PROBE_NAME`
leogr Jul 1, 2021
740f365
build(userspace/libscap): `PROBE_BPF_FILEPATH` cmake var
leogr Jul 1, 2021
06b36b7
docs(userspace/libsinsp): update doxygen headers
leogr Jul 22, 2021
9f6b4f2
chore(userspace): clean up comments
leogr Jul 22, 2021
d3a3d5b
build: correct driver package name
leogr Nov 15, 2021
a743aa4
refactor: correct var naming
leogr Nov 15, 2021
44a457d
Define __STDC_FORMAT_MACROS for inttypes.h (older g++)
mstemm Nov 18, 2021
de277bb
fix(build): Use correct package name in DKMS config file
gnosek Nov 18, 2021
99e9a3b
fix(driver): small fix for eBPF probe on amznlinux2 kernels.
FedeDP Nov 19, 2021
a89234b
fix(build): update grpc cmake module to use find_package() when build…
FedeDP Nov 23, 2021
c489384
update(build): fallback to manually find libraries when grpc config c…
FedeDP Nov 24, 2021
d1a2dd9
Update cmake/modules/grpc.cmake
FedeDP Nov 26, 2021
8808a06
fix(build): check GRPC_INCLUDE_IS_GRPCPP macro using GRPC_INCLUDE as …
FedeDP Nov 29, 2021
51403ef
fixes to make the libs compile on Mac
ldegio Nov 22, 2021
597cb94
when calling sinsp::get_thread_ref(), covert the return value from a …
ldegio Nov 24, 2021
41ae5b7
make sure curl is not used in the minimal build (it also needs to be …
ldegio Nov 26, 2021
c6cbde6
don't use the OS strlcpy on Mac
ldegio Nov 26, 2021
c432afa
cleanups
ldegio Nov 26, 2021
14e496c
apple check not needed when detecting strlcpy in the makefile
ldegio Nov 26, 2021
b0a30dc
cleanups
ldegio Nov 26, 2021
2160111
make sure curl is actually not include for minimal build
ldegio Nov 26, 2021
0fbdd13
fix(userspace/libscap): improve users loading code robustness: we nee…
FedeDP Sep 8, 2021
8a1db1f
repo(.gitignore): updated gitignore adding .idea folder (for CLion us…
FedeDP Sep 8, 2021
c954cc3
refactor(userspace/libsinsp): added a sinsp::get_group() api, similar…
FedeDP Sep 8, 2021
f522165
fix(userspace/libsinsp): added back assert() that was removed last co…
FedeDP Sep 8, 2021
3ee8453
update(userspace/libscap, userspace/libsinsp): addressed review comme…
FedeDP Nov 29, 2021
3cc178e
Make the `scap-driver` component name configurable
gnosek Dec 13, 2021
b573c6e
Updated protobuf version for s390x
dandotimujahid Nov 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt)
" 4. Run cmake from the build directory. ex: cmake ..\n"
" 5. Run make from the build directory. ex: make\n"
"Full paste-able example:\n"
"( rm -f CMakeCache.txt; mkdir build; cd build; cmake ..; make )\n"
"The following wiki page has more information on manually building sysdig: http://bit.ly/1oJ84UI")
"( rm -f CMakeCache.txt; mkdir build; cd build; cmake ..; make )")
endif()

cmake_minimum_required(VERSION 2.8.2)

project(sysdig)
project(falcosecurity-libs)

option(MINIMAL_BUILD "Produce a minimal build with only the essential features (no eBPF probe driver, no kubernetes, no mesos, no marathon and no container metadata)" OFF)
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
Expand All @@ -42,15 +41,24 @@ option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

if(NOT DEFINED SYSDIG_VERSION)
set(SYSDIG_VERSION "0.1.1dev")
if(NOT DEFINED FALCOSECURITY_LIBS_VERSION)
set(FALCOSECURITY_LIBS_VERSION "0.1.1dev")
endif()

if(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
endif()

set(PACKAGE_NAME "sysdig")
set(DRIVER_PACKAGE_NAME "scap")

include(CheckSymbolExists)
check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
if(HAVE_STRLCPY)
message(STATUS "Existing strlcpy found, will *not* use local definition by setting -DHAVE_STRLCPY.")
add_definitions(-DHAVE_STRLCPY)
else()
message(STATUS "No strlcpy found, will use local definition")
endif()

include(CompilerFlags)

Expand All @@ -69,3 +77,4 @@ if(CREATE_TEST_TARGETS AND NOT WIN32)
COMMAND ${CMAKE_MAKE_PROGRAM} run-unit-test-libsinsp
)
endif()

4 changes: 3 additions & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ approvers:
- leogr
- gnosek
- ldegio
- mstemm
reviewers:
- fntlnz
- leodido
- leogr
- gnosek
- ldegio
- ldegio
- mstemm
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# falcosecurity/libs

As per the [OSS Libraries Contribution Plan](https://github.com/falcosecurity/falco/blob/master/proposals/2021019-libraries-donation.md), this repository has been chosen to be the new home for **libsinsp**, **libscap**, the **kernel module driver** and the **eBPF driver sources**.
As per the [OSS Libraries Contribution Plan](https://github.com/falcosecurity/falco/blob/master/proposals/20210119-libraries-contribution.md), this repository has been chosen to be the new home for **libsinsp**, **libscap**, the **kernel module driver** and the **eBPF driver sources**.
42 changes: 21 additions & 21 deletions cmake/modules/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ endif()

if(NOT WIN32)

set(SYSDIG_COMMON_FLAGS "-Wall -ggdb")
set(SYSDIG_DEBUG_FLAGS "-D_DEBUG")
set(SYSDIG_RELEASE_FLAGS "-O3 -fno-strict-aliasing -DNDEBUG")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "-Wall -ggdb")
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "-D_DEBUG")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "-O3 -fno-strict-aliasing -DNDEBUG")

if(MINIMAL_BUILD)
set(SYSDIG_COMMON_FLAGS "${SYSDIG_COMMON_FLAGS} -DMINIMAL_BUILD")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -DMINIMAL_BUILD")
endif()

if(MUSL_OPTIMIZED_BUILD)
set(SYSDIG_COMMON_FLAGS "${SYSDIG_COMMON_FLAGS} -static -Os")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -static -Os")
endif()

if(BUILD_WARNINGS_AS_ERRORS)
set(CMAKE_SUPPRESSED_WARNINGS "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-implicit-fallthrough -Wno-format-truncation")
set(SYSDIG_COMMON_FLAGS "${SYSDIG_COMMON_FLAGS} -Wextra -Werror ${CMAKE_SUPPRESSED_WARNINGS}")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS} -Wextra -Werror ${CMAKE_SUPPRESSED_WARNINGS}")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SYSDIG_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SYSDIG_COMMON_FLAGS} -std=c++0x")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FALCOSECURITY_LIBS_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FALCOSECURITY_LIBS_COMMON_FLAGS} -std=c++0x")

set(CMAKE_C_FLAGS_DEBUG "${SYSDIG_DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${SYSDIG_DEBUG_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${FALCOSECURITY_LIBS_DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${FALCOSECURITY_LIBS_DEBUG_FLAGS}")

set(CMAKE_C_FLAGS_RELEASE "${SYSDIG_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${SYSDIG_RELEASE_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DHAS_CAPTURE)
Expand All @@ -41,18 +41,18 @@ if(NOT WIN32)
else()
set(MINIMAL_BUILD ON)

set(SYSDIG_COMMON_FLAGS "-D_CRT_SECURE_NO_WARNINGS -DWIN32 -DMINIMAL_BUILD /EHsc /W3 /Zi")
set(SYSDIG_DEBUG_FLAGS "/MTd /Od")
set(SYSDIG_RELEASE_FLAGS "/MT")
set(FALCOSECURITY_LIBS_COMMON_FLAGS "-D_CRT_SECURE_NO_WARNINGS -DWIN32 -DMINIMAL_BUILD /EHsc /W3 /Zi")
set(FALCOSECURITY_LIBS_DEBUG_FLAGS "/MTd /Od")
set(FALCOSECURITY_LIBS_RELEASE_FLAGS "/MT")

set(CMAKE_C_FLAGS "${SYSDIG_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${SYSDIG_COMMON_FLAGS}")
set(CMAKE_C_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${FALCOSECURITY_LIBS_COMMON_FLAGS}")

set(CMAKE_C_FLAGS_DEBUG "${SYSDIG_DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${SYSDIG_DEBUG_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${FALCOSECURITY_LIBS_DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${FALCOSECURITY_LIBS_DEBUG_FLAGS}")

set(CMAKE_C_FLAGS_RELEASE "${SYSDIG_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${SYSDIG_RELEASE_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${FALCOSECURITY_LIBS_RELEASE_FLAGS}")

add_definitions(-DHAS_CAPTURE)

Expand Down
71 changes: 48 additions & 23 deletions cmake/modules/grpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,55 @@ option(USE_BUNDLED_GRPC "Enable building of the bundled grpc" ${USE_BUNDLED_DEPS
if(GRPC_INCLUDE)
# we already have grpc
elseif(NOT USE_BUNDLED_GRPC)
find_library(GPR_LIB NAMES gpr)
if(GPR_LIB)
message(STATUS "Found gpr lib: ${GPR_LIB}")
else()
message(FATAL_ERROR "Couldn't find system gpr")
endif()
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h)
if(GRPCXX_INCLUDE)
set(GRPC_INCLUDE ${GRPCXX_INCLUDE})
else()
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h)
set(GRPC_INCLUDE ${GRPCPP_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
find_library(GRPC_LIB NAMES grpc)
find_library(GRPCPP_LIB NAMES grpc++)
if(GRPC_INCLUDE AND GRPC_LIB AND GRPCPP_LIB)
message(STATUS "Found grpc: include: ${GRPC_INCLUDE}, C lib: ${GRPC_LIB}, C++ lib: ${GRPCPP_LIB}")
# gRPC
find_package(gRPC CONFIG)
if(gRPC_FOUND)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(GPR_LIB gRPC::gpr)
set(GRPC_LIB gRPC::grpc)
set(GRPCPP_LIB gRPC::grpc++)

# gRPC C++ plugin
get_target_property(GRPC_CPP_PLUGIN gRPC::grpc_cpp_plugin LOCATION)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()

# gRPC include dir + properly handle grpc{++,pp}
get_target_property(GRPC_INCLUDE gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES)
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h PATHS ${GRPC_INCLUDE})
if(NOT GRPCXX_INCLUDE)
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h PATHS ${GRPC_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
else()
message(FATAL_ERROR "Couldn't find system grpc")
endif()
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
# Fallback to manually find libraries;
# Some distro, namely Ubuntu focal, do not install gRPC config cmake module
find_library(GPR_LIB NAMES gpr)
if(GPR_LIB)
message(STATUS "Found gpr lib: ${GPR_LIB}")
else()
message(FATAL_ERROR "Couldn't find system gpr")
endif()
find_path(GRPCXX_INCLUDE NAMES grpc++/grpc++.h)
if(GRPCXX_INCLUDE)
set(GRPC_INCLUDE ${GRPCXX_INCLUDE})
else()
find_path(GRPCPP_INCLUDE NAMES grpcpp/grpcpp.h)
set(GRPC_INCLUDE ${GRPCPP_INCLUDE})
add_definitions(-DGRPC_INCLUDE_IS_GRPCPP=1)
endif()
find_library(GRPC_LIB NAMES grpc)
find_library(GRPCPP_LIB NAMES grpc++)
if(GRPC_INCLUDE AND GRPC_LIB AND GRPCPP_LIB)
message(STATUS "Found grpc: include: ${GRPC_INCLUDE}, C lib: ${GRPC_LIB}, C++ lib: ${GRPCPP_LIB}")
else()
message(FATAL_ERROR "Couldn't find system grpc")
endif()
find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
if(NOT GRPC_CPP_PLUGIN)
message(FATAL_ERROR "System grpc_cpp_plugin not found")
endif()
endif()
else()
include(cares)
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ elseif(NOT USE_BUNDLED_GTEST)
message(FATAL_ERROR "Couldn't find system gtest")
endif()
else()
# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project
# https://github.com/google/googletest/tree/main/googletest#incorporating-into-an-existing-cmake-project
# Download and unpack googletest at configure time
configure_file(CMakeListsGtestInclude.cmake ${PROJECT_BINARY_DIR}/googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
Expand Down
25 changes: 21 additions & 4 deletions cmake/modules/libsinsp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system

option(WITH_CHISEL "Include chisel implementation" OFF)

if(DEFINED LIBSINSP_USER_AGENT)
add_definitions(-DLIBSINSP_USER_AGENT="${LIBSINSP_USER_AGENT}")
endif()

include(ExternalProject)
include(libscap)
if(NOT WIN32)
include(tbb)
endif()
if(NOT WIN32 AND NOT APPLE)
include(b64)
include(jq)
endif()
if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD)
include(curl)
endif()
include(jsoncpp)
if(NOT MINIMAL_BUILD)
include(cares)
Expand All @@ -29,10 +38,6 @@ endif()
if(NOT WIN32)
get_filename_component(TBB_ABSOLUTE_INCLUDE_DIR ${TBB_INCLUDE_DIR} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${TBB_ABSOLUTE_INCLUDE_DIR})
get_filename_component(B64_ABSOLUTE_INCLUDE_DIR ${B64_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${B64_ABSOLUTE_INCLUDE_DIR})
get_filename_component(JQ_ABSOLUTE_INCLUDE_DIR ${JQ_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JQ_ABSOLUTE_INCLUDE_DIR})
endif()

get_filename_component(JSONCPP_ABSOLUTE_INCLUDE_DIR ${JSONCPP_INCLUDE} ABSOLUTE)
Expand All @@ -42,6 +47,18 @@ if(NOT MINIMAL_BUILD)
list(APPEND LIBSINSP_INCLUDE_DIRS ${CARES_ABSOLUTE_INCLUDE_DIR})
endif()

if(NOT WIN32 AND NOT APPLE)
get_filename_component(B64_ABSOLUTE_INCLUDE_DIR ${B64_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${B64_ABSOLUTE_INCLUDE_DIR})
get_filename_component(JQ_ABSOLUTE_INCLUDE_DIR ${JQ_INCLUDE} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${JQ_ABSOLUTE_INCLUDE_DIR})
endif()

if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD)
get_filename_component(CURL_ABSOLUTE_INCLUDE_DIR ${CURL_INCLUDE_DIR} ABSOLUTE)
list(APPEND LIBSINSP_INCLUDE_DIRS ${CURL_ABSOLUTE_INCLUDE_DIR})
endif()

add_subdirectory(${LIBSINSP_DIR}/userspace/libsinsp ${CMAKE_BINARY_DIR}/libsinsp)

endif()
20 changes: 14 additions & 6 deletions cmake/modules/luajit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ else()
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
GIT_REPOSITORY "https://github.com/moonjit/moonjit"
GIT_TAG "2.1.2"
PATCH_COMMAND sed -i "s/luaL_reg/luaL_Reg/g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/chisel.cpp && sed -i "s/luaL_reg/luaL_Reg/g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/lua_parser.cpp && sed -i "s/luaL_getn/lua_objlen /g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/lua_parser_api.cpp
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
Expand All @@ -49,17 +48,26 @@ else()
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
GIT_REPOSITORY "https://github.com/linux-on-ibm-z/LuaJIT.git"
GIT_TAG "v2.1"
PATCH_COMMAND sed -i "s/luaL_reg/luaL_Reg/g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/chisel.cpp && sed -i "s/luaL_reg/luaL_Reg/g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/lua_parser.cpp && sed -i "s/luaL_getn/lua_objlen /g" ${PROJECT_SOURCE_DIR}/userspace/libsinsp/lua_parser_api.cpp
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
INSTALL_COMMAND "")
elseif(APPLE)
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.1.0-beta3.tar.gz"
URL_HASH "SHA256=409f7fe570d3c16558e594421c47bdd130238323c9d6fd6c83dedd2aaeb082a8"
CONFIGURE_COMMAND ""
BUILD_COMMAND make MACOSX_DEPLOYMENT_TARGET=10.14
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${LUAJIT_LIB}
INSTALL_COMMAND "")
else()
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.0.3.tar.gz"
URL_HASH "SHA256=8da3d984495a11ba1bce9a833ba60e18b532ca0641e7d90d97fafe85ff014baa"
GIT_REPOSITORY "https://github.com/LuaJIT/LuaJIT"
GIT_TAG "f3c856915b4ce7ccd24341e8ac73e8a9fd934171"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
Expand All @@ -69,8 +77,8 @@ else()
else()
ExternalProject_Add(luajit
PREFIX "${PROJECT_BINARY_DIR}/luajit-prefix"
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.0.3.tar.gz"
URL_HASH "SHA256=8da3d984495a11ba1bce9a833ba60e18b532ca0641e7d90d97fafe85ff014baa"
URL "https://github.com/LuaJIT/LuaJIT/archive/v2.1.0-beta3.tar.gz"
URL_HASH "SHA256=409f7fe570d3c16558e594421c47bdd130238323c9d6fd6c83dedd2aaeb082a8"
CONFIGURE_COMMAND ""
BUILD_COMMAND msvcbuild.bat
BUILD_BYPRODUCTS ${LUAJIT_LIB}
Expand Down
5 changes: 3 additions & 2 deletions cmake/modules/openssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ else()
set(OPENSSL_INCLUDE_DIR "${PROJECT_BINARY_DIR}/openssl-prefix/src/openssl/include")
set(OPENSSL_LIBRARY_SSL "${OPENSSL_INSTALL_DIR}/lib/libssl.a")
set(OPENSSL_LIBRARY_CRYPTO "${OPENSSL_INSTALL_DIR}/lib/libcrypto.a")
set(OPENSSL_LIBRARIES ${OPENSSL_LIBRARY_SSL} ${OPENSSL_LIBRARY_CRYPTO})

if(NOT TARGET openssl)
message(STATUS "Using bundled openssl in '${OPENSSL_BUNDLE_DIR}'")

ExternalProject_Add(openssl
PREFIX "${PROJECT_BINARY_DIR}/openssl-prefix"
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1k.tar.gz"
URL_HASH "SHA256=b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95"
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1l.tar.gz"
URL_HASH "SHA256=dac036669576e83e8523afdb3971582f8b5d33993a2d6a5af87daa035f529b4f"
CONFIGURE_COMMAND ./config no-shared --prefix=${OPENSSL_INSTALL_DIR}
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
Expand Down
38 changes: 11 additions & 27 deletions cmake/modules/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,17 @@ else()

if(NOT TARGET protobuf)
message(STATUS "Using bundled protobuf in '${PROTOBUF_SRC}'")
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "s390x")
ExternalProject_Add(protobuf
PREFIX "${PROJECT_BINARY_DIR}/protobuf-prefix"
DEPENDS openssl zlib
URL "http://download.sysdig.com/dependencies/protobuf-cpp-3.5.0.tar.gz"
URL_MD5 "e4ba8284a407712168593e79e6555eb2"
PATCH_COMMAND wget http://download.sysdig.com/dependencies/protobuf-3.5.0-s390x.patch && patch -p1 -i protobuf-3.5.0-s390x.patch
# TODO what if using system zlib?
CONFIGURE_COMMAND /usr/bin/env CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure --with-zlib --disable-shared --enable-static --prefix=${PROTOBUF_INSTALL_DIR}
COMMAND aclocal && automake
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${PROTOC} ${PROTOBUF_INCLUDE} ${PROTOBUF_LIB}
INSTALL_COMMAND make install)
else()
ExternalProject_Add(protobuf
PREFIX "${PROJECT_BINARY_DIR}/protobuf-prefix"
DEPENDS openssl zlib
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.tar.gz"
URL_HASH "SHA256=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb"
# TODO what if using system zlib?
CONFIGURE_COMMAND /usr/bin/env CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure --with-zlib --disable-shared --enable-static --prefix=${PROTOBUF_INSTALL_DIR}
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${PROTOC} ${PROTOBUF_INCLUDE} ${PROTOBUF_LIB}
INSTALL_COMMAND make install)
endif()
ExternalProject_Add(protobuf
PREFIX "${PROJECT_BINARY_DIR}/protobuf-prefix"
DEPENDS openssl zlib
URL "https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.tar.gz"
URL_HASH "SHA256=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb"
# TODO what if using system zlib?
CONFIGURE_COMMAND /usr/bin/env CPPFLAGS=-I${ZLIB_INCLUDE} LDFLAGS=-L${ZLIB_SRC} ./configure --with-zlib --disable-shared --enable-static --prefix=${PROTOBUF_INSTALL_DIR}
BUILD_COMMAND ${CMD_MAKE}
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS ${PROTOC} ${PROTOBUF_INCLUDE} ${PROTOBUF_LIB}
INSTALL_COMMAND make install)
endif()
endif()

Expand Down
Loading