From c44ae5c03130467400468d0e9a7f83e723c99f35 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 28 Mar 2025 00:31:34 +0000 Subject: gentoo auto-resync : 28:03:2025 - 00:31:34 --- dev-debug/Manifest.gz | Bin 4352 -> 4360 bytes dev-debug/bpftrace/Manifest | 3 + dev-debug/bpftrace/bpftrace-0.23.0.ebuild | 109 ++++++++++++++ dev-debug/scap-driver/Manifest | 4 +- dev-debug/scap-driver/scap-driver-0.17.3.ebuild | 42 ------ dev-debug/scap-driver/scap-driver-0.20.0.ebuild | 49 ++++++ dev-debug/sysdig/Manifest | 8 +- dev-debug/sysdig/files/0.38.1-libs-no-libanl.patch | 21 --- ...uffer-overrun-reading-sockets-from-procfs.patch | 36 +++++ dev-debug/sysdig/sysdig-0.38.1-r1.ebuild | 131 ---------------- dev-debug/sysdig/sysdig-0.40.1.ebuild | 166 +++++++++++++++++++++ 11 files changed, 369 insertions(+), 200 deletions(-) create mode 100644 dev-debug/bpftrace/bpftrace-0.23.0.ebuild delete mode 100644 dev-debug/scap-driver/scap-driver-0.17.3.ebuild create mode 100644 dev-debug/scap-driver/scap-driver-0.20.0.ebuild delete mode 100644 dev-debug/sysdig/files/0.38.1-libs-no-libanl.patch create mode 100644 dev-debug/sysdig/files/libs-0.20-fix-buffer-overrun-reading-sockets-from-procfs.patch delete mode 100644 dev-debug/sysdig/sysdig-0.38.1-r1.ebuild create mode 100644 dev-debug/sysdig/sysdig-0.40.1.ebuild (limited to 'dev-debug') diff --git a/dev-debug/Manifest.gz b/dev-debug/Manifest.gz index ea29ffea95b7..2d8cc729ae87 100644 Binary files a/dev-debug/Manifest.gz and b/dev-debug/Manifest.gz differ diff --git a/dev-debug/bpftrace/Manifest b/dev-debug/bpftrace/Manifest index 40143cc44caf..4561bb08c902 100644 --- a/dev-debug/bpftrace/Manifest +++ b/dev-debug/bpftrace/Manifest @@ -11,8 +11,11 @@ DIST bpftrace-0.22.0-man.gh.tar.xz 76028 BLAKE2B ac061b0b380aada39d4cddf442daf1c DIST bpftrace-0.22.0.gh.tar.gz 1125284 BLAKE2B 03e15555e405b2367e96553d975405ab5c25db28aa1685fb05cecd101995ee7b90801baee4a58c462093293c239b8e76dbd0e7a0abbe714a3fa123d30021264e SHA512 fd566191c0d1e2e7e9ebf08c9b983a6db41ab230e2a99bc14b1af5afe2ace3172f8d60bd158d288ac52a254158f8535cd2296d36107d8f2b7149b6045f8f2984 DIST bpftrace-0.22.1-man.gh.tar.xz 76024 BLAKE2B 8e3764b38b62dac271a941fd224155b72eb32872415734d734e36a77f709ea190639d009280f5bc671ba527981b1a735dd511ad9cb3e3e83869b74303df5b684 SHA512 165486401e985edbffd2c424093c067c5ef2930faadaead6ca26e090650724ea501494de7a6f6e4f55869dafc18ea0b0f3ecb8f434b299beee400a022f21dd31 DIST bpftrace-0.22.1.gh.tar.gz 1125892 BLAKE2B e694f3da7947458ffc1db755e18dfd6be7664fae5573c04cddbc8db802391e834f241827f2be93a981055b26fb13128f88878d1aa17f50420227c7e8b93bd59d SHA512 3bf00f97750092e66bd94b20b3889f29e932f45ae7f75966f1f364013fb9aeaad837617c0a28402fd9323d62773dd3dab0e9749d8dcb9da9c77093f17fce4d91 +DIST bpftrace-0.23.0-man.tar.xz 76040 BLAKE2B 040ae555d2e934571d5f05d55947b0a57fce41cb59e9f936430218a7b6bf0319a2b7d09b78ec68d2f3078b77d5434c11235a181833be9057943c2536993ae4bd SHA512 397e697bfdbd4163bc500373adf0f61cd9c30cb41336bfdf24eb846bbc86ae0aabb265719e6fcb2d0261e52d75eacd8b7b08d91f5e616e1d5a6ef2a3829a9f1b +DIST bpftrace-0.23.0.tar.gz 1170815 BLAKE2B 4f30e2db142c2e0684ca1a69d8d2ab30fbf47171971d08bdc48a6d21d2536e6a732391231c6e4d1ce9bf473f89ebc54e796d828d6e1a29c276d539170723e934 SHA512 822cd0a86729e32691705d1a191c86d9b314e8161085621d778559603477432914f1221a94680f1eb37c5c4c2ae7e774044d1daba4704c93d0b812596726c564 EBUILD bpftrace-0.21.2-r1.ebuild 2021 BLAKE2B 3f4e934bb718337291e690e96b6a3dc6af8408515a5f5ebb438e525a5d97a65f3c85c1112dc935ecc9fdf3a70bc4c166bbc5fdba1c53b5f459d19c9da09ec57f SHA512 ce20ac458db7ff080ccb3cc632251221aaefb365c30ee7d8062ff0cc81d92f5484d1f5d772fb8799e6f1e39e790e426e286787920ea67cb3aaf9e62d2519c3f2 EBUILD bpftrace-0.21.3.ebuild 2137 BLAKE2B 80f22cde7ac04cdcdea55b875128cb2455051a786cdcd30ca8623350c2d56cb80fa24d978b02f547757659ba9adc329ccef7816620fcaa6963f1aaf7b65fa4d0 SHA512 70f6f2a68208982fae78ff36119d5af688b906ff4f316ce158af799d4e4efd3e3e7fb3e88ceda1ca21c067b3ea87c2de91bd419ae13bdf1a929a2306efdb2460 EBUILD bpftrace-0.22.0.ebuild 2209 BLAKE2B 7ce4b6824b2273965537acea28c41f9e44e45251b031c2c7717606f1bb54d661bc531d28fbb42e3fcf2d21b6d172396fcc06a0f849c4b9cbcfdb98233ec71360 SHA512 6c27fffa02276944177abab57730d553f6e9e2c6a32e654517266736763e057e52afb320790e59388100d414dbe583dd8565efb29f23ae7005f836596d5ff271 EBUILD bpftrace-0.22.1.ebuild 2209 BLAKE2B 7ce4b6824b2273965537acea28c41f9e44e45251b031c2c7717606f1bb54d661bc531d28fbb42e3fcf2d21b6d172396fcc06a0f849c4b9cbcfdb98233ec71360 SHA512 6c27fffa02276944177abab57730d553f6e9e2c6a32e654517266736763e057e52afb320790e59388100d414dbe583dd8565efb29f23ae7005f836596d5ff271 +EBUILD bpftrace-0.23.0.ebuild 2286 BLAKE2B ffdee5c7d609e55213d3948f80e267fda2c5feb142af5bc76da70b594356574afca2765d0e2c6c8c2480857bccc51963f2f42bc7e51e3780f3e61de5ebd9579c SHA512 986890310935548f7fbd760c2e47cb46bd092e93748762bfddd2735146ea2397f6e166679dfa75fb8b6d9b36358f88718d041370d462c649e8aab6672578d1cd MISC metadata.xml 907 BLAKE2B 28033587d33daeda712ba67d88ba5133d183a2083778d8282a5d942110720b3b325c7a1c4d1e1da44be202c7cd9959928e71158b0f52166ee3bf2c3341093500 SHA512 ff490c8e3be2d6ab9b9c1934adc5518bbde3ac13fab82f7910488da0bd16d667e59de7c26232f996768bab0c207388cba7989995c1408ab63b49d1278ddc88e1 diff --git a/dev-debug/bpftrace/bpftrace-0.23.0.ebuild b/dev-debug/bpftrace/bpftrace-0.23.0.ebuild new file mode 100644 index 000000000000..826360e218d6 --- /dev/null +++ b/dev-debug/bpftrace/bpftrace-0.23.0.ebuild @@ -0,0 +1,109 @@ +# Copyright 2019-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {16..20} ) + +inherit cmake linux-info llvm-r1 + +DESCRIPTION="High-level tracing language for eBPF" +HOMEPAGE="https://github.com/bpftrace/bpftrace" +MY_PV="${PV//_/}" +# the man page version may trail the release +#MAN_V="0.22.0" +SRC_URI=" + https://github.com/bpftrace/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz + https://github.com/bpftrace/${PN}/releases/download/v${MAN_V:-${PV}}/man.tar.xz -> ${PN}-${MAN_V:-${PV}}-man.tar.xz +" +S="${WORKDIR}/${PN}-${MY_PV:-${PV}}" + +LICENSE="Apache-2.0" +SLOT="0" + +KEYWORDS="~amd64" +IUSE="pcap test systemd" + +# lots of fixing needed +RESTRICT="test" + +RDEPEND=" + >=dev-libs/libbpf-1.5:= + >=dev-util/bcc-0.25.0:= + $(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT}= + llvm-core/llvm:${LLVM_SLOT}=[llvm_targets_BPF(+)] + ') + sys-process/procps + sys-libs/binutils-libs:= + virtual/libelf:= + systemd? ( sys-apps/systemd:= ) + pcap? ( net-libs/libpcap:= ) +" +DEPEND=" + ${RDEPEND} + dev-libs/cereal:= + test? ( dev-cpp/gtest ) +" +BDEPEND=" + app-arch/xz-utils + app-alternatives/lex + app-alternatives/yacc + dev-libs/cereal + test? ( + app-editors/vim-core + dev-util/pahole + ) + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch" + "${FILESDIR}/bpftrace-0.21.0-dont-compress-man.patch" +) + +pkg_pretend() { + local CONFIG_CHECK=" + ~BPF + ~BPF_EVENTS + ~BPF_JIT + ~BPF_SYSCALL + ~FTRACE_SYSCALLS + ~HAVE_EBPF_JIT + " + + check_extra_config +} + +src_prepare() { + # 0.23 still has LLDB support, but apparently it's problematic, + # deprecated and already gone on master. + # Remove the configuration check. + sed -i "/find_package(LLDB)/d" CMakeLists.txt || die + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + # DO NOT build the internal libs as shared + -DBUILD_SHARED_LIBS=OFF + # DO dynamically link the bpftrace executable + -DSTATIC_LINKING:BOOL=OFF + # bug 809362, 754648 + -DBUILD_TESTING:BOOL=$(usex test) + -DBUILD_FUZZ:BOOL=OFF + -DENABLE_MAN:BOOL=OFF + -DENABLE_SYSTEMD:BOOL=$(usex systemd) + -DENABLE_SKB_OUTPUT:BOOL=$(usex pcap) + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + doman man/man8/*.? + gunzip "${WORKDIR}/man/man8/bpftrace.8.gz" || die + doman "${WORKDIR}/man/man8/bpftrace.8" +} diff --git a/dev-debug/scap-driver/Manifest b/dev-debug/scap-driver/Manifest index bdc5c2c16f20..d1444e09839e 100644 --- a/dev-debug/scap-driver/Manifest +++ b/dev-debug/scap-driver/Manifest @@ -1,5 +1,5 @@ -DIST falcosecurity-libs-0.17.3.tar.gz 4425090 BLAKE2B 3d6300bba2303715581d9b35f63e453f85a3889fa93233d3b1ca69f6ba92b33e0a7d90bbd160b765487b44771a1d94f5a1fb380cf4e5130506a885471dddb7e7 SHA512 05707c404bdd45c2e944b903dbbc1e5e0e5991a3d4cbe9ea357efb35b5ad0c4ede7cdd7b056a7dde2543cc2c0b8d5d3b42606202128b7287a80a1da686de169e DIST falcosecurity-libs-0.19.0.tar.gz 4499949 BLAKE2B 4d165f3b023183abf527a2243f601ca7e6929e882ab854901ff98c3441b6bee61f9bb5d3af8974953423fa46d3968872b7f9dbfb1d81d6ad78202442e5f8d9b7 SHA512 5b011c804b07bf2f3eb6a6d7e8c9ef4e54bcc8d74116020e887465aba3dec737bdf8fc854778a8230f7e23e87da29423c6320a8054873eb5c9c957ce40ef3825 -EBUILD scap-driver-0.17.3.ebuild 1136 BLAKE2B c074f354dc68350588f707991f3fe171ada78d0f8241a67baf49f0957cfc5d4c02f6c75a9aec3acc893933c4ebd639a88329e88cb15b109d2e155a3b66de7f7c SHA512 ffe00321af9b2a05855460b2ff9ed0b45cad0e2474e30a0df7c37efa0258c7513ab3d833ee397d1878e07efb5c3abe6be258c7743ed45778fed7983ee5b2c241 +DIST falcosecurity-libs-0.20.0.tar.gz 4545190 BLAKE2B 93a074ab6451c16c7ad58498ac580f0476339e7dee65112e56142307f79966c43b69c71234a784aff03f47ec2e37e838e797beb4b36e9c105db88cf32cad135e SHA512 b5ef481bda92a29b7b409baee25dabd0b766e4bbcac762740635f99b36cd823a6d98f541817fd03b1a86a1385d3fe24888b33b84dc3486cd9f8d00e5384eb705 EBUILD scap-driver-0.19.0.ebuild 1078 BLAKE2B d784709557fa35cb8a6398070dd4c4968ebe5230490321c2cb14e8293383abbddc1c98ce404dd313540596dd69649a7be4c0fc3ce5054d8472ba73f5fd1f74d1 SHA512 05cc16151e4ac7c87a9ee0545b79080fa8de22974c95a2947704c3ff737f187adb955d3127164001359b0d586d6bb2abb283bff7a3a843d7d0352db2f5da4686 +EBUILD scap-driver-0.20.0.ebuild 1259 BLAKE2B 9e412fb9ee958b13c4ecc6d095bdc5ee62ecc9e0e7599ac324f7d701b61751f4a39690f5f22404c82fb92c686fc80309893c9d8a0c168f343a02eda5c3bdcc3c SHA512 9cb604de9001eefd36904846c3c7a9ea2e061a277ee30f8d6e2691531a38ea18ffe6c1921d4575e3ea16548bb6fd20c3ccea53c67909b402f5197dd4fccc9733 MISC metadata.xml 494 BLAKE2B d0bc754d3af2488b9dc7672fc63e962f4c885d88a819e4332bd1c25f84c967e2e1cd8489122490a864cbfd930225b3dc28c8bfad4426750c030dce6ef5a08b4e SHA512 b77b7c103cfb606333814af210a0fae1f7956ddd9d3c3a044b0bebf42553f5ffe99d04549fb9c5e40fce33e9d23761830b4944b2cd83bd8ca2193f9b7da60fc0 diff --git a/dev-debug/scap-driver/scap-driver-0.17.3.ebuild b/dev-debug/scap-driver/scap-driver-0.17.3.ebuild deleted file mode 100644 index 5e4470f02d5e..000000000000 --- a/dev-debug/scap-driver/scap-driver-0.17.3.ebuild +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit cmake linux-mod-r1 - -DESCRIPTION="Kernel module for dev-debug/sysdig" -HOMEPAGE="https://sysdig.com/" -SRC_URI="https://github.com/falcosecurity/libs/archive/${PV}.tar.gz -> falcosecurity-libs-${PV}.tar.gz" -S="${WORKDIR}/libs-${PV}" - -LICENSE="Apache-2.0 GPL-2 MIT" -SLOT="0" -KEYWORDS="amd64 ~arm64 x86" - -RDEPEND="! - ---- libs-0.17.2/userspace/libsinsp/CMakeLists.txt~ 2024-06-14 11:38:50.000000000 +0200 -+++ libs-0.17.2/userspace/libsinsp/CMakeLists.txt 2024-07-05 00:18:03.326406540 +0200 -@@ -258,8 +258,8 @@ if(NOT WIN32) - ) - - if(NOT MUSL_OPTIMIZED_BUILD) -- target_link_libraries(sinsp INTERFACE rt anl) -- list(APPEND SINSP_PKGCONFIG_LIBRARIES rt anl) -+ target_link_libraries(sinsp INTERFACE rt) -+ list(APPEND SINSP_PKGCONFIG_LIBRARIES rt) - endif() - - else() diff --git a/dev-debug/sysdig/files/libs-0.20-fix-buffer-overrun-reading-sockets-from-procfs.patch b/dev-debug/sysdig/files/libs-0.20-fix-buffer-overrun-reading-sockets-from-procfs.patch new file mode 100644 index 000000000000..9741fad48e2a --- /dev/null +++ b/dev-debug/sysdig/files/libs-0.20-fix-buffer-overrun-reading-sockets-from-procfs.patch @@ -0,0 +1,36 @@ + +Patch from: +https://github.com/falcosecurity/libs/commit/de3f4cac9233682eae63c63377c82efb649679f5 + +From de3f4cac9233682eae63c63377c82efb649679f5 Mon Sep 17 00:00:00 2001 +From: Shane Lawrence +Date: Thu, 20 Feb 2025 14:55:41 +0000 +Subject: [PATCH] Fix buffer overrun reading sockets from procfs. + +Signed-off-by: Shane Lawrence +--- + userspace/libscap/linux/scap_fds.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/userspace/libscap/linux/scap_fds.c b/userspace/libscap/linux/scap_fds.c +index f98ac3f32f..73e99ca428 100644 +--- a/userspace/libscap/linux/scap_fds.c ++++ b/userspace/libscap/linux/scap_fds.c +@@ -766,7 +766,7 @@ int32_t scap_fd_read_ipv4_sockets_from_proc_fs(const char *dir, + break; + } + +- while(*scan_pos == ' ' && scan_pos < scan_end) { ++ while(scan_pos < scan_end && *scan_pos == ' ') { + scan_pos++; + } + +@@ -974,7 +974,7 @@ int32_t scap_fd_read_ipv6_sockets_from_proc_fs(char *dir, + break; + } + +- while(*scan_pos == ' ' && scan_pos < scan_end) { ++ while(scan_pos < scan_end && *scan_pos == ' ') { + scan_pos++; + } + diff --git a/dev-debug/sysdig/sysdig-0.38.1-r1.ebuild b/dev-debug/sysdig/sysdig-0.38.1-r1.ebuild deleted file mode 100644 index 1c03185f156d..000000000000 --- a/dev-debug/sysdig/sysdig-0.38.1-r1.ebuild +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -LUA_COMPAT=( luajit ) - -inherit bash-completion-r1 cmake flag-o-matic lua-single - -DESCRIPTION="A system exploration and troubleshooting tool" -HOMEPAGE="https://sysdig.com/" - -# The version of falcosecurity-libs required by sysdig as source tree -LIBS_VERSION="0.17.3" -SRC_URI="https://github.com/draios/sysdig/archive/${PV}.tar.gz -> ${P}.tar.gz - https://github.com/falcosecurity/libs/archive/${LIBS_VERSION}.tar.gz -> falcosecurity-libs-${LIBS_VERSION}.tar.gz" - -# The driver version as found in cmake/modules/driver.cmake -DRIVER_VERSION="7.2.0+driver" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="amd64 ~x86" -IUSE="+modules" -REQUIRED_USE="${LUA_REQUIRED_USE}" - -RDEPEND="${LUA_DEPS} - dev-cpp/abseil-cpp:= - dev-cpp/tbb:= - dev-cpp/yaml-cpp:= - dev-libs/jsoncpp:= - dev-libs/libb64:= - dev-libs/protobuf:= - dev-libs/re2:= - dev-libs/uthash - net-libs/grpc:= - net-misc/curl - sys-libs/ncurses:= - sys-libs/zlib:= - virtual/libelf:=" - -DEPEND="${RDEPEND} - dev-cpp/nlohmann_json - dev-cpp/valijson - virtual/os-headers" - -# pin the driver to the falcosecurity-libs version -PDEPEND="modules? ( =dev-debug/scap-driver-${LIBS_VERSION}* )" - -PATCHES=( "${FILESDIR}/${PV}-scap-loader.patch" ) - -src_prepare() { - # manually apply patches to falcosecurity-libs dependency - pushd "${WORKDIR}/libs-${LIBS_VERSION}" - # musl has no libanl (#929227) - if [ ${ELIBC} == "musl" ] ; then - eapply "${FILESDIR}/${PV}-libs-no-libanl.patch" || die - fi - popd - - # do not build with debugging info - sed -i -e 's/-ggdb//g' CMakeLists.txt "${WORKDIR}"/libs-${LIBS_VERSION}/cmake/modules/CompilerFlags.cmake || die - - # fix the driver version - sed -i -e 's/0.0.0-local/${DRIVER_VERSION}/g' cmake/modules/driver.cmake || die - - cmake_src_prepare -} - -src_configure() { - # known problems with strict aliasing: - # https://github.com/falcosecurity/libs/issues/1964 - append-flags -fno-strict-aliasing - - local mycmakeargs=( - # do not build the kernel driver - -DBUILD_DRIVER=OFF - - # libscap examples are not installed or really useful - -DBUILD_LIBSCAP_EXAMPLES=OFF - - # do not build internal libs as shared - -DBUILD_SHARED_LIBS=OFF - - # do not build eBPF driver for now - -DBUILD_SYSDIG_MODERN_BPF=OFF - - # set driver version to prevent downloading (don't ask..) - -DDRIVER_SOURCE_DIR="${WORKDIR}"/libs-${LIBS_VERSION}/driver - -DDRIVER_VERSION=${DRIVER_VERSION} - - # point sysdig to the libs tree - -DFALCOSECURITY_LIBS_SOURCE_DIR="${WORKDIR}"/libs-${LIBS_VERSION} - - # explicitly set sysdig version - required for some reason - -DSYSDIG_VERSION=${PV} - - # do not use bundled dependencies for sysdig - -DUSE_BUNDLED_DEPS=OFF - - # do not use bundled dependencies for falcosecurity-libs - -DUSE_BUNDLED_B64=OFF - -DUSE_BUNDLED_JSONCPP=OFF - -DUSE_BUNDLED_RE2=OFF - -DUSE_BUNDLED_TBB=OFF - -DUSE_BUNDLED_VALIJSON=OFF - - # set valijson include path to prevent downloading - -DVALIJSON_INCLUDE="${ESYSROOT}"/usr/include - - # enable chisels - -DWITH_CHISEL=ON - ) - - cmake_src_configure -} - -src_install() { - cmake_src_install - - # remove driver headers - rm -r "${ED}"/usr/src || die - - # remove libscap/libsinsp headers & libs (see #938187) - rm -r "${ED}"/usr/include/sysdig || die - rm -r "${ED}"/usr/$(get_libdir) || die - - # move bashcomp to the proper location - dobashcomp "${ED}"/usr/etc/bash_completion.d/sysdig || die - rm -r "${ED}"/usr/etc || die -} diff --git a/dev-debug/sysdig/sysdig-0.40.1.ebuild b/dev-debug/sysdig/sysdig-0.40.1.ebuild new file mode 100644 index 000000000000..886c0561ccdc --- /dev/null +++ b/dev-debug/sysdig/sysdig-0.40.1.ebuild @@ -0,0 +1,166 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LUA_COMPAT=( luajit ) + +inherit bash-completion-r1 cmake flag-o-matic linux-info lua-single + +DESCRIPTION="A system exploration and troubleshooting tool" +HOMEPAGE="https://sysdig.com/" + +# The version of falcosecurity-libs required by sysdig as source tree +LIBS_VERSION="0.20.0" +LIBS="falcosecurity-libs-${LIBS_VERSION}" + +SRC_URI="https://github.com/draios/sysdig/archive/${PV}.tar.gz -> ${P}.tar.gz + https://github.com/falcosecurity/libs/archive/${LIBS_VERSION}.tar.gz -> ${LIBS}.tar.gz" + +# The driver version as found in cmake/modules/driver.cmake or alternatively +# as git tag on the $LIBS_VERSION of falcosecurity-libs. +DRIVER_VERSION="8.0.0+driver" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="bpf +modules" +REQUIRED_USE="${LUA_REQUIRED_USE}" + +RDEPEND="${LUA_DEPS} + dev-cpp/abseil-cpp:= + dev-cpp/tbb:= + dev-cpp/yaml-cpp:= + dev-libs/jsoncpp:= + dev-libs/libb64:= + bpf? ( >=dev-libs/libbpf-1.1:= ) + dev-libs/protobuf:= + dev-libs/re2:= + dev-libs/uthash + net-libs/grpc:= + net-misc/curl + sys-libs/ncurses:= + sys-libs/zlib:= + virtual/libelf:=" + +DEPEND="${RDEPEND} + dev-cpp/nlohmann_json + dev-cpp/valijson + virtual/os-headers" + +BDEPEND="bpf? ( + dev-util/bpftool + llvm-core/clang:*[llvm_targets_BPF] + )" + +# pin the driver to the falcosecurity-libs version +PDEPEND="modules? ( =dev-debug/scap-driver-${LIBS_VERSION}* )" + +PATCHES=( + "${FILESDIR}/0.38.1-scap-loader.patch" +) + +pkg_pretend() { + if use bpf; then + local CONFIG_CHECK=" + ~BPF + ~BPF_EVENTS + ~BPF_JIT + ~BPF_SYSCALL + ~FTRACE_SYSCALLS + ~HAVE_EBPF_JIT + " + check_extra_config + fi +} + +src_prepare() { + # manually apply patches to falcosecurity-libs + pushd "${WORKDIR}/libs-${LIBS_VERSION}" + eapply "${FILESDIR}/libs-0.20-fix-buffer-overrun-reading-sockets-from-procfs.patch" || die + popd + + # do not build with debugging info + sed -i -e 's/-ggdb//g' CMakeLists.txt "${WORKDIR}"/libs-${LIBS_VERSION}/cmake/modules/CompilerFlags.cmake || die + + # fix the driver version + sed -i -e 's/0.0.0-local/${DRIVER_VERSION}/g' cmake/modules/driver.cmake || die + + cmake_src_prepare +} + +src_configure() { + # known problems with strict aliasing: + # https://github.com/falcosecurity/libs/issues/1964 + append-flags -fno-strict-aliasing + + local mycmakeargs=( + # do not build the kernel driver + -DBUILD_DRIVER=OFF + + # libscap examples are not installed or really useful + -DBUILD_LIBSCAP_EXAMPLES=OFF + + # do not build internal libs as shared + -DBUILD_SHARED_LIBS=OFF + + # build BPF probe depending on USE + -DBUILD_SYSDIG_MODERN_BPF:BOOL=$(usex bpf) + + # set driver version to prevent downloading (don't ask..) + -DDRIVER_SOURCE_DIR="${WORKDIR}"/libs-${LIBS_VERSION}/driver + -DDRIVER_VERSION=${DRIVER_VERSION} + + # point sysdig to the libs tree + -DUSE_BUNDLED_FALCOSECURITY_LIBS=ON + -DFALCOSECURITY_LIBS_SOURCE_DIR="${WORKDIR}"/libs-${LIBS_VERSION} + + # explicitly set sysdig version - required for some reason + -DSYSDIG_VERSION=${PV} + + # do not use bundled dependencies for sysdig + -DUSE_BUNDLED_DEPS=OFF + + # do not use bundled dependencies for falcosecurity-libs + -DUSE_BUNDLED_B64=OFF + -DUSE_BUNDLED_JSONCPP=OFF + -DUSE_BUNDLED_RE2=OFF + -DUSE_BUNDLED_TBB=OFF + -DUSE_BUNDLED_VALIJSON=OFF + + # set valijson include path to prevent downloading + -DVALIJSON_INCLUDE="${ESYSROOT}"/usr/include + + # enable chisels + -DWITH_CHISEL=ON + ) + + cmake_src_configure +} + +src_install() { + cmake_src_install + + # remove driver headers + rm -r "${ED}"/usr/src || die + + # remove libscap/libsinsp headers & libs (see #938187) + rm -r "${ED}"/usr/include/sysdig || die + rm -r "${ED}"/usr/$(get_libdir) || die + + # move bashcomp to the proper location + dobashcomp "${ED}"/usr/etc/bash_completion.d/sysdig || die + rm -r "${ED}"/usr/etc || die +} + +pkg_postinst() { + if use bpf; then + elog + elog "You have enabled the 'modern BPF' probe." + elog "This eBPF-based event source is an alternative to the traditional" + elog "scap kernel module." + elog + elog "To use it, start sysdig/csysdig with '--modern-bpf'." + elog + fi +} -- cgit v1.2.3