scripts/tarball.sh.broken
changeset 1112 c72aecd1a9ef
parent 1111 6a077c345cfe
child 1113 0abc2de191b0
     1.1 --- a/scripts/tarball.sh.broken	Sat Jan 03 20:53:19 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,102 +0,0 @@
     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 -# Parse the architecture-specific functions
    1.23 -. "${CT_LIB_DIR}/arch/${CT_ARCH}/functions"
    1.24 -
    1.25 -# Target tuple: CT_TARGET needs a little love:
    1.26 -CT_DoBuildTargetTuple
    1.27 -
    1.28 -# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
    1.29 -# re-parse them:
    1.30 -. "${CT_TOP_DIR}/.config"
    1.31 -
    1.32 -# Build a one-line list of files to include
    1.33 -CT_DoStep DEBUG "Building list of tarballs to add"
    1.34 -CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
    1.35 -CT_TARBALLS=""
    1.36 -for dir in '' tools debug; do
    1.37 -    CT_DoStep DEBUG "Scanning directory '${dir}'"
    1.38 -    for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
    1.39 -        CT_DoStep DEBUG "Testing component '${script}'"
    1.40 -        [ -n "${script}" ] || continue
    1.41 -        unset do_print_file_name
    1.42 -        . "${script}"
    1.43 -        for file in $(do_print_filename); do
    1.44 -            CT_DoLog DEBUG "Finding tarball for '${file}'"
    1.45 -            [ -n "${file}" ] || continue
    1.46 -            ext=$(CT_GetFileExtension "${file}")
    1.47 -            CT_TestOrAbort "Missing tarball for: '${file}'" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
    1.48 -            CT_DoLog DEBUG "Found '${file}${ext}'"
    1.49 -            CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
    1.50 -        done
    1.51 -        CT_EndStep
    1.52 -    done
    1.53 -    CT_EndStep
    1.54 -done    
    1.55 -CT_EndStep
    1.56 -
    1.57 -# We need to emulate a build directory:
    1.58 -CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
    1.59 -mkdir -p "${CT_BUILD_DIR}"
    1.60 -CT_MktempDir tempdir
    1.61 -
    1.62 -# Save crosstool-NG, as it is configured for the current toolchain.
    1.63 -topdir=$(basename "${CT_TOP_DIR}")
    1.64 -CT_Pushd "${CT_TOP_DIR}/.."
    1.65 -
    1.66 -botdir=$(pwd)
    1.67 -
    1.68 -# Build the list of files to exclude
    1.69 -CT_DoLog DEBUG "Building list of files to exclude"
    1.70 -exclude_list="${tempdir}/${CT_TARGET}.list"
    1.71 -{ echo ".svn";                                                  \
    1.72 -  echo "${topdir}/log.*";                                       \
    1.73 -  echo "${topdir}/targets/src";                                 \
    1.74 -  echo "${topdir}/targets/tst";                                 \
    1.75 -  echo "${topdir}/targets/*-*-*-*";                             \
    1.76 -  for t in $(ls -1 "${topdir}/targets/tarballs/"); do            \
    1.77 -      case " ${CT_TARBALLS} " in                                \
    1.78 -          *" ${t} "*) ;;                                        \
    1.79 -          *)          echo "${topdir}/targets/tarballs/${t}";;  \
    1.80 -      esac;                                                     \
    1.81 -  done;                                                         \
    1.82 -} >"${exclude_list}"
    1.83 -
    1.84 -# Render the install directory writable
    1.85 -chmod u+w "${CT_PREFIX_DIR}"
    1.86 -
    1.87 -CT_DoLog INFO "Saving crosstool-NG into the toolchain directory"
    1.88 -tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"    \
    1.89 -    --no-wildcards-match-slash                                  \
    1.90 -    -X "${exclude_list}"                                        \
    1.91 -    "${topdir}"                                                 2>&1 |CT_DoLog ALL
    1.92 -
    1.93 -CT_Popd
    1.94 -
    1.95 -CT_DoLog INFO "Saving the toolchain"
    1.96 -tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}"    2>&1 |CT_DoLog ALL
    1.97 -
    1.98 -CT_DoLog DEBUG "Getting rid of working directories"
    1.99 -rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
   1.100 -rm -rf "${tempdir}"
   1.101 -
   1.102 -if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
   1.103 -    # Render the install directory non-writable
   1.104 -    chmod u-w "${CT_PREFIX_DIR}"
   1.105 -fi