sys-process/glances: 3.1.4.1-r1 amd64 stable, bug #720368
[gentoo.git] / dev-libs / libaio / libaio-9999.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 multilib-minimal toolchain-funcs flag-o-matic usr-ldscript
7
8 DESCRIPTION="Asynchronous input/output library that uses the kernels native interface"
9 HOMEPAGE="https://pagure.io/libaio"
10 if [[ "${PV}" == 9999 ]] ; then
11         inherit git-r3
12         EGIT_REPO_URI="https://pagure.io/libaio.git"
13 else
14         SRC_URI="https://releases.pagure.org/${PN}/${P}.tar.gz"
15         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
16 fi
17 LICENSE="LGPL-2"
18 SLOT="0"
19 IUSE="static-libs test"
20 RESTRICT="!test? ( test )"
21
22 PATCHES=(
23         "${FILESDIR}"/${PN}-0.3.112-cppflags.patch
24         "${FILESDIR}"/${PN}-0.3.111-optional-werror.patch
25 )
26
27 src_prepare() {
28         default
29
30         local sed_args=(
31                 -e "/^prefix=/s:/usr:${EPREFIX}/usr:"
32                 -e '/^libdir=/s:lib$:$(ABI_LIBDIR):'
33         )
34         if ! use static-libs; then
35                 sed_args+=( -e '/\tinstall .*\/libaio.a/d' )
36                 # Tests require the static library to be built.
37                 use test || sed_args+=( -e '/^all_targets +=/s/ libaio.a//' )
38         fi
39         sed -i "${sed_args[@]}" src/Makefile Makefile || die
40
41         multilib_copy_sources
42 }
43
44 multilib_src_configure() {
45         if use arm ; then
46                 # When building for thumb, we can't allow frame pointers.
47                 # http://crbug.com/464517
48                 if $(tc-getCPP) ${CFLAGS} ${CPPFLAGS} - <<<$'#ifndef __thumb__\n#error\n#endif' >&/dev/null ; then
49                         append-flags -fomit-frame-pointer
50                 fi
51         fi
52 }
53
54 _emake() {
55         CC=$(tc-getCC) \
56         AR=$(tc-getAR) \
57         RANLIB=$(tc-getRANLIB) \
58         ABI_LIBDIR=$(get_libdir) \
59         CFLAGS_WERROR= \
60         emake "$@"
61 }
62
63 multilib_src_compile() {
64         _emake
65 }
66
67 multilib_src_test() {
68         mkdir -p testdir || die
69         # 'make check' breaks with sandbox, 'make partcheck' works
70         _emake partcheck prefix="${S}/src" libdir="${S}/src"
71 }
72
73 multilib_src_install() {
74         _emake install DESTDIR="${D}"
75 }
76
77 multilib_src_install_all() {
78         doman man/*
79         dodoc ChangeLog TODO
80
81         # move crap to / for multipath-tools #325355
82         gen_usr_ldscript -a aio
83
84         # This lib is a bare minimal shim on top of kernel syscalls.
85         export QA_DT_NEEDED=$(find "${ED}" -type f -name 'libaio.so.*' -printf '/%P\n')
86 }