123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- # 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 ca0c6186b5c9c4640f8ba13ea375b66882203e8ca831a2e6e5e4e039b37f277a)
- set(_libc "static")
- elseif(_libc STREQUAL "glibc")
- set(_hash d3027685e15fdb6406fd36faf45287d79534d40601d388aca5ab87e90959846d)
- elseif(_libc STREQUAL "musl")
- set(_hash e2268ca1fa012e87d4d3d588e01b3a2389ad8a4b1c878508f6226ce1dad34acf)
- 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.5.0/netdata-kernel-collector-${_libc}-v1.5.0.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()
|