Commit a302d736 authored by John Ericson's avatar John Ericson
Browse files

top-level: {build,host,target}Platform are defined in the stdenv instead

See #27069 for a discussion of this
parent afc20239
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
, dyld ? null # TODO: should this be a setup-hook on dyld?
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, hostPlatform, targetPlatform
, runCommand ? null
}:

@@ -22,12 +21,14 @@ assert !nativeTools ->
assert !(nativeLibc && noLibc);
assert (noLibc || nativeLibc) == (libc == null);

assert targetPlatform != hostPlatform -> runCommand != null;
assert stdenv.targetPlatform != stdenv.hostPlatform -> runCommand != null;

# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
assert cc.langVhdl or false -> zlib != null;

let
  inherit (stdenv) hostPlatform targetPlatform;

  # Prefix for binaries. Customarily ends with a dash separator.
  #
  # TODO(@Ericson2314) Make unconditional, or optional but always true by
+3 −5
Original line number Diff line number Diff line
@@ -61,11 +61,9 @@ rec {
                    , buildPlatform, hostPlatform, targetPlatform
                    } @ overrideArgs: let
    stdenv = overrideArgs.stdenv.override {
      # TODO(@Ericson2314): Cannot do this for now because then Nix thinks the
      # resulting derivation should be built on the host platform.
      #hostPlatform = buildPlatform;
      #targetPlatform = hostPlatform;
      inherit cc;
      inherit
        buildPlatform hostPlatform targetPlatform
        cc;

      allowedRequisites = null;

+4 −7
Original line number Diff line number Diff line
@@ -14,21 +14,18 @@ in bootStages ++ [

  # Build Packages
  (vanillaPackages: {
    buildPlatform = localSystem;
    hostPlatform = localSystem;
    targetPlatform = crossSystem;
    inherit config overlays;
    selfBuild = false;
    stdenv =
      assert vanillaPackages.hostPlatform == localSystem;
      assert vanillaPackages.targetPlatform == localSystem;
      vanillaPackages.stdenv.override { targetPlatform = crossSystem; };
    # It's OK to change the built-time dependencies
    allowCustomOverrides = true;
    inherit (vanillaPackages) stdenv;
  })

  # Run Packages
  (buildPackages: {
    buildPlatform = localSystem;
    hostPlatform = crossSystem;
    targetPlatform = crossSystem;
    inherit config overlays;
    selfBuild = false;
    stdenv = buildPackages.makeStdenvCross {
+4 −4
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@ in bootStages ++ [

  # Additional stage, built using custom stdenv
  (vanillaPackages: {
    buildPlatform = localSystem;
    hostPlatform = localSystem;
    targetPlatform = localSystem;
    inherit config overlays;
    stdenv = config.replaceStdenv { pkgs = vanillaPackages; };
    stdenv =
      assert vanillaPackages.hostPlatform == localSystem;
      assert vanillaPackages.targetPlatform == localSystem;
      config.replaceStdenv { pkgs = vanillaPackages; };
  })

]
+8 −16
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@ in rec {

        name = "stdenv-darwin-boot-${toString step}";

        buildPlatform = localSystem;
        hostPlatform = localSystem;
        targetPlatform = localSystem;

        cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
          inherit shell;
          inherit (last) stdenv;
@@ -73,8 +77,6 @@ in rec {
          nativeTools  = true;
          nativePrefix = bootstrapTools;
          nativeLibc   = false;
          hostPlatform = localSystem;
          targetPlatform = localSystem;
          libc         = last.pkgs.darwin.Libsystem;
          isClang      = true;
          cc           = { name = "clang-9.9.9"; outPath = bootstrapTools; };
@@ -90,9 +92,6 @@ in rec {
        '';
        initialPath  = [ bootstrapTools ];

        hostPlatform = localSystem;
        targetPlatform = localSystem;

        fetchurlBoot = import ../../build-support/fetchurl {
          stdenv = stage0.stdenv;
          curl   = bootstrapTools;
@@ -107,9 +106,6 @@ in rec {
      };

    in {
      buildPlatform = localSystem;
      hostPlatform = localSystem;
      targetPlatform = localSystem;
      inherit config overlays;
      stdenv = thisStdenv;
    };
@@ -279,6 +275,10 @@ in rec {

    name = "stdenv-darwin";

    buildPlatform = localSystem;
    hostPlatform = localSystem;
    targetPlatform = localSystem;

    preHook = commonPreHook + ''
      export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
    '';
@@ -286,9 +286,6 @@ in rec {
    stdenvSandboxProfile = binShClosure + libSystemProfile;
    extraSandboxProfile  = binShClosure + libSystemProfile;

    hostPlatform = localSystem;
    targetPlatform = localSystem;

    initialPath = import ../common-path.nix { inherit pkgs; };
    shell       = "${pkgs.bash}/bin/bash";

@@ -297,8 +294,6 @@ in rec {
      inherit shell;
      nativeTools = false;
      nativeLibc  = false;
      hostPlatform = localSystem;
      targetPlatform = localSystem;
      inherit (pkgs) coreutils binutils gnugrep;
      inherit (pkgs.darwin) dyld;
      cc   = pkgs.llvmPackages.clang-unwrapped;
@@ -338,9 +333,6 @@ in rec {
    stage3
    stage4
    (prevStage: {
      buildPlatform = localSystem;
      hostPlatform = localSystem;
      targetPlatform = localSystem;
      inherit config overlays;
      stdenv = stdenvDarwin prevStage;
    })
Loading