scripts/build/tools/200-sstrip.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 27 14:28:36 2008 +0000 (2008-07-27)
branch1.2
changeset 739 8ebf5ea601d8
parent 669 ca740b4c4262
child 713 e074abc50374
permissions -rw-r--r--
Backport #876 from trunk:
Re-enable the restart functionality by removing some variables from the saved environment.

/branches/1.2/scripts/functions | 16 10 6 0 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
yann@479
     1
# This will build and install sstrip to run on host and sstrip target files
yann@479
     2
yann@479
     3
is_enabled="${CT_SSTRIP}"
yann@479
     4
yann@479
     5
case "${CT_SSTRIP_FROM}" in
yann@479
     6
    ELFkickers)
yann@479
     7
        do_print_filename() {
yann@479
     8
            echo "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
yann@479
     9
        }
yann@479
    10
        do_tools_sstrip_get() {
yann@479
    11
            CT_GetFile "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"     \
yann@479
    12
                       http://www.muppetlabs.com/~breadbox/pub/software
yann@479
    13
        }
yann@479
    14
        do_tools_sstrip_extract() {
yann@479
    15
            CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
yann@479
    16
        }
yann@479
    17
        do_tools_sstrip_build() {
yann@479
    18
            CT_DoStep INFO "Installing sstrip"
yann@479
    19
            mkdir -p "${CT_BUILD_DIR}/build-strip"
yann@479
    20
            cd "${CT_BUILD_DIR}/build-strip"
yann@479
    21
            ( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
yann@479
    22
yann@479
    23
            CT_DoLog EXTRA "Building sstrip"
yann@669
    24
            CT_DoExecLog ALL make CC="${CT_CC_NATIVE}" sstrip
yann@479
    25
            
yann@479
    26
            CT_DoLog EXTRA "Installing sstrip"
yann@669
    27
            CT_DoExecLog ALL install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip"
yann@479
    28
yann@479
    29
            CT_EndStep
yann@479
    30
        }
yann@479
    31
    ;;
yann@479
    32
yann@479
    33
    buildroot)
yann@678
    34
        CT_HasOrAbort lynx
yann@479
    35
        sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
yann@479
    36
        do_print_filename() {
yann@479
    37
            echo "sstrip.c"
yann@479
    38
        }
yann@479
    39
        do_tools_sstrip_get() {
yann@479
    40
            # With this one, we must handle the download by ourselves,
yann@479
    41
            # we can't leave the job to the classic CT_GetFile.
yann@479
    42
            if [ -f "${CT_TARBALLS_DIR}/sstrip.c" ]; then
yann@479
    43
                return 0
yann@479
    44
            fi
yann@479
    45
            if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
yann@523
    46
                CT_DoLog EXTRA "Using 'sstrip' from local storage"
yann@479
    47
                ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c"  \
yann@479
    48
                       "${CT_TARBALLS_DIR}/sstrip.c"        2>&1 |CT_DoLog ALL
yann@479
    49
                return 0
yann@479
    50
            fi
yann@479
    51
            CT_Pushd "${CT_TARBALLS_DIR}"
yann@523
    52
            CT_DoLog EXTRA "Retrieving 'sstrip' from network"
yann@523
    53
            http_data=$(lynx -dump "${sstrip_url}")
yann@523
    54
            link=$(echo -en "${http_data}"                          \
yann@479
    55
                  |egrep '\[[[:digit:]]+\]download'                 \
yann@523
    56
                  |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;')
yann@523
    57
            rev_url=$(echo -en "${http_data}"                       \
yann@479
    58
                     |egrep '^ *8\.'                                \
yann@523
    59
                     |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;')
yann@479
    60
            CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
yann@479
    61
            mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
yann@479
    62
            if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
yann@523
    63
                CT_DoLog EXTRA "Saving 'sstrip.c' to local storage"
yann@669
    64
                CT_DoExecLog ALL cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}"
yann@479
    65
            fi
yann@479
    66
            CT_Popd
yann@479
    67
        }
yann@479
    68
        do_tools_sstrip_extract() {
yann@479
    69
            # We'll let buildroot guys take care of sstrip maintenance and patching.
yann@479
    70
            mkdir -p "${CT_SRC_DIR}/sstrip"
yann@669
    71
            CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip"
yann@479
    72
        }
yann@479
    73
        do_tools_sstrip_build() {
yann@479
    74
            CT_DoStep INFO "Installing sstrip"
yann@479
    75
            mkdir -p "${CT_BUILD_DIR}/build-sstrip"
yann@479
    76
            cd "${CT_BUILD_DIR}/build-sstrip"
yann@479
    77
yann@479
    78
            CT_DoLog EXTRA "Building sstrip"
yann@669
    79
            CT_DoExecLog ALL ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c"
yann@479
    80
yann@479
    81
            CT_DoLog EXTRA "Installing sstrip"
yann@669
    82
            CT_DoExecLog ALL install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip"
yann@479
    83
yann@479
    84
            CT_EndStep
yann@479
    85
        }
yann@479
    86
    ;;
yann@479
    87
yann@479
    88
    *)  do_print_filename() {
yann@479
    89
            :
yann@479
    90
        }
yann@479
    91
        do_tools_sstrip_get() {
yann@479
    92
            :
yann@479
    93
        }
yann@479
    94
        do_tools_sstrip_extract() {
yann@479
    95
            :
yann@479
    96
        }
yann@479
    97
        do_tools_sstrip_build() {
yann@479
    98
            :
yann@479
    99
        }
yann@479
   100
    ;;
yann@479
   101
esac