dev-libs/liborcus: Fix bashisms in configure.ac, --disable-static
[gentoo.git] / dev-libs / libaio / libaio-0.3.110.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils multilib-minimal toolchain-funcs flag-o-matic usr-ldscript
7
8 DESCRIPTION="Asynchronous input/output library that uses the kernels native interface"
9 HOMEPAGE="http://lse.sourceforge.net/io/aio.html"
10 SRC_URI="mirror://debian/pool/main/liba/${PN}/${PN}_${PV}.orig.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="LGPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux"
15 IUSE="static-libs test"
16 RESTRICT="!test? ( test )"
17
18 src_prepare() {
19         epatch \
20                 "${FILESDIR}"/${PN}-0.3.109-install.patch \
21                 "${FILESDIR}"/${PN}-0.3.109-x32.patch \
22                 "${FILESDIR}"/${PN}-0.3.109-testcase-8.patch \
23                 "${FILESDIR}"/${PN}-0.3.110-cppflags.patch \
24                 "${FILESDIR}"/${PN}-0.3.110-optional-werror.patch \
25                 "${FILESDIR}"/${PN}-0.3.110-link-stdlib.patch #558406
26
27         local sed_args=(
28                 -e "/^prefix=/s:/usr:${EPREFIX}/usr:"
29                 -e '/^libdir=/s:lib$:$(ABI_LIBDIR):'
30         )
31         if ! use static-libs; then
32                 sed_args+=( -e '/\tinstall .*\/libaio.a/d' )
33                 # Tests require the static library to be built.
34                 use test || sed_args+=( -e '/^all_targets +=/s/ libaio.a//' )
35         fi
36         sed -i "${sed_args[@]}" src/Makefile Makefile || die
37
38         multilib_copy_sources
39 }
40
41 multilib_src_configure() {
42         if use arm ; then
43                 # When building for thumb, we can't allow frame pointers.
44                 # http://crbug.com/464517
45                 if $(tc-getCPP) ${CFLAGS} ${CPPFLAGS} - <<<$'#ifndef __thumb__\n#error\n#endif' >&/dev/null ; then
46                         append-flags -fomit-frame-pointer
47                 fi
48         fi
49 }
50
51 _emake() {
52         CC=$(tc-getCC) \
53         AR=$(tc-getAR) \
54         RANLIB=$(tc-getRANLIB) \
55         ABI_LIBDIR=$(get_libdir) \
56         CFLAGS_WERROR= \
57         emake "$@"
58 }
59
60 multilib_src_compile() {
61         _emake
62 }
63
64 multilib_src_test() {
65         mkdir -p testdir || die
66         # 'make check' breaks with sandbox, 'make partcheck' works
67         _emake partcheck prefix="${S}/src" libdir="${S}/src"
68 }
69
70 multilib_src_install() {
71         _emake install DESTDIR="${D}"
72 }
73
74 multilib_src_install_all() {
75         doman man/*
76         dodoc ChangeLog TODO
77
78         # move crap to / for multipath-tools #325355
79         gen_usr_ldscript -a aio
80
81         # This lib is a bare minimal shim on top of kernel syscalls.
82         export QA_DT_NEEDED=$(find "${ED}" -type f -name 'libaio.so.*' -printf '/%P\n')
83 }