commit:     8f506bd2f62493dda21b28b51a04912d4eb2c2af
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Tue Dec 17 12:53:25 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 17 14:34:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f506bd2

dev-debug/bpftrace: add 0.21.3

This minor update switches to llvm-r1 and fixes building with
gcc-15 and LTO.

Closes: https://bugs.gentoo.org/939711
Closes: https://bugs.gentoo.org/945342
Closes: https://bugs.gentoo.org/946095
Closes: https://bugs.gentoo.org/946097
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-debug/bpftrace/Manifest                        |  2 +
 dev-debug/bpftrace/bpftrace-0.21.3.ebuild          | 99 ++++++++++++++++++++++
 .../files/bpftrace-0.21.3-allow-llvm-19.patch      | 18 ++++
 .../bpftrace/files/bpftrace-0.21.3-cstdint.patch   | 28 ++++++
 dev-debug/bpftrace/files/bpftrace-0.21.3-odr.patch | 37 ++++++++
 5 files changed, 184 insertions(+)

diff --git a/dev-debug/bpftrace/Manifest b/dev-debug/bpftrace/Manifest
index d57a01aec469..c41907a14253 100644
--- a/dev-debug/bpftrace/Manifest
+++ b/dev-debug/bpftrace/Manifest
@@ -3,3 +3,5 @@ DIST bpftrace-0.20.4.gh.tar.gz 1233327 BLAKE2B 
ef98dbae80285c42b6322c10666345600
 DIST bpftrace-0.21.1.gh.tar.gz 1293781 BLAKE2B 
154acfd076bd10d1ea7f81b77f8fe6b94812be7fc82bf798f508fa94a5558b068e1ec4bde7cecf51d1076593032d7674a5c0cde6432be7bb6dc4781656104915
 SHA512 
db6f5faf65fc2ac55ffbd1799b70941b8a6e4036c7fc2f56fe134f932dcf8a14fdd11a5a8b1d4b20261932d2d1ac18636cc1d7d4b87b31e366a9e53514a84ad3
 DIST bpftrace-0.21.2-man.gh.tar.xz 73044 BLAKE2B 
3adcd021ae6849933d488ab140cc0608cd9d1aa9df125f180a67bc85965105ae07f645ecf885ce8b6ac3a340c5f73761e0fab14309f3654b52c9deaeacf521fc
 SHA512 
95b05a04dec92a9c24f84a2603436e0c2f5fc7b08aafa69a2cf0843497f9100a7a104f8d3b4e654e5eb0640f272756d8d86ed4563d40ea592edbcad34af2dfa7
 DIST bpftrace-0.21.2.gh.tar.gz 1299415 BLAKE2B 
5a5d00c94c188ea4bc5008a88c9c244b0da4ac6f74c2b7083e13b8da9b0c566efc30fd9c7164f562505a4c72e6def1f2be4e360e3cd4556366e9a0aa3e1d3cf8
 SHA512 
8c64de94da29030dcde0680be90e3c16a5cd965a0066b1abe3c0740f11a78d70f383bf2e0bbe2fce639eddc7d45cb44508cc8a78743c205d7efa45734151e743
+DIST bpftrace-0.21.3-man.gh.tar.xz 73044 BLAKE2B 
3adcd021ae6849933d488ab140cc0608cd9d1aa9df125f180a67bc85965105ae07f645ecf885ce8b6ac3a340c5f73761e0fab14309f3654b52c9deaeacf521fc
 SHA512 
95b05a04dec92a9c24f84a2603436e0c2f5fc7b08aafa69a2cf0843497f9100a7a104f8d3b4e654e5eb0640f272756d8d86ed4563d40ea592edbcad34af2dfa7
+DIST bpftrace-0.21.3.gh.tar.gz 1299643 BLAKE2B 
138e767fd074911e643ed7582ed5666736fff6df58162a458d942220594e9e47b5817e999ef91a967c31ae2f84d8dae4499524eba87fa835da0ef539f92b98bd
 SHA512 
8c76b20601f49b08dcbcd947b3da0dcaf59c9e8beb7c56961c7f57bb05aa6130e83b0a664f654978305fa6ceb0507d24a0d446ff1420a1447db5bd52a36fbb75

diff --git a/dev-debug/bpftrace/bpftrace-0.21.3.ebuild 
b/dev-debug/bpftrace/bpftrace-0.21.3.ebuild
new file mode 100644
index 000000000000..0c97af5ec0f6
--- /dev/null
+++ b/dev-debug/bpftrace/bpftrace-0.21.3.ebuild
@@ -0,0 +1,99 @@
+# Copyright 2019-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( {15..19} )
+
+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.21.2"
+SRC_URI="https://github.com/bpftrace/${PN}/archive/v${MY_PV}.tar.gz -> 
${P}.gh.tar.gz"
+SRC_URI+=" 
https://github.com/bpftrace/${PN}/releases/download/v${MAN_V}/man.tar.xz -> 
${P}-man.gh.tar.xz"
+S="${WORKDIR}/${PN}-${MY_PV:-${PV}}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="lldb test"
+
+# lots of fixing needed
+RESTRICT="test"
+
+RDEPEND="
+       >=dev-libs/libbpf-1.1:=
+       >=dev-util/bcc-0.25.0:=
+       $(llvm_gen_dep '
+               lldb? ( =llvm-core/lldb-${LLVM_SLOT}* )
+               llvm-core/clang:${LLVM_SLOT}=
+               llvm-core/llvm:${LLVM_SLOT}=[llvm_targets_BPF(+)]
+       ')
+       sys-process/procps
+       sys-libs/binutils-libs:=
+       virtual/libelf:=
+"
+DEPEND="
+       ${COMMON_DEPEND}
+       dev-libs/cereal:=
+       test? ( dev-cpp/gtest )
+"
+BDEPEND="
+       app-arch/xz-utils
+       app-alternatives/lex
+       app-alternatives/yacc
+       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"
+       "${FILESDIR}/bpftrace-0.21.3-allow-llvm-19.patch"
+       "${FILESDIR}/bpftrace-0.21.3-cstdint.patch"
+       "${FILESDIR}/bpftrace-0.21.3-odr.patch"
+)
+
+pkg_pretend() {
+       local CONFIG_CHECK="
+               ~BPF
+               ~BPF_EVENTS
+               ~BPF_JIT
+               ~BPF_SYSCALL
+               ~FTRACE_SYSCALLS
+               ~HAVE_EBPF_JIT
+       "
+
+       check_extra_config
+}
+
+src_configure() {
+       local mycmakeargs=(
+               # prevent automagic lldb use
+               $(cmake_use_find_package lldb LLDB)
+               # 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
+       )
+
+       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/bpftrace/files/bpftrace-0.21.3-allow-llvm-19.patch 
b/dev-debug/bpftrace/files/bpftrace-0.21.3-allow-llvm-19.patch
new file mode 100644
index 000000000000..297c096a37a0
--- /dev/null
+++ b/dev-debug/bpftrace/files/bpftrace-0.21.3-allow-llvm-19.patch
@@ -0,0 +1,18 @@
+
+Patch adapted from from https://github.com/bpftrace/bpftrace/pull/3433
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2b60fa26d990..11927a434731 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -156,8 +156,8 @@ else()
+   find_package(LLVM REQUIRED)
+ endif()
+ 
+-set(MIN_LLVM_MAJOR 6)
++set(MIN_LLVM_MAJOR 13)
+-set(MAX_LLVM_MAJOR 18)
++set(MAX_LLVM_MAJOR 19)
+ 
+ if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR 
(${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
+   message(SEND_ERROR "Unsupported LLVM version found via 
${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")

diff --git a/dev-debug/bpftrace/files/bpftrace-0.21.3-cstdint.patch 
b/dev-debug/bpftrace/files/bpftrace-0.21.3-cstdint.patch
new file mode 100644
index 000000000000..60f8ea53d4d6
--- /dev/null
+++ b/dev-debug/bpftrace/files/bpftrace-0.21.3-cstdint.patch
@@ -0,0 +1,28 @@
+
+Patch from: 
https://github.com/bpftrace/bpftrace/commit/9996177e80f66e1d991f960fa9eb39c221ed7f45
+
+From 9996177e80f66e1d991f960fa9eb39c221ed7f45 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <[email protected]>
+Date: Tue, 20 Aug 2024 12:12:45 +0200
+Subject: [PATCH] Explicitly include <cstdint> for gcc-15
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes: https://github.com/bpftrace/bpftrace/issues/3406
+Signed-off-by: Holger Hoffstätte <[email protected]>
+---
+ src/disasm.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/disasm.h b/src/disasm.h
+index b5411f2e416c..d8d7fde8aa46 100644
+--- a/src/disasm.h
++++ b/src/disasm.h
+@@ -1,5 +1,6 @@
+ #pragma once
+ 
++#include <cstdint>
+ #include <memory>
+ #include <string>
+ 

diff --git a/dev-debug/bpftrace/files/bpftrace-0.21.3-odr.patch 
b/dev-debug/bpftrace/files/bpftrace-0.21.3-odr.patch
new file mode 100644
index 000000000000..fb1c8840d7b8
--- /dev/null
+++ b/dev-debug/bpftrace/files/bpftrace-0.21.3-odr.patch
@@ -0,0 +1,37 @@
+
+Patch from: https://github.com/bpftrace/bpftrace/pull/3648
+
+From 986acde60552af60c0a28aac234c38a7542d2f69 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <[email protected]>
+Date: Tue, 17 Dec 2024 13:27:41 +0100
+Subject: [PATCH] Fix ODR violation warning when compiling with LTO
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+yy_scan_string is declared to return void* due to a lack of a proper
+type definition of struct yy_buffer_state, which is only available in
+lex.yy.cc. Provide a struct forward declaration so that a proper
+return type can be used. This fixes the LTO complaint.
+
+Signed-off-by: Holger Hoffstätte <[email protected]>
+---
+ src/driver.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/driver.cpp b/src/driver.cpp
+index 0cd0267323b8..b1d2f91111cd 100644
+--- a/src/driver.cpp
++++ b/src/driver.cpp
+@@ -5,7 +5,10 @@
+ #include "log.h"
+ #include "parser.tab.hh"
+ 
+-extern void *yy_scan_string(const char *yy_str, yyscan_t yyscanner);
++struct yy_buffer_state;
++
++extern struct yy_buffer_state *yy_scan_string(const char *yy_str,
++                                              yyscan_t yyscanner);
+ extern int yylex_init(yyscan_t *scanner);
+ extern int yylex_destroy(yyscan_t yyscanner);
+ extern bpftrace::location loc;

Reply via email to