stdenv: define is* predicates with hostPlatform.is*
This is a saner default until stdenv's are removed altogether
This commit is contained in:
parent
c5c6606048
commit
1dc6f15de9
|
@ -61,7 +61,7 @@ in rec {
|
|||
allowedRequisites ? null}:
|
||||
let
|
||||
thisStdenv = import ../generic {
|
||||
inherit system config shell extraBuildInputs allowedRequisites;
|
||||
inherit config shell extraBuildInputs allowedRequisites;
|
||||
|
||||
name = "stdenv-darwin-boot-${toString step}";
|
||||
|
||||
|
@ -87,6 +87,10 @@ in rec {
|
|||
${extraPreHook}
|
||||
'';
|
||||
initialPath = [ bootstrapTools ];
|
||||
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
fetchurlBoot = import ../../build-support/fetchurl {
|
||||
stdenv = stage0.stdenv;
|
||||
curl = bootstrapTools;
|
||||
|
@ -268,7 +272,7 @@ in rec {
|
|||
};
|
||||
|
||||
stdenvDarwin = prevStage: let pkgs = prevStage; in import ../generic rec {
|
||||
inherit system config;
|
||||
inherit config;
|
||||
inherit (pkgs.stdenv) fetchurlBoot;
|
||||
|
||||
name = "stdenv-darwin";
|
||||
|
@ -280,6 +284,9 @@ in rec {
|
|||
stdenvSandboxProfile = binShClosure + libSystemProfile;
|
||||
extraSandboxProfile = binShClosure + libSystemProfile;
|
||||
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
initialPath = import ../common-path.nix { inherit pkgs; };
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
|
||||
|
|
|
@ -35,8 +35,10 @@ let inherit (localSystem) system; in
|
|||
|
||||
stdenv = import ../generic {
|
||||
name = "stdenv-freebsd-boot-1";
|
||||
inherit system config;
|
||||
inherit config;
|
||||
initialPath = [ "/" "/usr" ];
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
shell = "${bootstrapTools}/bin/bash";
|
||||
fetchurlBoot = null;
|
||||
cc = null;
|
||||
|
@ -50,9 +52,10 @@ let inherit (localSystem) system; in
|
|||
|
||||
stdenv = import ../generic {
|
||||
name = "stdenv-freebsd-boot-0";
|
||||
inherit system config;
|
||||
inherit config;
|
||||
initialPath = [ prevStage.bootstrapTools ];
|
||||
inherit (prevStage.stdenv) shell;
|
||||
inherit (prevStage.stdenv)
|
||||
hostPlatform targetPlatform shell;
|
||||
fetchurlBoot = prevStage.fetchurl;
|
||||
cc = null;
|
||||
};
|
||||
|
@ -65,10 +68,10 @@ let inherit (localSystem) system; in
|
|||
inherit config overlays;
|
||||
stdenv = import ../generic {
|
||||
name = "stdenv-freebsd-boot-3";
|
||||
inherit system config;
|
||||
inherit config;
|
||||
|
||||
inherit (prevStage.stdenv)
|
||||
initialPath shell fetchurlBoot;
|
||||
hostPlatform targetPlatform initialPath shell fetchurlBoot;
|
||||
|
||||
cc = import ../../build-support/cc-wrapper {
|
||||
nativeTools = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let lib = import ../../../lib; in lib.makeOverridable (
|
||||
|
||||
{ system, name ? "stdenv", preHook ? "", initialPath, cc, shell
|
||||
{ name ? "stdenv", preHook ? "", initialPath, cc, shell
|
||||
, allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
|
||||
|
||||
, # The `fetchurl' to use for downloading curl and its dependencies
|
||||
|
@ -14,9 +14,18 @@ let lib = import ../../../lib; in lib.makeOverridable (
|
|||
, __extraImpureHostDeps ? []
|
||||
, stdenvSandboxProfile ? ""
|
||||
, extraSandboxProfile ? ""
|
||||
|
||||
, # The platforms here do *not* correspond to the stage the stdenv is
|
||||
# used in, but rather the previous one, in which it was built. We
|
||||
# use the latter two platforms, like a cross compiler, because the
|
||||
# stand environment is a build tool if you squint at it, and because
|
||||
# neither of these are used when building stdenv so we know the
|
||||
# build platform is irrelevant.
|
||||
hostPlatform, targetPlatform
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (targetPlatform) system;
|
||||
|
||||
# See discussion at https://github.com/NixOS/nixpkgs/pull/25304#issuecomment-298385426
|
||||
# for why this defaults to false, but I (@copumpkin) want to default it to true soon.
|
||||
|
@ -265,7 +274,7 @@ let
|
|||
|
||||
outputs' =
|
||||
outputs ++
|
||||
(if separateDebugInfo then assert result.isLinux; [ "debug" ] else []);
|
||||
(if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []);
|
||||
|
||||
buildInputs' = lib.chooseDevOutputs buildInputs ++
|
||||
(if separateDebugInfo then [ ../../build-support/setup-hooks/separate-debug-info.sh ] else []);
|
||||
|
@ -311,7 +320,7 @@ let
|
|||
# Inputs built by the usual native compiler.
|
||||
nativeBuildInputs = nativeBuildInputs'
|
||||
++ lib.optional
|
||||
(result.isCygwin
|
||||
(hostPlatform.isCygwin
|
||||
|| (crossConfig != null && lib.hasSuffix "mingw32" crossConfig))
|
||||
../../build-support/setup-hooks/win-dll-link.sh
|
||||
;
|
||||
|
@ -392,51 +401,14 @@ let
|
|||
};
|
||||
|
||||
# Utility flags to test the type of platform.
|
||||
isDarwin = system == "x86_64-darwin";
|
||||
isLinux = system == "i686-linux"
|
||||
|| system == "x86_64-linux"
|
||||
|| system == "powerpc-linux"
|
||||
|| system == "armv5tel-linux"
|
||||
|| system == "armv6l-linux"
|
||||
|| system == "armv7l-linux"
|
||||
|| system == "aarch64-linux"
|
||||
|| system == "mips64el-linux";
|
||||
isGNU = system == "i686-gnu"; # GNU/Hurd
|
||||
isSunOS = system == "i686-solaris"
|
||||
|| system == "x86_64-solaris";
|
||||
isCygwin = system == "i686-cygwin"
|
||||
|| system == "x86_64-cygwin";
|
||||
isFreeBSD = system == "i686-freebsd"
|
||||
|| system == "x86_64-freebsd";
|
||||
isOpenBSD = system == "i686-openbsd"
|
||||
|| system == "x86_64-openbsd";
|
||||
isi686 = system == "i686-linux"
|
||||
|| system == "i686-gnu"
|
||||
|| system == "i686-freebsd"
|
||||
|| system == "i686-openbsd"
|
||||
|| system == "i686-cygwin"
|
||||
|| system == "i386-sunos";
|
||||
isx86_64 = system == "x86_64-linux"
|
||||
|| system == "x86_64-darwin"
|
||||
|| system == "x86_64-freebsd"
|
||||
|| system == "x86_64-openbsd"
|
||||
|| system == "x86_64-cygwin"
|
||||
|| system == "x86_64-solaris";
|
||||
is64bit = system == "x86_64-linux"
|
||||
|| system == "x86_64-darwin"
|
||||
|| system == "x86_64-freebsd"
|
||||
|| system == "x86_64-openbsd"
|
||||
|| system == "x86_64-cygwin"
|
||||
|| system == "x86_64-solaris"
|
||||
|| system == "aarch64-linux"
|
||||
|| system == "mips64el-linux";
|
||||
isMips = system == "mips-linux"
|
||||
|| system == "mips64el-linux";
|
||||
isArm = system == "armv5tel-linux"
|
||||
|| system == "armv6l-linux"
|
||||
|| system == "armv7l-linux";
|
||||
isAarch64 = system == "aarch64-linux";
|
||||
isBigEndian = system == "powerpc-linux";
|
||||
inherit (hostPlatform)
|
||||
isDarwin isLinux isSunOS isCygwin isFreeBSD isOpenBSD isi686 isx86_64
|
||||
is64bit isMips isBigEndian;
|
||||
isArm = hostPlatform.isArm32;
|
||||
isAarch64 = hostPlatform.isArm64;
|
||||
# Other code instead checks for anything using GNU userland,
|
||||
# e.g. GNU/linux. This refers just to GNU Hurd.
|
||||
isGNU = system == "i686-gnu";
|
||||
|
||||
# Whether we should run paxctl to pax-mark binaries.
|
||||
needsPax = isLinux;
|
||||
|
|
|
@ -52,7 +52,7 @@ let
|
|||
let
|
||||
|
||||
thisStdenv = import ../generic {
|
||||
inherit system config extraBuildInputs;
|
||||
inherit config extraBuildInputs;
|
||||
name = "stdenv-linux-boot";
|
||||
preHook =
|
||||
''
|
||||
|
@ -64,6 +64,9 @@ let
|
|||
shell = "${bootstrapTools}/bin/bash";
|
||||
initialPath = [bootstrapTools];
|
||||
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
|
||||
inherit system;
|
||||
};
|
||||
|
@ -261,7 +264,7 @@ in
|
|||
targetPlatform = localSystem;
|
||||
inherit config overlays;
|
||||
stdenv = import ../generic rec {
|
||||
inherit system config;
|
||||
inherit config;
|
||||
|
||||
preHook = ''
|
||||
# Make "strip" produce deterministic output, by setting
|
||||
|
@ -273,6 +276,9 @@ in
|
|||
initialPath =
|
||||
((import ../common-path.nix) {pkgs = prevStage;});
|
||||
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
|
||||
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
||||
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
|
||||
|
|
|
@ -81,6 +81,9 @@ let
|
|||
{ cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }:
|
||||
|
||||
import ../generic {
|
||||
hostPlatform = localSystem;
|
||||
targetPlatform = localSystem;
|
||||
|
||||
preHook =
|
||||
if system == "i686-freebsd" then prehookFreeBSD else
|
||||
if system == "x86_64-freebsd" then prehookFreeBSD else
|
||||
|
|
|
@ -24,11 +24,11 @@ bootStages ++ [
|
|||
|
||||
initialPath = (import ../common-path.nix) { pkgs = prevStage; };
|
||||
|
||||
system = stdenv.system;
|
||||
inherit (prevStage.stdenv) hostPlatform targetPlatform;
|
||||
|
||||
cc = import ../../build-support/cc-wrapper {
|
||||
nativeTools = false;
|
||||
nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
|
||||
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
|
||||
nativeLibc = true;
|
||||
inherit stdenv;
|
||||
inherit (prevStage) binutils coreutils gnugrep;
|
||||
|
|
Loading…
Reference in New Issue