unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob b2d38e42e037c5d67d0d11d5ddc1a9e0cf77e1ac 6181 bytes (raw)
name: packages/patches/falcosecurity-libs-libsinsp-pkg-config.patch 	 # note: path name is non-authoritative(*)

  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
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
 
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@

debug log:

solving b2d38e42e037c5d67d0d11d5ddc1a9e0cf77e1ac ...
found b2d38e42e037c5d67d0d11d5ddc1a9e0cf77e1ac in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).