scripts/build/tools/sstrip.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jul 28 21:34:41 2007 +0000 (2007-07-28)
changeset 301 2be7232a73ac
parent 265 4d5beae7cb87
child 355 42871dce9ced
permissions -rw-r--r--
Bump version to 0.2.2.
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@161
     7
        do_print_filename() {
yann@161
     8
            echo "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
yann@161
     9
        }
yann@149
    10
        do_tools_sstrip_get() {
yann@149
    11
            CT_GetFile "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"     \
yann@149
    12
                       http://www.muppetlabs.com/~breadbox/pub/software
yann@149
    13
        }
yann@149
    14
        do_tools_sstrip_extract() {
yann@149
    15
            CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
yann@149
    16
        }
yann@149
    17
        do_tools_sstrip_build() {
yann@149
    18
            CT_DoStep INFO "Installing sstrip"
yann@149
    19
            mkdir -p "${CT_BUILD_DIR}/build-strip"
yann@149
    20
            cd "${CT_BUILD_DIR}/build-strip"
yann@149
    21
            ( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
yann@149
    22
yann@149
    23
            CT_DoLog EXTRA "Building sstrip"
yann@149
    24
            make CC="${CT_CC_NATIVE}" sstrip 2>&1 |CT_DoLog ALL
yann@149
    25
            
yann@149
    26
            CT_DoLog EXTRA "Installing sstrip"
yann@149
    27
            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
yann@149
    28
yann@149
    29
            CT_EndStep
yann@149
    30
        }
yann@149
    31
    ;;
yann@149
    32
yann@149
    33
    buildroot)
yann@149
    34
        sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
yann@161
    35
        do_print_filename() {
yann@161
    36
            echo "sstrip.c"
yann@161
    37
        }
yann@149
    38
        do_tools_sstrip_get() {
yann@149
    39
            # With this one, we must handle the download by ourselves,
yann@149
    40
            # we can't leave the job to the classic CT_GetFile.
yann@161
    41
            if [ -f "${CT_TARBALLS_DIR}/sstrip.c" ]; then
yann@149
    42
                return 0
yann@149
    43
            fi
yann@204
    44
            if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
yann@278
    45
                CT_DoLog EXTRA "Retrieving \"sstrip.c\" from local storage"
yann@204
    46
                cp -v "${CT_LOCAL_TARBALLS_DIR}/sstrip.c"   \
yann@204
    47
                      "${CT_TARBALLS_DIR}/sstrip.c"         2>&1 |CT_DoLog ALL
yann@204
    48
                return 0
yann@204
    49
            fi
yann@161
    50
            CT_Pushd "${CT_TARBALLS_DIR}"
yann@154
    51
            CT_DoLog EXTRA "Retrieving \"sstrip\" (from buildroot's svn)"
yann@149
    52
            http_data=`lynx -dump "${sstrip_url}"`
yann@149
    53
            link=`echo -en "${http_data}"                           \
yann@149
    54
                  |egrep '\[[[:digit:]]+\]download'                 \
yann@149
    55
                  |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
yann@149
    56
            rev_url=`echo -en "${http_data}"                        \
yann@149
    57
                     |egrep '^ *8\.'                                \
yann@149
    58
                     |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
yann@149
    59
            CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
yann@278
    60
            mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
yann@278
    61
            if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
yann@278
    62
                CT_DoLog EXTRA "Saving \sstrip.c\" to local storage"
yann@278
    63
                cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG
yann@278
    64
            fi
yann@149
    65
            CT_Popd
yann@149
    66
        }
yann@149
    67
        do_tools_sstrip_extract() {
yann@149
    68
            # We'll let buildroot guys take care of sstrip maintenance and patching.
yann@161
    69
            mkdir -p "${CT_SRC_DIR}/sstrip"
yann@161
    70
            cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip" |CT_DoLog ALL
yann@149
    71
        }
yann@149
    72
        do_tools_sstrip_build() {
yann@149
    73
            CT_DoStep INFO "Installing sstrip"
yann@149
    74
            mkdir -p "${CT_BUILD_DIR}/build-sstrip"
yann@149
    75
            cd "${CT_BUILD_DIR}/build-sstrip"
yann@149
    76
yann@149
    77
            CT_DoLog EXTRA "Building sstrip"
yann@149
    78
            ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
yann@149
    79
yann@149
    80
            CT_DoLog EXTRA "Installing sstrip"
yann@149
    81
            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
yann@149
    82
yann@149
    83
            CT_EndStep
yann@149
    84
        }
yann@149
    85
    ;;
yann@161
    86
yann@161
    87
    *)  do_print_filename() {
yann@161
    88
            :
yann@161
    89
        }
yann@161
    90
        do_tools_sstrip_get() {
yann@161
    91
            :
yann@161
    92
        }
yann@161
    93
        do_tools_sstrip_extract() {
yann@161
    94
            :
yann@161
    95
        }
yann@161
    96
        do_tools_sstrip_build() {
yann@161
    97
            :
yann@161
    98
        }
yann@161
    99
    ;;
yann@149
   100
esac