scripts/build/companion_libs/mpc.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Tue Jul 31 22:27:29 2012 +0200 (2012-07-31)
changeset 3018 7776e8369284
parent 2929 22e495b7bee8
permissions -rw-r--r--
complibs/cloog: create missing m4 dir

Because we now patch configure.in and configure, the Makefile quicks
in a re-build rule as the source files are now more recent than the
bundled generated files, and that fails because the m4 directory
is missing, although on some systems where aclocal is not installed,
the re-build rule does nothing (except a warning).

Always create tht directory.

Reported-by: Per Arnold Blaasmo <per-arnold.blaasmo@atmel.com>
[Also thanks to Thomas De Schampheleire <patrickdepinguin@gmail.com>
for some digging works on this issue]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     1 # This file adds the functions to build the MPC library
     2 # Copyright 2009 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_mpc_get() { :; }
     6 do_mpc_extract() { :; }
     7 do_mpc_for_build() { :; }
     8 do_mpc_for_host() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_MPC}" = "y" ]; then
    12 
    13 # Download MPC
    14 do_mpc_get() {
    15     CT_GetFile "mpc-${CT_MPC_VERSION}" .tar.gz      \
    16         http://www.multiprecision.org/mpc/download
    17 }
    18 
    19 # Extract MPC
    20 do_mpc_extract() {
    21     CT_Extract "mpc-${CT_MPC_VERSION}"
    22     CT_Patch "mpc" "${CT_MPC_VERSION}"
    23 }
    24 
    25 # Build MPC for running on build
    26 # - always build statically
    27 # - we do not have build-specific CFLAGS
    28 # - install in build-tools prefix
    29 do_mpc_for_build() {
    30     local -a mpc_opts
    31 
    32     case "${CT_TOOLCHAIN_TYPE}" in
    33         native|cross)   return 0;;
    34     esac
    35 
    36     CT_DoStep INFO "Installing MPC for build"
    37     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-build-${CT_BUILD}"
    38 
    39     mpc_opts+=( "host=${CT_BUILD}" )
    40     mpc_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    41     do_mpc_backend "${mpc_opts[@]}"
    42 
    43     CT_Popd
    44     CT_EndStep
    45 }
    46 
    47 # Build MPC for running on host
    48 do_mpc_for_host() {
    49     local -a mpc_opts
    50 
    51     CT_DoStep INFO "Installing MPC for host"
    52     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mpc-host-${CT_HOST}"
    53 
    54     mpc_opts+=( "host=${CT_HOST}" )
    55     mpc_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    56     mpc_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    57     do_mpc_backend "${mpc_opts[@]}"
    58 
    59     CT_Popd
    60     CT_EndStep
    61 }
    62 
    63 # Build MPC
    64 #     Parameter     : description               : type      : default
    65 #     host          : machine to run on         : tuple     : (none)
    66 #     prefix        : prefix to install into    : dir       : (none)
    67 #     cflags        : host cflags to use        : string    : (empty)
    68 do_mpc_backend() {
    69     local host
    70     local prefix
    71     local cflags
    72     local arg
    73 
    74     for arg in "$@"; do
    75         eval "${arg// /\\ }"
    76     done
    77 
    78     CT_DoLog EXTRA "Configuring MPC"
    79 
    80     CT_DoExecLog CFG                                \
    81     CFLAGS="${cflags}"                              \
    82     "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
    83         --build=${CT_BUILD}                         \
    84         --host=${host}                              \
    85         --prefix="${prefix}"                        \
    86         --with-gmp="${prefix}"                      \
    87         --with-mpfr="${prefix}"                     \
    88         --disable-shared                            \
    89         --enable-static
    90 
    91     CT_DoLog EXTRA "Building MPC"
    92     CT_DoExecLog ALL make ${JOBSFLAGS}
    93 
    94     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
    95         CT_DoLog EXTRA "Checking MPC"
    96         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
    97     fi
    98 
    99     CT_DoLog EXTRA "Installing MPC"
   100     CT_DoExecLog ALL make install
   101 }
   102 
   103 fi # CT_MPC