mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
* Switching to the new stdenv-linux.
svn path=/nixpkgs/trunk/; revision=6828
This commit is contained in:
parent
60a9aa66bf
commit
18d730980c
@ -55,7 +55,7 @@ rec {
|
||||
|
||||
|
||||
# Linux standard environment.
|
||||
stdenvLinux = (import ./linux {inherit allPackages;}).stdenvLinux;
|
||||
stdenvLinux = (import ./linux {inherit system allPackages;}).stdenvLinux;
|
||||
|
||||
|
||||
# Darwin (Mac OS X) standard environment. Very simple for now
|
||||
|
@ -4,100 +4,69 @@
|
||||
# compiler and linker that do not search in default locations,
|
||||
# ensuring purity of components produced by it.
|
||||
|
||||
{allPackages}:
|
||||
{system, allPackages}:
|
||||
|
||||
rec {
|
||||
|
||||
system = "i686-linux";
|
||||
bootstrapTools =
|
||||
if system == "i686-linux" then import ./bootstrap/i686
|
||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64
|
||||
else abort "unsupported platform for the pure Linux stdenv";
|
||||
|
||||
|
||||
# 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 {
|
||||
name = "curl";
|
||||
builder = ./tools/bash;
|
||||
tar = ./tools/tar;
|
||||
bunzip2 = ./tools/bunzip2;
|
||||
cp = ./tools/cp;
|
||||
curl = ./tools/curl-7.15.1-static.tar.bz2;
|
||||
inherit system;
|
||||
args = [ ./scripts/unpack-curl.sh ];
|
||||
name = "curl";
|
||||
builder = bootstrapTools.bash;
|
||||
inherit (bootstrapTools) bunzip2 cp curl;
|
||||
args = [ ./new-scripts/unpack-curl.sh ];
|
||||
};
|
||||
|
||||
# This function downloads a file.
|
||||
download = {url, md5, pkgname}: derivation {
|
||||
download = {url, sha1, pkgname}: derivation {
|
||||
name = baseNameOf (toString url);
|
||||
builder = ./tools/bash;
|
||||
builder = bootstrapTools.bash;
|
||||
inherit system curl url;
|
||||
args = [ ./scripts/download.sh ];
|
||||
|
||||
# Nix 0.8 fixed-output derivations.
|
||||
outputHashAlgo = "md5";
|
||||
outputHash = md5;
|
||||
|
||||
# Compatibility with Nix <= 0.7.
|
||||
id = md5;
|
||||
args = [ ./new-scripts/download.sh ];
|
||||
outputHashAlgo = "sha1";
|
||||
outputHash = sha1;
|
||||
};
|
||||
|
||||
# This function downloads and unpacks a file.
|
||||
downloadAndUnpack =
|
||||
{ url, md5, pkgname, postProcess ? [], addToPath ? []
|
||||
, extra ? null, extra2 ? null
|
||||
, extra3 ? null, extra4? null, patchelf ? null}:
|
||||
derivation {
|
||||
downloadAndUnpack = pkgname: {url, sha1}: derivation {
|
||||
name = pkgname;
|
||||
builder = ./tools/bash;
|
||||
tar = ./tools/tar;
|
||||
bunzip2 = ./tools/bunzip2;
|
||||
cp = ./tools/cp;
|
||||
args = [ ./scripts/unpack.sh ];
|
||||
tarball = download {inherit url md5 pkgname;};
|
||||
inherit system postProcess addToPath extra extra2 extra3 extra4 patchelf;
|
||||
builder = bootstrapTools.bash;
|
||||
inherit (bootstrapTools) bunzip2 tar cp;
|
||||
args = [ ./new-scripts/unpack.sh ];
|
||||
tarball = download {inherit url sha1 pkgname;};
|
||||
inherit system;
|
||||
allowedReferences = [];
|
||||
};
|
||||
|
||||
# The various statically linked components that make up the standard
|
||||
# environment.
|
||||
staticTools = downloadAndUnpack {
|
||||
url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/static-tools.tar.bz2;
|
||||
pkgname = "static-tools";
|
||||
md5 = "90578c603079313123e8c754a85e40d7";
|
||||
};
|
||||
|
||||
binutils = downloadAndUnpack {
|
||||
url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/binutils-2.15-static.tar.bz2;
|
||||
pkgname = "binutils";
|
||||
md5 = "9c134038b7f1894a4b307d600207047c";
|
||||
};
|
||||
|
||||
staticGCC = (downloadAndUnpack {
|
||||
url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/gcc-3.4.2-static.tar.bz2;
|
||||
pkgname = "gcc";
|
||||
md5 = "600452fac470a49a41ea81d39c209f35";
|
||||
postProcess = [./scripts/fix-outpath.sh];
|
||||
addToPath = [staticTools];
|
||||
}) // { langC = true; langCC = false; langF77 = false; };
|
||||
|
||||
glibc = downloadAndUnpack {
|
||||
url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/glibc-2.3.3-static.tar.bz2;
|
||||
pkgname = "glibc";
|
||||
md5 = "36ff244e666c60784edfe1cc66f68e4c";
|
||||
postProcess = [./scripts/fix-outpath.sh];
|
||||
addToPath = [staticTools];
|
||||
};
|
||||
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, glibc, binutils, shell ? ""}:
|
||||
{gcc ? staticGCC, libc, binutils, shell ? ""}:
|
||||
(import ../../build-support/gcc-wrapper) {
|
||||
nativeTools = false;
|
||||
nativeGlibc = false;
|
||||
inherit gcc binutils glibc shell;
|
||||
nativeLibc = false;
|
||||
inherit gcc binutils libc shell;
|
||||
stdenv = stdenvInitial;
|
||||
};
|
||||
|
||||
@ -108,18 +77,18 @@ rec {
|
||||
stdenvInitial = let {
|
||||
body = derivation {
|
||||
name = "stdenv-linux-initial";
|
||||
builder = ./tools/bash;
|
||||
args = [ ./scripts/builder-stdenv-initial.sh ];
|
||||
inherit system staticTools;
|
||||
builder = bootstrapTools.bash;
|
||||
args = [ ./new-scripts/builder-stdenv-initial.sh ];
|
||||
inherit system staticTools curl;
|
||||
} // {
|
||||
# !!! too much duplication with stdenv/generic/default.nix
|
||||
mkDerivation = attrs: (derivation ((removeAttrs attrs ["meta"]) // {
|
||||
builder = ./tools/bash;
|
||||
builder = bootstrapTools.bash;
|
||||
args = ["-e" attrs.builder];
|
||||
stdenv = body;
|
||||
system = body.system;
|
||||
})) // { meta = if attrs ? meta then attrs.meta else {}; };
|
||||
shell = ./tools/bash;
|
||||
shell = bootstrapTools.bash;
|
||||
};
|
||||
};
|
||||
|
||||
@ -132,9 +101,9 @@ rec {
|
||||
import ../generic {
|
||||
name = "stdenv-linux-boot";
|
||||
param1 = if staticGlibc then "static" else "dynamic";
|
||||
preHook = ./prehook.sh;
|
||||
preHook = ./new-scripts/prehook.sh;
|
||||
stdenv = stdenvInitial;
|
||||
shell = ./tools/bash;
|
||||
shell = bootstrapTools.bash;
|
||||
initialPath = [
|
||||
staticTools
|
||||
];
|
||||
@ -147,10 +116,11 @@ rec {
|
||||
# the gcc configure script happy.
|
||||
stdenvLinuxBoot1 = stdenvBootFun {
|
||||
# Use the statically linked, downloaded glibc/gcc/binutils.
|
||||
gcc = wrapGCC {inherit glibc binutils;};
|
||||
gcc = wrapGCC {libc = staticGlibc; binutils = staticBinutils;};
|
||||
staticGlibc = true;
|
||||
extraAttrs = {inherit curl;};
|
||||
};
|
||||
|
||||
|
||||
# 2) These are the packages that we can build with the first
|
||||
# stdenv. We only need Glibc (in step 3).
|
||||
@ -159,25 +129,29 @@ rec {
|
||||
bootStdenv = stdenvLinuxBoot1;
|
||||
};
|
||||
|
||||
|
||||
# 3) Build Glibc with the statically linked tools. The result is the
|
||||
# full, dynamically linked, final Glibc.
|
||||
stdenvLinuxGlibc = stdenvLinuxBoot1Pkgs.glibc;
|
||||
stdenvLinuxGlibc = stdenvLinuxBoot1Pkgs.glibcNew;
|
||||
|
||||
|
||||
# 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.
|
||||
stdenvLinuxBoot2 = removeAttrs (stdenvBootFun {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {inherit binutils; glibc = stdenvLinuxGlibc;};
|
||||
gcc = wrapGCC {binutils = staticBinutils; libc = stdenvLinuxGlibc;};
|
||||
extraAttrs = {inherit curl; glibc = stdenvLinuxGlibc;};
|
||||
}) ["gcc" "binutils"];
|
||||
|
||||
|
||||
# 5) The packages that can be built using the second stdenv.
|
||||
stdenvLinuxBoot2Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvLinuxBoot2;
|
||||
};
|
||||
|
||||
|
||||
# 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.
|
||||
@ -185,24 +159,26 @@ rec {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
glibc = stdenvLinuxGlibc;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
};
|
||||
extraAttrs = {inherit curl;};
|
||||
};
|
||||
|
||||
|
||||
# 7) The packages that can be built using the third stdenv.
|
||||
stdenvLinuxBoot3Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvLinuxBoot3;
|
||||
};
|
||||
|
||||
|
||||
# 8) Construct the final stdenv. It uses the Glibc, GCC and
|
||||
# Binutils built above, and adds in dynamically linked versions
|
||||
# of all other tools.
|
||||
stdenvLinux = (import ../generic) {
|
||||
name = "stdenv-linux";
|
||||
preHook = ./prehook.sh;
|
||||
preHook = ./new-scripts/prehook.sh;
|
||||
initialPath = [
|
||||
((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
|
||||
stdenvLinuxBoot3Pkgs.patchelf
|
||||
@ -212,7 +188,7 @@ rec {
|
||||
|
||||
gcc = wrapGCC {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
glibc = stdenvLinuxGlibc;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
};
|
||||
|
@ -1,207 +0,0 @@
|
||||
# This file constructs the standard build environment for the
|
||||
# Linux/i686 platform. It's completely pure; that is, it relies on no
|
||||
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
|
||||
# compiler and linker that do not search in default locations,
|
||||
# ensuring purity of components produced by it.
|
||||
|
||||
{system, allPackages}:
|
||||
|
||||
rec {
|
||||
|
||||
bootstrapTools =
|
||||
if system == "i686-linux" then import ./bootstrap/i686
|
||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64
|
||||
else abort "unsupported platform for the pure Linux stdenv";
|
||||
|
||||
|
||||
# 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) bunzip2 cp curl;
|
||||
args = [ ./new-scripts/unpack-curl.sh ];
|
||||
};
|
||||
|
||||
# This function downloads a file.
|
||||
download = {url, sha1, pkgname}: derivation {
|
||||
name = baseNameOf (toString url);
|
||||
builder = bootstrapTools.bash;
|
||||
inherit system curl url;
|
||||
args = [ ./new-scripts/download.sh ];
|
||||
outputHashAlgo = "sha1";
|
||||
outputHash = sha1;
|
||||
};
|
||||
|
||||
# This function downloads and unpacks a file.
|
||||
downloadAndUnpack = pkgname: {url, sha1}: derivation {
|
||||
name = pkgname;
|
||||
builder = bootstrapTools.bash;
|
||||
inherit (bootstrapTools) bunzip2 tar cp;
|
||||
args = [ ./new-scripts/unpack.sh ];
|
||||
tarball = download {inherit url sha1 pkgname;};
|
||||
inherit system;
|
||||
allowedReferences = [];
|
||||
};
|
||||
|
||||
# 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 = [ ./new-scripts/builder-stdenv-initial.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 ? {}}:
|
||||
|
||||
import ../generic {
|
||||
name = "stdenv-linux-boot";
|
||||
param1 = if staticGlibc then "static" else "dynamic";
|
||||
preHook = ./new-scripts/prehook.sh;
|
||||
stdenv = stdenvInitial;
|
||||
shell = bootstrapTools.bash;
|
||||
initialPath = [
|
||||
staticTools
|
||||
];
|
||||
inherit gcc extraAttrs;
|
||||
};
|
||||
|
||||
|
||||
# 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.
|
||||
stdenvLinuxBoot1 = stdenvBootFun {
|
||||
# Use the statically linked, downloaded glibc/gcc/binutils.
|
||||
gcc = wrapGCC {libc = staticGlibc; binutils = staticBinutils;};
|
||||
staticGlibc = true;
|
||||
extraAttrs = {inherit curl;};
|
||||
};
|
||||
|
||||
|
||||
# 2) These are the packages that we can build with the first
|
||||
# stdenv. We only need Glibc (in step 3).
|
||||
stdenvLinuxBoot1Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvLinuxBoot1;
|
||||
};
|
||||
|
||||
|
||||
# 3) Build Glibc with the statically linked tools. The result is the
|
||||
# full, dynamically linked, final Glibc.
|
||||
stdenvLinuxGlibc = stdenvLinuxBoot1Pkgs.glibcNew;
|
||||
|
||||
|
||||
# 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.
|
||||
stdenvLinuxBoot2 = removeAttrs (stdenvBootFun {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {binutils = staticBinutils; libc = stdenvLinuxGlibc;};
|
||||
extraAttrs = {inherit curl; glibc = stdenvLinuxGlibc;};
|
||||
}) ["gcc" "binutils"];
|
||||
|
||||
|
||||
# 5) The packages that can be built using the second stdenv.
|
||||
stdenvLinuxBoot2Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvLinuxBoot2;
|
||||
};
|
||||
|
||||
|
||||
# 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.
|
||||
stdenvLinuxBoot3 = stdenvBootFun {
|
||||
staticGlibc = false;
|
||||
gcc = wrapGCC {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
};
|
||||
extraAttrs = {inherit curl;};
|
||||
};
|
||||
|
||||
|
||||
# 7) The packages that can be built using the third stdenv.
|
||||
stdenvLinuxBoot3Pkgs = allPackages {
|
||||
inherit system;
|
||||
bootStdenv = stdenvLinuxBoot3;
|
||||
};
|
||||
|
||||
|
||||
# 8) Construct the final stdenv. It uses the Glibc, GCC and
|
||||
# Binutils built above, and adds in dynamically linked versions
|
||||
# of all other tools.
|
||||
stdenvLinux = (import ../generic) {
|
||||
name = "stdenv-linux";
|
||||
preHook = ./new-scripts/prehook.sh;
|
||||
initialPath = [
|
||||
((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
|
||||
stdenvLinuxBoot3Pkgs.patchelf
|
||||
];
|
||||
|
||||
stdenv = stdenvInitial;
|
||||
|
||||
gcc = wrapGCC {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
libc = stdenvLinuxGlibc;
|
||||
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
};
|
||||
|
||||
shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh";
|
||||
|
||||
extraAttrs = {
|
||||
curl = stdenvLinuxBoot3Pkgs.realCurl;
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */ glibc;
|
||||
inherit (stdenvLinuxBoot3Pkgs)
|
||||
gzip bzip2 bash coreutils diffutils findutils gawk
|
||||
gnumake gnused gnutar gnugrep patch patchelf;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
export NIX_ENFORCE_PURITY=1
|
||||
|
||||
if test "$param1" = "static"; then
|
||||
export NIX_CFLAGS_LINK="-static"
|
||||
export NIX_LDFLAGS_BEFORE="-static"
|
||||
fi
|
||||
|
||||
havePatchELF=1
|
@ -1,9 +0,0 @@
|
||||
set -e
|
||||
|
||||
PATH=$staticTools/bin
|
||||
|
||||
mkdir $out
|
||||
|
||||
cat > $out/setup <<EOF
|
||||
PATH=$staticTools/bin
|
||||
EOF
|
@ -1,3 +0,0 @@
|
||||
set -e
|
||||
echo "downloading $out from $url"
|
||||
$curl/bin/curl --fail --location --max-redirs 20 "$url" > "$out"
|
@ -1,9 +0,0 @@
|
||||
cd $out
|
||||
|
||||
chmod -R +w .
|
||||
|
||||
find . -type f | while read fn; do
|
||||
cat $fn | sed "s|/nix/store/[a-z0-9]*-|/nix/store/ffffffffffffffffffffffffffffffff-|g" > $fn.tmp
|
||||
if test -x $fn; then chmod +x $fn.tmp; fi
|
||||
mv $fn.tmp $fn
|
||||
done
|
@ -1,8 +0,0 @@
|
||||
set -x
|
||||
set -e
|
||||
|
||||
echo $curl
|
||||
|
||||
$bunzip2 -d < $curl | $tar xvf -
|
||||
|
||||
$cp -prvd * $out
|
@ -1,14 +0,0 @@
|
||||
set -e
|
||||
|
||||
$bunzip2 -d < $tarball | $tar xvf -
|
||||
|
||||
$cp -prd * $out
|
||||
|
||||
if test -n "$postProcess"; then
|
||||
for i in $addToPath; do
|
||||
export PATH=$PATH:$i/bin
|
||||
done
|
||||
for i in $postProcess; do
|
||||
source $i
|
||||
done
|
||||
fi
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user