diff options
author | Alexey Neyman <stilor@att.net> | 2017-02-27 04:42:32 (GMT) |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2017-02-27 04:42:32 (GMT) |
commit | 2dae1cf81619606b133888675d5ebf1b688d9d7c (patch) | |
tree | d5592c1e342ff2f98ed18983394e901fc54a336b /scripts | |
parent | 59bab98b2de061f395dc81f9a31157b4b1f9de91 (diff) |
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 <stilor@att.net>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/companion_libs/110-mpfr.sh | 22 | ||||
-rw-r--r-- | scripts/crosstool-NG.sh.in | 2 | ||||
-rw-r--r-- | scripts/functions | 50 | ||||
-rwxr-xr-x | scripts/patch-renumber.sh | 2 | ||||
-rw-r--r-- | scripts/saveSample.sh.in | 2 |
5 files changed, 28 insertions, 50 deletions
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/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index b39dee4..902c15d 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 84054d5..eaa1a2b 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 <fmt> 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 c56473b..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/saveSample.sh.in b/scripts/saveSample.sh.in index 646c189..2e413bd 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) |