From 59bab98b2de061f395dc81f9a31157b4b1f9de91 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 26 Feb 2017 19:06:35 -0800 Subject: Revert "Determine whether -E/-r option selects extended regexp" This reverts commit 7bcf18bfab84374d3305c7a088f95ac1219ddf93. --- scripts/build/arch.sh | 2 +- scripts/build/binutils/binutils.sh | 2 +- scripts/build/cc/100-gcc.sh | 2 +- scripts/build/debug/200-duma.sh | 4 ++-- scripts/build/debug/300-gdb.sh | 4 ++-- scripts/build/debug/duma.in | 2 +- scripts/build/internals.sh | 30 ++++++++++++++---------------- scripts/build/kernel/linux.sh | 2 +- scripts/build/libc/glibc.sh | 6 +++--- scripts/build/test_suite/gcc.sh | 2 +- 10 files changed, 27 insertions(+), 29 deletions(-) (limited to 'scripts/build') diff --git a/scripts/build/arch.sh b/scripts/build/arch.sh index c4e4c1e8..75d3e211 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 e57be766..f9c5fe76 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 81ef5230..4dc7a693 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/debug/200-duma.sh b/scripts/build/debug/200-duma.sh index 3aa1c318..2a9b01f8 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 5255c646..a5ac7f9d 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 f69e70b1..90c90136 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 cf953838..18ada66a 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 81a88693..9cfc433f 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 00702a33..348c35ad 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 eac095d6..c829a438 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 -- cgit v1.2.3 From 2dae1cf81619606b133888675d5ebf1b688d9d7c Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 26 Feb 2017 20:42:32 -0800 Subject: Require GNU sed After much struggling with macos (BSD) sed and even getting everything work in crosstool-ng itself, I had to abandon that because some components rely on GNU syntax. Specifically, GNU libc uses '/.../{H;g}' (note absense of the separator after 'g'). So, revert the -r/-E detection and check for sed's being of GNU origin. MacOS people, sorry, but you'd have to install GNU sed. Signed-off-by: Alexey Neyman --- Makefile.in | 35 ++++------------------ configure.ac | 32 +++++++++----------- scripts/build/companion_libs/110-mpfr.sh | 22 -------------- scripts/crosstool-NG.sh.in | 2 +- scripts/functions | 50 ++++++++++++++++---------------- scripts/patch-renumber.sh | 2 +- scripts/saveSample.sh.in | 2 +- 7 files changed, 47 insertions(+), 98 deletions(-) (limited to 'scripts/build') diff --git a/Makefile.in b/Makefile.in index 4e8db5c9..f0034cb4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -204,41 +204,18 @@ $(PROG_NAME): ct-ng.in Makefile %: %.in Makefile $(call sed_it) +__paths_vars = install bash awk grep make sed libtool \ + libtoolize objcopy objdump readelf patch gperf + # We create a script fragment that is parseable from inside a Makefile, -# and one from inside a shell script +# and one from inside a shell script. paths.mk: FORCE @echo " GEN '$@'" - @(echo 'export install=$(install)'; \ - echo 'export bash=$(bash)'; \ - echo 'export awk=$(awk)'; \ - echo 'export grep=$(grep)'; \ - echo 'export make=$(make)'; \ - echo 'export sed=$(sed)'; \ - echo 'export libtool=$(libtool)'; \ - echo 'export libtoolize=$(libtoolize)'; \ - echo 'export objcopy=$(objcopy)'; \ - echo 'export objdump=$(objdump)'; \ - echo 'export readelf=$(readelf)'; \ - echo 'export patch=$(patch)'; \ - echo 'export gperf=$(gperf)'; \ - ) >$@ + @{ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w=$(subst ','\'',$($w))';)) :; } >$@ paths.sh: FORCE @echo " GEN '$@'" - @(echo 'export install="$(install)"'; \ - echo 'export bash="$(bash)"'; \ - echo 'export awk="$(awk)"'; \ - echo 'export grep="$(grep)"'; \ - echo 'export make="$(make)"'; \ - echo 'export sed="$(sed)"'; \ - echo 'export libtool="$(libtool)"'; \ - echo 'export libtoolize="$(libtoolize)"'; \ - echo 'export objcopy="$(objcopy)"'; \ - echo 'export objdump="$(objdump)"'; \ - echo 'export readelf="$(readelf)"'; \ - echo 'export patch="$(patch)"'; \ - echo 'export gperf="$(gperf)"'; \ - ) >$@ + @{ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w="$(subst ','\'',$($w))"';)) :; } >$@ config/configure.in: FORCE @echo " GEN '$@'" diff --git a/configure.ac b/configure.ac index 11c5a8e8..986d2807 100644 --- a/configure.ac +++ b/configure.ac @@ -162,24 +162,18 @@ AC_ARG_VAR([INSTALL], [Specify the full path to a BSD-compatible install]) AC_PROG_INSTALL ACX_WITH_DEPRECATED([grep], [GREP]) -AC_ARG_VAR([INSTALL], [Specify the full path to GNU grep]) +AC_ARG_VAR([GREP], [Specify the full path to GNU grep]) AC_PROG_GREP AC_PROG_EGREP AS_IF([test "$EGREP" != "$GREP -E"], [AC_MSG_ERROR([egrep is not $GREP -E])]) -ACX_WITH_DEPRECATED([sed], [SED]) -AC_ARG_VAR([INSTALL], [Specify the full path to GNU sed]) -AC_PROG_SED -AC_MSG_CHECKING([whether sed understands -r -i -e]) -echo foo > .ct-ng.sed.test -${SED} -r -i -e 's/f(o)o/b\1ar/' .ct-ng.sed.test >/dev/null 2>&1 -rc=$? -content=`cat .ct-ng.sed.test` -rm -f .ct-ng.sed.test -AS_IF([test "$rc:$content" = "0:boar"], - [AC_MSG_RESULT([yes])], - [AC_MSG_ERROR([sed does not accept -r -i -e])]) +ACX_PROG_VERSION_REQ_STRICT([SED], + [GNU sed >= 4.0], + [sed], + [gsed sed], + ['\(GNU sed\) [4-9]\.']) +AC_ARG_VAR([SED], [Specify the full path to GNU sed]) AC_PROG_LN_S @@ -294,42 +288,42 @@ ACX_PROG_VERSION([LIBTOOL], [GNU libtool >= 2.4], [libtool], [glibtool libtool], - ['^libtool \(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'], + ['\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'], [libtool_2_4_or_newer]) ACX_PROG_VERSION([LIBTOOLIZE], [GNU libtoolize >= 2.4], [libtoolize], [glibtoolize libtoolize], - ['^libtoolize \(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'], + ['\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'], [libtoolize_2_4_or_newer]) ACX_PROG_VERSION([AUTOCONF], [GNU autoconf >= 2.65], [AUTOCONF], [autoconf], - ['^autoconf \(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])'], + ['\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])'], [autoconf_2_63_or_newer]) ACX_PROG_VERSION([AUTORECONF], [GNU autoreconf >= 2.63], [autoreconf], [autoreconf], - ['^autoreconf \(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[3-9])'], + ['\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[3-9])'], [autoreconf_2_63_or_newer]) ACX_PROG_VERSION([AUTOMAKE], [GNU automake >= 1.15], [automake], [automake], - ['automake \(GNU automake\) ([2-9]\.|1\.[2-9][0-9]|1\.1[5-9])'], + ['\(GNU automake\) ([2-9]\.|1\.[2-9][0-9]|1\.1[5-9])'], [automake_1_15_or_newer]) ACX_PROG_VERSION([M4], [GNU m4 >= 1.4.12], [m4], [gm4 m4], - ['^m4 \(GNU M4\) ([2-9]\.|1\.[5-9]|1\.[1-4][0-9]|1\.4\.[2-9][0-9]|1\.4\.1[2-9])'], + ['\(GNU M4\) ([2-9]\.|1\.[5-9]|1\.[1-4][0-9]|1\.4\.[2-9][0-9]|1\.4\.1[2-9])'], [gnu_m4_1_4_12_or_newer]) #---------------------------------------- diff --git a/scripts/build/companion_libs/110-mpfr.sh b/scripts/build/companion_libs/110-mpfr.sh index a7b7f729..5a890774 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/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index b39dee4f..902c15d2 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -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 84054d58..eaa1a2bd 100644 --- a/scripts/functions +++ b/scripts/functions @@ -49,7 +49,7 @@ CT_LoadConfig() { fi # Double eval: first eval substitutes option name, second eval unescapes quotes # and whitespace. - for o in `set | sed -rn '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 } @@ -394,7 +394,7 @@ CT_SanitizeVarDir() { for var in "$@"; do eval "old_dir=\"\${${var}}\"" - new_dir=$( echo "${old_dir}" | awk ' + new_dir=$( echo "${old_dir}" | ${awk} ' { isabs = $1 == "" # Started with a slash trail = $NF == "" # Ending with a slash @@ -491,7 +491,7 @@ CT_Which() { # to the highest entire second # Usage: CT_DoDate CT_DoDate() { - date "$1" |sed -r -e 's/%?N$/000000000/;' + date "$1" |${sed} -r -e 's/%?N$/000000000/;' } CT_STEP_COUNT=1 @@ -514,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}]}" @@ -1002,7 +1002,7 @@ CT_GetGit() { local url="${3}" local _out_cset="${4}" - local ref=$(echo "${cset_or_ref}" | sed -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=$? @@ -1182,9 +1182,9 @@ 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 + elif git branch -a --no-color |${grep} -E "^. ${ref}$" >/dev/null 2>&1; then ref_type=branch elif date -d "${ref}" >/dev/null 2>&1; then ref_type=date @@ -1425,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.";; @@ -1498,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 @@ -1525,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 @@ -1548,12 +1548,12 @@ CT_DoSaveState() { # We must omit shell functions, and some specific bash variables # that break when restoring the environment, later. We could do # all the processing in the awk script, but a sed is easier... - set |awk ' + set |${awk} ' BEGIN { _p = 1; } $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" @@ -1613,10 +1613,10 @@ CT_KconfigSetOption() { local value="$2" local file="$3" - grep -E -q "^${option}=.*" "${file}" && \ - sed -i -r -e "s;^${option}=.*$;${option}=${value};" "${file}" || \ - grep -E -q "^# ${option} is not set$" "${file}" && \ - sed -i -r -e "s;^# ${option} is not set$;${option}=${value};" "${file}" || \ + ${grep} -E -q "^${option}=.*" "${file}" && \ + ${sed} -i -r -e "s;^${option}=.*$;${option}=${value};" "${file}" || \ + ${grep} -E -q "^# ${option} is not set$" "${file}" && \ + ${sed} -i -r -e "s;^# ${option} is not set$;${option}=${value};" "${file}" || \ echo "${option}=${value}" >> "${file}" } @@ -1635,9 +1635,9 @@ CT_KconfigDisableOption() { local option="${1}" local file="${2}" - grep -E -q "^# ${option} is not set$" "${file}" || \ - grep -E -q "^${option}=.*$" "${file}" && \ - sed -i -r -e "s;^${option}=.*$;# ${option} is not set;" "${file}" || \ + ${grep} -E -q "^# ${option} is not set$" "${file}" || \ + ${grep} -E -q "^${option}=.*$" "${file}" && \ + ${sed} -i -r -e "s;^${option}=.*$;# ${option} is not set;" "${file}" || \ echo "# ${option} is not set" >> "${file}" } @@ -1648,10 +1648,10 @@ CT_KconfigDeleteOption() { local option="${1}" local file="${2}" - grep -E -q "^# ${option} is not set$" "${file}" && \ - sed -i -r -e "/^# ${option} is not set$/d" "${file}" || \ - grep -E -q "^${option}=.*$" "${file}" && \ - sed -i -r -e "/^${option}=.*$/d" "${file}" || true + ${grep} -E -q "^# ${option} is not set$" "${file}" && \ + ${sed} -i -r -e "/^# ${option} is not set$/d" "${file}" || \ + ${grep} -E -q "^${option}=.*$" "${file}" && \ + ${sed} -i -r -e "/^${option}=.*$/d" "${file}" || true } # Multilib iterator. The caller should be in a directory where the directories @@ -1720,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} ) @@ -1740,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/patch-renumber.sh b/scripts/patch-renumber.sh index c56473b4..c9650ce9 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/saveSample.sh.in b/scripts/saveSample.sh.in index 646c1893..2e413bd0 100644 --- a/scripts/saveSample.sh.in +++ b/scripts/saveSample.sh.in @@ -50,7 +50,7 @@ force_default_opts=( \ ) regexp=${force_default_opts[*]} regexp=${regexp// /|} -grep -v -E '^(# )?CT_('"${regexp}"')' .config > .defconfig +${grep} -v -E '^(# )?CT_('"${regexp}"')' .config > .defconfig # Function to copy a file to the sample directory # Needed in case the file is already there (think of a previously available sample) -- cgit v1.2.3