diff options
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/cross/default.nix | 9 | ||||
-rw-r--r-- | pkgs/stdenv/generic/check-meta.nix | 25 | ||||
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 6 | ||||
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 11 |
4 files changed, 40 insertions, 11 deletions
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 31ca9f2c82e4..daa9f66615c9 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -53,12 +53,15 @@ in lib.init bootStages ++ [ else buildPackages.gcc; extraNativeBuildInputs = old.extraNativeBuildInputs + ++ lib.optionals + (hostPlatform.isLinux && !buildPlatform.isLinux) + [ buildPackages.patchelf buildPackages.paxctl ] + ++ lib.optional + (let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform)) + buildPackages.updateAutotoolsGnuConfigScriptsHook # without proper `file` command, libtool sometimes fails # to recognize 64-bit DLLs ++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file - ++ lib.optional - (hostPlatform.isAarch64 || hostPlatform.isMips || hostPlatform.libc == "musl") - buildPackages.updateAutotoolsGnuConfigScriptsHook ; }); }) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index a5c8ca705231..28b69f5c2dc9 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -81,6 +81,7 @@ let unsupported = remediate_whitelist "UnsupportedSystem"; blacklisted = x: ""; insecure = remediate_insecure; + broken-outputs = remediateOutputsToInstall; unknown-meta = x: ""; }; remediate_whitelist = allow_attr: attrs: @@ -125,6 +126,20 @@ let ''; + remediateOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in '' + The package ${attrs.name} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} + + however ${attrs.name} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} + + and is missing the following ouputs: + + ${lib.concatStrings (builtins.map (output: " - ${output}\n") missingOutputs)} + ''; + handleEvalIssue = attrs: { reason , errormsg ? "" }: let msg = '' @@ -185,6 +200,14 @@ let in anyMatch (attrs.meta.platforms or lib.platforms.all) && ! anyMatch (attrs.meta.badPlatforms or []); + checkOutputsToInstall = attrs: let + expectedOutputs = attrs.meta.outputsToInstall or []; + actualOutputs = attrs.outputs or [ "out" ]; + missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; + in if shouldCheckMeta + then builtins.length missingOutputs > 0 + else false; + # Check if a derivation is valid, that is whether it passes checks for # e.g brokenness or license. # @@ -202,6 +225,8 @@ let { valid = false; reason = "unsupported"; errormsg = "is not supported on ‘${hostPlatform.config}’"; } else if !(hasAllowedInsecure attrs) then { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; } + else if checkOutputsToInstall attrs then + { valid = false; reason = "broken-outputs"; errormsg = "has invalid meta.outputsToInstall"; } else let res = checkMeta (attrs.meta or {}); in if res != [] then { valid = false; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; } else { valid = true; }; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 3f35dce2eb29..2db40fc43e36 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -83,9 +83,7 @@ rec { doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; - outputs' = - outputs ++ - (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); + outputs' = outputs ++ lib.optional separateDebugInfo "debug"; fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated @@ -176,7 +174,7 @@ rec { // { # A hack to make `nix-env -qa` and `nix search` ignore broken packages. # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix. - name = assert validity.handled; name + lib.optionalString + name = assert validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); name + lib.optionalString # Fixed-output derivations like source tarballs shouldn't get a host # suffix. But we have some weird ones with run-time deps that are # just used for their side-affects. Those might as well since the diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index b29a96314d2c..08703b6934e5 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -251,7 +251,8 @@ in }; extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. - lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; + lib.optional (!localSystem.isx86 || localSystem.libc == "musl") + prevStage.updateAutotoolsGnuConfigScriptsHook; }) @@ -292,7 +293,8 @@ in }; extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. - lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; + lib.optional (!localSystem.isx86 || localSystem.libc == "musl") + prevStage.updateAutotoolsGnuConfigScriptsHook; }) # Construct the final stdenv. It uses the Glibc and GCC, and adds @@ -324,7 +326,8 @@ in extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. - lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; + lib.optional (!localSystem.isx86 || localSystem.libc == "musl") + prevStage.updateAutotoolsGnuConfigScriptsHook; cc = prevStage.gcc; @@ -357,7 +360,7 @@ in ++ [ /*propagated from .dev*/ linuxHeaders binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params ] - ++ lib.optionals (!localSystem.isx86) + ++ lib.optionals (!localSystem.isx86 || localSystem.libc == "musl") [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ]; overrides = self: super: { |