Get rid of all `command` (which is a bashism), and replace them with $(command), which is POSIX.
Get rid of all remaining \"text\" in log messages and replace them with 'text'.
Optimise the progress bar, should go un-noticed at log level DEBUG and below.
/trunk/scripts/build/tools/200-sstrip.sh | 16 8 8 0 ++--
/trunk/scripts/build/libc_glibc.sh | 50 25 25 0 +++++++-------
/trunk/scripts/build/libc_uClibc.sh | 4 2 2 0
/trunk/scripts/build/debug/100-dmalloc.sh | 2 1 1 0
/trunk/scripts/build/debug/400-ltrace.sh | 2 1 1 0
/trunk/scripts/build/debug/300-gdb.sh | 8 4 4 0 +-
/trunk/scripts/build/debug/200-duma.sh | 6 3 3 0 +-
/trunk/scripts/build/kernel_linux.sh | 30 15 15 0 ++++----
/trunk/scripts/build/cc_gcc.sh | 14 7 7 0 ++--
/trunk/scripts/crosstool.sh | 54 27 27 0 ++++++++--------
/trunk/scripts/functions | 128 64 64 0 ++++++++++++++++++------------------
/trunk/scripts/saveSample.sh | 4 2 2 0
/trunk/scripts/tarball.sh.broken | 20 10 10 0 +++---
/trunk/tools/addToolVersion.sh | 8 4 4 0 +-
/trunk/tools/populate.in | 18 9 9 0 ++--
15 files changed, 182 insertions(+), 182 deletions(-)
3 # This script will populate the root directory with libs from the sysroot.
4 # (C) 2007 Yann E. MORIN
5 # Licensed under the GPL v2
7 CT_READELF="@@CT_READELF@@"
8 CT_SYSROOT_DIR="@@CT_SYSROOT_DIR@@"
10 myname=$(basename "$0")
14 $myname [-f] [-v] -s source_root -d destination_root
17 use 'dir' as the un-populated (source) root directory
20 use 'dir' as the place to put the populated root directory
22 -f force execution: if destination directory already exists,
23 it will be removed first.
33 while getopts ":s:d:fvh" CT_OPT; do
35 s) CT_ROOT_SRC_DIR="${OPTARG}";;
36 d) CT_ROOT_DST_DIR="${OPTARG}";;
42 :) echo "$myname: '-${OPTARG}' takes exactly one argument."
45 ?) echo "$myname: unknown option '-${OPTARG}'."
52 if [ -z "${CT_ROOT_SRC_DIR}" -o -z "${CT_ROOT_DST_DIR}" ]; then
56 if [ ! -d "${CT_ROOT_SRC_DIR}" ]; then
57 echo "$myname: '${CT_ROOT_SRC_DIR}': no such file or directory"
60 if [ -d "${CT_ROOT_DST_DIR}" -a "${CT_FORCE}" != "y" ]; then
61 echo "$myname: '${CT_ROOT_DST_DIR}': already exists"
64 src_inode=$(ls -di "${CT_ROOT_SRC_DIR}")
65 dst_inode=$(ls -di "${CT_ROOT_DST_DIR}" 2>/dev/null)
66 if [ "${src_inode}" = "${dst_inode}" ]; then
67 echo "$myname: source and destination are the same!"
71 # Get rid of potentially older destination directory
72 if [ -d "${CT_ROOT_DST_DIR}" ]; then
73 mv "${CT_ROOT_DST_DIR}" "${CT_ROOT_DST_DIR}.$$"
74 setsid nohup rm -rf "${CT_ROOT_DST_DIR}.$$" >/dev/null 2>&1 &
77 # Create the working copy
78 mkdir -p "${CT_ROOT_DST_DIR}"
80 # Make all path absolute
81 CT_ROOT_SRC_DIR=$(cd "${CT_ROOT_SRC_DIR}"; pwd)
82 CT_ROOT_DST_DIR=$(cd "${CT_ROOT_DST_DIR}"; pwd)
84 cd "${CT_ROOT_SRC_DIR}"
85 tar cf - . |(cd "${CT_ROOT_DST_DIR}"; tar xf -)
87 # Parse the working copy for executables and libraries
88 cd "${CT_ROOT_DST_DIR}"
90 while [ ${still_needed} -eq 1 ]; do
91 ${CT_ECHO} "Looping..."
93 for f in $(find . -type f -exec file {} \; |egrep ': ELF [[:digit:]]+-bit .SB (executable|shared object),' |cut -d ":" -f 1); do
94 ${CT_ECHO} "Scanning '${f}'"
95 for libname in $("${CT_READELF}" -d "${f}" |egrep '(NEEDED)' |sed -r -e 's,.+\[(.+)\] *$,\1,;'); do
96 ${CT_ECHO} " searching for '${libname}'"
97 if [ -e "lib/${libname}" \
98 -o -e "usr/lib/${libname}" ]; then
99 ${CT_ECHO} " already present"
102 # Need to scan .. for libgcc_s et al.
103 for dir in . usr ..; do
104 ${CT_ECHO} -n " trying in '${dir}'"
106 [ "${tgt_dir}" = ".." ] && tgt_dir="usr"
107 libfile="${CT_SYSROOT_DIR}/${dir}/lib/${libname}"
108 ${CT_ECHO} ": '${libfile}'"
109 if [ -e "${libfile}" ]; then
110 mkdir -p "${dir}/lib"
111 ${CT_ECHO} " installing '${tgt_dir}/lib/${libname}'"
112 cp "${libfile}" "${tgt_dir}/lib/${libname}"