scripts/build/tools/sstrip.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jun 16 18:08:14 2007 +0000 (2007-06-16)
changeset 161 be4484f10ac7
parent 154 cbead170f5e7
child 204 1d9231eecc9b
permissions -rw-r--r--
Add a function to print each component's filename: this eases building the tarball of the generated toolchain.
Hard-link the libfloat tarball instead of soft-link: this also eases building the afore-mentioned tarball.
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@161
    44
            CT_Pushd "${CT_TARBALLS_DIR}"
yann@154
    45
            CT_DoLog EXTRA "Retrieving \"sstrip\" (from buildroot's svn)"
yann@149
    46
            http_data=`lynx -dump "${sstrip_url}"`
yann@149
    47
            link=`echo -en "${http_data}"                           \
yann@149
    48
                  |egrep '\[[[:digit:]]+\]download'                 \
yann@149
    49
                  |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
yann@149
    50
            rev_url=`echo -en "${http_data}"                        \
yann@149
    51
                     |egrep '^ *8\.'                                \
yann@149
    52
                     |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
yann@149
    53
            CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
yann@149
    54
            mv sstrip.c?* sstrip.c
yann@149
    55
            CT_Popd
yann@149
    56
        }
yann@149
    57
        do_tools_sstrip_extract() {
yann@149
    58
            # We'll let buildroot guys take care of sstrip maintenance and patching.
yann@161
    59
            mkdir -p "${CT_SRC_DIR}/sstrip"
yann@161
    60
            cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip" |CT_DoLog ALL
yann@149
    61
        }
yann@149
    62
        do_tools_sstrip_build() {
yann@149
    63
            CT_DoStep INFO "Installing sstrip"
yann@149
    64
            mkdir -p "${CT_BUILD_DIR}/build-sstrip"
yann@149
    65
            cd "${CT_BUILD_DIR}/build-sstrip"
yann@149
    66
yann@149
    67
            CT_DoLog EXTRA "Building sstrip"
yann@149
    68
            ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
yann@149
    69
yann@149
    70
            CT_DoLog EXTRA "Installing sstrip"
yann@149
    71
            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
yann@149
    72
yann@149
    73
            CT_EndStep
yann@149
    74
        }
yann@149
    75
    ;;
yann@161
    76
yann@161
    77
    *)  do_print_filename() {
yann@161
    78
            :
yann@161
    79
        }
yann@161
    80
        do_tools_sstrip_get() {
yann@161
    81
            :
yann@161
    82
        }
yann@161
    83
        do_tools_sstrip_extract() {
yann@161
    84
            :
yann@161
    85
        }
yann@161
    86
        do_tools_sstrip_build() {
yann@161
    87
            :
yann@161
    88
        }
yann@161
    89
    ;;
yann@149
    90
esac