summary refs log tree commit diff
path: root/gnu/packages/patches/sysdig-shared-falcosecurity-libs.patch
blob: 5d0fd4d1fb77882d058230ca2c9e27417b5d5bd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Upstream status: https://github.com/draios/sysdig/pull/2093

diff --git a/cmake/modules/falcosecurity-libs.cmake b/cmake/modules/falcosecurity-libs.cmake
index 7cee8a3c4..dd59c1b32 100644
--- a/cmake/modules/falcosecurity-libs.cmake
+++ b/cmake/modules/falcosecurity-libs.cmake
@@ -16,6 +16,19 @@
 # limitations under the License.
 #
 
+option(USE_BUNDLED_FALCOSECURITY_LIBS "Enable building of the bundled falcosecurity libraries" ${USE_BUNDLED_DEPS})
+
+if(NOT USE_BUNDLED_FALCOSECURITY_LIBS)
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(LIBSINSP REQUIRED IMPORTED_TARGET libsinsp)
+    message(STATUS "Found libsinsp:
+  include: ${LIBSINSP_INCLUDE_DIRS}
+  lib: ${LIBSINSP_LIBRARIES}
+  cflags: ${LIBSINSP_CFLAGS}")
+    return()
+endif()
+
+# else(): using bundled falcosecurity libs
 set(FALCOSECURITY_LIBS_CMAKE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/falcosecurity-libs-repo")
 set(FALCOSECURITY_LIBS_CMAKE_WORKING_DIR "${CMAKE_BINARY_DIR}/falcosecurity-libs-repo")
 
diff --git a/userspace/sysdig/CMakeLists.txt b/userspace/sysdig/CMakeLists.txt
index 60f8072ad..0cb179ccc 100644
--- a/userspace/sysdig/CMakeLists.txt
+++ b/userspace/sysdig/CMakeLists.txt
@@ -20,7 +20,6 @@ if(NOT WIN32)
 	include(ncurses)
 endif() # NOT WIN32
 
-include(zlib)
 include(luajit)
 
 include_directories("${PROJECT_BINARY_DIR}/userspace/sinspui")
@@ -84,6 +83,12 @@ if(USE_BUNDLED_DEPS)
 	add_dependencies(csysdig luajit)
 endif()
 
+if(USE_BUNDLED_FALCOSECURITY_LIBS)
+    set(SINSP_LIB sinsp)
+else()
+    set(SINSP_LIB PkgConfig::LIBSINSP)
+endif()
+
 target_include_directories(
 	sysdig
 	PUBLIC
@@ -108,7 +113,7 @@ if(NOT WIN32)
 	include_directories(${PROJECT_BINARY_DIR}/driver/src)
 
 	target_link_libraries(sysdig
-		sinsp
+		"${SINSP_LIB}"
 		"${LUAJIT_LIB}"
 		"${YAMLCPP_LIB}")
 
@@ -117,7 +122,7 @@ if(NOT WIN32)
 	endif()
 
 	target_link_libraries(csysdig
-		sinsp
+		"${SINSP_LIB}"
 		"${LUAJIT_LIB}"
 		"${CURSES_LIBRARIES}"
 		"${YAMLCPP_LIB}")
@@ -140,12 +145,12 @@ else()
 	add_definitions(-DNOCURSESUI)
 
 	target_link_libraries(sysdig
-		sinsp
+		"${SINSP_LIB}"
 		"${LUAJIT_LIB}"
 		"${YAMLCPP_LIB}")
 
 	target_link_libraries(csysdig
-		sinsp
+		"${SINSP_LIB}"
 		"${LUAJIT_LIB}"
 		"${YAMLCPP_LIB}")