scripts/tarball.sh.broken
changeset 182 223c84ec2d90
child 197 9383bf4a2e2e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/tarball.sh.broken	Sun Jul 01 19:04:20 2007 +0000
     1.3 @@ -0,0 +1,98 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +# This scripts makes a tarball of the configured toolchain
     1.7 +# Pre-requisites:
     1.8 +#  - crosstool-NG is configured
     1.9 +#  - components tarball are available
    1.10 +#  - toolchain is built successfully
    1.11 +
    1.12 +# We need the functions first:
    1.13 +. "${CT_TOP_DIR}/scripts/functions"
    1.14 +
    1.15 +# Don't care about any log file
    1.16 +exec >/dev/null
    1.17 +rm -f "${tmp_log_file}"
    1.18 +
    1.19 +# Parse the configuration file:
    1.20 +. ${CT_TOP_DIR}/.config
    1.21 +
    1.22 +CT_DoBuildTargetTriplet
    1.23 +
    1.24 +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
    1.25 +# re-parse them:
    1.26 +. "${CT_TOP_DIR}/.config"
    1.27 +
    1.28 +# Build a one-line list of files to include
    1.29 +CT_DoStep DEBUG "Building list of tarballs to add"
    1.30 +CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
    1.31 +CT_TARBALLS=""
    1.32 +for dir in '' tools debug; do
    1.33 +    CT_DoStep DEBUG "Scanning directory \"${dir}\""
    1.34 +    for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
    1.35 +        CT_DoStep DEBUG "Testing component \"${script}\""
    1.36 +        [ -n "${script}" ] || continue
    1.37 +        unset do_print_file_name
    1.38 +        . "${script}"
    1.39 +        for file in `do_print_filename`; do
    1.40 +            CT_DoLog DEBUG "Finding tarball for \"${file}\""
    1.41 +            [ -n "${file}" ] || continue
    1.42 +            ext=`CT_GetFileExtension "${file}"`
    1.43 +            CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
    1.44 +            CT_DoLog DEBUG "Found \"${file}${ext}\""
    1.45 +            CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
    1.46 +        done
    1.47 +        CT_EndStep
    1.48 +    done
    1.49 +    CT_EndStep
    1.50 +done    
    1.51 +CT_EndStep
    1.52 +
    1.53 +# We need to emulate a build directory:
    1.54 +CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
    1.55 +mkdir -p "${CT_BUILD_DIR}"
    1.56 +CT_MktempDir tempdir
    1.57 +
    1.58 +# Save crosstool-ng, as it is configured for the current toolchain.
    1.59 +topdir=`basename "${CT_TOP_DIR}"`
    1.60 +CT_Pushd "${CT_TOP_DIR}/.."
    1.61 +
    1.62 +botdir=`pwd`
    1.63 +
    1.64 +# Build the list of files to exclude
    1.65 +CT_DoLog DEBUG "Building list of files to exclude"
    1.66 +exclude_list="${tempdir}/${CT_TARGET}.list"
    1.67 +{ echo ".svn";                                                  \
    1.68 +  echo "${topdir}/log.*";                                       \
    1.69 +  echo "${topdir}/targets/src";                                 \
    1.70 +  echo "${topdir}/targets/tst";                                 \
    1.71 +  echo "${topdir}/targets/*-*-*-*";                             \
    1.72 +  for t in `ls -1 "${topdir}/targets/tarballs/"`; do            \
    1.73 +      case " ${CT_TARBALLS} " in                                \
    1.74 +          *" ${t} "*) ;;                                        \
    1.75 +          *)          echo "${topdir}/targets/tarballs/${t}";;  \
    1.76 +      esac;                                                     \
    1.77 +  done;                                                         \
    1.78 +} >"${exclude_list}"
    1.79 +
    1.80 +# Render the install directory writable
    1.81 +chmod u+w "${CT_PREFIX_DIR}"
    1.82 +
    1.83 +CT_DoLog INFO "Saving crosstool-ng into the toolchain directory"
    1.84 +tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"    \
    1.85 +    --no-wildcards-match-slash                                  \
    1.86 +    -X "${exclude_list}"                                        \
    1.87 +    "${topdir}"                                                 2>&1 |CT_DoLog ALL
    1.88 +
    1.89 +CT_Popd
    1.90 +
    1.91 +CT_DoLog INFO "Saving the toolchain"
    1.92 +tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}"    2>&1 |CT_DoLog ALL
    1.93 +
    1.94 +CT_DoLog DEBUG "Getting rid of working directories"
    1.95 +rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
    1.96 +rm -rf "${tempdir}"
    1.97 +
    1.98 +if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
    1.99 +    # Render the install directory non-writable
   1.100 +    chmod u-w "${CT_PREFIX_DIR}"
   1.101 +fi