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