dev-libs/libnfc: bump
[gentoo.git] / dev-libs / libaio / libaio-0.3.111.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://pagure.io/${PN}/archive/${P}/${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.109-install.patch
24         "${FILESDIR}"/${PN}-0.3.110-cppflags.patch
25         "${FILESDIR}"/${PN}-0.3.111-optional-werror.patch
26         "${FILESDIR}"/${PN}-0.3.110-link-stdlib.patch #558406
27 )
28
29 src_prepare() {
30         default
31
32         local sed_args=(
33                 -e "/^prefix=/s:/usr:${EPREFIX}/usr:"
34                 -e '/^libdir=/s:lib$:$(ABI_LIBDIR):'
35         )
36         if ! use static-libs; then
37                 sed_args+=( -e '/\tinstall .*\/libaio.a/d' )
38                 # Tests require the static library to be built.
39                 use test || sed_args+=( -e '/^all_targets +=/s/ libaio.a//' )
40         fi
41         sed -i "${sed_args[@]}" src/Makefile Makefile || die
42
43         multilib_copy_sources
44 }
45
46 multilib_src_configure() {
47         if use arm ; then
48                 # When building for thumb, we can't allow frame pointers.
49                 # http://crbug.com/464517
50                 if $(tc-getCPP) ${CFLAGS} ${CPPFLAGS} - <<<$'#ifndef __thumb__\n#error\n#endif' >&/dev/null ; then
51                         append-flags -fomit-frame-pointer
52                 fi
53         fi
54 }
55
56 _emake() {
57         CC=$(tc-getCC) \
58         AR=$(tc-getAR) \
59         RANLIB=$(tc-getRANLIB) \
60         ABI_LIBDIR=$(get_libdir) \
61         CFLAGS_WERROR= \
62         emake "$@"
63 }
64
65 multilib_src_compile() {
66         _emake
67 }
68
69 multilib_src_test() {
70         mkdir -p testdir || die
71         # 'make check' breaks with sandbox, 'make partcheck' works
72         _emake partcheck prefix="${S}/src" libdir="${S}/src"
73 }
74
75 multilib_src_install() {
76         _emake install DESTDIR="${D}"
77 }
78
79 multilib_src_install_all() {
80         doman man/*
81         dodoc ChangeLog TODO
82
83         # move crap to / for multipath-tools #325355
84         gen_usr_ldscript -a aio
85
86         # This lib is a bare minimal shim on top of kernel syscalls.
87         export QA_DT_NEEDED=$(find "${ED}" -type f -name 'libaio.so.*' -printf '/%P\n')
88 }