| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/dev-libs/gmp/gmp-5.0.4.ebuild,v 1.1 2012/02/10 17:26:19 vapier Exp $ |
| 4 |
|
| 5 |
inherit flag-o-matic eutils libtool unpacker toolchain-funcs |
| 6 |
|
| 7 |
MY_PV=${PV/_p*} |
| 8 |
MY_P=${PN}-${MY_PV} |
| 9 |
PLEVEL=${PV/*p} |
| 10 |
DESCRIPTION="Library for arithmetic on arbitrary precision integers, rational numbers, and floating-point numbers" |
| 11 |
HOMEPAGE="http://gmplib.org/" |
| 12 |
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz |
| 13 |
doc? ( http://gmplib.org/${PN}-man-${MY_PV}.pdf )" |
| 14 |
|
| 15 |
LICENSE="LGPL-3" |
| 16 |
SLOT="0" |
| 17 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
| 18 |
IUSE="doc cxx static-libs" |
| 19 |
|
| 20 |
DEPEND="sys-devel/m4 |
| 21 |
app-arch/xz-utils" |
| 22 |
RDEPEND="" |
| 23 |
|
| 24 |
S=${WORKDIR}/${MY_P} |
| 25 |
|
| 26 |
src_unpack() { |
| 27 |
unpacker_src_unpack |
| 28 |
cd "${S}" |
| 29 |
[[ -d ${FILESDIR}/${PV} ]] && EPATCH_SUFFIX="diff" EPATCH_FORCE="yes" epatch "${FILESDIR}"/${PV} |
| 30 |
epatch "${FILESDIR}"/${PN}-4.1.4-noexecstack.patch |
| 31 |
epatch "${FILESDIR}"/${PN}-5.0.2-x32-support.patch |
| 32 |
|
| 33 |
# disable -fPIE -pie in the tests for x86 #236054 |
| 34 |
if use x86 && gcc-specs-pie ; then |
| 35 |
epatch "${FILESDIR}"/${PN}-5.0.1-x86-nopie-tests.patch |
| 36 |
fi |
| 37 |
|
| 38 |
# note: we cannot run autotools here as gcc depends on this package |
| 39 |
elibtoolize |
| 40 |
|
| 41 |
# GMP uses the "ABI" env var during configure as does Gentoo (econf). |
| 42 |
# So, to avoid patching the source constantly, wrap things up. |
| 43 |
mv configure configure.wrapped || die |
| 44 |
cat <<-\EOF > configure |
| 45 |
#!/bin/sh |
| 46 |
exec env ABI="$GMPABI" "${0}.wrapped" "$@" |
| 47 |
EOF |
| 48 |
chmod a+rx configure |
| 49 |
} |
| 50 |
|
| 51 |
src_compile() { |
| 52 |
# Because of our 32-bit userland, 1.0 is the only HPPA ABI that works |
| 53 |
# http://gmplib.org/manual/ABI-and-ISA.html#ABI-and-ISA (bug #344613) |
| 54 |
if [[ ${CHOST} == hppa2.0-* ]] ; then |
| 55 |
export GMPABI="1.0" |
| 56 |
fi |
| 57 |
|
| 58 |
# ABI mappings (needs all architectures supported) |
| 59 |
case ${ABI} in |
| 60 |
32|x86) GMPABI=32;; |
| 61 |
64|amd64|n64) GMPABI=64;; |
| 62 |
[onx]32) GMPABI=${ABI};; |
| 63 |
esac |
| 64 |
export GMPABI |
| 65 |
|
| 66 |
tc-export CC |
| 67 |
econf \ |
| 68 |
--localstatedir=/var/state/gmp \ |
| 69 |
--disable-mpbsd \ |
| 70 |
$(use_enable cxx) \ |
| 71 |
$(use_enable static-libs static) \ |
| 72 |
|| die |
| 73 |
|
| 74 |
emake || die |
| 75 |
} |
| 76 |
|
| 77 |
src_install() { |
| 78 |
emake DESTDIR="${D}" install || die |
| 79 |
|
| 80 |
# should be a standalone lib |
| 81 |
rm -f "${D}"/usr/$(get_libdir)/libgmp.la |
| 82 |
# this requires libgmp |
| 83 |
local la="${D}/usr/$(get_libdir)/libgmpxx.la" |
| 84 |
use static-libs \ |
| 85 |
&& sed -i 's:/[^ ]*/libgmp.la:-lgmp:' "${la}" \ |
| 86 |
|| rm -f "${la}" |
| 87 |
|
| 88 |
dodoc AUTHORS ChangeLog NEWS README |
| 89 |
dodoc doc/configuration doc/isa_abi_headache |
| 90 |
dohtml -r doc |
| 91 |
|
| 92 |
use doc && cp "${DISTDIR}"/gmp-man-${MY_PV}.pdf "${D}"/usr/share/doc/${PF}/ |
| 93 |
} |
| 94 |
|
| 95 |
pkg_preinst() { |
| 96 |
preserve_old_lib /usr/$(get_libdir)/libgmp.so.3 |
| 97 |
} |
| 98 |
|
| 99 |
pkg_postinst() { |
| 100 |
preserve_old_lib_notify /usr/$(get_libdir)/libgmp.so.3 |
| 101 |
} |