1.1 --- a/scripts/build/companion_libs/gmp.sh Wed Apr 06 22:30:57 2011 +0200
1.2 +++ b/scripts/build/companion_libs/gmp.sh Sun Jul 17 18:56:30 2011 +0200
1.3 @@ -4,7 +4,7 @@
1.4
1.5 do_gmp_get() { :; }
1.6 do_gmp_extract() { :; }
1.7 -do_gmp() { :; }
1.8 +do_gmp_for_host() { :; }
1.9
1.10 # Overide functions depending on configuration
1.11 if [ "${CT_GMP}" = "y" ]; then
1.12 @@ -20,20 +20,45 @@
1.13 CT_Patch "gmp" "${CT_GMP_VERSION}"
1.14 }
1.15
1.16 -do_gmp() {
1.17 - mkdir -p "${CT_BUILD_DIR}/build-gmp"
1.18 - cd "${CT_BUILD_DIR}/build-gmp"
1.19 +# Build GMP for running on host
1.20 +do_gmp_for_host() {
1.21 + local -a gmp_opts
1.22
1.23 - CT_DoStep INFO "Installing GMP"
1.24 + CT_DoStep INFO "Installing GMP for host"
1.25 + CT_mkdir_pushd "${CT_BUILD_DIR}/build-gmp-host-${CT_HOST}"
1.26 +
1.27 + gmp_opts+=( "host=${CT_HOST}" )
1.28 + gmp_opts+=( "prefix=${CT_COMPLIBS_DIR}" )
1.29 + gmp_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
1.30 + do_gmp_backend "${gmp_opts[@]}"
1.31 +
1.32 + CT_Popd
1.33 + CT_EndStep
1.34 +}
1.35 +
1.36 +# Build GMP
1.37 +# Parameter : description : type : default
1.38 +# host : machine to run on : tuple : (none)
1.39 +# prefix : prefix to install into : dir : (none)
1.40 +# cflags : host cflags to use : string : (empty)
1.41 +do_gmp_backend() {
1.42 + local host
1.43 + local prefix
1.44 + local cflags
1.45 + local arg
1.46 +
1.47 + for arg in "$@"; do
1.48 + eval "${arg// /\\ }"
1.49 + done
1.50
1.51 CT_DoLog EXTRA "Configuring GMP"
1.52
1.53 CT_DoExecLog CFG \
1.54 - CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions" \
1.55 + CFLAGS="${cflags} -fexceptions" \
1.56 "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
1.57 --build=${CT_BUILD} \
1.58 - --host=${CT_HOST} \
1.59 - --prefix="${CT_COMPLIBS_DIR}" \
1.60 + --host=${host} \
1.61 + --prefix="${prefix}" \
1.62 --enable-fft \
1.63 --enable-mpbsd \
1.64 --enable-cxx \
1.65 @@ -50,8 +75,6 @@
1.66
1.67 CT_DoLog EXTRA "Installing GMP"
1.68 CT_DoExecLog ALL make install
1.69 -
1.70 - CT_EndStep
1.71 }
1.72
1.73 fi # CT_GMP