Subject: [PATCH 1/2] gnu: falcosecurity-libs: Update to 0.20.0.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 23 Jan 2025 16:33:18 +0900

* gnu/packages/linux.scm (falcosecurity-libs): Update to 0.20.0.
[source]: Update patches and combine into a single one.
[native-inputs]: Replace clang (13) with clang-14.
[inputs]: Move libbpf and libelf to...
[propagated-inputs]: ... here.
* gnu/packages/patches/falcosecurity-libs-shared-build.patch: New file.
* gnu/packages/patches/falcosecurity-libs-install-pman.patch
* gnu/packages/patches/falcosecurity-libs-libscap-pc.patch
* gnu/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch
* gnu/packages/patches/falcosecurity-libs-pkg-config.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Update accordingly.

Change-Id: I58b5d207da27ab4f52556e5c804d8e545e7e3974
---
 gnu/local.mk                                  |   8 +-
 gnu/packages/linux.scm                        |  33 +--
 .../falcosecurity-libs-install-pman.patch     |  14 -
 .../falcosecurity-libs-libscap-pc.patch       |  16 -
 ...lcosecurity-libs-libsinsp-pkg-config.patch | 155 ----------
 .../falcosecurity-libs-pkg-config.patch       |  23 --
 .../falcosecurity-libs-shared-build.patch     | 280 ++++++++++++++++++
 ...alcosecurity-libs-shared-library-fix.patch |  50 ----
 8 files changed, 297 insertions(+), 282 deletions(-)
 delete mode 100644 gnu/packages/patches/falcosecurity-libs-install-pman.patch
 delete mode 100644 gnu/packages/patches/falcosecurity-libs-libscap-pc.patch
 delete mode 100644 gnu/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch
 delete mode 100644 gnu/packages/patches/falcosecurity-libs-pkg-config.patch
 create mode 100644 gnu/packages/patches/falcosecurity-libs-shared-build.patch
 delete mode 100644 gnu/packages/patches/falcosecurity-libs-shared-library-fix.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5091f93eb8..de2e42cd79 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -19,7 +19,7 @@
 # Copyright © 2018 Amirouche Boubekki <[email-masked]>
 # Copyright © 2018, 2019, 2020, 2021, 2022, 2024 Oleg Pykhalov <[email-masked]>
 # Copyright © 2018 Stefan Stefanović <[email-masked]>
-# Copyright © 2018, 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer <[email-masked]>
+# Copyright © 2018, 2020-2025 Maxim Cournoyer <[email-masked]>
 # Copyright © 2019, 2020, 2021, 2022, 2024 Guillaume Le Vaillant <[email-masked]>
 # Copyright © 2019, 2020 John Soo <[email-masked]>
 # Copyright © 2019 Jonathan Brielmaier <[email-masked]>
@@ -1252,11 +1252,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/fail2ban-python310-server-action.patch	\
   %D%/packages/patches/fail2ban-python310-server-actions.patch	\
   %D%/packages/patches/fail2ban-python310-server-jails.patch	\
-  %D%/packages/patches/falcosecurity-libs-install-pman.patch	\
-  %D%/packages/patches/falcosecurity-libs-libscap-pc.patch	\
-  %D%/packages/patches/falcosecurity-libs-pkg-config.patch	\
-  %D%/packages/patches/falcosecurity-libs-shared-library-fix.patch	\
-  %D%/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch	\
+  %D%/packages/patches/falcosecurity-libs-shared-build.patch	\
   %D%/packages/patches/farstream-gupnp.patch                         \
   %D%/packages/patches/farstream-make.patch                          \
   %D%/packages/patches/fastcap-mulGlobal.patch			\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 172797f97d..46be9f3a37 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -34,7 +34,7 @@
 ;;; Copyright © 2018 Vasile Dumitrascu <[email-masked]>
 ;;; Copyright © 2019 Tim Gesthuizen <[email-masked]>
 ;;; Copyright © 2019 mikadoZero <[email-masked]>
-;;; Copyright © 2019, 2020, 2021, 2022, 2023, 2024 Maxim Cournoyer <[email-masked]>
+;;; Copyright © 2019-2025 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2019 Stefan Stefanović <[email-masked]>
 ;;; Copyright © 2019-2022 Brice Waegeneire <[email-masked]>
 ;;; Copyright © 2019 Kei Kebreau <[email-masked]>
@@ -9884,7 +9884,7 @@ (define-public fakechroot
 (define-public falcosecurity-libs
   (package
     (name "falcosecurity-libs")
-    (version "0.16.0")
+    (version "0.20.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -9893,14 +9893,10 @@ (define-public falcosecurity-libs
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1vzymzkfipb3bnjjd9m8ykzj0l94fm8mnpcxfm8mpxz3jbd8xnv9"))
+                "041ir9wk44v7isidwl7fzxrjvs85j637wcr7xirasd8ysxa0r4qv"))
               (patches
                (search-patches
-                "falcosecurity-libs-pkg-config.patch"
-                "falcosecurity-libs-install-pman.patch"
-                "falcosecurity-libs-libscap-pc.patch"
-                "falcosecurity-libs-shared-library-fix.patch"
-                "falcosecurity-libs-libsinsp-pkg-config.patch"))))
+                "falcosecurity-libs-shared-build.patch"))))
     (build-system cmake-build-system)
     (arguments
      (list
@@ -9928,21 +9924,22 @@ (define-public falcosecurity-libs
             (lambda _
               (delete-file-recursively
                (string-append #$output "/src")))))))
-    (native-inputs (list bpftool
-                         clang
-                         googletest
-                         pkg-config
-                         valijson))     ;header-only library
+    (native-inputs
+     (list bpftool
+           clang-14                    ;avoid stack limit exceeded build error
+           googletest
+           pkg-config
+           valijson))                   ;header-only library
     (inputs
-     (list elfutils
-           libbpf
-           libelf))
+     (list elfutils))
     (propagated-inputs
-     ;; The following inputs are in the 'Requires' field of libscap.pc and
-     ;; libsinp.pc.
+     ;; The following inputs are in the 'Requires' field of libscap.pc,
+     ;; libsinp.pc or libpman.pc.
      (list c-ares
            grpc
            jsoncpp
+           libbpf
+           libelf
            openssl
            protobuf
            uthash                       ;included in libscap headers
diff --git a/gnu/packages/patches/falcosecurity-libs-install-pman.patch b/gnu/packages/patches/falcosecurity-libs-install-pman.patch
deleted file mode 100644
index 38dcc0c4b8..0000000000
--- a/gnu/packages/patches/falcosecurity-libs-install-pman.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Install the pman library and its header.
-Upstream status: https://github.com/falcosecurity/libs/pull/1842
-
-diff --git a/userspace/libpman/CMakeLists.txt b/userspace/libpman/CMakeLists.txt
-index da92e9f27..4b57365fe 100644
---- a/userspace/libpman/CMakeLists.txt
-+++ b/userspace/libpman/CMakeLists.txt
-@@ -58,3 +58,6 @@ endif()
- if(USE_BUNDLED_LIBBPF)
-     add_dependencies(pman libbpf)
- endif()
-+
-+install(TARGETS pman LIBRARY ARCHIVE FRAMEWORK)
-+install(FILES include/libpman.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/gnu/packages/patches/falcosecurity-libs-libscap-pc.patch b/gnu/packages/patches/falcosecurity-libs-libscap-pc.patch
deleted file mode 100644
index ff650942ff..0000000000
--- a/gnu/packages/patches/falcosecurity-libs-libscap-pc.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-libscap: Guard against install_lib_link_libraries-NOTFOUND.
-Upstream status: https://github.com/falcosecurity/libs/pull/1842
-
-diff --git a/cmake/modules/libscap.cmake b/cmake/modules/libscap.cmake
-index 81ad2d28d..8b6b4197e 100644
---- a/cmake/modules/libscap.cmake
-+++ b/cmake/modules/libscap.cmake
-@@ -95,7 +95,7 @@ foreach(libscap_install_lib ${LIBSCAP_INSTALL_LIBS})
- 	list(APPEND libscap_link_libraries ${libscap_install_lib})
- 	get_target_property(install_lib_link_libraries ${libscap_install_lib} LINK_LIBRARIES)
- 	foreach (install_lib_link_library ${install_lib_link_libraries})
--		if (NOT ${install_lib_link_library} IN_LIST libscap_subdir_targets)
-+		if (${install_lib_link_library} AND (NOT ${install_lib_link_library} IN_LIST libscap_subdir_targets))
- 			if(${install_lib_link_library} MATCHES "/")
- 				# We have a path. Convert it to -L<dir> + -l<lib>.
- 				get_filename_component(scap_lib_dir ${install_lib_link_library} DIRECTORY)
diff --git a/gnu/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch b/gnu/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch
deleted file mode 100644
index b2d38e42e0..0000000000
--- a/gnu/packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-libsinsp: Refine pkg-config file generation.
-Upstream status: https://github.com/falcosecurity/libs/pull/1842
-
-diff --git a/userspace/libscap/libscap.pc.in b/userspace/libscap/libscap.pc.in
-index c5948489f..829bcd19b 100644
---- a/userspace/libscap/libscap.pc.in
-+++ b/userspace/libscap/libscap.pc.in
-@@ -1,4 +1,4 @@
--prefix=${pcfiledir}/../..
-+prefix=@CMAKE_INSTALL_PREFIX@
- libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
- includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
- 
-@@ -6,5 +6,6 @@ Name: libscap
- Description: lib for System CAPture
- Version: @FALCOSECURITY_LIBS_VERSION@
- 
--Libs: -L${libdir} @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
-+Requires: zlib
-+Libs: -L${libdir} -L{libdir}/@LIBS_PACKAGE_NAME@/libscap @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
- Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libscap -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@ -I@UTHASH_INCLUDE@
-diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt
-index 6104603e8..832f86067 100644
---- a/userspace/libsinsp/CMakeLists.txt
-+++ b/userspace/libsinsp/CMakeLists.txt
-@@ -169,13 +169,9 @@ target_link_libraries(sinsp
- 			"${RE2_LIB}"
- )
- 
--set(SINSP_PKGCONFIG_LIBRARIES
--	scap
--	"${ZLIB_LIB}"
--	"${CURL_LIBRARIES}"
--	"${JSONCPP_LIB}"
--	"${RE2_LIB}"
--)
-+set(SINSP_PKGCONFIG_LIBRARIES)
-+set(SINSP_PKGCONFIG_REQUIRES jsoncpp)
-+set(SINSP_PKGCONFIG_REQUIRES_PRIVATE libcurl re2)
- 
- if(NOT EMSCRIPTEN)
- 	target_link_libraries(sinsp
-@@ -184,7 +180,8 @@ if(NOT EMSCRIPTEN)
- 		PRIVATE
- 		"${TBB_LIB}"
- 	)
--	list(APPEND SINSP_PKGCONFIG_LIBRARIES "${CARES_LIB}")
-+	list(APPEND SINSP_PKGCONFIG_REQUIRES libcares)
-+	list(APPEND SINSP_PKGCONFIG_REQUIRES_PRIVATE tbb)
- endif()
- 
- if(USE_BUNDLED_VALIJSON)
-@@ -248,14 +245,12 @@ if(NOT WIN32)
- 						"${PROTOBUF_LIB}"
- 						"${CARES_LIB}"
- 			)
--			list(APPEND SINSP_PKGCONFIG_LIBRARIES
--						"${GRPC_LIBRARIES}"
--						"${GRPCPP_LIB}"
--						"${GRPC_LIB}"
--						"${GPR_LIB}"
--						"${PROTOBUF_LIB}"
--						"${CARES_LIB}"
--			)
-+			list(APPEND SINSP_PKGCONFIG_REQUIRES
-+				gpr
-+				grpc
-+				grpc++
-+				protobuf
-+				libcares)
- 
- 			if(NOT MUSL_OPTIMIZED_BUILD)
- 				target_link_libraries(sinsp INTERFACE rt anl)
-@@ -269,7 +264,7 @@ if(NOT WIN32)
- 	endif() # NOT APPLE
- 
- 	target_link_libraries(sinsp INTERFACE "${OPENSSL_LIBRARIES}")
--	list(APPEND SINSP_PKGCONFIG_LIBRARIES "${OPENSSL_LIBRARIES}")
-+	list(APPEND SINSP_PKGCONFIG_REQUIRES libcrypto libssl)
- 
- 	target_link_libraries(sinsp INTERFACE dl pthread)
- 	list(APPEND SINSP_PKGCONFIG_LIBRARIES dl pthread)
-@@ -306,41 +301,17 @@ if(NOT DEFINED SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR)
- endif()
- add_definitions(-DSINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR="${SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR}")
- 
--# Build our pkg-config "Libs:" flags. For now, loop over SINSP_PKGCONFIG_LIBRARIES. If
--# we ever start using pkg_search_module or pkg_check_modules in cmake/modules
--# we could add each module to our "Requires:" line instead. We might need to
--# expand this to use some of the techniques in
--# https://github.com/curl/curl/blob/curl-7_84_0/CMakeLists.txt#L1539
--set(SINSP_PKG_CONFIG_LIBS)
--set(SINSP_PKG_CONFIG_LIBDIRS "")
--foreach(sinsp_lib ${SINSP_PKGCONFIG_LIBRARIES})
--	if(${sinsp_lib} MATCHES "^-")
--		# We have a flag. Pass it through unchanged.
--		list(APPEND SINSP_PKG_CONFIG_LIBS ${sinsp_lib})
--	elseif(${sinsp_lib} MATCHES "/")
--		# We have a path. Convert it to -L<dir> + -l<lib>.
--		get_filename_component(sinsp_lib_dir ${sinsp_lib} DIRECTORY)
--		list(APPEND SINSP_PKG_CONFIG_LIBDIRS -L${sinsp_lib_dir})
--		get_filename_component(sinsp_lib_base ${sinsp_lib} NAME_WE)
--		string(REGEX REPLACE "^lib" "" sinsp_lib_base ${sinsp_lib_base})
--		list(APPEND SINSP_PKG_CONFIG_LIBS -l${sinsp_lib_base})
--	elseif(${sinsp_lib} STREQUAL "scap")
--		# We require libscap.pc, so skip it.
--	else()
--		# Assume we have a plain library name. Prefix it with "-l".
--		list(APPEND SINSP_PKG_CONFIG_LIBS -l${sinsp_lib})
--	endif()
--endforeach()
-+list(REMOVE_DUPLICATES SINSP_PKGCONFIG_LIBRARIES)
-+list(REMOVE_DUPLICATES SINSP_PKGCONFIG_REQUIRES)
-+list(REMOVE_DUPLICATES SINSP_PKGCONFIG_REQUIRES_PRIVATE)
- 
--# Build our pkg-config "Cflags:" flags.
--set(SINSP_PKG_CONFIG_INCLUDES "")
--foreach(sinsp_include_directory ${LIBSINSP_INCLUDE_DIRS})
--	list(APPEND SINSP_PKG_CONFIG_INCLUDES -I${sinsp_include_directory})
-+set(SINSP_LINK_FLAGS)
-+foreach(sinsp_link_library ${SINSP_PKGCONFIG_LIBRARIES})
-+	list(APPEND SINSP_LINK_FLAGS "-l${sinsp_link_library}")
- endforeach()
- 
--string(REPLACE ";" " " SINSP_PKG_CONFIG_LIBS "${SINSP_PKG_CONFIG_LIBS}")
--list(REMOVE_DUPLICATES SINSP_PKG_CONFIG_LIBDIRS)
--string(REPLACE ";" " " SINSP_PKG_CONFIG_LIBDIRS "${SINSP_PKG_CONFIG_LIBDIRS}")
--list(REMOVE_DUPLICATES SINSP_PKG_CONFIG_INCLUDES)
--string(REPLACE ";" " " SINSP_PKG_CONFIG_INCLUDES "${SINSP_PKG_CONFIG_INCLUDES}")
-+string(REPLACE ";" " " LIBSINSP_LINK_FLAGS "${SINSP_LINK_FLAGS}")
-+string(REPLACE ";" " " LIBSINSP_REQUIRES "${SINSP_PKGCONFIG_REQUIRES}")
-+string(REPLACE ";" " " LIBSINSP_REQUIRES_PRIVATE "${SINSP_PKGCONFIG_REQUIRES_PRIVATE}")
-+
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libsinsp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libsinsp.pc @ONLY)
-diff --git a/userspace/libsinsp/libsinsp.pc.in b/userspace/libsinsp/libsinsp.pc.in
-index 9292e73ce..f20da76b3 100644
---- a/userspace/libsinsp/libsinsp.pc.in
-+++ b/userspace/libsinsp/libsinsp.pc.in
-@@ -1,4 +1,4 @@
--prefix=${pcfiledir}/../..
-+prefix=@CMAKE_INSTALL_PREFIX@
- libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
- includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
- 
-@@ -6,6 +6,7 @@ Name: libsinsp
- Description: lib for System INSPection
- Version: @FALCOSECURITY_LIBS_VERSION@
- 
--Requires: libscap
--Libs: -L${libdir} -lsinsp @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
--Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libsinsp -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@ @SINSP_PKG_CONFIG_INCLUDES@
-+Requires: libscap @LIBSINSP_REQUIRES@
-+Requires.private: @LIBSINSP_REQUIRES_PRIVATE@
-+Libs: -L${libdir} -lsinsp @LIBSINSP_LINK_FLAGS@
-+Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libsinsp -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@
diff --git a/gnu/packages/patches/falcosecurity-libs-pkg-config.patch b/gnu/packages/patches/falcosecurity-libs-pkg-config.patch
deleted file mode 100644
index f686cec3f7..0000000000
--- a/gnu/packages/patches/falcosecurity-libs-pkg-config.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-userspace: Extend CFLAGS of libscap.pc and libsinsp.pc.
-Upstream status: https://github.com/falcosecurity/libs/pull/1842
-
-diff --git a/userspace/libscap/libscap.pc.in b/userspace/libscap/libscap.pc.in
-index 40b6e96ed..c5948489f 100644
---- a/userspace/libscap/libscap.pc.in
-+++ b/userspace/libscap/libscap.pc.in
-@@ -7,4 +7,4 @@ Description: lib for System CAPture
- Version: @FALCOSECURITY_LIBS_VERSION@
- 
- Libs: -L${libdir} @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
--Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libscap
-+Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libscap -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@ -I@UTHASH_INCLUDE@
-diff --git a/userspace/libsinsp/libsinsp.pc.in b/userspace/libsinsp/libsinsp.pc.in
-index c1cc4a1e2..9292e73ce 100644
---- a/userspace/libsinsp/libsinsp.pc.in
-+++ b/userspace/libsinsp/libsinsp.pc.in
-@@ -8,4 +8,4 @@ Version: @FALCOSECURITY_LIBS_VERSION@
- 
- Requires: libscap
- Libs: -L${libdir} -lsinsp @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
--Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libsinsp @SINSP_PKG_CONFIG_INCLUDES@
-+Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libsinsp -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@ @SINSP_PKG_CONFIG_INCLUDES@
diff --git a/gnu/packages/patches/falcosecurity-libs-shared-build.patch b/gnu/packages/patches/falcosecurity-libs-shared-build.patch
new file mode 100644
index 0000000000..08d547272c
--- /dev/null
+++ b/gnu/packages/patches/falcosecurity-libs-shared-build.patch
@@ -0,0 +1,280 @@
+Upstream-status: https://github.com/falcosecurity/libs/pull/1842
+
+diff --git a/cmake/modules/BuildPkgConfigDependencies.cmake b/cmake/modules/BuildPkgConfigDependencies.cmake
+index a597f18ac..2129bffac 100644
+--- a/cmake/modules/BuildPkgConfigDependencies.cmake
++++ b/cmake/modules/BuildPkgConfigDependencies.cmake
+@@ -3,6 +3,7 @@
+ # libsinsp.pc (which requires libscap.pc and pulls them in that way)
+ function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
+ 
++	message(DEBUG "[add_pkgconfig_library] processing lib \"${lib}\"")
+ 	# if it's not a target, it doesn't have dependencies we know or care about
+ 	if(NOT TARGET ${lib})
+ 		return()
+@@ -14,14 +15,25 @@ function(add_pkgconfig_library LIBDIRS_VAR LIBS_VAR lib ignored)
+ 		return()
+ 	endif()
+ 
++	message(DEBUG "[add_pkgconfig_library] LINK_LIBRARIES property: \"${PKGCONFIG_LIBRARIES}\"")
++
+ 	get_property(
+ 		target_type
+ 		TARGET ${lib}
+ 		PROPERTY TYPE
+ 	)
++	message(DEBUG "[add_pkgconfig_library] ignored list: \"${ignored}\"")
+ 	foreach(dep ${PKGCONFIG_LIBRARIES})
+-		# ignore dependencies in the list ${ignored}
+-		if(${dep} IN_LIST "${ignored}")
++		# XXX: We use a (very) loose match as we are potentially
++		# comparing absolute library file names (dep) to pkg-config
++		# library names to be ignored.  The only alternative I can
++		# think of would be to maintain a map associating pkg-config
++		# names to their library file name.
++		get_filename_component(dep_base ${dep} NAME_WE)
++		string(REGEX REPLACE "^lib" "" dep_name ${dep_base})
++		message(DEBUG "[add_pkgconfig_library] processing dep ${dep}")
++		if("${ignored}" MATCHES "${dep_name}")
++			message(DEBUG "[add_pkgconfig_library] \"${dep}\" ignored")
+ 			continue()
+ 		endif()
+ 
+diff --git a/cmake/modules/libscap.cmake b/cmake/modules/libscap.cmake
+index 346ac51b1..045a4564c 100644
+--- a/cmake/modules/libscap.cmake
++++ b/cmake/modules/libscap.cmake
+@@ -93,7 +93,11 @@ if(NOT HAVE_LIBSCAP)
+ 
+ 	set(libscap_link_flags)
+ 	set(libscap_link_libdirs "")
+-	add_pkgconfig_dependency(libscap_link_libdirs libscap_link_flags scap "")
++	add_pkgconfig_dependency(libscap_link_libdirs libscap_link_flags scap
++		# Avoid using these in libscap.pc Libs field, as they are
++		# already listed in Requires.  lbpf is transitively required
++		# via libpman.pc.
++		"jsoncpp;libelf;libpman;protobuf;zlib")
+ 
+ 	string(REPLACE ";" " " LIBSCAP_LINK_LIBRARIES_FLAGS "${libscap_link_flags}")
+ 	string(REPLACE ";" " " LIBSCAP_LINK_LIBDIRS_FLAGS "${libscap_link_libdirs}")
+diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt
+index 94f37ee2a..fc844da7b 100644
+--- a/driver/CMakeLists.txt
++++ b/driver/CMakeLists.txt
+@@ -158,6 +158,11 @@ set(DRIVER_SOURCES
+ 	ppm_consumer.h
+ 	capture_macro.h
+ 	socketcall_to_syscall.h
++	syscall_compat_loongarch64.h
++	syscall_compat_ppc64le.h
++	syscall_compat_riscv64.h
++	syscall_compat_s390x.h
++	syscall_compat_x86_64.h
+ 	syscall_ia32_64_map.c
+ )
+ 
+diff --git a/test/libscap/CMakeLists.txt b/test/libscap/CMakeLists.txt
+index ebac7e968..eeb99ca2f 100644
+--- a/test/libscap/CMakeLists.txt
++++ b/test/libscap/CMakeLists.txt
+@@ -39,7 +39,13 @@ set(LIBSCAP_TESTS_INCLUDE
+ # Needed by gtest
+ find_package(Threads)
+ 
+-set(LIBSCAP_TESTS_LIBRARIES "${GTEST_LIB}" "${GTEST_MAIN_LIB}" "${CMAKE_THREAD_LIBS_INIT}" scap)
++set(LIBSCAP_TESTS_LIBRARIES
++	"${GTEST_LIB}"
++	"${GTEST_MAIN_LIB}"
++	"${CMAKE_THREAD_LIBS_INIT}"
++	"${PROTOBUF_LIB}"
++	scap
++)
+ 
+ set(LIBSCAP_TESTS_DEPENDENCIES gtest scap)
+ 
+diff --git a/userspace/libpman/CMakeLists.txt b/userspace/libpman/CMakeLists.txt
+index b5d982b0d..72b7ec2c1 100644
+--- a/userspace/libpman/CMakeLists.txt
++++ b/userspace/libpman/CMakeLists.txt
+@@ -53,3 +53,11 @@ install(
+ 			COMPONENT "scap"
+ 			OPTIONAL
+ )
++
++install(FILES include/libpman.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
++configure_file(
++	${CMAKE_CURRENT_SOURCE_DIR}/libpman.pc.in
++	${PROJECT_BINARY_DIR}/libpman.pc @ONLY)
++
++install(FILES ${PROJECT_BINARY_DIR}/libpman.pc
++	    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+diff --git a/userspace/libpman/libpman.pc.in b/userspace/libpman/libpman.pc.in
+new file mode 100644
+index 000000000..e5373e87d
+--- /dev/null
++++ b/userspace/libpman/libpman.pc.in
+@@ -0,0 +1,11 @@
++prefix=@CMAKE_INSTALL_PREFIX@
++libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
++includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
++
++Name: libpman
++Description: Utility library for BPF probes
++Version: @FALCOSECURITY_LIBS_VERSION@
++
++Requires: libbpf zlib
++Libs: -L${libdir} -lpman -lscap_event_schema -lscap_platform
++Cflags: -I${includedir}
+diff --git a/userspace/libscap/CMakeLists.txt b/userspace/libscap/CMakeLists.txt
+index 20ac14cdf..c92cf9021 100644
+--- a/userspace/libscap/CMakeLists.txt
++++ b/userspace/libscap/CMakeLists.txt
+@@ -90,8 +90,7 @@ target_include_directories(
+ 
+ target_link_libraries(scap PRIVATE scap_error "${ZLIB_LIB}")
+ 
+-add_library(
+-	scap_event_schema STATIC
++add_library(scap_event_schema
+ 	scap_event.c
+ 	ppm_sc_names.c
+ 	scap_print_event.c
+diff --git a/userspace/libscap/libscap.pc.in b/userspace/libscap/libscap.pc.in
+index 520020691..e5876b03c 100644
+--- a/userspace/libscap/libscap.pc.in
++++ b/userspace/libscap/libscap.pc.in
+@@ -1,4 +1,4 @@
+-prefix=${pcfiledir}/../..
++prefix=@CMAKE_INSTALL_PREFIX@
+ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@LIBS_PACKAGE_NAME@
+ 
+@@ -6,5 +6,10 @@ Name: libscap
+ Description: lib for System CAPture
+ Version: @FALCOSECURITY_LIBS_VERSION@
+ 
++# Note: jsoncpp and protobuf are required by scap_engine_gvisor, which
++# currently lacks its own pkg-config file.  Similarly, libelf is
++# required by scap_engine_bpf.
++Requires: jsoncpp libelf libpman protobuf
++Requires.private: zlib
+ Libs: -L${libdir} @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@
+-Cflags: -I${includedir}
++Cflags: -I${includedir} -I${includedir}/libscap -I${includedir}/driver -I@UTHASH_INCLUDE@
+diff --git a/userspace/libscap/linux/CMakeLists.txt b/userspace/libscap/linux/CMakeLists.txt
+index 435c8546c..4047d5430 100644
+--- a/userspace/libscap/linux/CMakeLists.txt
++++ b/userspace/libscap/linux/CMakeLists.txt
+@@ -12,8 +12,7 @@
+ # or implied. See the License for the specific language governing permissions and limitations under
+ # the License.
+ #
+-add_library(
+-	scap_platform STATIC
++add_library(scap_platform
+ 	scap_linux_platform.c
+ 	scap_linux_hostinfo_platform.c
+ 	scap_procs.c
+diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt
+index f58b00962..2f963d448 100644
+--- a/userspace/libsinsp/CMakeLists.txt
++++ b/userspace/libsinsp/CMakeLists.txt
+@@ -177,12 +177,17 @@ target_link_libraries(
+ 	PRIVATE "${CURL_LIBRARIES}" "${JSONCPP_LIB}" "${RE2_LIB}"
+ )
+ 
++set(SINSP_PKGCONFIG_REQUIRES jsoncpp)
++set(SINSP_PKGCONFIG_REQUIRES_PRIVATE libcurl re2)
++
+ if(NOT EMSCRIPTEN)
+ 	target_link_libraries(
+ 		sinsp
+ 		INTERFACE "${CARES_LIB}"
+ 		PRIVATE "${TBB_LIB}"
+ 	)
++	list(APPEND SINSP_PKGCONFIG_REQUIRES libcares)
++	list(APPEND SINSP_PKGCONFIG_REQUIRES_PRIVATE tbb)
+ endif()
+ 
+ if(USE_BUNDLED_VALIJSON)
+@@ -275,6 +280,12 @@ if(NOT WIN32)
+ 			)
+ 
+ 			target_link_libraries(sinsp PRIVATE cri_v1alpha2 cri_v1 containerd_interface)
++			list(APPEND SINSP_PKGCONFIG_REQUIRES
++				gpr
++				grpc
++				grpc++
++				protobuf
++				libcares)
+ 
+ 			if(NOT MUSL_OPTIMIZED_BUILD)
+ 				find_library(LIB_ANL anl)
+@@ -290,6 +301,8 @@ if(NOT WIN32)
+ 		endif() # NOT MINIMAL_BUILD
+ 	endif() # NOT APPLE
+ 
++	list(APPEND SINSP_PKGCONFIG_REQUIRES libcrypto libssl)
++
+ 	target_link_libraries(sinsp INTERFACE dl pthread)
+ 
+ 	if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+@@ -329,7 +342,8 @@ add_definitions(-DSINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR="${SINSP_AGENT_CGROUP_MEM_
+ # https://github.com/curl/curl/blob/curl-7_84_0/CMakeLists.txt#L1539
+ set(SINSP_PKG_CONFIG_LIBS)
+ set(SINSP_PKG_CONFIG_LIBDIRS "")
+-add_pkgconfig_dependency(SINSP_PKG_CONFIG_LIBDIRS SINSP_PKG_CONFIG_LIBS sinsp scap)
++add_pkgconfig_dependency(SINSP_PKG_CONFIG_LIBDIRS SINSP_PKG_CONFIG_LIBS sinsp
++	"scap;${SINSP_PKGCONFIG_REQUIRES};${SINSP_PKGCONFIG_REQUIRES_PRIVATE}")
+ 
+ # Build our pkg-config "Cflags:" flags.
+ set(SINSP_PKG_CONFIG_INCLUDES "")
+@@ -337,6 +351,8 @@ foreach(sinsp_include_directory ${LIBSINSP_INCLUDE_DIRS})
+ 	list(APPEND SINSP_PKG_CONFIG_INCLUDES -I${sinsp_include_directory})
+ endforeach()
+ 
++string(REPLACE ";" " " LIBSINSP_REQUIRES "${SINSP_PKGCONFIG_REQUIRES}")
++string(REPLACE ";" " " LIBSINSP_REQUIRES_PRIVATE "${SINSP_PKGCONFIG_REQUIRES_PRIVATE}")
+ string(REPLACE ";" " " SINSP_PKG_CONFIG_LIBS "${SINSP_PKG_CONFIG_LIBS}")
+ list(REMOVE_DUPLICATES SINSP_PKG_CONFIG_LIBDIRS)
+ string(REPLACE ";" " " SINSP_PKG_CONFIG_LIBDIRS "${SINSP_PKG_CONFIG_LIBDIRS}")
+diff --git a/userspace/libsinsp/libsinsp.pc.in b/userspace/libsinsp/libsinsp.pc.in
+index 38e8e4e0d..9ab103ee1 100644
+--- a/userspace/libsinsp/libsinsp.pc.in
++++ b/userspace/libsinsp/libsinsp.pc.in
+@@ -1,4 +1,4 @@
+-prefix=${pcfiledir}/../..
++prefix=@CMAKE_INSTALL_PREFIX@
+ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@LIBS_PACKAGE_NAME@
+ 
+@@ -6,6 +6,7 @@ Name: libsinsp
+ Description: lib for System INSPection
+ Version: @FALCOSECURITY_LIBS_VERSION@
+ 
+-Requires: libscap
+-Libs: -L${libdir} -lsinsp @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
+-Cflags: -I${includedir} @SINSP_PKG_CONFIG_INCLUDES@
++Requires: libscap @LIBSINSP_REQUIRES@
++Requires.private: @LIBSINSP_REQUIRES_PRIVATE@
++Libs: -L${libdir} @SINSP_PKG_CONFIG_LIBDIRS@ @SINSP_PKG_CONFIG_LIBS@
++Cflags: -I${includedir} -I${includedir}/libsinsp -I${includedir}/driver @SINSP_PKG_CONFIG_INCLUDES@
+diff --git a/userspace/libsinsp/test/CMakeLists.txt b/userspace/libsinsp/test/CMakeLists.txt
+index fb8c46754..be6420672 100644
+--- a/userspace/libsinsp/test/CMakeLists.txt
++++ b/userspace/libsinsp/test/CMakeLists.txt
+@@ -191,7 +191,13 @@ target_include_directories(
+ )
+ 
+ target_link_libraries(
+-	unit-test-libsinsp sinsp "${GTEST_LIB}" "${GTEST_MAIN_LIB}" "${TBB_LIB}" "${JSONCPP_LIB}"
++	unit-test-libsinsp
++	sinsp
++	"${GRPCPP_LIB}"
++	"${GTEST_LIB}"
++	"${GTEST_MAIN_LIB}"
++	"${TBB_LIB}"
++	"${JSONCPP_LIB}"
+ )
+ 
+ # Add some additional include directories associated with `ADDITIONAL_SINSP_TESTS_SUITE`
diff --git a/gnu/packages/patches/falcosecurity-libs-shared-library-fix.patch b/gnu/packages/patches/falcosecurity-libs-shared-library-fix.patch
deleted file mode 100644
index 3334a89516..0000000000
--- a/gnu/packages/patches/falcosecurity-libs-shared-library-fix.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Fix shared library build.
-Upstream status: https://github.com/falcosecurity/libs/pull/1842
-
-diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt
-index 80229cc03..70c9ba65b 100644
---- a/driver/CMakeLists.txt
-+++ b/driver/CMakeLists.txt
-@@ -152,6 +152,11 @@ set(DRIVER_SOURCES
- 	ppm_consumer.h
- 	capture_macro.h
- 	socketcall_to_syscall.h
-+	syscall_compat_loongarch64.h
-+	syscall_compat_ppc64le.h
-+	syscall_compat_riscv64.h
-+	syscall_compat_s390x.h
-+	syscall_compat_x86_64.h
- 	syscall_ia32_64_map.c
- )
- 
-diff --git a/test/libscap/CMakeLists.txt b/test/libscap/CMakeLists.txt
-index e88603ebd..fa26ba7ee 100644
---- a/test/libscap/CMakeLists.txt
-+++ b/test/libscap/CMakeLists.txt
-@@ -45,6 +45,7 @@ set(LIBSCAP_TESTS_LIBRARIES
- 	"${GTEST_LIB}"
- 	"${GTEST_MAIN_LIB}"
- 	"${CMAKE_THREAD_LIBS_INIT}"
-+	"${PROTOBUF_LIB}"
- 	scap
- )
- 
-diff --git a/userspace/libscap/engine/gvisor/CMakeLists.txt b/userspace/libscap/engine/gvisor/CMakeLists.txt
-index 6dfbafb14..875847b5d 100644
---- a/userspace/libscap/engine/gvisor/CMakeLists.txt
-+++ b/userspace/libscap/engine/gvisor/CMakeLists.txt
-@@ -76,6 +76,14 @@ if (BUILD_SHARED_LIBS)
-     add_dependencies(scap_engine_gvisor_o uthash)
-     add_dependencies(scap scap_engine_gvisor_o)
-     target_sources(scap PRIVATE $<TARGET_OBJECTS:scap_engine_gvisor_o>)
-+
-+    target_include_directories(scap_engine_gvisor_o
-+        PRIVATE
-+        ${CMAKE_BINARY_DIR}
-+        ${CMAKE_CURRENT_BINARY_DIR}
-+        ${CMAKE_SOURCE_DIR}
-+        ${CMAKE_SOURCE_DIR}/userspace
-+    )
- else()
-     add_library(scap_engine_gvisor
-         ${scap_engine_gvisor_sources}
-- 
2.47.1