* Use GCC 4.3 by default.
* Updated stdenv-linux:
- The bootstrap tools are no longer statically linked (except for
binaries in the Nixpkgs tree used to download and unpack the
bootstrap tools).
- x86_64 uses the same static binaries as i686. This makes the
Nixpkgs tree a bit smaller.
- Use the Linux 2.6.28 headers.
svn path=/nixpkgs/branches/stdenv-updates/; revision=13946
This commit is contained in:
+112
-108
@@ -9,7 +9,7 @@
|
||||
|
||||
rec {
|
||||
|
||||
bootstrapTools =
|
||||
bootstrapFiles =
|
||||
if system == "i686-linux" then import ./bootstrap/i686
|
||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64
|
||||
else if system == "powerpc-linux" then import ./bootstrap/powerpc
|
||||
@@ -19,114 +19,115 @@ rec {
|
||||
# The bootstrap process proceeds in several steps.
|
||||
|
||||
|
||||
# 1) Create a standard environment by downloading pre-built
|
||||
# statically linked binaries of coreutils, gcc, etc.
|
||||
|
||||
# To fetch the pre-built binaries, we use a statically linked `curl'
|
||||
# binary which is unpacked here.
|
||||
curl = derivation {
|
||||
inherit system;
|
||||
name = "curl";
|
||||
builder = bootstrapTools.bash;
|
||||
inherit (bootstrapTools) bzip2 cp curl;
|
||||
args = [ ./scripts/unpack-curl.sh ];
|
||||
};
|
||||
# 1) Create a standard environment by downloading pre-built binaries
|
||||
# of coreutils, GCC, etc.
|
||||
|
||||
# This function downloads a file.
|
||||
download = {url, sha1, pkgname}: derivation {
|
||||
download = {url, sha256}: derivation {
|
||||
name = baseNameOf (toString url);
|
||||
builder = bootstrapTools.bash;
|
||||
inherit system curl url;
|
||||
builder = bootstrapFiles.sh;
|
||||
inherit system url;
|
||||
inherit (bootstrapFiles) bzip2 mkdir curl cpio ln;
|
||||
args = [ ./scripts/download.sh ];
|
||||
outputHashAlgo = "sha1";
|
||||
outputHash = sha1;
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = sha256;
|
||||
impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
|
||||
};
|
||||
|
||||
# This function downloads and unpacks a file.
|
||||
downloadAndUnpack = pkgname: {url, sha1}: derivation {
|
||||
name = pkgname;
|
||||
builder = bootstrapTools.bash;
|
||||
inherit (bootstrapTools) bzip2 tar cp;
|
||||
args = [ ./scripts/unpack.sh ];
|
||||
tarball = download {inherit url sha1 pkgname;};
|
||||
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
|
||||
bootstrapTools = derivation {
|
||||
name = "bootstrap-tools";
|
||||
|
||||
builder = bootstrapFiles.sh;
|
||||
|
||||
args = [ ./scripts/unpack-bootstrap-tools.sh ];
|
||||
|
||||
inherit (bootstrapFiles) bzip2 mkdir curl cpio;
|
||||
|
||||
tarball = download {
|
||||
inherit (bootstrapFiles.bootstrapTools) url sha256;
|
||||
};
|
||||
|
||||
inherit system;
|
||||
allowedReferences = [];
|
||||
|
||||
# Needed by the GCC wrapper.
|
||||
langC = true;
|
||||
langCC = true;
|
||||
};
|
||||
|
||||
# The various statically linked components that make up the standard
|
||||
# environment.
|
||||
staticTools = downloadAndUnpack "static-tools" bootstrapTools.staticToolsURL;
|
||||
staticBinutils = downloadAndUnpack "static-binutils" bootstrapTools.binutilsURL;
|
||||
staticGCC = (downloadAndUnpack "static-gcc" bootstrapTools.gccURL)
|
||||
// { langC = true; langCC = false; langF77 = false; };
|
||||
staticGlibc = downloadAndUnpack "static-glibc" bootstrapTools.glibcURL;
|
||||
|
||||
|
||||
# A helper function to call gcc-wrapper.
|
||||
wrapGCC =
|
||||
{gcc ? staticGCC, libc, binutils, shell ? ""}:
|
||||
(import ../../build-support/gcc-wrapper) {
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
inherit gcc binutils libc shell;
|
||||
stdenv = stdenvInitial;
|
||||
};
|
||||
|
||||
|
||||
# The "fake" standard environment used to build "real" standard
|
||||
# environments. It consists of just the basic statically linked
|
||||
# tools.
|
||||
stdenvInitial = let {
|
||||
body = derivation {
|
||||
name = "stdenv-linux-initial";
|
||||
builder = bootstrapTools.bash;
|
||||
args = [ ./scripts/builder-stdenv-initial.sh ];
|
||||
stdenvScript = ../generic/setup.sh;
|
||||
inherit system staticTools curl;
|
||||
} // {
|
||||
# !!! too much duplication with stdenv/generic/default.nix
|
||||
mkDerivation = attrs: (derivation ((removeAttrs attrs ["meta"]) // {
|
||||
builder = bootstrapTools.bash;
|
||||
args = ["-e" attrs.builder];
|
||||
stdenv = body;
|
||||
system = body.system;
|
||||
})) // { meta = if attrs ? meta then attrs.meta else {}; };
|
||||
shell = bootstrapTools.bash;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
# This function builds the various standard environments used during
|
||||
# the bootstrap.
|
||||
stdenvBootFun =
|
||||
{gcc, staticGlibc, extraAttrs ? {}, extraPath ? []}:
|
||||
{gcc, extraAttrs ? {}, extraPath ? [], fetchurl}:
|
||||
|
||||
let
|
||||
fetchurlBoot = import ../../build-support/fetchurl {
|
||||
stdenv = stdenvInitial;
|
||||
inherit curl;
|
||||
};
|
||||
in import ../generic {
|
||||
import ../generic {
|
||||
inherit system;
|
||||
name = "stdenv-linux-boot";
|
||||
param1 = if staticGlibc then "static" else "dynamic";
|
||||
preHook = ./scripts/prehook.sh;
|
||||
stdenv = stdenvInitial;
|
||||
shell = bootstrapTools.bash;
|
||||
initialPath = [staticTools] ++ extraPath;
|
||||
inherit fetchurlBoot;
|
||||
param1 = bootstrapTools;
|
||||
preHook = builtins.toFile "prehook.sh"
|
||||
''
|
||||
export LD_LIBRARY_PATH=$param1/lib
|
||||
export NIX_ENFORCE_PURITY=1
|
||||
havePatchELF=1
|
||||
# Don't patch #!/interpreter because it leads to retained
|
||||
# dependencies on the bootstrapTools in the final stdenv.
|
||||
dontPatchShebangs=1
|
||||
'';
|
||||
shell = "${bootstrapTools}/bin/sh";
|
||||
initialPath = [bootstrapTools] ++ extraPath;
|
||||
fetchurlBoot = fetchurl;
|
||||
forceFetchurlBoot = true;
|
||||
inherit gcc extraAttrs;
|
||||
};
|
||||
|
||||
|
||||
# Build a dummy stdenv with no GCC or working fetchurl. This is
|
||||
# because we need a stdenv to build the GCC wrapper and fetchurl.
|
||||
stdenvLinuxBoot0 = stdenvBootFun {
|
||||
gcc = "/no-such-path";
|
||||
fetchurl = null;
|
||||
};
|
||||
|
||||
|
||||
fetchurl = import ../../build-support/fetchurl {
|
||||
stdenv = stdenvLinuxBoot0;
|
||||
curl = bootstrapTools;
|
||||
};
|
||||
|
||||
|
||||
# The Glibc include directory cannot have the same prefix as the GCC
|
||||
# include directory, since GCC gets confused otherwise (it will
|
||||
# search the Glibc headers before the GCC headers). So create a
|
||||
# dummy Glibc.
|
||||
bootstrapGlibc = stdenvLinuxBoot0.mkDerivation {
|
||||
name = "bootstrap-glibc";
|
||||
buildCommand = ''
|
||||
ensureDir $out
|
||||
ln -s ${bootstrapTools}/lib $out/lib
|
||||
ln -s ${bootstrapTools}/include-glibc $out/include
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
# A helper function to call gcc-wrapper.
|
||||
wrapGCC =
|
||||
{gcc ? bootstrapTools, libc, binutils, shell ? "", name ? "bootstrap-gcc"}:
|
||||
|
||||
import ../../build-support/gcc-wrapper {
|
||||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
inherit gcc binutils libc shell name;
|
||||
stdenv = stdenvLinuxBoot0;
|
||||
};
|
||||
|
||||
|
||||
# Create the first "real" standard environment. This one consists
|
||||
# of statically linked components only, and a minimal glibc to keep
|
||||
# the gcc configure script happy.
|
||||
# of bootstrap tools only, and a minimal Glibc to keep the GCC
|
||||
# configure script happy.
|
||||
stdenvLinuxBoot1 = stdenvBootFun {
|
||||
# Use the statically linked, downloaded glibc/gcc/binutils.
|
||||
gcc = wrapGCC {libc = staticGlibc; binutils = staticBinutils;};
|
||||
staticGlibc = true;
|
||||
gcc = wrapGCC {libc = bootstrapGlibc; binutils = bootstrapTools;};
|
||||
inherit fetchurl;
|
||||
};
|
||||
|
||||
|
||||
@@ -138,18 +139,18 @@ rec {
|
||||
};
|
||||
|
||||
|
||||
# 3) Build Glibc with the statically linked tools. The result is the
|
||||
# full, dynamically linked, final Glibc.
|
||||
# 3) Build Glibc with the bootstrap tools. The result is the full,
|
||||
# dynamically linked, final Glibc.
|
||||
stdenvLinuxGlibc = stdenvLinuxBoot1Pkgs.glibc;
|
||||
|
||||
|
||||
# 4) Construct a second stdenv identical to the first, except that
|
||||
# this one uses the Glibc built in step 3. It still uses
|
||||
# statically linked tools.
|
||||
# the rest of the bootstrap tools, including GCC.
|
||||
stdenvLinuxBoot2 = removeAttrs (stdenvBootFun {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {binutils = staticBinutils; libc = stdenvLinuxGlibc;};
|
||||
gcc = wrapGCC {binutils = bootstrapTools; libc = stdenvLinuxGlibc;};
|
||||
extraAttrs = {glibc = stdenvLinuxGlibc;};
|
||||
inherit fetchurl;
|
||||
}) ["gcc" "binutils"];
|
||||
|
||||
|
||||
@@ -160,25 +161,18 @@ rec {
|
||||
};
|
||||
|
||||
|
||||
# Ugh, some packages in stdenvLinuxBoot3Pkgs need "sh", so create a
|
||||
# package that contains just a symlink to bash.
|
||||
shSymlink = stdenvLinuxBoot2Pkgs.runCommand "sh-symlink" {} ''
|
||||
ensureDir $out/bin
|
||||
ln -s $shell $out/bin/sh
|
||||
'';
|
||||
|
||||
|
||||
# 6) Construct a third stdenv identical to the second, except that
|
||||
# this one uses the dynamically linked GCC and Binutils from step
|
||||
# 5. The other tools (e.g. coreutils) are still static.
|
||||
# 5. The other tools (e.g. coreutils) are still from the
|
||||
# bootstrap tools.
|
||||
stdenvLinuxBoot3 = stdenvBootFun {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {
|
||||
gcc = wrapGCC rec {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
name = gcc.name;
|
||||
};
|
||||
extraPath = [stdenvLinuxBoot2Pkgs.replace shSymlink];
|
||||
inherit fetchurl;
|
||||
};
|
||||
|
||||
|
||||
@@ -192,21 +186,31 @@ rec {
|
||||
# 8) Construct the final stdenv. It uses the Glibc, GCC and
|
||||
# Binutils built above, and adds in dynamically linked versions
|
||||
# of all other tools.
|
||||
#
|
||||
# When updating stdenvLinux, make sure that the result has no
|
||||
# dependency (`nix-store -qR') on bootstrapTools.
|
||||
stdenvLinux = import ../generic {
|
||||
name = "stdenv-linux";
|
||||
preHook = ./scripts/prehook.sh;
|
||||
|
||||
inherit system;
|
||||
|
||||
preHook = builtins.toFile "prehook.sh"
|
||||
''
|
||||
export NIX_ENFORCE_PURITY=1
|
||||
havePatchELF=1
|
||||
'';
|
||||
|
||||
initialPath = [
|
||||
((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
|
||||
stdenvLinuxBoot3Pkgs.patchelf
|
||||
];
|
||||
|
||||
stdenv = stdenvInitial;
|
||||
|
||||
gcc = wrapGCC {
|
||||
gcc = wrapGCC rec {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
name = gcc.name;
|
||||
};
|
||||
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
|
||||
Reference in New Issue
Block a user