2014-02-04 16:18:38 +00:00
|
|
|
let lib = import ../../../lib; in lib.makeOverridable (
|
|
|
|
|
2017-05-22 01:37:16 +00:00
|
|
|
{ name ? "stdenv", preHook ? "", initialPath, cc, shell
|
2016-12-19 16:10:47 +00:00
|
|
|
, allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
|
2009-02-02 15:03:38 +00:00
|
|
|
|
|
|
|
, # The `fetchurl' to use for downloading curl and its dependencies
|
|
|
|
# (see all-packages.nix).
|
|
|
|
fetchurlBoot
|
2014-02-04 16:18:38 +00:00
|
|
|
|
|
|
|
, setupScript ? ./setup.sh
|
|
|
|
|
2017-08-15 15:30:45 +00:00
|
|
|
, extraNativeBuildInputs ? []
|
2014-02-04 16:18:38 +00:00
|
|
|
, extraBuildInputs ? []
|
2015-06-12 00:58:26 +00:00
|
|
|
, __stdenvImpureHostDeps ? []
|
|
|
|
, __extraImpureHostDeps ? []
|
2015-11-21 20:06:41 +00:00
|
|
|
, stdenvSandboxProfile ? ""
|
|
|
|
, extraSandboxProfile ? ""
|
2017-05-22 01:37:16 +00:00
|
|
|
|
2017-07-06 01:47:48 +00:00
|
|
|
## Platform parameters
|
|
|
|
##
|
|
|
|
## The "build" "host" "target" terminology below comes from GNU Autotools. See
|
|
|
|
## its documentation for more information on what those words mean. Note that
|
|
|
|
## each should always be defined, even when not cross compiling.
|
|
|
|
##
|
|
|
|
## For purposes of bootstrapping, think of each stage as a "sliding window"
|
|
|
|
## over a list of platforms. Specifically, the host platform of the previous
|
|
|
|
## stage becomes the build platform of the current one, and likewise the
|
|
|
|
## target platform of the previous stage becomes the host platform of the
|
|
|
|
## current one.
|
|
|
|
##
|
|
|
|
|
|
|
|
, # The platform on which packages are built. Consists of `system`, a
|
|
|
|
# string (e.g.,`i686-linux') identifying the most import attributes of the
|
|
|
|
# build platform, and `platform` a set of other details.
|
|
|
|
buildPlatform
|
|
|
|
|
|
|
|
, # The platform on which packages run.
|
|
|
|
hostPlatform
|
|
|
|
|
|
|
|
, # The platform which build tools (especially compilers) build for in this stage,
|
|
|
|
targetPlatform
|
2004-07-02 10:05:53 +00:00
|
|
|
}:
|
|
|
|
|
2009-04-25 14:08:29 +00:00
|
|
|
let
|
2017-08-15 15:30:45 +00:00
|
|
|
defaultNativeBuildInputs = extraNativeBuildInputs ++
|
2014-07-08 12:26:35 +00:00
|
|
|
[ ../../build-support/setup-hooks/move-docs.sh
|
|
|
|
../../build-support/setup-hooks/compress-man-pages.sh
|
2014-06-27 11:33:05 +00:00
|
|
|
../../build-support/setup-hooks/strip.sh
|
|
|
|
../../build-support/setup-hooks/patch-shebangs.sh
|
2017-05-06 11:18:28 +00:00
|
|
|
]
|
|
|
|
# FIXME this on Darwin; see
|
|
|
|
# https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
|
2017-07-05 21:56:53 +00:00
|
|
|
++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
|
2017-05-06 11:18:28 +00:00
|
|
|
++ [
|
2014-08-30 06:27:43 +00:00
|
|
|
../../build-support/setup-hooks/multiple-outputs.sh
|
2014-10-07 12:43:56 +00:00
|
|
|
../../build-support/setup-hooks/move-sbin.sh
|
2014-10-07 13:04:13 +00:00
|
|
|
../../build-support/setup-hooks/move-lib64.sh
|
2016-01-05 14:32:59 +00:00
|
|
|
../../build-support/setup-hooks/set-source-date-epoch-to-latest.sh
|
2014-12-17 18:11:30 +00:00
|
|
|
cc
|
2014-06-27 11:33:05 +00:00
|
|
|
];
|
|
|
|
|
2017-08-15 15:30:45 +00:00
|
|
|
defaultBuildInputs = extraBuildInputs;
|
|
|
|
|
2014-02-04 16:18:38 +00:00
|
|
|
# The stdenv that we are producing.
|
2017-07-05 21:56:53 +00:00
|
|
|
stdenv =
|
2014-08-29 20:09:01 +00:00
|
|
|
derivation (
|
2017-08-15 15:30:45 +00:00
|
|
|
lib.optionalAttrs (allowedRequisites != null) {
|
|
|
|
allowedRequisites = allowedRequisites
|
|
|
|
++ defaultNativeBuildInputs ++ defaultBuildInputs;
|
|
|
|
}
|
|
|
|
// {
|
2017-07-06 01:47:48 +00:00
|
|
|
inherit name;
|
|
|
|
|
|
|
|
# Nix itself uses the `system` field of a derivation to decide where to
|
|
|
|
# build it. This is a bit confusing for cross compilation.
|
|
|
|
inherit (buildPlatform) system;
|
2014-02-04 16:18:38 +00:00
|
|
|
|
|
|
|
builder = shell;
|
|
|
|
|
|
|
|
args = ["-e" ./builder.sh];
|
|
|
|
|
|
|
|
setup = setupScript;
|
|
|
|
|
2017-10-06 05:26:19 +00:00
|
|
|
# We pretty much never need rpaths on Darwin, since all library path references
|
|
|
|
# are absolute unless we go out of our way to make them relative (like with CF)
|
|
|
|
# TODO: This really wants to be in stdenv/darwin but we don't have hostPlatform
|
|
|
|
# there (yet?) so it goes here until then.
|
|
|
|
preHook = preHook+ lib.optionalString buildPlatform.isDarwin ''
|
|
|
|
export NIX_BUILD_DONT_SET_RPATH=1
|
|
|
|
'' + lib.optionalString hostPlatform.isDarwin ''
|
|
|
|
export NIX_DONT_SET_RPATH=1
|
|
|
|
export NIX_NO_SELF_RPATH=1
|
|
|
|
'' + lib.optionalString targetPlatform.isDarwin ''
|
|
|
|
export NIX_TARGET_DONT_SET_RPATH=1
|
|
|
|
'';
|
|
|
|
|
|
|
|
inherit initialPath shell
|
2017-08-15 15:30:45 +00:00
|
|
|
defaultNativeBuildInputs defaultBuildInputs;
|
2015-06-18 17:03:32 +00:00
|
|
|
}
|
2017-07-06 01:47:48 +00:00
|
|
|
// lib.optionalAttrs buildPlatform.isDarwin {
|
2015-11-21 20:06:41 +00:00
|
|
|
__sandboxProfile = stdenvSandboxProfile;
|
2015-06-18 17:03:32 +00:00
|
|
|
__impureHostDeps = __stdenvImpureHostDeps;
|
2014-08-29 20:09:01 +00:00
|
|
|
})
|
2014-02-04 16:18:38 +00:00
|
|
|
|
|
|
|
// rec {
|
|
|
|
|
2016-08-28 14:56:31 +00:00
|
|
|
meta = {
|
|
|
|
description = "The default build environment for Unix packages in Nixpkgs";
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
};
|
2014-02-04 16:18:38 +00:00
|
|
|
|
2017-07-06 01:47:48 +00:00
|
|
|
inherit buildPlatform hostPlatform targetPlatform;
|
|
|
|
|
2017-08-15 15:30:45 +00:00
|
|
|
inherit extraNativeBuildInputs extraBuildInputs
|
|
|
|
__extraImpureHostDeps extraSandboxProfile;
|
2017-07-05 23:58:24 +00:00
|
|
|
|
2014-02-04 16:18:38 +00:00
|
|
|
# Utility flags to test the type of platform.
|
2017-05-22 01:37:16 +00:00
|
|
|
inherit (hostPlatform)
|
2017-05-22 16:42:03 +00:00
|
|
|
isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
|
2017-08-23 22:16:02 +00:00
|
|
|
isi686 isx86_64 is64bit isArm isAarch64 isMips isBigEndian;
|
2014-02-04 16:18:38 +00:00
|
|
|
|
2014-06-30 12:26:23 +00:00
|
|
|
# Whether we should run paxctl to pax-mark binaries.
|
|
|
|
needsPax = isLinux;
|
|
|
|
|
2017-07-05 21:56:53 +00:00
|
|
|
inherit (import ./make-derivation.nix {
|
|
|
|
inherit lib config stdenv;
|
|
|
|
}) mkDerivation;
|
2014-07-01 14:43:52 +00:00
|
|
|
|
2014-02-04 16:18:38 +00: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 14:17:23 +00:00
|
|
|
|
2014-12-17 18:11:30 +00:00
|
|
|
inherit cc;
|
2018-02-25 03:51:22 +00:00
|
|
|
|
|
|
|
isCross = targetPlatform != buildPlatform;
|
2014-02-04 16:18:38 +00: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 21:56:53 +00:00
|
|
|
in stdenv)
|