Merge media-sound/spotify: Fix homepage URL
[gentoo.git] / dev-libs / libffi / libffi-3.0.13-r1.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit eutils libtool multilib toolchain-funcs multilib-minimal
7
8 DESCRIPTION="a portable, high level programming interface to various calling conventions"
9 HOMEPAGE="http://sourceware.org/libffi/"
10 SRC_URI="ftp://sourceware.org/pub/${PN}/${P}.tar.gz"
11
12 LICENSE="MIT"
13 SLOT="0"
14 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15 IUSE="debug pax_kernel static-libs test"
16
17 RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r1
18                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
19 DEPEND="test? ( dev-util/dejagnu )"
20
21 DOCS="ChangeLog* README"
22
23 ECONF_SOURCE=${S}
24
25 pkg_setup() {
26         # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
27         if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
28                 local base="${T}"/conftest
29                 echo 'int main() { }' > "${base}".c
30                 $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
31                 if [ $? -eq 0 ]; then
32                         eerror "The linker reported linking against -lffi to be working while it shouldn't have."
33                         eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
34                         die "The system is in inconsistent state with unknown libffi installed."
35                 fi
36         fi
37 }
38
39 src_prepare() {
40         sed -i 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
41         epatch "${FILESDIR}"/${P}-emutramp_pax_proc.patch #457194
42         epatch_user
43         elibtoolize
44 }
45
46 multilib_src_configure() {
47         use userland_BSD && export HOST="${CHOST}"
48         econf \
49                 $(use_enable static-libs static) \
50                 $(use_enable pax_kernel pax_emutramp) \
51                 $(use_enable debug)
52 }
53
54 multilib_src_install_all() {
55         prune_libtool_files
56         einstalldocs
57 }
58
59 pkg_preinst() {
60         preserve_old_lib /usr/$(get_libdir)/${PN}$(get_libname 5)
61 }
62
63 pkg_postinst() {
64         preserve_old_lib_notify /usr/$(get_libdir)/${PN}$(get_libname 5)
65 }