scripts/build/debug/200-duma.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Oct 24 15:40:58 2008 +0000 (2008-10-24)
changeset 973 6709d9a12f69
parent 711 c9bb5606a265
child 1041 2573519c00d6
permissions -rw-r--r--
Make ltrace finally build:
- copy sources to build directory, as it does not build out-of-tree
- add a patch to make it build for non *-linux-gnu host tuples
- add a patch to make it cross-build correctly

/trunk/patches/ltrace/0.4/100-fix-build-with-exotic-linux-host-OS.patch | 26 26 0 0 +++
/trunk/patches/ltrace/0.4/110-allow-cross-compile.patch | 89 89 0 0 ++++++++++
/trunk/scripts/build/debug/400-ltrace.sh | 5 3 2 0 +
3 files changed, 118 insertions(+), 2 deletions(-)
     1 # Build script for D.U.M.A.
     2 
     3 do_print_filename() {
     4     echo "duma_${CT_DUMA_VERSION}"
     5 }
     6 
     7 do_debug_duma_get() {
     8     CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/
     9     # D.U.M.A. doesn't separate its name from its version with a dash,
    10     # but with an underscore. Create a link so that crosstool-NG can
    11     # work correctly:
    12     CT_Pushd "${CT_TARBALLS_DIR}"
    13     duma_ext=$(CT_GetFileExtension "duma_${CT_DUMA_VERSION}")
    14     rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
    15     ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
    16     # Downloading from sourceforge leaves garbage, cleanup
    17     rm -f showfiles.php\?group_id\=*
    18     CT_Popd
    19 }
    20 
    21 do_debug_duma_extract() {
    22     CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
    23     cd "${CT_SRC_DIR}"
    24     rm -f "duma-${CT_DUMA_VERSION}"
    25     ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
    26 }
    27 
    28 do_debug_duma_build() {
    29     CT_DoStep INFO "Installing D.U.M.A."
    30     CT_DoLog EXTRA "Copying sources"
    31     cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
    32     CT_Pushd "${CT_BUILD_DIR}/build-duma"
    33 
    34     DUMA_CPP=
    35     [ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1
    36 
    37     # The shared library needs some love: some version have libduma.so.0.0,
    38     # while others have libduma.so.0.0.0
    39     duma_so=$(make -n -p 2>&1 |egrep '^libduma.so[^:]*:' |head -n 1 |cut -d : -f 1)
    40 
    41     libs=
    42     [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
    43     [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} ${duma_so}"
    44     libs="${libs# }"
    45     CT_DoLog EXTRA "Building libraries '${libs}'"
    46     CT_DoExecLog ALL                    \
    47     make HOSTCC="${CT_CC_NATIVE}"       \
    48          HOSTCXX="${CT_CC_NATIVE}"      \
    49          CC="${CT_TARGET}-gcc"          \
    50          CXX="${CT_TARGET}-gcc"         \
    51          RANLIB="${CT_TARGET}-ranlib"   \
    52          DUMA_CPP="${DUMA_CPP}"         \
    53          ${libs}
    54     CT_DoLog EXTRA "Installing libraries '${libs}'"
    55     CT_DoExecLog ALL install -m 644 ${libs} "${CT_SYSROOT_DIR}/usr/lib"
    56     if [ "${CT_DUMA_SO}" = "y" ]; then
    57         CT_DoLog EXTRA "Installing shared library link"
    58         ln -vsf ${duma_so} "${CT_SYSROOT_DIR}/usr/lib/libduma.so"   2>&1 |CT_DoLog ALL
    59         CT_DoLog EXTRA "Installing wrapper script"
    60         mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin"
    61         # Install a simpler, smaller, safer wrapper than the one provided by D.U.M.A.
    62         sed -r -e 's:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/'"${duma_so}"':;'   \
    63             "${CT_LIB_DIR}/scripts/build/debug/duma.in"                     \
    64             >"${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
    65         chmod 755 "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"
    66     fi
    67 
    68     CT_Popd
    69     CT_EndStep
    70 }
    71