sys-libs/libexecinfo - 1.1.0 (headspace)

Search

Install

Install this version:

emerge -a =sys-libs/libexecinfo-1.1.0

If this version is masked, you can unmask it using the autounmask tool or standard emerge options:

autounmask =sys-libs/libexecinfo-1.1.0

Or alternatively:

emerge --autounmask-write -a =sys-libs/libexecinfo-1.1.0

Package Information

Description:
A modern, BSD-licensed clone of the backtrace facility found in GNU libc
Homepage:
https://github.com/fam007e/libexecinfo
License:
BSD-2

Ebuild Details

Version EAPI Keywords Slot
1.1.0 8 ~amd64 0
View Raw Ebuild
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="A modern, BSD-licensed clone of the backtrace facility found in GNU libc"
HOMEPAGE="https://github.com/fam007e/libexecinfo"
SRC_URI="https://github.com/fam007e/libexecinfo/archive/refs/tags/v1.1.0.13.tar.gz -> ${P}.tar.gz"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="static-libs"

DEPEND="
	dev-lang/python:3.6"
RDEPEND="!sys-libs/glibc"

S="${WORKDIR}/${PN}-1.1.0.13"

src_prepare() {
	default
	# The upstream Makefile generates stacktraverse.c from gen.py
	# Ensure it uses our toolchain settings
	sed -i \
		-e 's/^CC ?= cc/CC ?= $(CC)/' \
		-e 's/^AR ?= ar/AR ?= $(AR)/' \
		-e 's/^PYTHON ?= python3/PYTHON ?= python3/' \
		-e 's/^STRIP ?= strip/STRIP ?= $(STRIP)/' \
		-e 's/^INSTALL ?= install/INSTALL ?= install/' \
		Makefile || die "Failed to patch Makefile"

	# Fix Makefile for musl/clang compatibility:
	# - Remove -fsanitize=address (not compatible with musl)
	# - Comment out ldconfig call in install
	sed -i \
		-e 's/-fsanitize=address/#-fsanitize=address/' \
		-e 's/^	ldconfig -n/#	ldconfig -n/' \
		Makefile || die "Failed to patch Makefile for musl/clang"
}

src_compile() {
	# Generate stacktraverse.c first
	emake generate CC="$(tc-getCC)" AR="$(tc-getAR)" PYTHON="python3"

	# Build both static and shared libraries
	emake static dynamic CC="$(tc-getCC)" AR="$(tc-getAR)"
}

src_test() {
	# Run the test suite
	emake test CC="$(tc-getCC)" AR="$(tc-getAR)"
	LD_LIBRARY_PATH="${S}" ./test || die "Tests failed"
}

src_install() {
	# Install libraries
	if use static-libs; then
		dolib.a libexecinfo.a
	fi
	dolib.so libexecinfo.so.${PV}
	dosym libexecinfo.so.${PV} /usr/$(get_libdir)/libexecinfo.so.1
	dosym libexecinfo.so.${PV} /usr/$(get_libdir)/libexecinfo.so

	# Install headers
	insinto /usr/include
	doins execinfo.h stacktraverse.h

	# Install pkg-config file
	# Generate it with correct paths
	sed \
		-e "s|@PREFIX@|/usr|g" \
		-e "s|@LIBDIR@|/usr/$(get_libdir)|g" \
		-e "s|@INCLUDEDIR@|/usr/include|g" \
		-e "s|@VERSION@|${PV}|g" \
		"${FILESDIR}"/libexecinfo.pc.in > libexecinfo.pc || die
	insinto /usr/$(get_libdir)/pkgconfig
	doins libexecinfo.pc

	# Documentation
	dodoc README.md
}

pkg_postinst() {
	elog "libexecinfo provides execinfo.h and backtrace() / backtrace_symbols()"
	elog "for musl libc which lacks these GNU extensions."
	elog ""
	elog "Link with -lexecinfo when using backtrace functions."
}

USE Flags

Manage flags for this package: euse -i <flag> -p sys-libs/libexecinfo | euse -E <flag> -p sys-libs/libexecinfo | euse -D <flag> -p sys-libs/libexecinfo

Global/Standard Flags

Inherited Eclasses

Dependencies

DEPEND

	dev-lang/python:3.6

RDEPEND

!sys-libs/glibc

Manifest for 1.1.0

Type File Size Source URLs
DIST libexecinfo-1.1.0.tar.gz 22027 bytes https://github.com/fam007e/libexecinfo/archive/refs/tags/v1.1.0.13.tar.gz