commit:     aa313703ee5b9f0067261cf302bff01abf558c6b
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Wed Mar 26 18:47:34 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar 27 11:48:07 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa313703

dev-libs/blazesym_c: add initial version 0.1.1

blazesym_c is a C API to blazesym, a Rust-based library for address
symbolization and related tasks.

Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/blazesym_c/Manifest                       |  4 ++
 dev-libs/blazesym_c/blazesym_c-0.1.1.ebuild        | 78 ++++++++++++++++++++++
 ...i-feature-to-enable-building-with-cargo-c.patch | 43 ++++++++++++
 dev-libs/blazesym_c/metadata.xml                   | 19 ++++++
 4 files changed, 144 insertions(+)

diff --git a/dev-libs/blazesym_c/Manifest b/dev-libs/blazesym_c/Manifest
new file mode 100644
index 000000000000..a8a8ca4a82d4
--- /dev/null
+++ b/dev-libs/blazesym_c/Manifest
@@ -0,0 +1,4 @@
+DIST blazesym-capi-v0.1.1-crates.tar.xz 34294836 BLAKE2B 
85e163004ac8762b50be99bfd794a59c4eb2e2a11857f0962b19a8a93f78d3d195dbab1f8c629045f08e9d27d70287e50728fbcd1542b34923d756d225b38f9f
 SHA512 
42bec9f03bfaea3bec17674d5b8d99de998b596894952fb960e60db8e979ac5e8d8ea97b9dfe4e73e5f74d67f48f3480e1048268321b5d696cc0525906efc260
+DIST blazesym_c-0.1.1.tar.gz 597215 BLAKE2B 
b38eff7ab56f35049a88afecb573596430a45a39b5631b82c05817a844b9db2535d0780ded7242b9ef123fe8871930469f4399c447a80c5b29e5bcf7b28529f9
 SHA512 
13d597b65f11504ea68299738cecccae3659a87e46bef88fdb848887b5bb59bcd987782d67791d225a9f206d02d302ceff9eb3b07748c5b8c7c84273ca4a3890
+DIST criterion.rs-b913e232edd98780961ecfbae836ec77ede49259.gh.tar.gz 786764 
BLAKE2B 
007c75791d93d2d24e11a6ca367ab53a45cfb0be67e1d65c4cdee4696709365a9417b4448ffcf44e790bf3582e8e17a15598e5cfff49bcd11cb61e4f8fb1f7b9
 SHA512 
2374fd2bb86e3c734a054215f5d350f159831c42e8889fba4c59d2d70a90f27eba6869ddb89daee16ce9a7b70d99266cf3e9370d433415ff23b515f3b5d4eb22
+DIST vmlinux.h-a9c092aa771310bf8b00b5018f7d40a1fdb6ec82.gh.tar.gz 3327904 
BLAKE2B 
4798b43e1b9213fe45b284fe3e4cf86a5df77eddcb4a699dada630c07eddd9365c62ebf09c6ef85d2b304b6dbcbfb3013f7479b32b72fdf836223d36458e9750
 SHA512 
02f957c3642b22d801c5eac5f9fc70f1606fc045b14fb1b7ffedbd3a3171c53728f664a33d88a90e2a7d15a9fe1c0559a48b52fcbea2e699199e9bc35943fa81

diff --git a/dev-libs/blazesym_c/blazesym_c-0.1.1.ebuild 
b/dev-libs/blazesym_c/blazesym_c-0.1.1.ebuild
new file mode 100644
index 000000000000..01d8f1357015
--- /dev/null
+++ b/dev-libs/blazesym_c/blazesym_c-0.1.1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Autogenerated by pycargoebuild 0.14.0
+
+EAPI=8
+
+CRATES="
+"
+
+declare -A GIT_CRATES=(
+       
[criterion-plot]='https://github.com/bheisler/criterion.rs;b913e232edd98780961ecfbae836ec77ede49259;criterion.rs-%commit%/plot'
+       
[criterion]='https://github.com/bheisler/criterion.rs;b913e232edd98780961ecfbae836ec77ede49259;criterion.rs-%commit%'
+       
[vmlinux]='https://github.com/libbpf/vmlinux.h;a9c092aa771310bf8b00b5018f7d40a1fdb6ec82;vmlinux.h-%commit%'
+)
+
+inherit cargo edo rust-toolchain
+
+DESCRIPTION="C bindings for blazesym, a library for address symbolization and 
related tasks"
+HOMEPAGE="https://github.com/libbpf/blazesym";
+SRC_URI="
+       https://github.com/libbpf/blazesym/archive/refs/tags/capi-v${PV}.tar.gz 
-> ${P}.tar.gz
+       
https://github.com/gentoo-crate-dist/blazesym/releases/download/capi-v${PV}/blazesym-capi-v${PV}-crates.tar.xz
+       ${CARGO_CRATE_URIS}
+"
+
+# build in the capi subdirectory since cargo has no -C option:
+# https://github.com/rust-lang/cargo/issues/10098
+S="${WORKDIR}/blazesym-capi-v${PV}/capi"
+
+LICENSE="BSD"
+# Dependent crate licenses
+LICENSE+="
+       Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD Boost-1.0 ISC
+       MIT MPL-2.0 Unicode-3.0
+"
+
+SLOT="0"
+KEYWORDS="~amd64"
+
+# many failures (WIP)
+RESTRICT="test"
+
+BDEPEND="
+       dev-util/cargo-c
+"
+
+src_prepare() {
+       default
+
+       # make blazesym aware of cargo-c
+       # https://github.com/libbpf/blazesym/pull/1098 (merged)
+       eapply -p2 
"${FILESDIR}/0.1.1-add-capi-feature-to-enable-building-with-cargo-c.patch"
+}
+
+src_configure() {
+       CARGO_ARGS=(
+               --library-type=cdylib
+               --prefix="${EPREFIX}"/usr
+               --libdir="${EPREFIX}/usr/$(get_libdir)"
+               --target="$(rust_abi)"
+               $(usev !debug '--release')
+       )
+
+       cargo_src_configure
+}
+
+src_compile() {
+       edo cargo cbuild "${CARGO_ARGS[@]}" || die
+}
+
+src_install() {
+       CARGO_ARGS+=(
+               --destdir="${ED}"
+       )
+
+       edo cargo cinstall "${CARGO_ARGS[@]}" || die
+}

diff --git 
a/dev-libs/blazesym_c/files/0.1.1-add-capi-feature-to-enable-building-with-cargo-c.patch
 
b/dev-libs/blazesym_c/files/0.1.1-add-capi-feature-to-enable-building-with-cargo-c.patch
new file mode 100644
index 000000000000..2b1ad9d5fb4b
--- /dev/null
+++ 
b/dev-libs/blazesym_c/files/0.1.1-add-capi-feature-to-enable-building-with-cargo-c.patch
@@ -0,0 +1,43 @@
+
+Patch from:
+https://github.com/libbpf/blazesym/commit/32f136b06b8b71110499073909dd238e577b23d0
+
+From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= <[email protected]>
+Date: Tue, 25 Mar 2025 10:10:56 +0100
+Subject: [PATCH] capi: add capi feature to enable building with cargo-c
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Disable generating the header since it already exists,
+and more importantly because we cannot run the required custom
+cbindgen extension from cargo-c.
+
+Signed-off-by: Holger Hoffstätte <[email protected]>
+--- a/capi/Cargo.toml
++++ b/capi/Cargo.toml
+@@ -36,6 +36,8 @@ crate-type = ["cdylib", "staticlib", "lib"]
+ default = [
+   "dwarf",
+ ]
++# Required by cargo-c
++capi = []
+ # Check C code documentation snippets.
+ check-doc-snippets = []
+ # Enable this feature to enable blazesym's DWARF support.
+@@ -46,6 +48,15 @@ dwarf = ["blazesym/dwarf"]
+ # changed.
+ generate-c-header = ["dep:cbindgen", "dep:which"]
+ 
++# cargo-c configuration:
++# skip header generation
++[package.metadata.capi.header]
++generation = false
++subdirectory = false
++# use the existing header for installation
++[package.metadata.capi.install.include]
++asset = [{ from="include/blazesym.h" }]
++
+ [[bench]]
+ name = "capi"
+ path = "benches/capi.rs"

diff --git a/dev-libs/blazesym_c/metadata.xml b/dev-libs/blazesym_c/metadata.xml
new file mode 100644
index 000000000000..4f2e3ded751b
--- /dev/null
+++ b/dev-libs/blazesym_c/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="person" proxied="yes">
+    <email>[email protected]</email>
+    <name>Holger Hoffstätte</name>
+  </maintainer>
+  <maintainer type="person">
+    <email>[email protected]</email>
+    <name>Yixun Lan</name>
+  </maintainer>
+  <maintainer type="project" proxied="proxy">
+    <email>[email protected]</email>
+    <name>Proxy Maintainers</name>
+  </maintainer>
+  <upstream>
+    <remote-id type="github">libbpf/blazesym</remote-id>
+  </upstream>
+</pkgmetadata>

Reply via email to