scripts/build/debug/400-ltrace.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Mar 06 16:05:20 2010 +0100 (2010-03-06)
changeset 1820 55adc838cd68
parent 1688 ffdf4dc4b582
child 1821 57c71b197ee6
permissions -rw-r--r--
debug/ltrace: fix building on x86

ltrace uses i386 and x86_64, whereas crosstool-NG use x86 for both cases.
Fix that by detecting what bitness we're building for, and pass appropriate
i386 or x86_64 to ltrace's configure.
     1 # Build script for ltrace
     2 
     3 do_debug_ltrace_get() {
     4     CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" .tar.gz               \
     5                {ftp,http}://ftp.de.debian.org/debian/pool/main/l/ltrace/
     6     # Create a link so that the following steps are easier to do:
     7     CT_Pushd "${CT_TARBALLS_DIR}"
     8     ltrace_ext=$(CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig")
     9     ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}"              \
    10            "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}"
    11     CT_Popd
    12 }
    13 
    14 do_debug_ltrace_extract() {
    15     CT_Extract "ltrace-${CT_LTRACE_VERSION}"
    16     CT_Patch "ltrace-${CT_LTRACE_VERSION}"
    17     # ltrace uses ppc instead of powerpc for the arch name
    18     # create a symlink to get it to build for powerpc
    19     CT_Pushd "${CT_SRC_DIR}/ltrace-${CT_LTRACE_VERSION}/sysdeps/linux-gnu"
    20     CT_DoExecLog ALL ln -sf ppc powerpc
    21     CT_Popd
    22 }
    23 
    24 do_debug_ltrace_build() {
    25     local ltrace_host
    26 
    27     CT_DoStep INFO "Installing ltrace"
    28 
    29     CT_DoLog EXTRA "Copying sources to build dir"
    30     CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace-${CT_LTRACE_VERSION}" \
    31                             "${CT_BUILD_DIR}/build-ltrace"
    32     CT_Pushd "${CT_BUILD_DIR}/build-ltrace"
    33 
    34     CT_DoLog EXTRA "Configuring ltrace"
    35     # ltrace-0.5.3, and later, don't use GNU Autotools configure script anymore
    36     if [ "${CT_LTRACE_0_5_3_or_later}" = "y" ]; then
    37         case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
    38             x86:32) ltrace_host="i386";;
    39             x86:64) ltrace_host="x86_64";;
    40             *)      ltrace_host="${CT_ARCH}";;
    41         esac
    42         CC="${CT_TARGET}-${CT_CC}"      \
    43         HOST="${ltrace_host}"           \
    44         CFLAGS="${CT_TARGET_CFLAGS}"    \
    45         CT_DoExecLog ALL ./configure --prefix=/usr
    46     else
    47         CT_DoExecLog ALL        \
    48         ./configure             \
    49             --build=${CT_BUILD} \
    50             --host=${CT_TARGET} \
    51             --prefix=/usr
    52     fi
    53 
    54     CT_DoLog EXTRA "Building ltrace"
    55     CT_DoExecLog ALL make
    56 
    57     CT_DoLog EXTRA "Installing ltrace"
    58     CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
    59 
    60     CT_Popd
    61     CT_EndStep
    62 }
    63