# Handling for eBPF legacy programs # # Copyright (c) 2024 Netdata Inc. # SPDX-License-Identifier: GPL-3.0-or-later include(ExternalProject) include(NetdataUtil) set(ebpf-legacy_SOURCE_DIR "${CMAKE_BINARY_DIR}/ebpf-legacy") set(ebpf-legacy_BUILD_DIR "${CMAKE_BINARY_DIR}/ebpf-legacy-build") # Fetch the legacy eBPF code. function(netdata_fetch_legacy_ebpf_code) netdata_identify_libc(_libc) if(DEFINED BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS) set(need_static TRUE) endif() endif() if(need_static) set(_hash 1c0c8f1177514e9e21a23c28841406595e57b7cfacd93746ff2d6b25987b94a6) set(_libc "static") elseif(_libc STREQUAL "glibc") set(_hash e365a76a2bb25190f1d91e4dea2cfc5ff5db63b5238fbfbc89f72755cf85a12c) elseif(_libc STREQUAL "musl") set(_hash ec14dcdfa29d4fba1cea6763740b9d37683515bde88a1a29b6e7c70ce01a604d) else() message(FATAL_ERROR "Could not determine libc implementation, unable to install eBPF legacy code.") endif() ExternalProject_Add( ebpf-code-legacy URL https://github.com/netdata/kernel-collector/releases/download/v1.4.5.1/netdata-kernel-collector-${_libc}-v1.4.5.1.tar.xz URL_HASH SHA256=${_hash} SOURCE_DIR "${ebpf-legacy_SOURCE_DIR}" CONFIGURE_COMMAND "" BUILD_COMMAND sh -c "mkdir -p ${ebpf-legacy_BUILD_DIR}/ebpf.d && mv ${ebpf-legacy_SOURCE_DIR}/*netdata_ebpf_*.o ${ebpf-legacy_BUILD_DIR}/ebpf.d" INSTALL_COMMAND "" ) endfunction() function(netdata_install_legacy_ebpf_code) install(DIRECTORY ${ebpf-legacy_BUILD_DIR}/ebpf.d DESTINATION usr/libexec/netdata/plugins.d COMPONENT ebpf-code-legacy) endfunction()