From 84dd812f33d338d0050fdde146deb363e2121478 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 23 Oct 2006 14:27:34 +0000 Subject: Finally, the new stdenv-linux. * The statically linked bootstrap tools are now automatically reproducable, just do: $ nix-build ./make-bootstrap-tools.nix The resulting binaries in result/in-nixpkgs go to stdenv/linux/bootstrap//, and the tarballs in result/on-server go to https://svn.cs.uu.nl:12443/repos/trace/tarballs/trunk/stdenv-linux///. These are checked out on nix.cs.uu.nl under http://.../dist/tarballs. * The statically linked libraries all use dietlibc now (except patchelf and glibc), so they are much smaller. This is especially nice for the tools in the Nixpkgs tree, since it makes Nixpkgs tarballs smaller. * Use Binutils 2.17 and GCC 4.1.1 for the bootstrap. * The stdenv is now based on Glibc 2.5. I hope it works ;-) svn path=/nixpkgs/trunk/; revision=6803 --- pkgs/development/libraries/glibc-2.5/builder.sh | 69 ------- pkgs/development/libraries/glibc-2.5/default.nix | 21 --- .../libraries/glibc-2.5/glibc-pwd.patch | 74 -------- pkgs/development/libraries/glibc-new/builder.sh | 63 +++++++ pkgs/development/libraries/glibc-new/default.nix | 44 +++++ .../libraries/glibc-new/glibc-pwd.patch | 74 ++++++++ .../kernel-headers/kernel-headers-2.6.18.1.nix | 12 ++ pkgs/stdenv/linux/bootstrap/i686/bash | Bin 0 -> 484660 bytes pkgs/stdenv/linux/bootstrap/i686/bunzip2 | Bin 0 -> 69060 bytes pkgs/stdenv/linux/bootstrap/i686/cp | Bin 0 -> 51124 bytes pkgs/stdenv/linux/bootstrap/i686/curl.bz2 | Bin 0 -> 147729 bytes pkgs/stdenv/linux/bootstrap/i686/default.nix | 27 +++ pkgs/stdenv/linux/bootstrap/i686/tar.bz2 | Bin 0 -> 95712 bytes .../linux/new-scripts/builder-stdenv-initial.sh | 10 + pkgs/stdenv/linux/new-scripts/download.sh | 3 + pkgs/stdenv/linux/new-scripts/prehook.sh | 8 + pkgs/stdenv/linux/new-scripts/unpack-curl.sh | 11 ++ pkgs/stdenv/linux/new-scripts/unpack.sh | 8 + pkgs/stdenv/linux/new.nix | 206 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 9 + 20 files changed, 475 insertions(+), 164 deletions(-) delete mode 100644 pkgs/development/libraries/glibc-2.5/builder.sh delete mode 100644 pkgs/development/libraries/glibc-2.5/default.nix delete mode 100644 pkgs/development/libraries/glibc-2.5/glibc-pwd.patch create mode 100644 pkgs/development/libraries/glibc-new/builder.sh create mode 100644 pkgs/development/libraries/glibc-new/default.nix create mode 100644 pkgs/development/libraries/glibc-new/glibc-pwd.patch create mode 100644 pkgs/os-specific/linux/kernel-headers/kernel-headers-2.6.18.1.nix create mode 100755 pkgs/stdenv/linux/bootstrap/i686/bash create mode 100755 pkgs/stdenv/linux/bootstrap/i686/bunzip2 create mode 100755 pkgs/stdenv/linux/bootstrap/i686/cp create mode 100755 pkgs/stdenv/linux/bootstrap/i686/curl.bz2 create mode 100644 pkgs/stdenv/linux/bootstrap/i686/default.nix create mode 100755 pkgs/stdenv/linux/bootstrap/i686/tar.bz2 create mode 100644 pkgs/stdenv/linux/new-scripts/builder-stdenv-initial.sh create mode 100644 pkgs/stdenv/linux/new-scripts/download.sh create mode 100644 pkgs/stdenv/linux/new-scripts/prehook.sh create mode 100644 pkgs/stdenv/linux/new-scripts/unpack-curl.sh create mode 100644 pkgs/stdenv/linux/new-scripts/unpack.sh create mode 100644 pkgs/stdenv/linux/new.nix diff --git a/pkgs/development/libraries/glibc-2.5/builder.sh b/pkgs/development/libraries/glibc-2.5/builder.sh deleted file mode 100644 index 0219e30c4ba98..0000000000000 --- a/pkgs/development/libraries/glibc-2.5/builder.sh +++ /dev/null @@ -1,69 +0,0 @@ -# glibc cannot have itself in its rpath. -export NIX_NO_SELF_RPATH=1 -export NIX_DONT_SET_RPATH=1 - -source $stdenv/setup -source $substitute - -glibc=`cat $NIX_GCC/nix-support/orig-glibc` -echo $glibc - -export LD_LIBRARY_PATH=$glibc/lib - -# Explicitly tell glibc to use our pwd, not /bin/pwd. -export PWD_P=$(type -tP pwd) - - -postUnpack=postUnpack -postUnpack() { - cd $sourceRoot - unpackFile $linuxthreadsSrc - cd .. -} - - -preConfigure=preConfigure -preConfigure() { - - # Use Linuxthreads instead of NPTL. - rm -rf nptl - - for i in configure io/ftwtest-sh; do - substituteInPlace "$i" \ - --replace "@PWD@" "pwd" - done - - mkdir ../build - cd ../build - - configureScript=../$sourceRoot/configure - # `--with-tls --without-__thread' enables support for TLS but - # causes it not to be used. Required if we don't want to barf on - # 2.4 kernels. Or something. - configureFlags="--enable-add-ons \ - --with-headers=$kernelHeaders/include - --with-tls --without-__thread --disable-sanity-checks" -} - - -postConfigure=postConfigure -postConfigure() { - # Hack: get rid of the `-static' flag set by the bootstrap stdenv. - # This has to be done *after* `configure' because it builds some - # test binaries. - export NIX_CFLAGS_LINK= - export NIX_LDFLAGS_BEFORE= -} - - -postInstall=postInstall -postInstall() { - if test -n "$installLocales"; then - make localedata/install-locales - fi - rm $out/etc/ld.so.cache - (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1 -} - - -genericBuild diff --git a/pkgs/development/libraries/glibc-2.5/default.nix b/pkgs/development/libraries/glibc-2.5/default.nix deleted file mode 100644 index 20f5cba82b15d..0000000000000 --- a/pkgs/development/libraries/glibc-2.5/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{stdenv, fetchurl, kernelHeaders, installLocales ? true}: - -stdenv.mkDerivation { - name = "glibc-2.5"; - builder = ./builder.sh; - substitute = ../../../build-support/substitute/substitute.sh; - - src = fetchurl { - url = http://ftp.gnu.org/gnu/glibc/glibc-2.5.tar.bz2; - md5 = "1fb29764a6a650a4d5b409dda227ac9f"; - }; - - linuxthreadsSrc = fetchurl { - url = http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.5.tar.bz2; - md5 = "870d76d46dcaba37c13d01dca47d1774"; - }; - - patches = [ ./glibc-pwd.patch ]; - - inherit kernelHeaders installLocales; -} diff --git a/pkgs/development/libraries/glibc-2.5/glibc-pwd.patch b/pkgs/development/libraries/glibc-2.5/glibc-pwd.patch deleted file mode 100644 index 07039718477fe..0000000000000 --- a/pkgs/development/libraries/glibc-2.5/glibc-pwd.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff -ruN glibc-20050110/configure glibc-20050110.patched/configure ---- glibc-20050110/configure 2005-01-05 10:39:53.000000000 +0100 -+++ glibc-20050110.patched/configure 2005-01-18 13:33:01.000000000 +0100 -@@ -1393,7 +1393,7 @@ - ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - - --if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then -+if test "`cd $srcdir; @PWD@`" = "`@PWD@`"; then - { { echo "$as_me:$LINENO: error: you must configure in a separate build directory" >&5 - echo "$as_me: error: you must configure in a separate build directory" >&2;} - { (exit 1); exit 1; }; } -diff -ruN glibc-20050110/io/ftwtest-sh glibc-20050110.patched/io/ftwtest-sh ---- glibc-20050110/io/ftwtest-sh 2004-02-09 21:12:23.000000000 +0100 -+++ glibc-20050110.patched/io/ftwtest-sh 2005-01-18 13:33:15.000000000 +0100 -@@ -120,7 +120,7 @@ - sort > $testout - - # perhaps $tmp involves some symlinks... --tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd` -+tmpreal=`cd $tmp; @PWD@ 2>/dev/null || /usr/bin/pwd` - - cat </dev/null || /usr/bin/pwd` -+curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` - cd "$tmp" - LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d | - sort > $testout -@@ -160,7 +160,7 @@ - EOF - rm $testout - --curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` -+curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` - cd "$tmp" - LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. | - sort > $testout -@@ -182,7 +182,7 @@ - EOF - rm $testout - --curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` -+curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` - cd "$tmp" - LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 | - sort > $testout -diff -ruN glibc-20050110/scripts/rellns-sh glibc-20050110.patched/scripts/rellns-sh ---- glibc-20050110/scripts/rellns-sh 1999-12-19 00:40:25.000000000 +0100 -+++ glibc-20050110.patched/scripts/rellns-sh 2005-01-18 13:35:53.245937423 +0100 -@@ -22,13 +22,13 @@ - exit 1 - fi - --if test -x /bin/pwd; then -- pwd=/bin/pwd --elif test -x /usr/bin/pwd; then -- pwd=/usr/bin/pwd --else -+#if test -x /bin/pwd; then -+# pwd=/bin/pwd -+#elif test -x /usr/bin/pwd; then -+# pwd=/usr/bin/pwd -+#else - pwd='pwd' --fi -+#fi - - # Make both paths absolute. - if test -d $1; then diff --git a/pkgs/development/libraries/glibc-new/builder.sh b/pkgs/development/libraries/glibc-new/builder.sh new file mode 100644 index 0000000000000..2007235ab7660 --- /dev/null +++ b/pkgs/development/libraries/glibc-new/builder.sh @@ -0,0 +1,63 @@ +# glibc cannot have itself in its rpath. +export NIX_NO_SELF_RPATH=1 +export NIX_DONT_SET_RPATH=1 + +source $stdenv/setup +source $substitute + +glibc=`cat $NIX_GCC/nix-support/orig-glibc` +echo $glibc + +export LD_LIBRARY_PATH=$glibc/lib + +# Explicitly tell glibc to use our pwd, not /bin/pwd. +export PWD_P=$(type -tP pwd) + + +postUnpack=postUnpack +postUnpack() { + cd $sourceRoot + unpackFile $linuxthreadsSrc + cd .. +} + + +preConfigure=preConfigure +preConfigure() { + + # Use Linuxthreads instead of NPTL. + rm -rf nptl + + for i in configure io/ftwtest-sh; do + substituteInPlace "$i" \ + --replace "@PWD@" "pwd" + done + + mkdir ../build + cd ../build + + configureScript=../$sourceRoot/configure +} + + +postConfigure=postConfigure +postConfigure() { + # Hack: get rid of the `-static' flag set by the bootstrap stdenv. + # This has to be done *after* `configure' because it builds some + # test binaries. + export NIX_CFLAGS_LINK= + export NIX_LDFLAGS_BEFORE= +} + + +postInstall=postInstall +postInstall() { + if test -n "$installLocales"; then + make localedata/install-locales + fi + rm $out/etc/ld.so.cache + (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1 +} + + +genericBuild diff --git a/pkgs/development/libraries/glibc-new/default.nix b/pkgs/development/libraries/glibc-new/default.nix new file mode 100644 index 0000000000000..e87d14165533b --- /dev/null +++ b/pkgs/development/libraries/glibc-new/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, kernelHeaders +, installLocales ? true +, profilingLibraries ? false +}: + +stdenv.mkDerivation { + name = "glibc-2.5"; + builder = ./builder.sh; + substitute = ../../../build-support/substitute/substitute.sh; + + /* + src = fetchurl { + url = http://nix.cs.uu.nl/dist/tarballs/glibc-2.3.6.tar.bz2; + md5 = "bfdce99f82d6dbcb64b7f11c05d6bc96"; + }; + + linuxthreadsSrc = fetchurl { + url = http://nix.cs.uu.nl/dist/tarballs/glibc-linuxthreads-2.3.6.tar.bz2; + md5 = "d4eeda37472666a15cc1f407e9c987a9"; + }; + */ + + src = fetchurl { + url = http://ftp.gnu.org/gnu/glibc/glibc-2.5.tar.bz2; + md5 = "1fb29764a6a650a4d5b409dda227ac9f"; + }; + + linuxthreadsSrc = fetchurl { + url = http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.5.tar.bz2; + md5 = "870d76d46dcaba37c13d01dca47d1774"; + }; + + patches = [ ./glibc-pwd.patch ]; + + inherit kernelHeaders installLocales; + + # `--with-tls --without-__thread' enables support for TLS but causes + # it not to be used. Required if we don't want to barf on 2.4 + # kernels. Or something. + configureFlags="--enable-add-ons + --with-headers=${kernelHeaders}/include + --with-tls --without-__thread --disable-sanity-checks + ${if profilingLibraries then "--enable-profile" else "--disable-profile"}"; +} diff --git a/pkgs/development/libraries/glibc-new/glibc-pwd.patch b/pkgs/development/libraries/glibc-new/glibc-pwd.patch new file mode 100644 index 0000000000000..07039718477fe --- /dev/null +++ b/pkgs/development/libraries/glibc-new/glibc-pwd.patch @@ -0,0 +1,74 @@ +diff -ruN glibc-20050110/configure glibc-20050110.patched/configure +--- glibc-20050110/configure 2005-01-05 10:39:53.000000000 +0100 ++++ glibc-20050110.patched/configure 2005-01-18 13:33:01.000000000 +0100 +@@ -1393,7 +1393,7 @@ + ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +-if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then ++if test "`cd $srcdir; @PWD@`" = "`@PWD@`"; then + { { echo "$as_me:$LINENO: error: you must configure in a separate build directory" >&5 + echo "$as_me: error: you must configure in a separate build directory" >&2;} + { (exit 1); exit 1; }; } +diff -ruN glibc-20050110/io/ftwtest-sh glibc-20050110.patched/io/ftwtest-sh +--- glibc-20050110/io/ftwtest-sh 2004-02-09 21:12:23.000000000 +0100 ++++ glibc-20050110.patched/io/ftwtest-sh 2005-01-18 13:33:15.000000000 +0100 +@@ -120,7 +120,7 @@ + sort > $testout + + # perhaps $tmp involves some symlinks... +-tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd` ++tmpreal=`cd $tmp; @PWD@ 2>/dev/null || /usr/bin/pwd` + + cat </dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d | + sort > $testout +@@ -160,7 +160,7 @@ + EOF + rm $testout + +-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. | + sort > $testout +@@ -182,7 +182,7 @@ + EOF + rm $testout + +-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 | + sort > $testout +diff -ruN glibc-20050110/scripts/rellns-sh glibc-20050110.patched/scripts/rellns-sh +--- glibc-20050110/scripts/rellns-sh 1999-12-19 00:40:25.000000000 +0100 ++++ glibc-20050110.patched/scripts/rellns-sh 2005-01-18 13:35:53.245937423 +0100 +@@ -22,13 +22,13 @@ + exit 1 + fi + +-if test -x /bin/pwd; then +- pwd=/bin/pwd +-elif test -x /usr/bin/pwd; then +- pwd=/usr/bin/pwd +-else ++#if test -x /bin/pwd; then ++# pwd=/bin/pwd ++#elif test -x /usr/bin/pwd; then ++# pwd=/usr/bin/pwd ++#else + pwd='pwd' +-fi ++#fi + + # Make both paths absolute. + if test -d $1; then diff --git a/pkgs/os-specific/linux/kernel-headers/kernel-headers-2.6.18.1.nix b/pkgs/os-specific/linux/kernel-headers/kernel-headers-2.6.18.1.nix new file mode 100644 index 0000000000000..73311a4092087 --- /dev/null +++ b/pkgs/os-specific/linux/kernel-headers/kernel-headers-2.6.18.1.nix @@ -0,0 +1,12 @@ +{stdenv, fetchurl}: + +assert stdenv.isLinux; + +stdenv.mkDerivation { + name = "linux-headers-2.6.18.1"; + builder = ./builder.sh; + src = fetchurl { + url = ftp://ftp.nl.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.1.tar.bz2; + md5 = "38f00633b02f07819d17bcd87d03eb3a"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap/i686/bash b/pkgs/stdenv/linux/bootstrap/i686/bash new file mode 100755 index 0000000000000..259e3ffe163a5 Binary files /dev/null and b/pkgs/stdenv/linux/bootstrap/i686/bash differ diff --git a/pkgs/stdenv/linux/bootstrap/i686/bunzip2 b/pkgs/stdenv/linux/bootstrap/i686/bunzip2 new file mode 100755 index 0000000000000..3f3f810e77ee2 Binary files /dev/null and b/pkgs/stdenv/linux/bootstrap/i686/bunzip2 differ diff --git a/pkgs/stdenv/linux/bootstrap/i686/cp b/pkgs/stdenv/linux/bootstrap/i686/cp new file mode 100755 index 0000000000000..06de68ad9a857 Binary files /dev/null and b/pkgs/stdenv/linux/bootstrap/i686/cp differ diff --git a/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 b/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 new file mode 100755 index 0000000000000..f1d4e4216932a Binary files /dev/null and b/pkgs/stdenv/linux/bootstrap/i686/curl.bz2 differ diff --git a/pkgs/stdenv/linux/bootstrap/i686/default.nix b/pkgs/stdenv/linux/bootstrap/i686/default.nix new file mode 100644 index 0000000000000..695039692f5e1 --- /dev/null +++ b/pkgs/stdenv/linux/bootstrap/i686/default.nix @@ -0,0 +1,27 @@ +{ + bash = ./bash; + bunzip2 = ./bunzip2; + cp = ./cp; + curl = ./curl.bz2; + tar = ./tar.bz2; + + staticToolsURL = { + url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/i686/r6800/static-tools.tar.bz2; + sha1 = "18c5e93a23a16282a12e9af05f4dc28254dc9013"; + }; + + binutilsURL = { + url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/i686/r6800/binutils.tar.bz2; + sha1 = "4bf2859aa705acdcc08d333200f0e55754fab4a9"; + }; + + gccURL = { + url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/i686/r6800/gcc.tar.bz2; + sha1 = "bd69a67b779014a683fa93706497eef0afede2b2"; + }; + + glibcURL = { + url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/i686/r6800/glibc.tar.bz2; + sha1 = "9f3f3f1248d672d5a845326ed36d8ca470de0094"; + }; +} diff --git a/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 b/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 new file mode 100755 index 0000000000000..26ea95b44404c Binary files /dev/null and b/pkgs/stdenv/linux/bootstrap/i686/tar.bz2 differ diff --git a/pkgs/stdenv/linux/new-scripts/builder-stdenv-initial.sh b/pkgs/stdenv/linux/new-scripts/builder-stdenv-initial.sh new file mode 100644 index 0000000000000..f753667d260ad --- /dev/null +++ b/pkgs/stdenv/linux/new-scripts/builder-stdenv-initial.sh @@ -0,0 +1,10 @@ +set -e + +PATH=$staticTools/bin + +mkdir $out + +cat > $out/setup < "$out" diff --git a/pkgs/stdenv/linux/new-scripts/prehook.sh b/pkgs/stdenv/linux/new-scripts/prehook.sh new file mode 100644 index 0000000000000..4ba81f1eef74c --- /dev/null +++ b/pkgs/stdenv/linux/new-scripts/prehook.sh @@ -0,0 +1,8 @@ +export NIX_ENFORCE_PURITY=1 + +if test "$param1" = "static"; then + export NIX_CFLAGS_LINK="-static" + export NIX_LDFLAGS_BEFORE="-static" +fi + +havePatchELF=1 diff --git a/pkgs/stdenv/linux/new-scripts/unpack-curl.sh b/pkgs/stdenv/linux/new-scripts/unpack-curl.sh new file mode 100644 index 0000000000000..147edcebe04a1 --- /dev/null +++ b/pkgs/stdenv/linux/new-scripts/unpack-curl.sh @@ -0,0 +1,11 @@ +set -x +set -e + +# Tricky: need to make $out/bin without mkdir ;-). So use cp to copy +# the current (empty) directory. +$cp -prvd . $out +$cp -prvd . $out/bin + +$cp $curl curl.bz2 +$bunzip2 -d curl.bz2 +$cp curl $out/bin diff --git a/pkgs/stdenv/linux/new-scripts/unpack.sh b/pkgs/stdenv/linux/new-scripts/unpack.sh new file mode 100644 index 0000000000000..ef3eaf6349c29 --- /dev/null +++ b/pkgs/stdenv/linux/new-scripts/unpack.sh @@ -0,0 +1,8 @@ +set -e + +$cp $tar .tar.bz2 +$bunzip2 .tar.bz2 + +$bunzip2 -d < $tarball | ./.tar xvf - + +$cp -prd * $out diff --git a/pkgs/stdenv/linux/new.nix b/pkgs/stdenv/linux/new.nix new file mode 100644 index 0000000000000..31a78ec20579c --- /dev/null +++ b/pkgs/stdenv/linux/new.nix @@ -0,0 +1,206 @@ +# 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 = import ./bootstrap/i686; + + + # 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, glibc, binutils, shell ? ""}: + (import ../../build-support/gcc-wrapper) { + nativeTools = false; + nativeGlibc = false; + inherit gcc binutils glibc 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 {glibc = 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; glibc = 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; + binutils = stdenvLinuxBoot2Pkgs.binutils217; + glibc = 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; + binutils = stdenvLinuxBoot2Pkgs.binutils217; + glibc = 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; + }; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ee45b6c1fa458..f0c282e3dca3e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1253,6 +1253,11 @@ rec { installLocales = true; }); + glibcNew = import ../development/libraries/glibc-new { + inherit fetchurl stdenv; + kernelHeaders = kernelHeadersNew; + }; + glibmm = import ../development/libraries/gtk-libs-2.6/glibmm { inherit fetchurl stdenv pkgconfig libsigcxx; inherit (gtkLibs26) glib; @@ -2083,6 +2088,10 @@ rec { inherit fetchurl stdenv; }; + kernelHeadersNew = import ../os-specific/linux/kernel-headers/kernel-headers-2.6.18.1.nix { + inherit fetchurl stdenv; + }; + kernelHeadersArm = import ../os-specific/linux/kernel-headers-cross { inherit fetchurl stdenv; cross = "arm-linux"; -- cgit 1.4.1