expand-response-params: Build more normally

This commit is contained in:
John Ericson 2017-08-23 16:39:15 -04:00 committed by John Ericson
parent 287fce6402
commit a470be5a16
4 changed files with 15 additions and 8 deletions

View file

@ -342,7 +342,8 @@ stdenv.mkDerivation {
inherit dynamicLinker expand-response-params;
expandResponseParams = expand-response-params; # for substitution in utils.sh
# for substitution in utils.sh
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
crossAttrs = {
shell = shell.crossDrv + shell.crossDrv.shellPath;

View file

@ -30,7 +30,7 @@ expandResponseParams() {
if [[ "$arg" == @* ]]; then
# phase separation makes this look useless
# shellcheck disable=SC2157
if [ -n "@expandResponseParams@" ]; then
if [ -x "@expandResponseParams@" ]; then
# params is used by caller
#shellcheck disable=SC2034
readarray -d '' params < <("@expandResponseParams@" "$@")

View file

@ -3,11 +3,17 @@
stdenv.mkDerivation {
name = "expand-response-params";
src = ./expand-response-params.c;
buildCommand = ''
# Work around "stdenv-darwin-boot-2 is not allowed to refer to path /nix/store/...-expand-response-params.c"
# Work around "stdenv-darwin-boot-2 is not allowed to refer to path
# /nix/store/...-expand-response-params.c"
unpackPhase = ''
cp "$src" expand-response-params.c
"$CC" -std=c99 -O3 -o "$out" expand-response-params.c
strip -S $out
${stdenv.lib.optionalString stdenv.hostPlatform.isLinux "patchelf --shrink-rpath $out"}
src=$PWD
'';
buildPhase = ''
"$CC" -std=c99 -O3 -o "expand-response-params" expand-response-params.c
'';
installPhase = ''
mkdir -p $prefix/bin
mv expand-response-params $prefix/bin/
'';
}

View file

@ -310,7 +310,7 @@ in
# More complicated cases
++ [
glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders
gcc gcc.cc gcc.cc.lib gcc.expandResponseParams
gcc gcc.cc gcc.cc.lib gcc.expand-response-params
]
++ lib.optionals (system == "aarch64-linux")
[ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];