2014-02-04 11:18:38 -05:00
|
|
|
let lib = import ../../../lib; in lib.makeOverridable (
|
|
|
|
|
2017-05-21 21:37:16 -04:00
|
|
|
{ name ? "stdenv", preHook ? "", initialPath, cc, shell
|
2016-12-19 11:10:47 -05:00
|
|
|
, allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
|
2009-02-02 10:03:38 -05:00
|
|
|
|
|
|
|
, # The `fetchurl' to use for downloading curl and its dependencies
|
|
|
|
# (see all-packages.nix).
|
|
|
|
fetchurlBoot
|
2014-02-04 11:18:38 -05:00
|
|
|
|
|
|
|
, setupScript ? ./setup.sh
|
|
|
|
|
|
|
|
, extraBuildInputs ? []
|
2015-06-11 20:58:26 -04:00
|
|
|
, __stdenvImpureHostDeps ? []
|
|
|
|
, __extraImpureHostDeps ? []
|
2015-11-21 15:06:41 -05:00
|
|
|
, stdenvSandboxProfile ? ""
|
|
|
|
, extraSandboxProfile ? ""
|
2017-05-21 21:37:16 -04:00
|
|
|
|
|
|
|
, # 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
|
2004-07-02 06:05:53 -04:00
|
|
|
}:
|
|
|
|
|
2009-04-25 10:08:29 -04:00
|
|
|
let
|
2017-05-21 21:37:16 -04:00
|
|
|
inherit (targetPlatform) system;
|
2009-04-25 10:08:29 -04:00
|
|
|
|
2014-11-06 06:10:28 -05:00
|
|
|
defaultNativeBuildInputs = extraBuildInputs ++
|
2014-07-08 08:26:35 -04:00
|
|
|
[ ../../build-support/setup-hooks/move-docs.sh
|
|
|
|
../../build-support/setup-hooks/compress-man-pages.sh
|
2014-06-27 07:33:05 -04:00
|
|
|
../../build-support/setup-hooks/strip.sh
|
|
|
|
../../build-support/setup-hooks/patch-shebangs.sh
|
2017-05-06 07:18:28 -04:00
|
|
|
]
|
|
|
|
# FIXME this on Darwin; see
|
|
|
|
# https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
|
2017-07-05 17:56:53 -04:00
|
|
|
++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
|
2017-05-06 07:18:28 -04:00
|
|
|
++ [
|
2014-08-30 02:27:43 -04:00
|
|
|
../../build-support/setup-hooks/multiple-outputs.sh
|
2014-10-07 08:43:56 -04:00
|
|
|
../../build-support/setup-hooks/move-sbin.sh
|
2014-10-07 09:04:13 -04:00
|
|
|
../../build-support/setup-hooks/move-lib64.sh
|
2016-01-05 09:32:59 -05:00
|
|
|
../../build-support/setup-hooks/set-source-date-epoch-to-latest.sh
|
2014-12-17 13:11:30 -05:00
|
|
|
cc
|
2014-06-27 07:33:05 -04:00
|
|
|
];
|
|
|
|
|
2014-02-04 11:18:38 -05:00
|
|
|
# The stdenv that we are producing.
|
2017-07-05 17:56:53 -04:00
|
|
|
stdenv =
|
2014-08-29 16:09:01 -04:00
|
|
|
derivation (
|
2014-11-06 07:33:08 -05:00
|
|
|
(if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
|
2014-08-29 16:09:01 -04:00
|
|
|
{
|
2014-02-04 11:18:38 -05:00
|
|
|
inherit system name;
|
|
|
|
|
|
|
|
builder = shell;
|
|
|
|
|
|
|
|
args = ["-e" ./builder.sh];
|
|
|
|
|
|
|
|
setup = setupScript;
|
|
|
|
|
2014-11-06 06:10:28 -05:00
|
|
|
inherit preHook initialPath shell defaultNativeBuildInputs;
|
2015-06-18 13:03:32 -04:00
|
|
|
}
|
2017-07-05 17:56:53 -04:00
|
|
|
// lib.optionalAttrs hostPlatform.isDarwin {
|
2015-11-21 15:06:41 -05:00
|
|
|
__sandboxProfile = stdenvSandboxProfile;
|
2015-06-18 13:03:32 -04:00
|
|
|
__impureHostDeps = __stdenvImpureHostDeps;
|
2014-08-29 16:09:01 -04:00
|
|
|
})
|
2014-02-04 11:18:38 -05:00
|
|
|
|
|
|
|
// rec {
|
|
|
|
|
2016-08-28 10:56:31 -04:00
|
|
|
meta = {
|
|
|
|
description = "The default build environment for Unix packages in Nixpkgs";
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
};
|
2014-02-04 11:18:38 -05:00
|
|
|
|
|
|
|
# Utility flags to test the type of platform.
|
2017-05-21 21:37:16 -04:00
|
|
|
inherit (hostPlatform)
|
2017-05-22 12:42:03 -04:00
|
|
|
isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
|
|
|
|
isi686 isx86_64 is64bit isMips isBigEndian;
|
2017-05-21 21:37:16 -04:00
|
|
|
isArm = hostPlatform.isArm32;
|
|
|
|
isAarch64 = hostPlatform.isArm64;
|
2014-02-04 11:18:38 -05:00
|
|
|
|
2014-06-30 08:26:23 -04:00
|
|
|
# Whether we should run paxctl to pax-mark binaries.
|
|
|
|
needsPax = isLinux;
|
|
|
|
|
2017-07-05 17:56:53 -04:00
|
|
|
inherit (import ./make-derivation.nix {
|
|
|
|
inherit lib config stdenv;
|
|
|
|
# TODO(@Ericson2314): Remove
|
|
|
|
inherit
|
|
|
|
extraBuildInputs
|
|
|
|
__extraImpureHostDeps
|
|
|
|
extraSandboxProfile
|
|
|
|
hostPlatform targetPlatform;
|
|
|
|
}) mkDerivation;
|
2014-07-01 10:43:52 -04:00
|
|
|
|
2014-02-04 11:18:38 -05:00
|
|
|
# For convenience, bring in the library functions in lib/ so
|
|
|
|
# packages don't have to do that themselves.
|
|
|
|
inherit lib;
|
|
|
|
|
|
|
|
inherit fetchurlBoot;
|
|
|
|
|
|
|
|
inherit overrides;
|
2014-07-01 10:17:23 -04:00
|
|
|
|
2014-12-17 13:11:30 -05:00
|
|
|
inherit cc;
|
2014-02-04 11:18:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# Propagate any extra attributes. For instance, we use this to
|
|
|
|
# "lift" packages like curl from the final stdenv for Linux to
|
|
|
|
# all-packages.nix for that platform (meaning that it has a line
|
|
|
|
# like curl = if stdenv ? curl then stdenv.curl else ...).
|
|
|
|
// extraAttrs;
|
|
|
|
|
2017-07-05 17:56:53 -04:00
|
|
|
in stdenv)
|