diff options
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 8 | ||||
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 53 |
2 files changed, 41 insertions, 20 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index cb94db48f4bdc..69bcd6490594a 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -264,18 +264,16 @@ let __ignoreNulls = true; # Inputs built by the cross compiler. - buildInputs = if crossConfig != null then buildInputs' else []; - propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs' else []; + buildInputs = buildInputs'; + propagatedBuildInputs = propagatedBuildInputs'; # Inputs built by the usual native compiler. nativeBuildInputs = nativeBuildInputs' - ++ lib.optionals (crossConfig == null) buildInputs' ++ lib.optional (result.isCygwin || (crossConfig != null && lib.hasSuffix "mingw32" crossConfig)) ../../build-support/setup-hooks/win-dll-link.sh ; - propagatedNativeBuildInputs = propagatedNativeBuildInputs' ++ - (if crossConfig == null then propagatedBuildInputs' else []); + propagatedNativeBuildInputs = propagatedNativeBuildInputs'; } // ifDarwin { # TODO: remove lib.unique once nix has a list canonicalization primitive __sandboxProfile = diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 154fdefd789c7..de33ab5659823 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -290,15 +290,26 @@ findInputs() { fi } -crossPkgs="" -for i in $buildInputs $defaultBuildInputs $propagatedBuildInputs; do - findInputs $i crossPkgs propagated-build-inputs -done +if [ -z "$crossConfig" ]; then + # Not cross-compiling - both buildInputs (and variants like propagatedBuildInputs) + # are handled identically to nativeBuildInputs + nativePkgs="" + for i in $nativeBuildInputs $buildInputs \ + $defaultNativeBuildInputs $defaultBuildInputs \ + $propagatedNativeBuildInputs $propagatedBuildInputs; do + findInputs $i nativePkgs propagated-native-build-inputs + done +else + crossPkgs="" + for i in $buildInputs $defaultBuildInputs $propagatedBuildInputs; do + findInputs $i crossPkgs propagated-build-inputs + done -nativePkgs="" -for i in $nativeBuildInputs $defaultNativeBuildInputs $propagatedNativeBuildInputs; do - findInputs $i nativePkgs propagated-native-build-inputs -done + nativePkgs="" + for i in $nativeBuildInputs $defaultNativeBuildInputs $propagatedNativeBuildInputs; do + findInputs $i nativePkgs propagated-native-build-inputs + done +fi # Set the relevant environment variables to point to the build inputs @@ -759,14 +770,26 @@ fixupPhase() { # Propagate build inputs and setup hook into the development output. - if [ -n "$propagatedBuildInputs" ]; then - mkdir -p "${!outputDev}/nix-support" - echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs" - fi + if [ -z "$crossConfig" ]; then + # Not cross-compiling - propagatedBuildInputs are handled identically to propagatedNativeBuildInputs + local propagated="$propagatedNativeBuildInputs" + if [ -n "$propagatedBuildInputs" ]; then + propagated+="${propagated:+ }$propagatedBuildInputs" + fi + if [ -n "$propagated" ]; then + mkdir -p "${!outputDev}/nix-support" + echo "$propagated" > "${!outputDev}/nix-support/propagated-native-build-inputs" + fi + else + if [ -n "$propagatedBuildInputs" ]; then + mkdir -p "${!outputDev}/nix-support" + echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs" + fi - if [ -n "$propagatedNativeBuildInputs" ]; then - mkdir -p "${!outputDev}/nix-support" - echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs" + if [ -n "$propagatedNativeBuildInputs" ]; then + mkdir -p "${!outputDev}/nix-support" + echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs" + fi fi if [ -n "$setupHook" ]; then |