summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-02-27 22:16:59 (GMT)
committerGitHub <noreply@github.com>2017-02-27 22:16:59 (GMT)
commit1ec5e7aa3400b534264ba1c2fa3949dc6a2cca90 (patch)
tree67bf8ce9fc7b7558d39a26a0958399a3f0640baa /scripts
parent85ae00c1a6331d7738abb406a1eb59091c8a4535 (diff)
parentb3c23b7fdb62f396d47f46d8e3908725570d4acd (diff)
Merge pull request #618 from stilor/revert-sed-require-gnu-sed
Require GNU sed on macos
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/addToolVersion.sh2
-rw-r--r--scripts/build/arch.sh2
-rw-r--r--scripts/build/binutils/binutils.sh2
-rw-r--r--scripts/build/cc/100-gcc.sh2
-rw-r--r--scripts/build/companion_libs/110-mpfr.sh22
-rw-r--r--scripts/build/debug/200-duma.sh4
-rw-r--r--scripts/build/debug/300-gdb.sh4
-rw-r--r--scripts/build/debug/duma.in2
-rw-r--r--scripts/build/internals.sh30
-rw-r--r--scripts/build/kernel/linux.sh2
-rw-r--r--scripts/build/libc/glibc.sh6
-rw-r--r--scripts/build/test_suite/gcc.sh2
-rw-r--r--scripts/crosstool-NG.sh.in4
-rw-r--r--scripts/functions36
-rwxr-xr-xscripts/gen_in_frags.sh28
-rwxr-xr-xscripts/patch-renumber.sh2
-rw-r--r--scripts/populate.in41
-rw-r--r--scripts/saveSample.sh.in4
-rwxr-xr-xscripts/showSamples.sh2
-rw-r--r--scripts/xldd.in15
20 files changed, 91 insertions, 121 deletions
diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh
index 5631a5f..dbd1243 100755
--- a/scripts/addToolVersion.sh
+++ b/scripts/addToolVersion.sh
@@ -73,7 +73,7 @@ addToolVersion() {
[ -f "${file}" ] || return 0
- v=$(echo "${version}" |${sed_r} -e 's/-/_/g; s/\./_/g;')
+ v=$(echo "${version}" |"${sed}" -r -e 's/-/_/g; s/\./_/g;')
config_ver_option="${cat}_V_${v}"
diff --git a/scripts/build/arch.sh b/scripts/build/arch.sh
index c4e4c1e..75d3e21 100644
--- a/scripts/build/arch.sh
+++ b/scripts/build/arch.sh
@@ -23,7 +23,7 @@ CT_DoArchUClibcSelectArch() {
local cfg="${1}"
local arch="${2}"
- sed_r -i -e '/^TARGET_.*/d' "${cfg}"
+ sed -i -r -e '/^TARGET_.*/d' "${cfg}"
CT_KconfigEnableOption "TARGET_${arch}" "${cfg}"
CT_KconfigSetOption "TARGET_ARCH" "${arch}" "${cfg}"
}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index e57be76..f9c5fe7 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -257,7 +257,7 @@ do_binutils_backend() {
CT_DoLog EXTRA "Installing ld wrapper"
rm -f "${prefix}/bin/${CT_TARGET}-ld"
rm -f "${prefix}/${CT_TARGET}/bin/ld"
- sed_r -e "s/@@DEFAULT_LD@@/${CT_BINUTILS_LINKER_DEFAULT}/" \
+ sed -r -e "s/@@DEFAULT_LD@@/${CT_BINUTILS_LINKER_DEFAULT}/" \
"${CT_LIB_DIR}/scripts/build/binutils/binutils-ld.in" \
>"${prefix}/bin/${CT_TARGET}-ld"
chmod +x "${prefix}/bin/${CT_TARGET}-ld"
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh
index 81ef523..4dc7a69 100644
--- a/scripts/build/cc/100-gcc.sh
+++ b/scripts/build/cc/100-gcc.sh
@@ -660,7 +660,7 @@ do_gcc_core_backend() {
CT_DoExecLog ALL make ${JOBSFLAGS} -C gcc ${libgcc_rule} \
${repair_cc}
- sed_r -i -e 's@-lc@@g' gcc/${libgcc_rule}
+ sed -r -i -e 's@-lc@@g' gcc/${libgcc_rule}
else # build_libgcc
core_targets=( gcc )
fi # ! build libgcc
diff --git a/scripts/build/companion_libs/110-mpfr.sh b/scripts/build/companion_libs/110-mpfr.sh
index a7b7f72..5a89077 100644
--- a/scripts/build/companion_libs/110-mpfr.sh
+++ b/scripts/build/companion_libs/110-mpfr.sh
@@ -41,28 +41,6 @@ do_mpfr_extract() {
fi
CT_Popd
;;
- 1.*|2.0.*|2.1.*|2.2.*|2.3.*)
- CT_Pushd "${CT_SRC_DIR}/mpfr-${CT_MPFR_VERSION}"
- if [ ! -f .autotools.ct-ng ]; then
- CT_DoLog DEBUG "Re-building autotools files"
- CT_DoExecLog ALL autoreconf -fi
- # Starting with libtool-1.9f, config.{guess,sub} are no longer
- # installed without -i, but starting with libtool-2.2.6, they
- # are no longer removed without -i. Sight... Just use -i with
- # libtool >=2
- # See: http://sourceware.org/ml/crossgcc/2008-11/msg00046.html
- # and: http://sourceware.org/ml/crossgcc/2008-11/msg00048.html
- libtoolize_opt=
- case "$(libtoolize --version |head -n 1 |awk '{ print $(NF); }')" in
- 0.*) ;;
- 1.*) ;;
- *) libtoolize_opt=-i;;
- esac
- CT_DoExecLog ALL libtoolize -f ${libtoolize_opt}
- touch .autotools.ct-ng
- fi
- CT_Popd
- ;;
esac
}
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index 3aa1c31..2a9b01f 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -48,7 +48,7 @@ do_debug_duma_build() {
if [ "${CT_DUMA_CUSTOM_WRAPPER}" = "y" ]; then
# The shared library needs some love: some version have libduma.so.0.0,
# while others have libduma.so.0.0.0
- duma_so=$( make "${make_args[@]}" printvars | sed_r -n -e 's/^DUMASO \[(.*)\]$/\1/p' )
+ duma_so=$( make "${make_args[@]}" printvars | sed -n -r -e 's/^DUMASO \[(.*)\]$/\1/p' )
CT_DoLog EXTRA "Installing wrapper script"
CT_DoExecLog ALL mkdir -p "${CT_DEBUGROOT_DIR}/usr/bin"
@@ -56,7 +56,7 @@ do_debug_duma_build() {
CT_DoExecLog ALL rm -f "${CT_DEBUGROOT_DIR}/usr/bin/duma"
CT_DoExecLog ALL cp "${CT_LIB_DIR}/scripts/build/debug/duma.in" \
"${CT_DEBUGROOT_DIR}/usr/bin/duma"
- CT_DoExecLog ALL sed_r -i -e "s:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/${duma_so}:;" \
+ CT_DoExecLog ALL sed -i -r -e "s:^LIBDUMA_SO=.*:LIBDUMA_SO=/usr/lib/${duma_so}:;" \
"${CT_DEBUGROOT_DIR}/usr/bin/duma"
CT_DoExecLog ALL chmod 755 "${CT_DEBUGROOT_DIR}/usr/bin/duma"
fi
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 5255c64..a5ac7f9 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -156,11 +156,11 @@ do_debug_gdb_build() {
if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
else
- gcc_version=$(sed_r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
+ gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
"${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
)
fi
- sed_r \
+ sed -r \
-e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
-e "s:@@VERSION@@:${gcc_version}:;" \
"${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
diff --git a/scripts/build/debug/duma.in b/scripts/build/debug/duma.in
index f69e70b..90c9013 100644
--- a/scripts/build/debug/duma.in
+++ b/scripts/build/debug/duma.in
@@ -16,7 +16,7 @@ case "$1" in
# We use a suposedly POSIX-compliant shell: /bin/sh
# -> we can't use "${LD_PRELOAD//${LIBDUMA_SO}/}", it's not POSIX
# We don't know if sed will be present on the target
- # -> we can't use $(echo "${LD_PRELOAD}" |${sed_r} -e "s|${LIBDUMA_SO}||;")
+ # -> we can't use $(echo "${LD_PRELOAD}" |sed -r -e "s|${LIBDUMA_SO}||;")
# So, iterate through LD_PRELOAD, and keep only those libs that
# are not "${LIBDUMA_SO}"
old_LD_PRELOAD="${LD_PRELOAD}"
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index cf95383..18ada66 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -47,7 +47,7 @@ do_finish() {
if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
else
- gcc_version=$(sed_r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
+ gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
"${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
)
fi
@@ -71,14 +71,13 @@ do_finish() {
if [ "${CT_BARE_METAL}" != "y" ]; then
CT_DoLog EXTRA "Installing the populate helper"
- sed_r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
- -e 's|@@CT_install@@|'"${install}"'|g;' \
- -e 's|@@CT_awk@@|'"${awk}"'|g;' \
+ sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
+ -e 's|@@CT_install@@|'"install"'|g;' \
+ -e 's|@@CT_awk@@|'"awk"'|g;' \
-e 's|@@CT_bash@@|'"${bash}"'|g;' \
- -e 's|@@CT_grep@@|'"${grep}"'|g;' \
- -e 's|@@CT_make@@|'"${make}"'|g;' \
- -e 's|@@CT_sed@@|'"${sed}"'|g;' \
- -e 's|@@CT_sed_r@@|'"${sed_r}"'|g;' \
+ -e 's|@@CT_grep@@|'"grep"'|g;' \
+ -e 's|@@CT_make@@|'"make"'|g;' \
+ -e 's|@@CT_sed@@|'"sed"'|g;' \
"${CT_LIB_DIR}/scripts/populate.in" \
>"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
@@ -86,15 +85,14 @@ do_finish() {
if [ "${CT_LIBC_XLDD}" = "y" ]; then
CT_DoLog EXTRA "Installing a cross-ldd helper"
- sed_r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;' \
+ sed -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;' \
-e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
-e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|g;' \
- -e 's|@@CT_install@@|'"${install}"'|g;' \
+ -e 's|@@CT_install@@|'"install"'|g;' \
-e 's|@@CT_bash@@|'"${bash}"'|g;' \
- -e 's|@@CT_grep@@|'"${grep}"'|g;' \
- -e 's|@@CT_make@@|'"${make}"'|g;' \
- -e 's|@@CT_sed@@|'"${sed}"'|g;' \
- -e 's|@@CT_sed_r@@|'"${sed_r}"'|g;' \
+ -e 's|@@CT_grep@@|'"grep"'|g;' \
+ -e 's|@@CT_make@@|'"make"'|g;' \
+ -e 's|@@CT_sed@@|'"sed"'|g;' \
"${CT_LIB_DIR}/scripts/xldd.in" \
>"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
@@ -105,11 +103,11 @@ do_finish() {
CT_Pushd "${CT_PREFIX_DIR}/bin"
for t in "${CT_TARGET}-"*; do
if [ -n "${CT_TARGET_ALIAS}" ]; then
- _t=$(echo "$t" |sed_r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
+ _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
fi
if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
- _t=$(echo "$t" |sed_r -e "${CT_TARGET_ALIAS_SED_EXPR}")
+ _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
if [ "${_t}" = "${t}" ]; then
CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
else
diff --git a/scripts/build/kernel/linux.sh b/scripts/build/kernel/linux.sh
index 81a8869..9cfc433 100644
--- a/scripts/build/kernel/linux.sh
+++ b/scripts/build/kernel/linux.sh
@@ -80,7 +80,7 @@ do_kernel_extract() {
# to version - patching each particular Linux version would be
# too cumbersome.
CT_Pushd "${CT_SRC_DIR}/linux-${CT_KERNEL_VERSION}"
- sed_r -i 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile
+ sed -i -r 's/(\$\(MAKE\) .* relocs)$/:/' arch/*/Makefile
CT_Popd
}
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 00702a3..348c35a 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -473,7 +473,7 @@ do_libc_backend_once() {
do_libc_add_ons_list() {
local sep="$1"
local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}" \
- |sed_r -e "s/[[:space:],]/${sep}/g;" \
+ |sed -r -e "s/[[:space:],]/${sep}/g;" \
)"
if [ "${CT_LIBC_GLIBC_2_20_or_later}" != "y" ]; then
case "${CT_THREADS}" in
@@ -483,7 +483,7 @@ do_libc_add_ons_list() {
fi
[ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
# Remove duplicate, leading and trailing separators
- echo "${addons_list}" |sed_r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
+ echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
}
# Compute up the minimum supported Linux kernel version
@@ -512,7 +512,7 @@ do_libc_min_kernel_config() {
elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
# Trim the fourth part of the linux version, keeping only the first three numbers
min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \
- |sed_r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \
+ |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \
)"
fi
echo "--enable-kernel=${min_kernel_config}"
diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh
index eac095d..c829a43 100644
--- a/scripts/build/test_suite/gcc.sh
+++ b/scripts/build/test_suite/gcc.sh
@@ -21,7 +21,7 @@ do_test_suite_gcc_build() {
"${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/testsuite" \
"${CT_TEST_SUITE_DIR}/gcc"
- CT_DoExecLog ALL sed_r -i -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \
+ CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \
"${CT_TEST_SUITE_DIR}/gcc/Makefile"
CT_EndStep
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 7145403..902c15d 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -117,7 +117,7 @@ cat "${CT_LIB_DIR}/paths.sh" |while read trash line; do
fi
CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template"
CT_DoExecLog ALL cp "${tmpl}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
- CT_DoExecLog ALL ${sed_r} -i \
+ CT_DoExecLog ALL ${sed} -i -r \
-e "s#@CONFIG_SHELL@#${CT_CONFIG_SHELL}#g" \
-e "s#@TOOL_PATH@#${path}#g" \
-e "s#@TOOLS_OVERRIDE_DIR@#${CT_TOOLS_OVERRIDE_DIR}#g" \
@@ -148,7 +148,7 @@ CT_DoLog INFO "Building environment variables"
CT_TestAndAbort "'CT_PREFIX_DIR' is not set: where should I install?" -z "${CT_PREFIX_DIR}"
# Avoid multiple '/' in the prefix dir, it breaks relocatability
-CT_PREFIX_DIR="$( ${sed_r} -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )"
+CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )"
# Second kludge: merge user-supplied target CFLAGS with architecture-provided
# target CFLAGS. Do the same for LDFLAGS in case it happens in the future.
diff --git a/scripts/functions b/scripts/functions
index f075b62..eaa1a2b 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -4,10 +4,6 @@
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
-# NOTE: The functions in this file may be used before the tools override
-# directory is created (or in the scripts that don't create the tools override
-# directory at all). Therefore, use the variables exported by paths.sh.
-
CT_LoadConfig() {
local o
@@ -53,7 +49,7 @@ CT_LoadConfig() {
fi
# Double eval: first eval substitutes option name, second eval unescapes quotes
# and whitespace.
- for o in `set | ${sed_r} -n 's/^(CT_[A-Za-z0-9_]*_ARRAY)=.*/\1/p'`; do
+ for o in `set | ${sed} -rn 's/^(CT_[A-Za-z0-9_]*_ARRAY)=.*/\1/p'`; do
eval "eval $o=(\"\$$o\")"
done
}
@@ -495,7 +491,7 @@ CT_Which() {
# to the highest entire second
# Usage: CT_DoDate <fmt>
CT_DoDate() {
- date "$1" | ${sed_r} -e 's/%?N$/000000000/;'
+ date "$1" |${sed} -r -e 's/%?N$/000000000/;'
}
CT_STEP_COUNT=1
@@ -518,7 +514,7 @@ CT_DoStep() {
CT_EndStep() {
local stop=$(CT_DoDate +%s%N)
local duration=$(printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) \
- | ${sed_r} -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;'
+ |${sed} -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;'
)
local elapsed=$(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60)))
local level="${CT_STEP_LEVEL[${CT_STEP_COUNT}]}"
@@ -1006,7 +1002,7 @@ CT_GetGit() {
local url="${3}"
local _out_cset="${4}"
- local ref=$(echo "${cset_or_ref}" | ${sed_r} -n 's/^ref=(.*)/\1/p')
+ local ref=$(echo "${cset_or_ref}" | ${sed} -n 's/^ref=\(.*\)/\1/p')
if [ -n "$ref" ]; then
local matches=$(git ls-remote --exit-code "$url" --refs "${ref}")
local result=$?
@@ -1186,7 +1182,7 @@ CT_ExtractGit() {
if [ -z "${ref}" ]; then
ref_type=head
ref=$(git rev-list -n1 HEAD)
- elif git tag |${grep} -E "^${ref}$" >/dev/null 2>&1; then
+ elif git tag |{grep} -E "^${ref}$" >/dev/null 2>&1; then
ref_type=tag
elif git branch -a --no-color |${grep} -E "^. ${ref}$" >/dev/null 2>&1; then
ref_type=branch
@@ -1429,7 +1425,7 @@ CT_DoBuildTargetTuple() {
# Sanity checks
__sed_alias=""
if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
- __sed_alias=$(echo "${CT_TARGET}" | ${sed_r} -e "${CT_TARGET_ALIAS_SED_EXPR}")
+ __sed_alias=$(echo "${CT_TARGET}" |${sed} -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
fi
case ":${CT_TARGET_VENDOR}:${CT_TARGET_ALIAS}:${__sed_alias}:" in
:*" "*:*:*:) CT_Abort "Don't use spaces in the vendor string, it breaks things.";;
@@ -1502,7 +1498,7 @@ CT_DoTarballIfExists() {
CT_DoLog DEBUG " Saving '${dir}'"
{ tar c -C "${dir}" -v -f - "${extra_tar_opts[@]}" . \
|"${compress[@]}" >"${tarball}.tar${tar_ext}" ;
- } 2>&1 | ${sed_r} -e 's/^/ /;' |CT_DoLog STATE
+ } 2>&1 |${sed} -r -e 's/^/ /;' |CT_DoLog STATE
else
CT_DoLog STATE " Not saving '${dir}': does not exist"
fi
@@ -1529,7 +1525,7 @@ CT_DoExtractTarballIfExists() {
CT_DoExecLog DEBUG mkdir -p "${dir}"
{ "${uncompress[@]}" "${tarball}.tar${tar_ext}" \
|tar x -C "${dir}" -v -f - "${extra_tar_opts[@]}" ;
- } 2>&1 | ${sed_r} -e 's/^/ /;' |CT_DoLog STATE
+ } 2>&1 |${sed} -r -e 's/^/ /;' |CT_DoLog STATE
else
CT_DoLog STATE " Not restoring '${dir}': does not exist"
fi
@@ -1557,7 +1553,7 @@ CT_DoSaveState() {
$0~/^[^ ]+ \(\)/ { _p = 0; }
_p == 1
$0 == "}" { _p = 1; }
- ' | ${sed_r} -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
+ ' |${sed} -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
/^(UID|EUID)=/d;
/^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
@@ -1618,9 +1614,9 @@ CT_KconfigSetOption() {
local file="$3"
${grep} -E -q "^${option}=.*" "${file}" && \
- ${sed_r} -i -e "s;^${option}=.*$;${option}=${value};" "${file}" || \
+ ${sed} -i -r -e "s;^${option}=.*$;${option}=${value};" "${file}" || \
${grep} -E -q "^# ${option} is not set$" "${file}" && \
- ${sed_r} -i -e "s;^# ${option} is not set$;${option}=${value};" "${file}" || \
+ ${sed} -i -r -e "s;^# ${option} is not set$;${option}=${value};" "${file}" || \
echo "${option}=${value}" >> "${file}"
}
@@ -1641,7 +1637,7 @@ CT_KconfigDisableOption() {
${grep} -E -q "^# ${option} is not set$" "${file}" || \
${grep} -E -q "^${option}=.*$" "${file}" && \
- ${sed_r} -i -e "s;^${option}=.*$;# ${option} is not set;" "${file}" || \
+ ${sed} -i -r -e "s;^${option}=.*$;# ${option} is not set;" "${file}" || \
echo "# ${option} is not set" >> "${file}"
}
@@ -1653,9 +1649,9 @@ CT_KconfigDeleteOption() {
local file="${2}"
${grep} -E -q "^# ${option} is not set$" "${file}" && \
- ${sed_r} -i -e "/^# ${option} is not set$/d" "${file}" || \
+ ${sed} -i -r -e "/^# ${option} is not set$/d" "${file}" || \
${grep} -E -q "^${option}=.*$" "${file}" && \
- ${sed_r} -i -e "/^${option}=.*$/d" "${file}" || true
+ ${sed} -i -r -e "/^${option}=.*$/d" "${file}" || true
}
# Multilib iterator. The caller should be in a directory where the directories
@@ -1724,7 +1720,7 @@ CT_IterateMultilibs() {
# We do supply original multi_os_dir for consumers that need to look inside
# GCC's directories (e.g. to locate the libraries), under the name of
# multi_os_dir_gcc.
- multi_flags=$( echo "${multilib#*;}" | ${sed_r} -e 's/@/ -/g;' )
+ multi_flags=$( echo "${multilib#*;}" | ${sed} -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} )
multi_root=$( "${CT_TARGET}-${CT_CC}" -print-sysroot ${multi_flags} )
@@ -1744,7 +1740,7 @@ CT_IterateMultilibs() {
# the architecture-specific functions.
multi_index=1
for multilib in "${multilibs[@]}"; do
- multi_flags=$( echo "${multilib#*;}" | ${sed_r} -e 's/@/ -/g;' )
+ multi_flags=$( echo "${multilib#*;}" | ${sed} -r -e 's/@/ -/g;' )
multi_dir="${multilib%%;*}"
multi_os_dir=$( "${CT_TARGET}-${CT_CC}" -print-multi-os-directory ${multi_flags} )
multi_os_dir_gcc="${multi_os_dir}"
diff --git a/scripts/gen_in_frags.sh b/scripts/gen_in_frags.sh
index f23b0bc..9fbb871 100755
--- a/scripts/gen_in_frags.sh
+++ b/scripts/gen_in_frags.sh
@@ -65,18 +65,18 @@ gen_choice() {
printf '\n'
for entry in "${@}"; do
file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |${sed_r} -s -e 's/[-.+]/_/g;')
+ _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}"
printf ' bool\n'
printf ' prompt "%s"\n' "${entry}"
if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
printf ' depends on %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
fi
- ${sed_r} -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
- ${sed_r} -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
- if ${grep} -E '^## help' ${file} >/dev/null 2>&1; then
+ "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
+ "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
+ if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
printf ' help\n'
- ${sed_r} -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
+ "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
fi
printf '\n'
done
@@ -84,7 +84,7 @@ gen_choice() {
for entry in "${@}"; do
file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |${sed_r} -s -e 's/[-.+]/_/g;')
+ _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf '\n'
if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
printf 'config %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
@@ -107,7 +107,7 @@ gen_choice() {
printf '# Generated file, do not edit!!!\n'
for entry in "${@}"; do
file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |${sed_r} -s -e 's/[-.+]/_/g;')
+ _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
if [ -f "${file}.2" ]; then
printf '\n'
printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
@@ -135,18 +135,18 @@ gen_menu() {
printf '\n'
for entry in "${@}"; do
file="${base_dir}/${entry}.in"
- _entry=$(printf '%s\n' "${entry}" |${sed_r} -s -e 's/[-.+]/_/g;')
+ _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}"
printf ' bool\n'
- if ${grep} -E '^## default' ${file} >/dev/null 2>&1; then
- ${sed_r} -e '/^## default ?/!d; s/^## default ?/ default /;' ${file} 2>/dev/null
+ if "${grep}" -E '^## default' ${file} >/dev/null 2>&1; then
+ "${sed}" -r -e '/^## default ?/!d; s/^## default ?/ default /;' ${file} 2>/dev/null
fi
printf ' prompt "%s"\n' "${entry}"
- ${sed_r} -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
- ${sed_r} -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
- if ${grep} -E '^## help' ${file} >/dev/null 2>&1; then
+ "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
+ "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
+ if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
printf ' help\n'
- ${sed_r} -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
+ "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
fi
printf '\n'
printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
diff --git a/scripts/patch-renumber.sh b/scripts/patch-renumber.sh
index 602f904..c9650ce 100755
--- a/scripts/patch-renumber.sh
+++ b/scripts/patch-renumber.sh
@@ -59,7 +59,7 @@ for p in "${src}/"*.patch*; do
newname="$(printf "%03d-%s" \
"${cpt}" \
"$( basename "${p}" \
- |${sed_r} -e 's/^[[:digit:]]+[-_]//' \
+ |${sed} -r -e 's/^[[:digit:]]+[-_]//' \
-e "${sed_re}" \
)" \
)"
diff --git a/scripts/populate.in b/scripts/populate.in
index e5d0b45..f68acd9 100644
--- a/scripts/populate.in
+++ b/scripts/populate.in
@@ -8,26 +8,25 @@ set -e
install="@@CT_install@@"
grep="@@CT_grep@@"
sed="@@CT_sed@@"
-sed_r="@@CT_sed_r@@"
awk="@@CT_awk@@"
# Detect where the toolchain is:
CT_PREFIX_DIR="$(cd "$(dirname "$0")/.."; pwd)"
CT_GCC="${0%-populate}-gcc"
CT_READELF="${0%-populate}-readelf"
-CT_CFG_PREFIX_DIR="$(${CT_GCC} -v 2>&1 \
+CT_CFG_PREFIX_DIR="$("${CT_GCC}" -v 2>&1 \
|tr ' ' '\n' \
- |${grep} -E -- '--prefix=' \
+ |"${grep}" -E -- '--prefix=' \
|cut -d = -f 2-
)"
-CT_CFG_SYSROOT_DIR="$(${CT_GCC} -v 2>&1 \
- |tr ' ' '\n' \
- |${grep} -E -- '--with-sysroot=' \
+CT_CFG_SYSROOT_DIR="$("${CT_GCC}" -v 2>&1 \
+ |tr ' ' '\n' \
+ |"${grep}" -E -- '--with-sysroot=' \
|cut -d = -f 2-
)"
-CT_SYSROOT_DIR="$(printf "${CT_CFG_SYSROOT_DIR}\n" \
- |${sed_r} -e "s:^${CT_CFG_PREFIX_DIR}:${CT_PREFIX_DIR}:;" \
- -e 's,/+,/,g;' \
+CT_SYSROOT_DIR="$(printf "${CT_CFG_SYSROOT_DIR}\n" \
+ |"${sed}" -r -e "s:^${CT_CFG_PREFIX_DIR}:${CT_PREFIX_DIR}:;" \
+ |"${sed}" -r -e 's,/+,/,g;' \
)"
myname=$(basename "$0")
@@ -198,9 +197,9 @@ do_add_lib() {
${CT_PRINTF} ": '%s'\n" "${libfile}"
if [ -e "${libfile}" ]; then
mkdir -p "${dir}"
- true_libname=$("${CT_READELF}" -d "${libfile}" \
- |${grep} "Library soname:" \
- |${sed_r} -e 's,.+\[(.+)\] *$,\1,;' \
+ true_libname=$("${CT_READELF}" -d "${libfile}" \
+ |"${grep}" "Library soname:" \
+ |"${sed}" -r -e 's,.+\[(.+)\] *$,\1,;' \
)
case "${libfile}" in
*/ld*) mode=0755;;
@@ -225,9 +224,9 @@ do_resolve_deps() {
local file="${1}"
local libname
- for libname in $("${CT_READELF}" -d "${file}" \
- |${grep} -E '\(NEEDED\)[[:space:]]+Shared library:' \
- |${sed_r} -e 's,.+\[(.+)\] *$,\1,;' \
+ for libname in $("${CT_READELF}" -d "${file}" \
+ |"${grep}" -E '\(NEEDED\)[[:space:]]+Shared library:' \
+ |"${sed}" -r -e 's,.+\[(.+)\] *$,\1,;' \
); do
[ -n "${libname}" ] || continue
${CT_PRINTF} "Searching for '%s' needed by '%s'\n" "${libname}" "${file}"
@@ -244,15 +243,15 @@ cd "${CT_ROOT_DST_DIR}"
# First of, copy the forced libraries into the working copy
lib_list=
if [ -n "${CT_LIB_FILE}" ]; then
- lib_list=$(${sed_r} -e ':loop; s/#.*//;' \
- -e 's/[[:space:]]+//g;' \
- -e 's/([^:])$/\1:/;' \
- -e '/$/N; s/\n//; tloop;' \
+ lib_list=$("${sed}" -r -e ':loop; s/#.*//;' \
+ -e 's/[[:space:]]+//g;' \
+ -e 's/([^:])$/\1:/;' \
+ -e '/$/N; s/\n//; tloop;' \
"${CT_LIB_FILE}"
)
fi
CT_LIB_LIST=$(printf "${CT_LIB_LIST}:${lib_list}\n" \
- |${sed_r} -e 's/^:+//; s/:+$//; s/:+/ /g;' \
+ |"${sed}" -r -e 's/^:+//; s/:+$//; s/:+/ /g;' \
)
if [ -n "${CT_LIB_LIST}" ]; then
for name in ${CT_LIB_LIST}; do
@@ -283,7 +282,7 @@ trap "rm -rf ${CT_TMP_DIR}" EXIT
# List all ELF (executables|shared objects)...
find . -type f -exec file {} \; \
-|${grep} -E ': ELF [[:digit:]]+-bit (L|M)SB +(executable|shared object),' \
+|"${grep}" -E ': ELF [[:digit:]]+-bit (L|M)SB +(executable|shared object),' \
|cut -d ":" -f 1 \
>"${CT_TMP_DIR}/files.list"
diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in
index cab9b7f..2e413bd 100644
--- a/scripts/saveSample.sh.in
+++ b/scripts/saveSample.sh.in
@@ -75,7 +75,7 @@ fi
if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
# We save the file, and then point the saved sample to this file
CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
- ${sed_r} -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
+ "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
.defconfig
else
# remove any dangling files
@@ -98,7 +98,7 @@ read -p "Reporter name [${reporter_name}]: " reporter_name
read -p "Reporter URL [${reporter_url}]: " reporter_url
if [ -n "${reporter_comment}" ]; then
echo "Old comment:"
- printf "${reporter_comment}\n" | ${sed_r} -e 's/^/ > /;'
+ printf "${reporter_comment}\n" | ${sed} -r -e 's/^/ > /;'
fi
echo "Reporter comment (Ctrl-D to finish, '.' to use previous):"
reporter_comment=$(cat)
diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh
index 14eb080..f3a21d2 100755
--- a/scripts/showSamples.sh
+++ b/scripts/showSamples.sh
@@ -129,7 +129,7 @@ dump_single_sample() {
;;
canadian)
printf "| ''"
- printf "${sample}" |${sed_r} -e 's/.*,//'
+ printf "${sample}" |${sed} -r -e 's/.*,//'
printf "'' | ${CT_HOST} "
;;
*) ;;
diff --git a/scripts/xldd.in b/scripts/xldd.in
index cea0394..0e8c0d0 100644
--- a/scripts/xldd.in
+++ b/scripts/xldd.in
@@ -5,7 +5,6 @@ export LC_ALL=C
version="@@CT_VERSION@@"
bits="@@CT_BITS@@"
sed="${SED:-@@CT_sed@@}"
-sed_r="${SED_R:-@@CT_sed_r@@}"
grep="${GREP:-@@CT_grep@@}"
my_name="$( basename "${0}" )"
@@ -160,7 +159,7 @@ fi
sysroot="$( "${gcc}" -print-sysroot 2>/dev/null )"
if [ -z "${sysroot}" ]; then
sysroot="$( "${gcc}" -print-file-name=libc.so 2>/dev/null \
- |${sed_r} -e 's:/usr/lib/libc.so$::;' \
+ |${sed} -r -e 's:/usr/lib/libc.so$::;' \
)"
fi
if [ -z "${sysroot}" ]; then
@@ -258,9 +257,9 @@ do_process_file() {
do_trace "Parsing file '%s'\n" "${file}"
save_search_rpath=( "${search_rpath[@]}" )
- for n in $( ${readelf} -d "${file}" \
- |${grep} -E '\((RPATH|RUNPATH)\)' \
- |${sed_r} -e 's/^.*Library r(|un)path:[[:space:]]+\[(.*)\]$/\2/;'\
+ for n in $( "${readelf}" -d "${file}" \
+ |"${grep}" -E '\((RPATH|RUNPATH)\)' \
+ |"${sed}" -r -e 's/^.*Library r(|un)path:[[:space:]]+\[(.*)\]$/\2/;'\
); do
do_trace "-> adding rpath '%s'\n" "${n}"
search_rpath+=( "${n}" )
@@ -271,9 +270,9 @@ do_process_file() {
done
do_trace ": end search path\n"
- for n in $( ${readelf} -d "${file}" \
- |${grep} -E '\(NEEDED\)' \
- |${sed_r} -e 's/^.*Shared library:[[:space:]]+\[([^]]+)\].*/\1/;' \
+ for n in $( "${readelf}" -d "${file}" \
+ |"${grep}" -E '\(NEEDED\)' \
+ |"${sed}" -r -e 's/^.*Shared library:[[:space:]]+\[([^]]+)\].*/\1/;' \
); do
found=0
for m in "${needed_list[@]}"; do