1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 inherit autotools eutils libtool multilib-minimal
10 DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
11 HOMEPAGE="https://savannah.nongnu.org/projects/libunwind"
12 SRC_URI="mirror://nongnu/libunwind/${MY_P}.tar.gz"
16 KEYWORDS="amd64 arm arm64 hppa ia64 ~mips ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
17 IUSE="debug debug-frame doc libatomic lzma +static-libs"
19 RESTRICT="test" # half of tests are broken (toolchain version dependent)
21 # We just use the header from libatomic.
22 RDEPEND="lzma? ( app-arch/xz-utils )"
24 libatomic? ( dev-libs/libatomic_ops )"
26 S="${WORKDIR}/${MY_P}"
28 MULTILIB_WRAPPED_HEADERS=(
29 /usr/include/libunwind.h
31 # see libunwind.h for the full list of arch-specific headers
32 /usr/include/libunwind-aarch64.h
33 /usr/include/libunwind-arm.h
34 /usr/include/libunwind-hppa.h
35 /usr/include/libunwind-ia64.h
36 /usr/include/libunwind-mips.h
37 /usr/include/libunwind-ppc32.h
38 /usr/include/libunwind-ppc64.h
39 /usr/include/libunwind-sh.h
40 /usr/include/libunwind-tilegx.h
41 /usr/include/libunwind-x86.h
42 /usr/include/libunwind-x86_64.h
46 "${FILESDIR}"/${PN}-1.2-coredump-regs.patch #586092
47 "${FILESDIR}"/${PN}-1.2-ia64-undwarf.patch
48 "${FILESDIR}"/${PN}-1.2-ia64-ptrace-coredump.patch
49 "${FILESDIR}"/${PN}-1.2-ia64-missing.patch
50 "${FILESDIR}"/${PN}-1.2.1-fix_version_macros.patch
51 "${FILESDIR}"/${PN}-1.2.1-only-include-execinfo_h-if-avaliable.patch
56 chmod +x src/ia64/mk_cursor_i || die
57 # Since we have tests disabled via RESTRICT, disable building in the subdir
58 # entirely. This worksaround some build errors too. #484846
59 sed -i -e '/^SUBDIRS/s:tests::' Makefile.in || die
65 multilib_src_configure() {
66 # --enable-cxx-exceptions: always enable it, headers provide the interface
67 # and on some archs it is disabled by default causing a mismatch between the
68 # API and the ABI, bug #418253
69 # conservative-checks: validate memory addresses before use; as of 1.0.1,
70 # only x86_64 supports this, yet may be useful for debugging, couple it with
73 ac_cv_header_atomic_ops_h=$(usex libatomic) \
75 --enable-cxx-exceptions \
79 $(use_enable debug-frame) \
80 $(use_enable doc documentation) \
81 $(use_enable lzma minidebuginfo) \
82 $(use_enable static-libs static) \
83 $(use_enable debug conservative_checks) \
87 multilib_src_compile() {
89 CCACHE_NODIRECT=1 default
93 # Explicitly allow parallel build of tests.
94 # Sandbox causes some tests to freak out.
95 SANDBOX_ON=0 emake check
98 multilib_src_install() {
100 # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
101 # shared library, so we keep it in any case
102 use static-libs || find "${ED}"usr '(' -name 'libunwind-generic.a' -o -name 'libunwind*.la' ')' -delete