1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit multilib multilib-minimal toolchain-funcs
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"
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"
21 BDEPEND="test? ( dev-util/dejagnu )"
23 DOCS="ChangeLog* README.md"
26 "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
27 "${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
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
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."
48 multilib_src_configure() {
49 use userland_BSD && export HOST="${CHOST}"
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) \
58 multilib_src_install_all() {
59 find "${ED}" -name "*.la" -delete || die