dev-util/google-perftools: version bump to 2.6.2
[gentoo.git] / dev-util / google-perftools / google-perftools-2.6.2.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 MY_P="gperftools-${PV}"
7 inherit toolchain-funcs flag-o-matic vcs-snapshot autotools multilib-minimal
8
9 DESCRIPTION="Fast, multi-threaded malloc() and nifty performance analysis tools"
10 HOMEPAGE="https://github.com/gperftools/gperftools"
11 SRC_URI="https://github.com/gperftools/gperftools/tarball/${MY_P} -> ${MY_P}.tar.gz"
12
13 LICENSE="MIT"
14 SLOT="0/4"
15 # contains ASM code, with support for
16 # freebsd x86/amd64
17 # linux x86/amd64/ppc/ppc64/arm
18 # OSX ppc/amd64
19 # AIX ppc/ppc64
20 KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
21 IUSE="largepages +debug minimal optimisememory test static-libs"
22
23 DEPEND="sys-libs/libunwind"
24 RDEPEND="${DEPEND}"
25
26 S="${WORKDIR}/${MY_P}"
27
28 HTML_DOCS="docs"
29
30 pkg_setup() {
31         # set up the make options in here so that we can actually make use
32         # of them on both compile and install.
33
34         # Avoid building the unit testing if we're not going to execute
35         # tests; this trick here allows us to ignore the tests without
36         # touching the build system (and thus without rebuilding
37         # autotools). Keep commented as long as it's restricted.
38         use test || \
39                 MAKEOPTS+=" noinst_PROGRAMS= "
40 }
41
42 src_prepare() {
43         default
44         eautoreconf
45         multilib_copy_sources
46 }
47
48 multilib_src_configure() {
49         use largepages && append-cppflags -DTCMALLOC_LARGE_PAGES
50         use optimisememory && append-cppflags -DTCMALLOC_SMALL_BUT_SLOW
51         append-flags -fno-strict-aliasing -fno-omit-frame-pointer
52
53         econf \
54                 --htmldir=${EPREFIX}/usr/share/doc/${PF}/html \
55                 --docdir=${EPREFIX}/usr/share/doc/${PF} \
56                 --enable-shared \
57                 $(use_enable static-libs static) \
58                 $(use_enable debug debugalloc) \
59                 $(if [[ ${ABI} == x32 ]]; then printf "--enable-minimal\n" else use_enable minimal; fi)
60 }
61
62 src_test() {
63         case "${LD_PRELOAD}" in
64                 *libsandbox*)
65                         ewarn "Unable to run tests when sandbox is enabled."
66                         ewarn "See https://bugs.gentoo.org/290249"
67                         return 0
68                         ;;
69         esac
70
71         multilib-minimal_src_test
72 }
73
74 src_install() {
75         if ! use minimal && has x32 ${MULTILIB_ABIS}; then
76                 MULTILIB_WRAPPED_HEADERS=(
77                         /usr/include/gperftools/heap-checker.h
78                         /usr/include/gperftools/heap-profiler.h
79                         /usr/include/gperftools/stacktrace.h
80                         /usr/include/gperftools/profiler.h
81                 )
82         fi
83
84         multilib-minimal_src_install
85 }