2008-04-30 10:43:41 +00:00
|
|
|
# This file adds the functions to build the MPFR library
|
|
|
|
# Copyright 2008 Yann E. MORIN
|
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
do_mpfr_get() { :; }
|
|
|
|
do_mpfr_extract() { :; }
|
|
|
|
do_mpfr() { :; }
|
|
|
|
do_mpfr_target() { :; }
|
|
|
|
|
|
|
|
# Overide function depending on configuration
|
2010-02-17 22:50:49 +00:00
|
|
|
if [ "${CT_MPFR}" = "y" -o "${CT_MPFR_TARGET}" = "y" ]; then
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
# Download MPFR
|
|
|
|
do_mpfr_get() {
|
2009-01-04 14:25:58 +00:00
|
|
|
CT_GetFile "mpfr-${CT_MPFR_VERSION}" http://www.mpfr.org/mpfr-current/ \
|
2008-05-19 21:41:19 +00:00
|
|
|
http://www.mpfr.org/mpfr-${CT_MPFR_VERSION}/
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract MPFR
|
|
|
|
do_mpfr_extract() {
|
2009-01-05 23:02:43 +00:00
|
|
|
CT_Extract "mpfr-${CT_MPFR_VERSION}"
|
|
|
|
CT_Patch "mpfr-${CT_MPFR_VERSION}"
|
2008-04-30 10:43:41 +00:00
|
|
|
|
2008-06-19 21:54:57 +00:00
|
|
|
# OK, Gentoo have a sanity check that libtool.m4 and ltmain.sh have the
|
|
|
|
# same version number. Unfortunately, some tarballs of MPFR are not
|
|
|
|
# built sanely, and thus ./configure fails on Gentoo.
|
|
|
|
# See: http://sourceware.org/ml/crossgcc/2008-05/msg00080.html
|
|
|
|
# and: http://sourceware.org/ml/crossgcc/2008-06/msg00005.html
|
2008-06-20 10:58:45 +00:00
|
|
|
# This hack is not bad per se, but the MPFR guys would be better not to
|
2008-06-19 21:54:57 +00:00
|
|
|
# do that in the future...
|
2009-03-08 22:13:27 +00:00
|
|
|
# It seems that MPFR >= 2.4.0 do not need this...
|
|
|
|
case "${CT_MPFR_VERSION}" in
|
2010-04-10 20:45:36 +00:00
|
|
|
2.4.*)
|
2009-08-02 22:49:25 +00:00
|
|
|
CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
|
|
|
|
if [ ! -f .autoreconf.ct-ng ]; then
|
|
|
|
CT_DoLog DEBUG "Running autoreconf"
|
2010-04-09 19:04:24 +00:00
|
|
|
CT_DoExecLog ALL autoreconf -fi
|
2009-08-02 22:49:25 +00:00
|
|
|
touch .autoreconf.ct-ng
|
|
|
|
fi
|
|
|
|
CT_Popd
|
|
|
|
;;
|
2009-03-08 22:13:27 +00:00
|
|
|
1.*|2.0.*|2.1.*|2.2.*|2.3.*)
|
|
|
|
CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
|
|
|
|
if [ ! -f .autotools.ct-ng ]; then
|
|
|
|
CT_DoLog DEBUG "Re-building autotools files"
|
|
|
|
CT_DoExecLog ALL autoreconf -fi
|
|
|
|
# Starting with libtool-1.9f, config.{guess,sub} are no longer
|
|
|
|
# installed without -i, but starting with libtool-2.2.6, they
|
|
|
|
# are no longer removed without -i. Sight... Just use -i with
|
|
|
|
# libtool >=2
|
|
|
|
# See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
|
|
|
|
# and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
|
|
|
|
libtoolize_opt=
|
2009-04-20 21:10:03 +00:00
|
|
|
case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
|
2009-03-08 22:13:27 +00:00
|
|
|
0.*) ;;
|
|
|
|
1.*) ;;
|
|
|
|
*) libtoolize_opt=-i;;
|
|
|
|
esac
|
|
|
|
CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
|
|
|
|
touch .autotools.ct-ng
|
|
|
|
fi
|
|
|
|
CT_Popd
|
|
|
|
;;
|
|
|
|
esac
|
2008-06-20 09:17:06 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
if [ "${CT_MPFR}" = "y" ]; then
|
|
|
|
|
2008-06-20 09:17:06 +00:00
|
|
|
do_mpfr() {
|
2010-04-10 22:47:23 +00:00
|
|
|
local -a mpfr_opts
|
|
|
|
|
2008-06-20 09:17:06 +00:00
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-mpfr"
|
|
|
|
cd "${CT_BUILD_DIR}/build-mpfr"
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing MPFR"
|
2008-06-19 21:54:57 +00:00
|
|
|
|
2009-03-08 22:13:27 +00:00
|
|
|
# Under Cygwin, we can't build a thread-safe library
|
2009-02-07 20:11:13 +00:00
|
|
|
case "${CT_HOST}" in
|
2010-04-10 22:47:23 +00:00
|
|
|
*cygwin*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*mingw*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*darwin*) mpfr_opts+=( --disable-thread-safe );;
|
|
|
|
*) mpfr_opts+=( --enable-thread-safe );;
|
2009-02-07 20:11:13 +00:00
|
|
|
esac
|
|
|
|
|
2010-04-10 22:47:23 +00:00
|
|
|
if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
|
|
|
|
mpfr_opts+=( --enable-shared --disable-static )
|
|
|
|
else
|
|
|
|
mpfr_opts+=( --disable-shared --enable-static )
|
|
|
|
fi
|
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
CT_DoLog EXTRA "Configuring MPFR"
|
2009-03-08 22:13:27 +00:00
|
|
|
CC="${CT_HOST}-gcc" \
|
2009-01-04 14:25:58 +00:00
|
|
|
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
|
|
|
CT_DoExecLog ALL \
|
|
|
|
"${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_HOST} \
|
2010-04-11 09:10:06 +00:00
|
|
|
--prefix="${CT_COMPLIBS_DIR}" \
|
|
|
|
--with-gmp="${CT_COMPLIBS_DIR}" \
|
2010-04-10 22:47:23 +00:00
|
|
|
"${mpfr_opts[@]}"
|
2008-04-30 10:43:41 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building MPFR"
|
2008-07-14 15:15:40 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2008-04-30 10:43:41 +00:00
|
|
|
|
2010-04-10 21:42:28 +00:00
|
|
|
if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
|
2008-04-30 10:43:41 +00:00
|
|
|
CT_DoLog EXTRA "Checking MPFR"
|
2008-07-14 15:15:40 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS} -s check
|
2008-04-30 10:43:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing MPFR"
|
2008-07-14 15:15:40 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2008-04-30 10:43:41 +00:00
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
}
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
fi # CT_MPFR
|
|
|
|
|
|
|
|
if [ "${CT_MPFR_TARGET}" = "y" ]; then
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
do_mpfr_target() {
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-mpfr-target"
|
|
|
|
cd "${CT_BUILD_DIR}/build-mpfr-target"
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing MPFR for the target"
|
|
|
|
|
2009-02-07 20:11:13 +00:00
|
|
|
mpfr_opt=
|
2009-03-08 22:13:27 +00:00
|
|
|
# Under Cygwin, we can't build a thread-safe library
|
2009-02-07 20:11:13 +00:00
|
|
|
case "${CT_TARGET}" in
|
|
|
|
*-cygwin) mpfr_opt="--disable-thread-safe";;
|
|
|
|
*) mpfr_opt="--enable-thread-safe";;
|
|
|
|
esac
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
CT_DoLog EXTRA "Configuring MPFR"
|
2009-03-08 22:13:27 +00:00
|
|
|
CC="${CT_TARGET}-gcc" \
|
2009-01-04 14:25:58 +00:00
|
|
|
CFLAGS="${CT_CFLAGS_FOR_TARGET}" \
|
|
|
|
CT_DoExecLog ALL \
|
|
|
|
"${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--prefix=/usr \
|
2009-02-07 20:11:13 +00:00
|
|
|
${mpfr_opt} \
|
|
|
|
--disable-shared \
|
|
|
|
--enable-static \
|
2008-07-14 15:15:40 +00:00
|
|
|
--with-gmp="${CT_SYSROOT_DIR}/usr"
|
2008-06-20 15:16:43 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building MPFR"
|
2008-07-14 15:15:40 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2008-06-20 15:16:43 +00:00
|
|
|
|
|
|
|
# Not possible to check MPFR while X-compiling
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing MPFR"
|
2008-07-14 15:15:40 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
|
2008-06-20 15:16:43 +00:00
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
fi # CT_MPFR_TARGET
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
fi # CT_MPFR || CT_MPFR_TARGET
|