From 24dbad043d345a848bcb9b85dbbed1193ab1af33 Mon Sep 17 00:00:00 2001 From: Vincent Schweiger Date: Thu, 5 Mar 2026 19:27:49 +0100 Subject: [PATCH] New package: ananicy-cpp-1.2.0 --- srcpkgs/ananicy-cpp/files/ananicy-cpp/run | 5 ++ .../ananicy-cpp/patches/fix-cross-build.patch | 42 +++++++++++++++++ srcpkgs/ananicy-cpp/patches/fix-musl.patch | 46 +++++++++++++++++++ srcpkgs/ananicy-cpp/template | 25 ++++++++++ 4 files changed, 118 insertions(+) create mode 100644 srcpkgs/ananicy-cpp/files/ananicy-cpp/run create mode 100644 srcpkgs/ananicy-cpp/patches/fix-cross-build.patch create mode 100644 srcpkgs/ananicy-cpp/patches/fix-musl.patch create mode 100644 srcpkgs/ananicy-cpp/template diff --git a/srcpkgs/ananicy-cpp/files/ananicy-cpp/run b/srcpkgs/ananicy-cpp/files/ananicy-cpp/run new file mode 100644 index 00000000000000..ea1ac758e5a07b --- /dev/null +++ b/srcpkgs/ananicy-cpp/files/ananicy-cpp/run @@ -0,0 +1,5 @@ +#!/bin/sh + +exec 2>&1 + +exec ananicy-cpp start diff --git a/srcpkgs/ananicy-cpp/patches/fix-cross-build.patch b/srcpkgs/ananicy-cpp/patches/fix-cross-build.patch new file mode 100644 index 00000000000000..bf047392276c97 --- /dev/null +++ b/srcpkgs/ananicy-cpp/patches/fix-cross-build.patch @@ -0,0 +1,42 @@ +From 88b51489346e6ef352c56fff8dd0298341e0108e Mon Sep 17 00:00:00 2001 +From: Vincent Schweiger +Date: Thu, 9 Apr 2026 19:34:47 +0200 +Subject: [PATCH] fix cross build + +--- + cmake/FindBpfObject.cmake | 17 +++-------------- + 1 file changed, 3 insertions(+), 14 deletions(-) + +diff --git a/cmake/FindBpfObject.cmake b/cmake/FindBpfObject.cmake +index 2f2ada3..570a1a5 100644 +--- a/cmake/FindBpfObject.cmake ++++ b/cmake/FindBpfObject.cmake +@@ -128,22 +128,11 @@ find_package_handle_standard_args(BpfObject + GENERATED_VMLINUX_DIR) + + # Get clang bpf system includes +-execute_process( +- COMMAND bash -c "${BPFOBJECT_CLANG_EXE} -v -E - < /dev/null 2>&1 | +- sed -n '/<...> search starts here:/,/End of search list./{ s| \\(/.*\\)|-idirafter \\1|p }'" +- OUTPUT_VARIABLE CLANG_SYSTEM_INCLUDES_output +- ERROR_VARIABLE CLANG_SYSTEM_INCLUDES_error +- RESULT_VARIABLE CLANG_SYSTEM_INCLUDES_result +- OUTPUT_STRIP_TRAILING_WHITESPACE) +-if(${CLANG_SYSTEM_INCLUDES_result} EQUAL 0) +- string(REPLACE "\n" " " CLANG_SYSTEM_INCLUDES ${CLANG_SYSTEM_INCLUDES_output}) +- message(STATUS "BPF system include flags: ${CLANG_SYSTEM_INCLUDES}") +-else() +- message(FATAL_ERROR "Failed to determine BPF system includes: ${CLANG_SYSTEM_INCLUDES_error}") +-endif() ++set(CLANG_SYSTEM_INCLUDES "-I${XBPS_CROSS_BASE}/usr/include -I${XBPS_CROSS_BASE}/usr/include/${XBPS_TARGET_TRIPLET}") ++message(STATUS "BPF system include flags: ${CLANG_SYSTEM_INCLUDES}") + + # Get target arch +-execute_process(COMMAND uname -m ++execute_process(COMMAND printf "${CMAKE_SYSTEM_PROCESSOR}" + COMMAND sed -e "s/x86_64/x86/" -e "s/aarch64/arm64/" -e "s/ppc64le/powerpc/" -e "s/mips.*/mips/" + OUTPUT_VARIABLE ARCH_output + ERROR_VARIABLE ARCH_error +-- +2.53.0 + diff --git a/srcpkgs/ananicy-cpp/patches/fix-musl.patch b/srcpkgs/ananicy-cpp/patches/fix-musl.patch new file mode 100644 index 00000000000000..9a7a35a1b74da0 --- /dev/null +++ b/srcpkgs/ananicy-cpp/patches/fix-musl.patch @@ -0,0 +1,46 @@ +From 368a57bcaaab7fe563313c33a7599df2d7974d5b Mon Sep 17 00:00:00 2001 +From: Vincent Schweiger +Date: Thu, 9 Apr 2026 16:26:58 +0000 +Subject: [PATCH] Fix musl build + +--- + src/platform/linux/process_info.cpp | 7 +++++++ + src/platform/linux/syscalls.h | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/src/platform/linux/process_info.cpp b/src/platform/linux/process_info.cpp +index 96bc2f3..41905e1 100644 +--- a/src/platform/linux/process_info.cpp ++++ b/src/platform/linux/process_info.cpp +@@ -83,6 +83,13 @@ static nlohmann::json parse_proc_status(process_id_t pid) { + return status; + } + ++#ifndef SCHED_ISO ++/* glibc defines this, musl does not. ++ * SCHED_ISO is a reserved value. ++ */ ++#define SCHED_ISO 4 ++#endif ++ + static std::string get_sched_policy_name(unsigned sched_policy) { + switch (sched_policy & 0xFF) { + case SCHED_RR: +diff --git a/src/platform/linux/syscalls.h b/src/platform/linux/syscalls.h +index e7eefb9..e7602d3 100644 +--- a/src/platform/linux/syscalls.h ++++ b/src/platform/linux/syscalls.h +@@ -46,6 +46,10 @@ enum { + */ + #define IOPRIO_NORM (4) + ++#ifndef __priority_which_t ++typedef int __priority_which_t; ++#endif ++ + static int ioprio_set(__priority_which_t _which, id_t _who, int _prio) { + return static_cast(syscall(SYS_ioprio_set, _which, _who, _prio)); + } +-- +2.53.0 + diff --git a/srcpkgs/ananicy-cpp/template b/srcpkgs/ananicy-cpp/template new file mode 100644 index 00000000000000..71efd1a804dcab --- /dev/null +++ b/srcpkgs/ananicy-cpp/template @@ -0,0 +1,25 @@ +# Template file for 'ananicy-cpp' +pkgname=ananicy-cpp +version=1.2.0 +revision=1 +archs="x86_64* aarch64* ppc64* riscv64*" +build_style=cmake +configure_args="-DENABLE_SYSTEMD=OFF -DUSE_EXTERNAL_SPDLOG=ON -DUSE_EXTERNAL_FMTLIB=ON -DUSE_EXTERNAL_JSON=ON -DUSE_BPF_PROC_IMPL=ON -DBPF_BUILD_LIBBPF=OFF -DENABLE_REGEX_SUPPORT=ON -DENABLE_ANANICY_TESTS=ON -DVERSION=${version}" +hostmakedepends="git pkg-config clang bpftool" +makedepends="libbpf-devel elfutils-devel fmt-devel spdlog json-c++ pcre2-devel" +short_desc="Ananicy rewritten in C++ for much lower CPU and memory usage" +maintainer="Vincent Schweiger " +license="GPL-3.0-or-later" +homepage="https://gitlab.com/ananicy-cpp/ananicy-cpp" +distfiles="https://gitlab.com/ananicy-cpp/ananicy-cpp/-/archive/v${version}/ananicy-cpp-v${version}.tar.gz" +checksum=d75157b9588748ce6ae04c3e2d71625d8eec6bf2d23e06f8cb6f9687c74813f7 +make_dirs="/etc/ananicy.d 0755 root root" + +if [ "$XBPS_TARGET_LIBC" = musl ]; then + makedepends+=" libexecinfo-devel" + configure_args+=" -DCMAKE_CXX_STANDARD_LIBRARIES=-lexecinfo" +fi + +post_install() { + vsv ananicy-cpp +}