2008-04-30 10:43:41 +00:00
|
|
|
# This file adds the functions to build the GMP 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_gmp_get() { :; }
|
|
|
|
do_gmp_extract() { :; }
|
2011-07-24 21:53:14 +00:00
|
|
|
do_gmp_for_build() { :; }
|
2011-07-17 16:56:30 +00:00
|
|
|
do_gmp_for_host() { :; }
|
2015-11-05 23:49:19 +00:00
|
|
|
do_gmp_for_target() { :; }
|
2008-06-20 15:16:43 +00:00
|
|
|
|
|
|
|
# Overide functions depending on configuration
|
2010-08-23 21:18:49 +00:00
|
|
|
if [ "${CT_GMP}" = "y" ]; then
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
# Download GMP
|
|
|
|
do_gmp_get() {
|
2014-12-08 23:03:08 +00:00
|
|
|
CT_GetFile "gmp-${CT_GMP_VERSION}" \
|
|
|
|
https://gmplib.org/download/gmp \
|
|
|
|
{http,ftp,https}://ftp.gnu.org/gnu/gmp
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract GMP
|
|
|
|
do_gmp_extract() {
|
2009-01-05 23:02:43 +00:00
|
|
|
CT_Extract "gmp-${CT_GMP_VERSION}"
|
2010-04-11 21:18:10 +00:00
|
|
|
CT_Patch "gmp" "${CT_GMP_VERSION}"
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
|
|
|
|
2011-07-24 21:53:14 +00:00
|
|
|
# Build GMP for running on build
|
|
|
|
# - always build statically
|
|
|
|
# - we do not have build-specific CFLAGS
|
|
|
|
# - install in build-tools prefix
|
|
|
|
do_gmp_for_build() {
|
|
|
|
local -a gmp_opts
|
|
|
|
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
native|cross) return 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing GMP for build"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
gmp_opts+=( "host=${CT_BUILD}" )
|
|
|
|
gmp_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
gmp_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
|
|
gmp_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
2011-07-24 21:53:14 +00:00
|
|
|
do_gmp_backend "${gmp_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
# Build GMP for running on host
|
|
|
|
do_gmp_for_host() {
|
|
|
|
local -a gmp_opts
|
2008-04-30 10:43:41 +00:00
|
|
|
|
2011-07-17 16:56:30 +00:00
|
|
|
CT_DoStep INFO "Installing GMP for host"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
|
|
|
|
|
|
|
|
gmp_opts+=( "host=${CT_HOST}" )
|
2011-07-25 17:04:17 +00:00
|
|
|
gmp_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
gmp_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
2011-07-17 16:56:30 +00:00
|
|
|
do_gmp_backend "${gmp_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build GMP
|
|
|
|
# Parameter : description : type : default
|
|
|
|
# host : machine to run on : tuple : (none)
|
|
|
|
# prefix : prefix to install into : dir : (none)
|
2012-11-16 14:25:57 +00:00
|
|
|
# cflags : cflags to use : string : (empty)
|
|
|
|
# ldflags : ldflags to use : string : (empty)
|
2011-07-17 16:56:30 +00:00
|
|
|
do_gmp_backend() {
|
|
|
|
local host
|
|
|
|
local prefix
|
|
|
|
local cflags
|
2012-11-16 14:25:57 +00:00
|
|
|
local ldflags
|
2011-07-17 16:56:30 +00:00
|
|
|
local arg
|
2014-12-23 21:28:26 +00:00
|
|
|
local -a extra_config
|
2011-07-17 16:56:30 +00:00
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
2008-04-30 10:43:41 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring GMP"
|
2009-05-05 22:04:20 +00:00
|
|
|
|
2014-12-23 21:28:26 +00:00
|
|
|
if [ ! "${CT_GMP_5_0_2_or_later}" = "y" ]; then
|
|
|
|
extra_config+=("--enable-mpbsd")
|
|
|
|
fi
|
|
|
|
|
2010-10-22 20:02:57 +00:00
|
|
|
CT_DoExecLog CFG \
|
2011-07-17 16:56:30 +00:00
|
|
|
CFLAGS="${cflags} -fexceptions" \
|
2012-11-16 14:25:57 +00:00
|
|
|
LDFLAGS="${ldflags}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
2009-01-04 14:25:58 +00:00
|
|
|
"${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
2011-07-17 16:56:30 +00:00
|
|
|
--host=${host} \
|
|
|
|
--prefix="${prefix}" \
|
2009-05-05 22:04:20 +00:00
|
|
|
--enable-fft \
|
2010-04-10 22:47:23 +00:00
|
|
|
--enable-cxx \
|
2011-04-06 20:30:57 +00:00
|
|
|
--disable-shared \
|
2014-12-23 21:28:26 +00:00
|
|
|
--enable-static \
|
|
|
|
"${extra_config}"
|
2008-04-30 10:43:41 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building GMP"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
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 GMP"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} -s check
|
2008-04-30 10:43:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing GMP"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2008-04-30 10:43:41 +00:00
|
|
|
}
|
2008-04-30 16:38:06 +00:00
|
|
|
|
2010-02-17 22:50:49 +00:00
|
|
|
fi # CT_GMP
|