scripts/build/debug/200-duma.sh
author Cody Schafer <dev@codyps.com>
Fri May 09 19:13:49 2014 -0700 (2014-05-09)
changeset 3312 4876ff97e039
parent 2992 e31a3bfdf863
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 # Build script for D.U.M.A.
     2 
     3 do_debug_duma_get() {
     4     local dl_base
     5 
     6     dl_base="http://downloads.sourceforge.net/project/duma/duma"
     7     dl_base+="/${CT_DUMA_VERSION//_/.}"
     8 
     9     # Downloading an non-existing file from sourceforge will give you an
    10     # HTML file containing an error message, instead of returning a 404.
    11     # Sigh...
    12     CT_GetFile "duma_${CT_DUMA_VERSION}" .tar.gz "${dl_base}"
    13     # Downloading from sourceforge may leave garbage, cleanup
    14     CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
    15 }
    16 
    17 do_debug_duma_extract() {
    18     CT_Extract "duma_${CT_DUMA_VERSION}"
    19     CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}"
    20     CT_Patch nochdir "duma" "${CT_DUMA_VERSION}"
    21     CT_Popd
    22 }
    23 
    24 do_debug_duma_build() {
    25     CT_DoStep INFO "Installing D.U.M.A."
    26     CT_DoLog EXTRA "Copying sources"
    27     cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
    28     CT_Pushd "${CT_BUILD_DIR}/build-duma"
    29 
    30     DUMA_CPP=
    31     [ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1
    32 
    33     # The shared library needs some love: some version have libduma.so.0.0,
    34     # while others have libduma.so.0.0.0
    35     duma_so=$(make -n -p 2>&1 |grep -E '^libduma.so[^:]*:' |head -n 1 |cut -d : -f 1)
    36 
    37     libs=
    38     [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
    39     [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} ${duma_so}"
    40     libs="${libs# }"
    41     CT_DoLog EXTRA "Building libraries '${libs}'"
    42     CT_DoExecLog ALL                    \
    43     make HOSTCC="${CT_BUILD}-gcc"       \
    44          CC="${CT_TARGET}-gcc"          \
    45          CXX="${CT_TARGET}-gcc"         \
    46          RANLIB="${CT_TARGET}-ranlib"   \
    47          DUMA_CPP="${DUMA_CPP}"         \
    48          ${libs}
    49     CT_DoLog EXTRA "Installing libraries '${libs}'"
    50     CT_DoExecLog ALL install -m 644 ${libs} "${CT_SYSROOT_DIR}/usr/lib"
    51     if [ "${CT_DUMA_SO}" = "y" ]; then
    52         CT_DoLog EXTRA "Installing shared library link"
    53         ln -vsf ${duma_so} "${CT_SYSROOT_DIR}/usr/lib/libduma.so"   2>&1 |CT_DoLog ALL
    54         CT_DoLog EXTRA "Installing wrapper script"
    55         mkdir -p "${CT_DEBUGROOT_DIR}/usr/bin"
    56         # Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A.
    57         sed -r -e 's:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/'"${duma_so}"':;'   \
    58             "${CT_LIB_DIR}/scripts/build/debug/duma.in"                     \
    59             >"${CT_DEBUGROOT_DIR}/usr/bin/duma"
    60         chmod 755 "${CT_DEBUGROOT_DIR}/usr/bin/duma"
    61     fi
    62 
    63     CT_Popd
    64     CT_EndStep
    65 }
    66