nixpkgs/pkgs/stdenv/native/default.nix
John Ericson d240a0da1a top-level: Remove cycles: stdenv calls in top-level but not vice versa
This commit changes the dependencies of stdenv, and clean-up the stdenv
story by removing the `defaultStdenv` attribute as well as the `bootStdenv`
parameter.

Before, the final bootstrapping stage's stdenv was provided by
all-packages, which was iterating multiple times over the
top-level/default.nix expression, and non-final bootstrapping stages'
stdenvs were explicitly specified with the `bootStdenv` parameter.

Now, all stages' stdenvs are specified with the `stdenv` parameter.
For non-final bootstrapping stages, this is a small change---basically just
rename the parameter.
For the final stage, top-level/default.nix takes the chosen stdenv and
makes the final stage with it.

`allPackages` is used to make all bootstrapping stages, final and
non-final alike. It's basically the expression of `stage.nix` (along with a
few partially-applied default arguments)

Note, the make-bootstrap-tools scripts are temporarily broken
2016-11-30 19:10:59 -05:00

146 lines
3.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ system, allPackages ? import ../../.., config }:
rec {
shell =
if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash"
else "/bin/bash";
path =
(if system == "i686-solaris" then [ "/usr/gnu" ] else []) ++
(if system == "i686-netbsd" then [ "/usr/pkg" ] else []) ++
(if system == "x86_64-solaris" then [ "/opt/local/gnu" ] else []) ++
["/" "/usr" "/usr/local"];
prehookBase = ''
# Disable purity tests; it's allowed (even needed) to link to
# libraries outside the Nix store (like the C library).
export NIX_ENFORCE_PURITY=
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
'';
prehookFreeBSD = ''
${prehookBase}
alias make=gmake
alias tar=gtar
alias sed=gsed
export MAKE=gmake
shopt -s expand_aliases
'';
prehookOpenBSD = ''
${prehookBase}
alias make=gmake
alias grep=ggrep
alias mv=gmv
alias ln=gln
alias sed=gsed
alias tar=gtar
export MAKE=gmake
shopt -s expand_aliases
'';
prehookNetBSD = ''
${prehookBase}
alias make=gmake
alias sed=gsed
alias tar=gtar
export MAKE=gmake
shopt -s expand_aliases
'';
# prevent libtool from failing to find dynamic libraries
prehookCygwin = ''
${prehookBase}
shopt -s expand_aliases
export lt_cv_deplibs_check_method=pass_all
'';
extraBuildInputsCygwin = [
../cygwin/all-buildinputs-as-runtimedep.sh
../cygwin/wrap-exes-to-find-dlls.sh
] ++ (if system == "i686-cygwin" then [
../cygwin/rebase-i686.sh
] else if system == "x86_64-cygwin" then [
../cygwin/rebase-x86_64.sh
] else []);
# A function that builds a "native" stdenv (one that uses tools in
# /usr etc.).
makeStdenv =
{ cc, fetchurl, extraPath ? [], overrides ? (pkgs: { }) }:
import ../generic {
preHook =
if system == "i686-freebsd" then prehookFreeBSD else
if system == "x86_64-freebsd" then prehookFreeBSD else
if system == "i686-openbsd" then prehookOpenBSD else
if system == "i686-netbsd" then prehookNetBSD else
if system == "i686-cygwin" then prehookCygwin else
if system == "x86_64-cygwin" then prehookCygwin else
prehookBase;
extraBuildInputs =
if system == "i686-cygwin" then extraBuildInputsCygwin else
if system == "x86_64-cygwin" then extraBuildInputsCygwin else
[];
initialPath = extraPath ++ path;
fetchurlBoot = fetchurl;
inherit system shell cc overrides config;
};
stdenvBoot0 = makeStdenv {
cc = null;
fetchurl = null;
};
cc = import ../../build-support/cc-wrapper {
name = "cc-native";
nativeTools = true;
nativeLibc = true;
nativePrefix = if system == "i686-solaris" then "/usr/gnu" else if system == "x86_64-solaris" then "/opt/local/gcc47" else "/usr";
stdenv = stdenvBoot0;
};
fetchurl = import ../../build-support/fetchurl {
stdenv = stdenvBoot0;
# Curl should be in /usr/bin or so.
curl = null;
};
# First build a stdenv based only on tools outside the store.
stdenvBoot1 = makeStdenv {
inherit cc fetchurl;
} // {inherit fetchurl;};
stdenvBoot1Pkgs = allPackages {
inherit system;
allowCustomOverrides = false;
stdenv = stdenvBoot1;
};
# Using that, build a stdenv that adds the xz command (which most
# systems don't have, so we mustn't rely on the native environment
# providing it).
stdenvBoot2 = makeStdenv {
inherit cc fetchurl;
extraPath = [ stdenvBoot1Pkgs.xz ];
overrides = pkgs: { inherit (stdenvBoot1Pkgs) xz; };
};
stdenvNative = stdenvBoot2;
}