scripts/build/tools/200-sstrip.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri May 02 21:59:14 2008 +0000 (2008-05-02)
changeset 479 05c62432ec19
child 523 010f6f4e4dd6
permissions -rw-r--r--
For tools/ and debug/ build scripts, annd a numeric prefix, so that they always get built in the same order, in case of library dependencies.

/trunk/scripts/build/debug.sh | 2 1 1 0 +-
/trunk/scripts/build/tools.sh | 2 1 1 0 +-
2 files changed, 2 insertions(+), 2 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@479
    24
            make CC="${CT_CC_NATIVE}" sstrip 2>&1 |CT_DoLog ALL
yann@479
    25
            
yann@479
    26
            CT_DoLog EXTRA "Installing sstrip"
yann@479
    27
            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
yann@479
    28
yann@479
    29
            CT_EndStep
yann@479
    30
        }
yann@479
    31
    ;;
yann@479
    32
yann@479
    33
    buildroot)
yann@479
    34
        sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
yann@479
    35
        do_print_filename() {
yann@479
    36
            echo "sstrip.c"
yann@479
    37
        }
yann@479
    38
        do_tools_sstrip_get() {
yann@479
    39
            # With this one, we must handle the download by ourselves,
yann@479
    40
            # we can't leave the job to the classic CT_GetFile.
yann@479
    41
            if [ -f "${CT_TARBALLS_DIR}/sstrip.c" ]; then
yann@479
    42
                return 0
yann@479
    43
            fi
yann@479
    44
            if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
yann@479
    45
                CT_DoLog EXTRA "Using \"sstrip\" from local storage"
yann@479
    46
                ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c"  \
yann@479
    47
                       "${CT_TARBALLS_DIR}/sstrip.c"        2>&1 |CT_DoLog ALL
yann@479
    48
                return 0
yann@479
    49
            fi
yann@479
    50
            CT_Pushd "${CT_TARBALLS_DIR}"
yann@479
    51
            CT_DoLog EXTRA "Retrieving \"sstrip\" from network"
yann@479
    52
            http_data=`lynx -dump "${sstrip_url}"`
yann@479
    53
            link=`echo -en "${http_data}"                           \
yann@479
    54
                  |egrep '\[[[:digit:]]+\]download'                 \
yann@479
    55
                  |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
yann@479
    56
            rev_url=`echo -en "${http_data}"                        \
yann@479
    57
                     |egrep '^ *8\.'                                \
yann@479
    58
                     |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
yann@479
    59
            CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
yann@479
    60
            mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
yann@479
    61
            if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
yann@479
    62
                CT_DoLog EXTRA "Saving \"sstrip.c\" to local storage"
yann@479
    63
                cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG
yann@479
    64
            fi
yann@479
    65
            CT_Popd
yann@479
    66
        }
yann@479
    67
        do_tools_sstrip_extract() {
yann@479
    68
            # We'll let buildroot guys take care of sstrip maintenance and patching.
yann@479
    69
            mkdir -p "${CT_SRC_DIR}/sstrip"
yann@479
    70
            cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip" |CT_DoLog ALL
yann@479
    71
        }
yann@479
    72
        do_tools_sstrip_build() {
yann@479
    73
            CT_DoStep INFO "Installing sstrip"
yann@479
    74
            mkdir -p "${CT_BUILD_DIR}/build-sstrip"
yann@479
    75
            cd "${CT_BUILD_DIR}/build-sstrip"
yann@479
    76
yann@479
    77
            CT_DoLog EXTRA "Building sstrip"
yann@479
    78
            ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
yann@479
    79
yann@479
    80
            CT_DoLog EXTRA "Installing sstrip"
yann@479
    81
            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
yann@479
    82
yann@479
    83
            CT_EndStep
yann@479
    84
        }
yann@479
    85
    ;;
yann@479
    86
yann@479
    87
    *)  do_print_filename() {
yann@479
    88
            :
yann@479
    89
        }
yann@479
    90
        do_tools_sstrip_get() {
yann@479
    91
            :
yann@479
    92
        }
yann@479
    93
        do_tools_sstrip_extract() {
yann@479
    94
            :
yann@479
    95
        }
yann@479
    96
        do_tools_sstrip_build() {
yann@479
    97
            :
yann@479
    98
        }
yann@479
    99
    ;;
yann@479
   100
esac