This reverts commit 0a944b345e, reversing
changes made to 61733ed6cc.
I dislike these massive stdenv changes with unclear motivation,
especially when they involve gratuitous mass renames like NIX_CC ->
NIX_BINUTILS. The previous such rename (NIX_GCC -> NIX_CC) caused
months of pain, so let's not do that again.
(cherry picked from commit ec8d41f08c)
patchPhase was being run after installPhase, causing patchelf to be
run on the left-behind binary instead of the copy in $out. Fixes:
```
$ .../bin/sc
bash: .../bin/sc: No such file or directory
$ patchelf --print-interpreter .../bin/sc
/lib64/ld-linux-x86-64.so.2
```
Many (less easily automatically converted) old-style strings
remain.
Where there was any possible ambiguity about the exact version or
variant intended, nothing was changed. IANAL, nor a search robot.
Use `with stdenv.lib` wherever it makes sense.