scripts/build/companion_libs/121-isl.sh
author Cody Schafer <dev@codyps.com>
Fri May 09 19:13:49 2014 -0700 (2014-05-09)
changeset 3312 4876ff97e039
parent 3216 bfad02f03c75
permissions -rw-r--r--
cc/gcc: allow CC_EXTRA_CONFIG_ARRAY on baremetal

The final bare-metal compiler is built using the core backend.
Currently the core uses the CC_CORE_EXTRA_CONFIG_ARRAY variable.

While this works as supposed to, this can leave the user puzzled
in the menuconfig, since all he can see is the core options, not
the final options.

Only show the core options if any of the core passes are needed,
and use the final options in the core-backend if we're issuing
the bare-metal compiler.

Signed-off-by: Cody P Schafer <dev@codyps.com>
[yann.morin.1998@free.fr: hide core options if no core pass needed;
use final option in core backend if issuing the bare-metal compiler]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <22181e546ba746202489.1399688067@localhost>
Patchwork-Id: 347586
     1 # This file adds the functions to build the ISL library
     2 # Copyright 2009 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 do_isl_get() { :; }
     6 do_isl_extract() { :; }
     7 do_isl_for_build() { :; }
     8 do_isl_for_host() { :; }
     9 
    10 # Overide functions depending on configuration
    11 if [ "${CT_ISL}" = "y" ]; then
    12 
    13 # Download ISL
    14 do_isl_get() {
    15     CT_GetFile "isl-${CT_ISL_VERSION}"  \
    16         ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/ \
    17         http://mirrors.kernel.org/sources.redhat.com/gcc/infrastructure
    18 }
    19 
    20 # Extract ISL
    21 do_isl_extract() {
    22     CT_Extract "isl-${CT_ISL_VERSION}"
    23     CT_Patch "isl" "${CT_ISL_VERSION}"
    24 }
    25 
    26 # Build ISL for running on build
    27 # - always build statically
    28 # - we do not have build-specific CFLAGS
    29 # - install in build-tools prefix
    30 do_isl_for_build() {
    31     local -a isl_opts
    32     local isl_cflags
    33     local isl_cxxflags
    34 
    35     case "${CT_TOOLCHAIN_TYPE}" in
    36         native|cross)   return 0;;
    37     esac
    38 
    39     CT_DoStep INFO "Installing ISL for build"
    40     CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-build-${CT_BUILD}"
    41 
    42     isl_cflags="${CT_CFLAGS_FOR_BUILD}"
    43     isl_cxxflags="${CT_CFLAGS_FOR_BUILD}"
    44 
    45     isl_opts+=( "host=${CT_BUILD}" )
    46     isl_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    47     isl_opts+=( "cflags=${isl_cflags}" )
    48     isl_opts+=( "cxxflags=${isl_cxxflags}" )
    49     isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    50     do_isl_backend "${isl_opts[@]}"
    51 
    52     CT_Popd
    53     CT_EndStep
    54 }
    55 
    56 # Build ISL for running on host
    57 do_isl_for_host() {
    58     local -a isl_opts
    59     local isl_cflags
    60     local isl_cxxflags
    61 
    62     CT_DoStep INFO "Installing ISL for host"
    63     CT_mkdir_pushd "${CT_BUILD_DIR}/build-isl-host-${CT_HOST}"
    64 
    65     isl_cflags="${CT_CFLAGS_FOR_HOST}"
    66     isl_cxxflags="${CT_CFLAGS_FOR_HOST}"
    67 
    68     isl_opts+=( "host=${CT_HOST}" )
    69     isl_opts+=( "prefix=${CT_HOST_COMPLIBS_DIR}" )
    70     isl_opts+=( "cflags=${isl_cflags}" )
    71     isl_opts+=( "cxxflags=${isl_cxxflags}" )
    72     isl_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    73     do_isl_backend "${isl_opts[@]}"
    74 
    75     CT_Popd
    76     CT_EndStep
    77 }
    78 
    79 # Build ISL
    80 #     Parameter     : description               : type      : default
    81 #     host          : machine to run on         : tuple     : (none)
    82 #     prefix        : prefix to install into    : dir       : (none)
    83 #     cflags        : cflags to use             : string    : (empty)
    84 #     ldflags       : ldflags to use            : string    : (empty)
    85 do_isl_backend() {
    86     local host
    87     local prefix
    88     local cflags
    89     local cxxflags
    90     local ldflags
    91     local arg
    92 
    93     for arg in "$@"; do
    94         eval "${arg// /\\ }"
    95     done
    96 
    97     CT_DoLog EXTRA "Configuring ISL"
    98 
    99     CT_DoExecLog CFG                                \
   100     CFLAGS="${cflags}"                              \
   101     CXXFLAGS="${cxxflags}"                          \
   102     LDFLAGS="${ldflags}"                            \
   103     "${CT_SRC_DIR}/isl-${CT_ISL_VERSION}/configure" \
   104         --build=${CT_BUILD}                         \
   105         --host=${host}                              \
   106         --prefix="${prefix}"                        \
   107         --with-libgmp-prefix="${prefix}"            \
   108         --with-libgmpxx-prefix="${prefix}"          \
   109         --with-gmp-prefix="${prefix}"               \
   110         --disable-shared                            \
   111         --enable-static                             \
   112         --with-gmp=system                           \
   113         --with-gmp-prefix="${prefix}"               \
   114         --with-piplib=no                            \
   115         --with-clang=no
   116 
   117     CT_DoLog EXTRA "Building ISL"
   118     CT_DoExecLog ALL make ${JOBSFLAGS}
   119 
   120     if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
   121         CT_DoLog EXTRA "Checking ISL"
   122         CT_DoExecLog ALL make ${JOBSFLAGS} -s check
   123     fi
   124 
   125     CT_DoLog EXTRA "Installing ISL"
   126     CT_DoExecLog ALL make install
   127 }
   128 
   129 fi # CT_ISL