scripts/build/tools/200-sstrip.sh
changeset 479 05c62432ec19
child 523 010f6f4e4dd6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/build/tools/200-sstrip.sh	Fri May 02 21:59:14 2008 +0000
     1.3 @@ -0,0 +1,100 @@
     1.4 +# This will build and install sstrip to run on host and sstrip target files
     1.5 +
     1.6 +is_enabled="${CT_SSTRIP}"
     1.7 +
     1.8 +case "${CT_SSTRIP_FROM}" in
     1.9 +    ELFkickers)
    1.10 +        do_print_filename() {
    1.11 +            echo "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
    1.12 +        }
    1.13 +        do_tools_sstrip_get() {
    1.14 +            CT_GetFile "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"     \
    1.15 +                       http://www.muppetlabs.com/~breadbox/pub/software
    1.16 +        }
    1.17 +        do_tools_sstrip_extract() {
    1.18 +            CT_ExtractAndPatch "ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}"
    1.19 +        }
    1.20 +        do_tools_sstrip_build() {
    1.21 +            CT_DoStep INFO "Installing sstrip"
    1.22 +            mkdir -p "${CT_BUILD_DIR}/build-strip"
    1.23 +            cd "${CT_BUILD_DIR}/build-strip"
    1.24 +            ( cd "${CT_SRC_DIR}/ELFkickers-${CT_SSTRIP_ELFKICKERS_VERSION}/sstrip"; tar cf - . ) |tar xf -
    1.25 +
    1.26 +            CT_DoLog EXTRA "Building sstrip"
    1.27 +            make CC="${CT_CC_NATIVE}" sstrip 2>&1 |CT_DoLog ALL
    1.28 +            
    1.29 +            CT_DoLog EXTRA "Installing sstrip"
    1.30 +            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
    1.31 +
    1.32 +            CT_EndStep
    1.33 +        }
    1.34 +    ;;
    1.35 +
    1.36 +    buildroot)
    1.37 +        sstrip_url='http://buildroot.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/sstrip/sstrip.c'
    1.38 +        do_print_filename() {
    1.39 +            echo "sstrip.c"
    1.40 +        }
    1.41 +        do_tools_sstrip_get() {
    1.42 +            # With this one, we must handle the download by ourselves,
    1.43 +            # we can't leave the job to the classic CT_GetFile.
    1.44 +            if [ -f "${CT_TARBALLS_DIR}/sstrip.c" ]; then
    1.45 +                return 0
    1.46 +            fi
    1.47 +            if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
    1.48 +                CT_DoLog EXTRA "Using \"sstrip\" from local storage"
    1.49 +                ln -sf "${CT_LOCAL_TARBALLS_DIR}/sstrip.c"  \
    1.50 +                       "${CT_TARBALLS_DIR}/sstrip.c"        2>&1 |CT_DoLog ALL
    1.51 +                return 0
    1.52 +            fi
    1.53 +            CT_Pushd "${CT_TARBALLS_DIR}"
    1.54 +            CT_DoLog EXTRA "Retrieving \"sstrip\" from network"
    1.55 +            http_data=`lynx -dump "${sstrip_url}"`
    1.56 +            link=`echo -en "${http_data}"                           \
    1.57 +                  |egrep '\[[[:digit:]]+\]download'                 \
    1.58 +                  |sed -r -e 's/.*\[([[:digit:]]+)\]download.*/\1/;'`
    1.59 +            rev_url=`echo -en "${http_data}"                        \
    1.60 +                     |egrep '^ *8\.'                                \
    1.61 +                     |sed -r -e 's/^ *'${link}'\. +(.+)$/\1/;'`
    1.62 +            CT_DoGetFile "${rev_url}" 2>&1 |CT_DoLog ALL
    1.63 +            mv -v sstrip.c?* sstrip.c 2>&1 |CT_DoLog DEBUG
    1.64 +            if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
    1.65 +                CT_DoLog EXTRA "Saving \"sstrip.c\" to local storage"
    1.66 +                cp -v sstrip.c "${CT_LOCAL_TARBALLS_DIR}" 2>&1 |CT_DoLog DEBUG
    1.67 +            fi
    1.68 +            CT_Popd
    1.69 +        }
    1.70 +        do_tools_sstrip_extract() {
    1.71 +            # We'll let buildroot guys take care of sstrip maintenance and patching.
    1.72 +            mkdir -p "${CT_SRC_DIR}/sstrip"
    1.73 +            cp -v "${CT_TARBALLS_DIR}/sstrip.c" "${CT_SRC_DIR}/sstrip" |CT_DoLog ALL
    1.74 +        }
    1.75 +        do_tools_sstrip_build() {
    1.76 +            CT_DoStep INFO "Installing sstrip"
    1.77 +            mkdir -p "${CT_BUILD_DIR}/build-sstrip"
    1.78 +            cd "${CT_BUILD_DIR}/build-sstrip"
    1.79 +
    1.80 +            CT_DoLog EXTRA "Building sstrip"
    1.81 +            ${CT_CC_NATIVE} -Wall -o sstrip "${CT_SRC_DIR}/sstrip/sstrip.c" 2>&1 |CT_DoLog ALL
    1.82 +
    1.83 +            CT_DoLog EXTRA "Installing sstrip"
    1.84 +            install -m 755 sstrip "${CT_PREFIX_DIR}/bin/${CT_TARGET}-sstrip" 2>&1 |CT_DoLog ALL
    1.85 +
    1.86 +            CT_EndStep
    1.87 +        }
    1.88 +    ;;
    1.89 +
    1.90 +    *)  do_print_filename() {
    1.91 +            :
    1.92 +        }
    1.93 +        do_tools_sstrip_get() {
    1.94 +            :
    1.95 +        }
    1.96 +        do_tools_sstrip_extract() {
    1.97 +            :
    1.98 +        }
    1.99 +        do_tools_sstrip_build() {
   1.100 +            :
   1.101 +        }
   1.102 +    ;;
   1.103 +esac