dev-util/strace: Don't build with -Werror
[gentoo.git] / dev-util / strace / strace-5.6.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit autotools flag-o-matic toolchain-funcs
7
8 if [[ ${PV} == "9999" ]] ; then
9         EGIT_REPO_URI="https://github.com/strace/strace.git"
10         inherit git-r3 autotools
11 else
12         SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.xz"
13         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
14 fi
15
16 DESCRIPTION="A useful diagnostic, instructional, and debugging tool"
17 HOMEPAGE="https://strace.io/"
18
19 LICENSE="BSD"
20 SLOT="0"
21 IUSE="aio perl static unwind elfutils"
22
23 REQUIRED_USE="?? ( unwind elfutils )"
24
25 BDEPEND="
26         virtual/pkgconfig
27 "
28 LIB_DEPEND="
29         unwind? ( sys-libs/libunwind[static-libs(+)] )
30         elfutils? ( dev-libs/elfutils[static-libs(+)] )
31 "
32 # strace only uses the header from libaio to decode structs
33 DEPEND="
34         static? ( ${LIB_DEPEND} )
35         aio? ( >=dev-libs/libaio-0.3.106 )
36         sys-kernel/linux-headers
37 "
38 RDEPEND="
39         !static? ( ${LIB_DEPEND//\[static-libs(+)]} )
40         perl? ( dev-lang/perl )
41 "
42
43 PATCHES=(
44         "${FILESDIR}/${PN}-5.5-static.patch"
45 )
46
47 src_prepare() {
48         default
49
50         eautoreconf
51
52         if [[ ! -e configure ]] ; then
53                 # git generation
54                 sed /autoreconf/d -i bootstrap || die
55                 ./bootstrap || die
56                 eautoreconf
57                 [[ ! -e CREDITS ]] && cp CREDITS{.in,}
58         fi
59
60         filter-lfs-flags # configure handles this sanely
61
62         export ac_cv_header_libaio_h=$(usex aio)
63         use elibc_musl && export ac_cv_header_stdc=no
64
65         # Stub out the -k test since it's known to be flaky. #545812
66         sed -i '1iexit 77' tests*/strace-k.test || die
67 }
68
69 src_configure() {
70         # Set up the default build settings, and then use the names strace expects.
71         tc-export_build_env BUILD_{CC,CPP}
72         local v bv
73         for v in CC CPP {C,CPP,LD}FLAGS ; do
74                 bv="BUILD_${v}"
75                 export "${v}_FOR_BUILD=${!bv}"
76         done
77
78         # Don't require mpers support on non-multilib systems. #649560
79         local myeconfargs=(
80                 --disable-gcc-Werror
81                 --enable-mpers=check
82                 $(use_enable static)
83                 $(use_with unwind libunwind)
84                 $(use_with elfutils libdw)
85         )
86         econf "${myeconfargs[@]}"
87 }
88
89 src_test() {
90         if has usersandbox ${FEATURES} ; then
91                 ewarn "Test suite is known to fail with FEATURES=usersandbox -- skipping ..." #643044
92                 return 0
93         fi
94
95         default
96 }
97
98 src_install() {
99         default
100         if ! use perl ; then
101                 rm "${ED}"/usr/bin/strace-graph || die
102         fi
103         dodoc CREDITS
104 }