scripts/tarball.sh.broken
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Oct 10 14:30:44 2008 +0000 (2008-10-10)
changeset 916 68af6b83ff7e
parent 394 5e5d02b2d786
permissions -rwxr-xr-x
Simplify the Tools and Debug facilities menu entries:
- each config file no longer have to define their own 'menuconfig foo - if FOO - endif' gym
- each build script no longer has to say wether they are enabled
- generation of the 'menuconfig' entries for the Tools and Debug facilities now uses the same code
Some re-ordering of the code to be consistent with the steps ordering (tools, then debug).

/trunk/kconfig/kconfig.mk | 66 43 23 0 +++++++++++++++++++++++-------------
/trunk/scripts/build/debug.sh | 14 9 5 0 +++++---
/trunk/scripts/build/tools/000-template.sh | 7 0 7 0 ----
/trunk/scripts/build/tools/100-libelf.sh | 3 0 3 0 --
/trunk/scripts/build/tools/200-sstrip.sh | 2 0 2 0 -
/trunk/scripts/build/debug/000-template.sh | 7 0 7 0 ----
/trunk/scripts/build/debug/100-dmalloc.sh | 3 0 3 0 --
/trunk/scripts/build/debug/400-ltrace.sh | 3 0 3 0 --
/trunk/scripts/build/debug/300-gdb.sh | 3 0 3 0 --
/trunk/scripts/build/debug/500-strace.sh | 3 0 3 0 --
/trunk/scripts/build/debug/200-duma.sh | 3 0 3 0 --
/trunk/scripts/build/tools.sh | 14 9 5 0 +++++---
/trunk/scripts/crosstool.sh | 2 1 1 0
/trunk/config/debug/ltrace.in | 14 3 11 0 ++------
/trunk/config/debug/dmalloc.in | 9 1 8 0 +----
/trunk/config/debug/gdb.in | 9 1 8 0 +----
/trunk/config/debug/strace.in | 10 1 9 0 -----
/trunk/config/debug/duma.in | 10 1 9 0 -----
/trunk/config/tools/libelf.in | 12 2 10 0 +------
/trunk/config/tools/sstrip.in | 10 1 9 0 -----
/trunk/config/config.in | 4 2 2 0 +-
21 files changed, 74 insertions(+), 134 deletions(-)
     1 #!/bin/bash
     2 
     3 # This scripts makes a tarball of the configured toolchain
     4 # Pre-requisites:
     5 #  - crosstool-NG is configured
     6 #  - components tarball are available
     7 #  - toolchain is built successfully
     8 
     9 # We need the functions first:
    10 . "${CT_TOP_DIR}/scripts/functions"
    11 
    12 # Don't care about any log file
    13 exec >/dev/null
    14 rm -f "${tmp_log_file}"
    15 
    16 # Parse the configuration file:
    17 . ${CT_TOP_DIR}/.config
    18 
    19 # Parse the architecture-specific functions
    20 . "${CT_LIB_DIR}/arch/${CT_ARCH}/functions"
    21 
    22 # Target tuple: CT_TARGET needs a little love:
    23 CT_DoBuildTargetTuple
    24 
    25 # Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
    26 # re-parse them:
    27 . "${CT_TOP_DIR}/.config"
    28 
    29 # Build a one-line list of files to include
    30 CT_DoStep DEBUG "Building list of tarballs to add"
    31 CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
    32 CT_TARBALLS=""
    33 for dir in '' tools debug; do
    34     CT_DoStep DEBUG "Scanning directory '${dir}'"
    35     for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
    36         CT_DoStep DEBUG "Testing component '${script}'"
    37         [ -n "${script}" ] || continue
    38         unset do_print_file_name
    39         . "${script}"
    40         for file in $(do_print_filename); do
    41             CT_DoLog DEBUG "Finding tarball for '${file}'"
    42             [ -n "${file}" ] || continue
    43             ext=$(CT_GetFileExtension "${file}")
    44             CT_TestOrAbort "Missing tarball for: '${file}'" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
    45             CT_DoLog DEBUG "Found '${file}${ext}'"
    46             CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
    47         done
    48         CT_EndStep
    49     done
    50     CT_EndStep
    51 done    
    52 CT_EndStep
    53 
    54 # We need to emulate a build directory:
    55 CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
    56 mkdir -p "${CT_BUILD_DIR}"
    57 CT_MktempDir tempdir
    58 
    59 # Save crosstool-NG, as it is configured for the current toolchain.
    60 topdir=$(basename "${CT_TOP_DIR}")
    61 CT_Pushd "${CT_TOP_DIR}/.."
    62 
    63 botdir=$(pwd)
    64 
    65 # Build the list of files to exclude
    66 CT_DoLog DEBUG "Building list of files to exclude"
    67 exclude_list="${tempdir}/${CT_TARGET}.list"
    68 { echo ".svn";                                                  \
    69   echo "${topdir}/log.*";                                       \
    70   echo "${topdir}/targets/src";                                 \
    71   echo "${topdir}/targets/tst";                                 \
    72   echo "${topdir}/targets/*-*-*-*";                             \
    73   for t in $(ls -1 "${topdir}/targets/tarballs/"); do            \
    74       case " ${CT_TARBALLS} " in                                \
    75           *" ${t} "*) ;;                                        \
    76           *)          echo "${topdir}/targets/tarballs/${t}";;  \
    77       esac;                                                     \
    78   done;                                                         \
    79 } >"${exclude_list}"
    80 
    81 # Render the install directory writable
    82 chmod u+w "${CT_PREFIX_DIR}"
    83 
    84 CT_DoLog INFO "Saving crosstool-NG into the toolchain directory"
    85 tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"    \
    86     --no-wildcards-match-slash                                  \
    87     -X "${exclude_list}"                                        \
    88     "${topdir}"                                                 2>&1 |CT_DoLog ALL
    89 
    90 CT_Popd
    91 
    92 CT_DoLog INFO "Saving the toolchain"
    93 tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}"    2>&1 |CT_DoLog ALL
    94 
    95 CT_DoLog DEBUG "Getting rid of working directories"
    96 rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
    97 rm -rf "${tempdir}"
    98 
    99 if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
   100     # Render the install directory non-writable
   101     chmod u-w "${CT_PREFIX_DIR}"
   102 fi