3
0
Fork 0
forked from mirrors/nixpkgs

* Fix stdenvNative/stdenvNix.

svn path=/nixpkgs/branches/stdenv-updates/; revision=13957
This commit is contained in:
Eelco Dolstra 2009-02-02 15:03:38 +00:00
parent 3e727ebe97
commit 1dee2d3de0
7 changed files with 60 additions and 93 deletions

View file

@ -10,7 +10,7 @@
# system, e.g., cygwin and mingw builds on i686-cygwin. Most people # system, e.g., cygwin and mingw builds on i686-cygwin. Most people
# can ignore it. # can ignore it.
{system, stdenvType ? system, allPackages}: {system, stdenvType ? system, allPackages ? import ../..}:
assert system != "i686-cygwin" -> system == stdenvType; assert system != "i686-cygwin" -> system == stdenvType;
@ -18,21 +18,14 @@ assert system != "i686-cygwin" -> system == stdenvType;
rec { 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 # The native (i.e., impure) build environment. This one uses the
# tools installed on the system outside of the Nix environment, # tools installed on the system outside of the Nix environment,
# i.e., the stuff in /bin, /usr/bin, etc. This environment should # i.e., the stuff in /bin, /usr/bin, etc. This environment should
# be used with care, since many Nix packages will not build properly # be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make). # with it (e.g., because they require GNU Make).
stdenvNative = import ./native { stdenvNative = (import ./native {
inherit stdenvInitial; inherit system allPackages;
}; }).stdenv;
stdenvNativePkgs = allPackages { stdenvNativePkgs = allPackages {
bootStdenv = stdenvNative; bootStdenv = stdenvNative;
@ -41,10 +34,10 @@ rec {
# The Nix build environment. # The Nix build environment.
stdenvNix = import ./nix (rec { stdenvNix = import ./nix {
stdenv = stdenvNative; stdenv = stdenvNative;
pkgs = stdenvNativePkgs; pkgs = stdenvNativePkgs;
}); };
# Linux standard environment. # Linux standard environment.

View file

@ -1,7 +1,10 @@
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell { system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? "" , param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
, extraAttrs ? {} , extraAttrs ? {}
, fetchurlBoot, forceFetchurlBoot
, # The `fetchurl' to use for downloading curl and its dependencies
# (see all-packages.nix).
fetchurlBoot
}: }:
let { let {
@ -82,9 +85,7 @@ let {
# "lift" packages like curl from the final stdenv for Linux to # "lift" packages like curl from the final stdenv for Linux to
# all-packages.nix for that platform (meaning that it has a line # all-packages.nix for that platform (meaning that it has a line
# like curl = if stdenv ? curl then stdenv.curl else ...). # like curl = if stdenv ? curl then stdenv.curl else ...).
// extraAttrs // extraAttrs;
// (if forceFetchurlBoot then {fetchurl = fetchurlBoot;} else {});
}.result; }.result;

View file

@ -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

View file

@ -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;
};
}

View file

@ -22,6 +22,7 @@ rec {
# 1) Create a standard environment by downloading pre-built binaries # 1) Create a standard environment by downloading pre-built binaries
# of coreutils, GCC, etc. # of coreutils, GCC, etc.
# This function downloads a file. # This function downloads a file.
download = {url, sha256}: derivation { download = {url, sha256}: derivation {
name = baseNameOf (toString url); name = baseNameOf (toString url);
@ -34,6 +35,7 @@ rec {
impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ]; impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
}; };
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...). # Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
bootstrapTools = derivation { bootstrapTools = derivation {
name = "bootstrap-tools"; name = "bootstrap-tools";
@ -77,8 +79,8 @@ rec {
shell = "${bootstrapTools}/bin/sh"; shell = "${bootstrapTools}/bin/sh";
initialPath = [bootstrapTools] ++ extraPath; initialPath = [bootstrapTools] ++ extraPath;
fetchurlBoot = fetchurl; fetchurlBoot = fetchurl;
forceFetchurlBoot = true; inherit gcc;
inherit gcc extraAttrs; extraAttrs = extraAttrs // {inherit fetchurl;};
}; };
@ -215,8 +217,7 @@ rec {
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh"; shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
fetchurlBoot = stdenvLinuxBoot3.fetchurlBoot; fetchurlBoot = fetchurl;
forceFetchurlBoot = false;
extraAttrs = { extraAttrs = {
inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc; inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;

View file

@ -1,11 +1,11 @@
{stdenvInitial}: {system, allPackages ? import ../../..}:
let rec {
system = stdenvInitial.system;
shell = "/bin/bash"; shell = "/bin/bash";
path = ["/" "/usr" "/usr/local"];
prehookBase = builtins.toFile "prehook-base.sh" '' prehookBase = builtins.toFile "prehook-base.sh" ''
# Disable purity tests; it's allowed (even needed) to link to # 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 # A function that builds a "native" stdenv (one that uses tools in
# /usr etc.). # /usr etc.).
makeStdenv = {stdenvBoot, extraPath, forceFetchurlBoot}: import ../generic { makeStdenv =
{gcc, fetchurl, extraPath ? []}:
import ../generic {
name = "stdenv-native"; name = "stdenv-native";
preHook = preHook =
@ -54,36 +57,42 @@ let
if system == "i686-freebsd" then prehookFreeBSD else if system == "i686-freebsd" then prehookFreeBSD else
prehookBase; 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 { gcc = import ../../build-support/gcc-wrapper {
name = "gcc-native"; name = "gcc-native";
nativeTools = true; nativeTools = true;
nativeLibc = true; nativeLibc = true;
nativePrefix = "/usr"; nativePrefix = "/usr";
stdenv = stdenvBoot; stdenv = stdenvBoot0;
}; };
inherit shell forceFetchurlBoot;
fetchurlBoot = import ../../build-support/fetchurl { fetchurl = import ../../build-support/fetchurl {
stdenv = stdenvBoot; stdenv = stdenvBoot0;
# Curl should be in /usr/bin or so. # Curl should be in /usr/bin or so.
curl = null; curl = null;
}; };
};
# First build a stdenv based only on tools outside the store. # First build a stdenv based only on tools outside the store.
stdenvBoot1 = makeStdenv { stdenvBoot1 = makeStdenv {
stdenvBoot = stdenvInitial; inherit gcc fetchurl;
extraPath = []; } // {inherit fetchurl;};
forceFetchurlBoot = true;
};
stdenvBoot1Pkgs = import ../../.. { stdenvBoot1Pkgs = allPackages {
inherit system; inherit system;
bootStdenv = stdenvBoot1; bootStdenv = stdenvBoot1;
}; };
@ -93,9 +102,10 @@ let
# most systems don't have, so we mustn't rely on the native # most systems don't have, so we mustn't rely on the native
# environment providing it). # environment providing it).
stdenvBoot2 = makeStdenv { stdenvBoot2 = makeStdenv {
stdenvBoot = stdenvBoot1; inherit gcc fetchurl;
extraPath = [stdenvBoot1Pkgs.replace]; extraPath = [stdenvBoot1Pkgs.replace];
forceFetchurlBoot = false;
}; };
in stdenvBoot2
stdenv = stdenvBoot2;
}

View file

@ -5,7 +5,7 @@ import ../generic {
preHook = ./prehook.sh; preHook = ./prehook.sh;
initialPath = (import ../common-path.nix) {pkgs = pkgs;}; initialPath = (import ../common-path.nix) {pkgs = pkgs;};
inherit stdenv; system = stdenv.system;
gcc = import ../../build-support/gcc-wrapper { gcc = import ../../build-support/gcc-wrapper {
nativeTools = false; nativeTools = false;
@ -23,5 +23,4 @@ import ../generic {
shell = pkgs.bash + "/bin/sh"; shell = pkgs.bash + "/bin/sh";
fetchurlBoot = stdenv.fetchurlBoot; fetchurlBoot = stdenv.fetchurlBoot;
forceFetchurlBoot = false;
} }