dev-libs/libffi: bump up to 3.3_rc2
[gentoo.git] / dev-libs / libffi / libffi-3.3_rc1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 inherit multilib multilib-minimal toolchain-funcs
6
7 MY_PV=${PV/_rc/-rc}
8 MY_P=${PN}-${MY_PV}
9
10 DESCRIPTION="a portable, high level programming interface to various calling conventions"
11 HOMEPAGE="https://sourceware.org/libffi/"
12 SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
13
14 LICENSE="MIT"
15 SLOT="0/7" # SONAME=libffi.so.7
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 IUSE="debug pax_kernel static-libs test"
18
19 RDEPEND=""
20 DEPEND=""
21 BDEPEND="test? ( dev-util/dejagnu )"
22
23 DOCS="ChangeLog* README.md"
24
25 PATCHES=(
26         "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
27         "${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
28 )
29
30 S=${WORKDIR}/${MY_P}
31
32 ECONF_SOURCE=${S}
33
34 pkg_setup() {
35         # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
36         if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
37                 local base="${T}"/conftest
38                 echo 'int main() { }' > "${base}".c
39                 $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
40                 if [ $? -eq 0 ]; then
41                         eerror "The linker reported linking against -lffi to be working while it shouldn't have."
42                         eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
43                         die "The system is in inconsistent state with unknown libffi installed."
44                 fi
45         fi
46 }
47
48 multilib_src_configure() {
49         use userland_BSD && export HOST="${CHOST}"
50         econf \
51                 --includedir="${EPREFIX}"/usr/$(get_libdir)/${P}/include \
52                 --disable-multi-os-directory \
53                 $(use_enable static-libs static) \
54                 $(use_enable pax_kernel pax_emutramp) \
55                 $(use_enable debug)
56 }
57
58 multilib_src_install_all() {
59         find "${ED}" -name "*.la" -delete || die
60         einstalldocs
61 }