Merge remote-tracking branch 'github/pr/264'.
[gentoo.git] / dev-libs / mpfr / mpfr-3.1.1.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="3"
6
7 # NOTE: we cannot depend on autotools here starting with gcc-4.3.x
8 inherit eutils multilib
9
10 MY_PV=${PV/_p*}
11 MY_P=${PN}-${MY_PV}
12 PLEVEL=${PV/*p}
13 DESCRIPTION="library for multiple-precision floating-point computations with exact rounding"
14 HOMEPAGE="http://www.mpfr.org/"
15 SRC_URI="http://www.mpfr.org/mpfr-${MY_PV}/${MY_P}.tar.xz"
16
17 LICENSE="LGPL-2.1"
18 SLOT="0"
19 KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
20 IUSE="static-libs"
21
22 RDEPEND=">=dev-libs/gmp-4.1.4-r2[static-libs?]"
23 DEPEND="${RDEPEND}"
24
25 S=${WORKDIR}/${MY_P}
26
27 src_prepare() {
28         [[ ${PLEVEL} == ${PV} ]] && return 0
29         for ((i=1; i<=PLEVEL; ++i)) ; do
30                 patch=patch$(printf '%02d' ${i})
31                 if [[ -f ${FILESDIR}/${MY_PV}/${patch} ]] ; then
32                         epatch "${FILESDIR}"/${MY_PV}/${patch}
33                 elif [[ -f ${DISTDIR}/${PN}-${MY_PV}_p${i} ]] ; then
34                         epatch "${DISTDIR}"/${PN}-${MY_PV}_p${i}
35                 else
36                         ewarn "${DISTDIR}/${PN}-${MY_PV}_p${i}"
37                         die "patch ${i} missing - please report to bugs.gentoo.org"
38                 fi
39         done
40         sed -i '/if test/s:==:=:' configure #261016
41         find . -type f -print0 | xargs -0 touch -r configure
42 }
43
44 src_configure() {
45         econf \
46                 --docdir=/usr/share/doc/${PF} \
47                 $(use_enable static-libs static)
48 }
49
50 src_install() {
51         emake install DESTDIR="${D}" || die
52         use static-libs || rm -f "${D}"/usr/$(get_libdir)/libmpfr.la
53
54         # clean up html/license install
55         pushd "${D}"/usr/share/doc/${PF} >/dev/null
56         dohtml *.html && rm COPYING* *.html || die
57         popd >/dev/null
58         # some, but not all, are already installed
59         dodoc AUTHORS BUGS ChangeLog NEWS README TODO
60         prepalldocs
61 }
62
63 pkg_preinst() {
64         preserve_old_lib /usr/$(get_libdir)/libmpfr.so.1
65 }
66
67 pkg_postinst() {
68         preserve_old_lib_notify /usr/$(get_libdir)/libmpfr.so.1
69 }