diff --git a/pkgs/stdenv/common-path.nix b/pkgs/stdenv/common-path.nix index c2e5dedfd22a..cff6fd0a3eed 100644 --- a/pkgs/stdenv/common-path.nix +++ b/pkgs/stdenv/common-path.nix @@ -11,6 +11,5 @@ pkgs.gnumake pkgs.bash pkgs.patch - pkgs.replace pkgs.xz ] diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh index 23cc2a0775f5..01e86ce39986 100644 --- a/pkgs/stdenv/generic/builder.sh +++ b/pkgs/stdenv/generic/builder.sh @@ -16,8 +16,6 @@ done mkdir $out -# Can't use substitute() here, because replace may not have been -# built yet (in the bootstrap). sed \ -e "s^@preHook@^$_preHook^g" \ -e "s^@postHook@^$_postHook^g" \ diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index a06b72058269..9ea97c1bf581 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -315,43 +315,39 @@ substitute() { local output="$2" local -a params=("$@") - local -a args=() local n p pattern replacement varName + local content="$(cat $input)" + for ((n = 2; n < ${#params[*]}; n += 1)); do p=${params[$n]} - if test "$p" = "--replace"; then + if [ "$p" = --replace ]; then pattern="${params[$((n + 1))]}" replacement="${params[$((n + 2))]}" n=$((n + 2)) fi - if test "$p" = "--subst-var"; then + if [ "$p" = --subst-var ]; then varName="${params[$((n + 1))]}" pattern="@$varName@" replacement="${!varName}" n=$((n + 1)) fi - if test "$p" = "--subst-var-by"; then + if [ "$p" = --subst-var-by ]; then pattern="@${params[$((n + 1))]}@" replacement="${params[$((n + 2))]}" n=$((n + 2)) fi - if test ${#args[@]} != 0; then - args[${#args[@]}]="-a" - fi - args[${#args[@]}]="$pattern" - args[${#args[@]}]="$replacement" + content="${content//"$pattern"/$replacement}" done - replace-literal -e -s -- "${args[@]}" < "$input" > "$output".tmp - if test -x "$output"; then - chmod +x "$output".tmp - fi + # !!! This doesn't work properly if $content is "-n". + echo -n "$content" > "$output".tmp + if [ -x "$output" ]; then chmod +x "$output".tmp; fi mv -f "$output".tmp "$output" } diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index a780574539f9..9116b2225690 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -133,7 +133,6 @@ rec { cp -d ${gnumake}/bin/* $out/bin cp -d ${patch}/bin/* $out/bin cp ${patchelf}/bin/* $out/bin - cp ${replace}/bin/* $out/bin cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep