forked from mirrors/nixpkgs
* Fix stdenvNative/stdenvNix.
svn path=/nixpkgs/branches/stdenv-updates/; revision=13957
This commit is contained in:
parent
3e727ebe97
commit
1dee2d3de0
|
@ -10,7 +10,7 @@
|
|||
# system, e.g., cygwin and mingw builds on i686-cygwin. Most people
|
||||
# can ignore it.
|
||||
|
||||
{system, stdenvType ? system, allPackages}:
|
||||
{system, stdenvType ? system, allPackages ? import ../..}:
|
||||
|
||||
assert system != "i686-cygwin" -> system == stdenvType;
|
||||
|
||||
|
@ -18,21 +18,14 @@ assert system != "i686-cygwin" -> system == stdenvType;
|
|||
rec {
|
||||
|
||||
|
||||
# Trivial environment used for building other environments.
|
||||
stdenvInitial = import ./initial {
|
||||
name = "stdenv-initial";
|
||||
inherit system;
|
||||
};
|
||||
|
||||
|
||||
# The native (i.e., impure) build environment. This one uses the
|
||||
# tools installed on the system outside of the Nix environment,
|
||||
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
|
||||
# be used with care, since many Nix packages will not build properly
|
||||
# with it (e.g., because they require GNU Make).
|
||||
stdenvNative = import ./native {
|
||||
inherit stdenvInitial;
|
||||
};
|
||||
stdenvNative = (import ./native {
|
||||
inherit system allPackages;
|
||||
}).stdenv;
|
||||
|
||||
stdenvNativePkgs = allPackages {
|
||||
bootStdenv = stdenvNative;
|
||||
|
@ -41,10 +34,10 @@ rec {
|
|||
|
||||
|
||||
# The Nix build environment.
|
||||
stdenvNix = import ./nix (rec {
|
||||
stdenvNix = import ./nix {
|
||||
stdenv = stdenvNative;
|
||||
pkgs = stdenvNativePkgs;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
# Linux standard environment.
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
|
||||
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
|
||||
, extraAttrs ? {}
|
||||
, fetchurlBoot, forceFetchurlBoot
|
||||
|
||||
, # The `fetchurl' to use for downloading curl and its dependencies
|
||||
# (see all-packages.nix).
|
||||
fetchurlBoot
|
||||
}:
|
||||
|
||||
let {
|
||||
|
@ -82,9 +85,7 @@ let {
|
|||
# "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
|
||||
|
||||
// (if forceFetchurlBoot then {fetchurl = fetchurlBoot;} else {});
|
||||
// extraAttrs;
|
||||
|
||||
}.result;
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
export PATH=/usr/bin:/bin
|
||||
|
||||
mkdir $out
|
||||
|
||||
sed -e "s^@initialPath@^/usr /^" -e "s^@preHook@^^" -e "s^@postHook@^^" -e "s^@shell@^/bin/sh^" < $stdenvScript > $out/setup
|
|
@ -1,32 +0,0 @@
|
|||
# Here we construct an absolutely trivial `initial' standard
|
||||
# environment. It's not actually a functional stdenv, since there is
|
||||
# not necessarily a working C compiler. We need this to build
|
||||
# gcc-wrapper et al. for the native stdenv.
|
||||
|
||||
{system, name}:
|
||||
|
||||
let {
|
||||
|
||||
shell = "/bin/bash";
|
||||
|
||||
body =
|
||||
|
||||
derivation {
|
||||
inherit system name;
|
||||
builder = shell;
|
||||
args = ["-e" ./builder.sh];
|
||||
stdenvScript = ../generic/setup.sh;
|
||||
}
|
||||
|
||||
// {
|
||||
mkDerivation = attrs: derivation ((removeAttrs attrs ["meta"]) // {
|
||||
builder = shell;
|
||||
args = ["-e" attrs.builder];
|
||||
stdenv = body;
|
||||
system = body.system;
|
||||
});
|
||||
|
||||
inherit shell;
|
||||
};
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@ rec {
|
|||
# 1) Create a standard environment by downloading pre-built binaries
|
||||
# of coreutils, GCC, etc.
|
||||
|
||||
|
||||
# This function downloads a file.
|
||||
download = {url, sha256}: derivation {
|
||||
name = baseNameOf (toString url);
|
||||
|
@ -34,6 +35,7 @@ rec {
|
|||
impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
|
||||
};
|
||||
|
||||
|
||||
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
|
||||
bootstrapTools = derivation {
|
||||
name = "bootstrap-tools";
|
||||
|
@ -77,8 +79,8 @@ rec {
|
|||
shell = "${bootstrapTools}/bin/sh";
|
||||
initialPath = [bootstrapTools] ++ extraPath;
|
||||
fetchurlBoot = fetchurl;
|
||||
forceFetchurlBoot = true;
|
||||
inherit gcc extraAttrs;
|
||||
inherit gcc;
|
||||
extraAttrs = extraAttrs // {inherit fetchurl;};
|
||||
};
|
||||
|
||||
|
||||
|
@ -215,8 +217,7 @@ rec {
|
|||
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
|
||||
fetchurlBoot = stdenvLinuxBoot3.fetchurlBoot;
|
||||
forceFetchurlBoot = false;
|
||||
fetchurlBoot = fetchurl;
|
||||
|
||||
extraAttrs = {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{stdenvInitial}:
|
||||
{system, allPackages ? import ../../..}:
|
||||
|
||||
let
|
||||
|
||||
system = stdenvInitial.system;
|
||||
rec {
|
||||
|
||||
shell = "/bin/bash";
|
||||
|
||||
path = ["/" "/usr" "/usr/local"];
|
||||
|
||||
|
||||
prehookBase = builtins.toFile "prehook-base.sh" ''
|
||||
# Disable purity tests; it's allowed (even needed) to link to
|
||||
|
@ -46,7 +46,10 @@ let
|
|||
|
||||
# A function that builds a "native" stdenv (one that uses tools in
|
||||
# /usr etc.).
|
||||
makeStdenv = {stdenvBoot, extraPath, forceFetchurlBoot}: import ../generic {
|
||||
makeStdenv =
|
||||
{gcc, fetchurl, extraPath ? []}:
|
||||
|
||||
import ../generic {
|
||||
name = "stdenv-native";
|
||||
|
||||
preHook =
|
||||
|
@ -54,36 +57,42 @@ let
|
|||
if system == "i686-freebsd" then prehookFreeBSD else
|
||||
prehookBase;
|
||||
|
||||
initialPath = extraPath ++ ["/" "/usr" "/usr/local"];
|
||||
initialPath = extraPath ++ path;
|
||||
|
||||
fetchurlBoot = fetchurl;
|
||||
|
||||
inherit system shell gcc;
|
||||
};
|
||||
|
||||
|
||||
stdenvBoot0 = makeStdenv {
|
||||
gcc = "/no-such-path";
|
||||
fetchurl = null;
|
||||
};
|
||||
|
||||
stdenv = stdenvBoot;
|
||||
|
||||
gcc = import ../../build-support/gcc-wrapper {
|
||||
name = "gcc-native";
|
||||
nativeTools = true;
|
||||
nativeLibc = true;
|
||||
nativePrefix = "/usr";
|
||||
stdenv = stdenvBoot;
|
||||
stdenv = stdenvBoot0;
|
||||
};
|
||||
|
||||
inherit shell forceFetchurlBoot;
|
||||
|
||||
fetchurlBoot = import ../../build-support/fetchurl {
|
||||
stdenv = stdenvBoot;
|
||||
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 {
|
||||
stdenvBoot = stdenvInitial;
|
||||
extraPath = [];
|
||||
forceFetchurlBoot = true;
|
||||
};
|
||||
inherit gcc fetchurl;
|
||||
} // {inherit fetchurl;};
|
||||
|
||||
stdenvBoot1Pkgs = import ../../.. {
|
||||
stdenvBoot1Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvBoot1;
|
||||
};
|
||||
|
@ -93,9 +102,10 @@ let
|
|||
# most systems don't have, so we mustn't rely on the native
|
||||
# environment providing it).
|
||||
stdenvBoot2 = makeStdenv {
|
||||
stdenvBoot = stdenvBoot1;
|
||||
inherit gcc fetchurl;
|
||||
extraPath = [stdenvBoot1Pkgs.replace];
|
||||
forceFetchurlBoot = false;
|
||||
};
|
||||
|
||||
in stdenvBoot2
|
||||
|
||||
stdenv = stdenvBoot2;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import ../generic {
|
|||
preHook = ./prehook.sh;
|
||||
initialPath = (import ../common-path.nix) {pkgs = pkgs;};
|
||||
|
||||
inherit stdenv;
|
||||
system = stdenv.system;
|
||||
|
||||
gcc = import ../../build-support/gcc-wrapper {
|
||||
nativeTools = false;
|
||||
|
@ -23,5 +23,4 @@ import ../generic {
|
|||
shell = pkgs.bash + "/bin/sh";
|
||||
|
||||
fetchurlBoot = stdenv.fetchurlBoot;
|
||||
forceFetchurlBoot = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue