scripts/build/tools/sstrip.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jun 01 17:00:43 2007 +0000 (2007-06-01)
changeset 149 39d8baac9c69
child 154 cbead170f5e7
permissions -rw-r--r--
Add the first tool facility: sstrip.
     1 # This will build and install sstrip to run on host and sstrip target files
     2 
     3 is_enabled="${CT_SSTRIP}"
     4 
     5 case "${CT_SSTRIP_FROM}" in
     6     ELFkickers)
     7         do_tools_sstrip_get() {
     8             CT_GetFile "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"     \
     9                        http://www.muppetlabs.com/~breadbox/pub/software
    10         }
    11         do_tools_sstrip_extract() {
    12             CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
    13         }
    14         do_tools_sstrip_build() {
    15             CT_DoStep INFO "Installing sstrip"
    16             mkdir -p "${CT_BUILD_DIR}/build-strip"
    17             cd "${CT_BUILD_DIR}/build-strip"
    18             ( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
    19 
    20             CT_DoLog EXTRA "Building sstrip"
    21             make CC="${CT_CC_NATIVE}" sstrip 2>&1 |CT_DoLog ALL
    22             
    23             CT_DoLog EXTRA "Installing sstrip"
    24             install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
    25 
    26             CT_EndStep
    27         }
    28     ;;
    29 
    30     buildroot)
    31         sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
    32         do_tools_sstrip_get() {
    33             # With this one, we must handle the download by ourselves,
    34             # we can't leave the job to the classic CT_GetFile.
    35             if [ -f "${CT_SRC_DIR}/sstrip/sstrip.c" ]; then
    36                 return 0
    37             fi
    38             CT_Pushd "${CT_SRC_DIR}"
    39             CT_DoLog EXTRA "Retrieving sstrip (buildroot)"
    40             mkdir -p sstrip
    41             cd sstrip
    42             http_data=`lynx -dump "${sstrip_url}"`
    43             link=`echo -en "${http_data}"                           \
    44                   |egrep '\[[[:digit:]]+\]download'                 \
    45                   |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
    46             rev_url=`echo -en "${http_data}"                        \
    47                      |egrep '^ *8\.'                                \
    48                      |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
    49             CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
    50             mv sstrip.c?* sstrip.c
    51             CT_Popd
    52         }
    53         do_tools_sstrip_extract() {
    54             # We'll let buildroot guys take care of sstrip maintenance and patching.
    55             :
    56         }
    57         do_tools_sstrip_build() {
    58             CT_DoStep INFO "Installing sstrip"
    59             mkdir -p "${CT_BUILD_DIR}/build-sstrip"
    60             cd "${CT_BUILD_DIR}/build-sstrip"
    61 
    62             CT_DoLog EXTRA "Building sstrip"
    63             ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
    64 
    65             CT_DoLog EXTRA "Installing sstrip"
    66             install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
    67 
    68             CT_EndStep
    69         }
    70     ;;
    71 esac