From 02e13f0eb4ef057f27e8828f673a4162fa743752 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 10 Jul 2006 15:42:19 +0000 Subject: [PATCH] * Regularize the treatment of the "gcc" attributes in all-packages.nix. All "gcc*" attributes are wrapped GCC instances now. svn path=/nixpkgs/trunk/; revision=5671 --- pkgs/stdenv/linux/default.nix | 51 ++++++++-------- pkgs/top-level/all-packages.nix | 88 ++++++++++------------------ pkgs/top-level/build-for-release.nix | 3 +- 3 files changed, 60 insertions(+), 82 deletions(-) diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 25c72be5cb7d..faa39a9802f0 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -73,7 +73,7 @@ rec { md5 = "9c134038b7f1894a4b307d600207047c"; }; - gcc = (downloadAndUnpack { + staticGCC = (downloadAndUnpack { url = http://nix.cs.uu.nl/dist/tarballs/stdenv-linux/gcc-3.4.2-static.tar.bz2; pkgname = "gcc"; md5 = "600452fac470a49a41ea81d39c209f35"; @@ -90,6 +90,17 @@ rec { }; + # 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. @@ -115,7 +126,7 @@ rec { # This function builds the various standard environments used during # the bootstrap. stdenvBootFun = - {glibc, gcc, binutils, staticGlibc, extraAttrs ? {}}: + {gcc, staticGlibc, extraAttrs ? {}}: import ../generic { name = "stdenv-linux-boot"; @@ -123,16 +134,10 @@ rec { preHook = ./prehook.sh; stdenv = stdenvInitial; shell = ./tools/bash; - gcc = (import ../../build-support/gcc-wrapper) { - stdenv = stdenvInitial; - nativeTools = false; - nativeGlibc = false; - inherit gcc glibc binutils; - }; initialPath = [ staticTools ]; - inherit extraAttrs; + inherit gcc extraAttrs; }; @@ -141,7 +146,7 @@ rec { # the gcc configure script happy. stdenvLinuxBoot1 = stdenvBootFun { # Use the statically linked, downloaded glibc/gcc/binutils. - inherit glibc gcc binutils; + gcc = wrapGCC {inherit glibc binutils;}; staticGlibc = true; extraAttrs = {inherit curl;}; }; @@ -159,12 +164,11 @@ rec { # 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 = stdenvBootFun { - glibc = stdenvLinuxGlibc; + stdenvLinuxBoot2 = removeAttrs (stdenvBootFun { staticGlibc = false; - inherit gcc binutils; - extraAttrs = {inherit curl;}; - }; + gcc = wrapGCC {inherit binutils; glibc = stdenvLinuxGlibc;}; + extraAttrs = {inherit curl; glibc = stdenvLinuxGlibc;}; + }) ["gcc" "binutils"]; # 5) The packages that can be built using the second stdenv. stdenvLinuxBoot2Pkgs = allPackages { @@ -175,9 +179,12 @@ rec { # this one uses the dynamically linked GCC and Binutils from step # 5. The other tools (e.g. coreutils) are still static. stdenvLinuxBoot3 = stdenvBootFun { - glibc = stdenvLinuxGlibc; staticGlibc = false; - inherit (stdenvLinuxBoot2Pkgs) gcc binutils; + gcc = wrapGCC { + inherit (stdenvLinuxBoot2Pkgs) binutils; + glibc = stdenvLinuxGlibc; + gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; + }; extraAttrs = {inherit curl;}; }; @@ -199,12 +206,10 @@ rec { stdenv = stdenvInitial; - gcc = (import ../../build-support/gcc-wrapper) { - stdenv = stdenvInitial; - nativeTools = false; - nativeGlibc = false; - inherit (stdenvLinuxBoot2Pkgs) gcc binutils; + gcc = wrapGCC { + inherit (stdenvLinuxBoot2Pkgs) binutils; glibc = stdenvLinuxGlibc; + gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; shell = stdenvLinuxBoot3Pkgs.bash ~ /bin/sh; }; @@ -212,7 +217,7 @@ rec { extraAttrs = { curl = stdenvLinuxBoot3Pkgs.realCurl; - inherit (stdenvLinuxBoot2Pkgs) binutils /* gcc */; + 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 4cec3748e371..c91184d0fdbd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -577,13 +577,7 @@ rec { m4 = gnum4; }; - gcc = (import ../development/compilers/gcc-4.1) { - inherit fetchurl stdenv noSysDirs; - langCC = gccWithCC; - profiledCompiler = gccWithProfiling; - }; - - gccWrapped = stdenv.gcc; + gcc = useFromStdenv (stdenv ? gcc) stdenv.gcc gcc41; gcc_static = (import ../development/compilers/gcc-static-3.4) { inherit fetchurl stdenv; @@ -603,25 +597,34 @@ rec { inherit stdenv; }; - gcc33 = (import ../build-support/gcc-wrapper) { + wrapGCC = baseGCC: (import ../build-support/gcc-wrapper) { nativeTools = false; nativeGlibc = false; - gcc = (import ../development/compilers/gcc-3.3) { - inherit fetchurl stdenv noSysDirs; - }; - inherit (stdenv.gcc) binutils glibc; - inherit stdenv; + gcc = baseGCC; + inherit stdenv binutils glibc; }; - gcc34 = (import ../build-support/gcc-wrapper) { - nativeTools = false; - nativeGlibc = false; - gcc = (import ../development/compilers/gcc-3.4) { - inherit fetchurl stdenv noSysDirs; - }; - inherit (stdenv.gcc) binutils glibc; - inherit stdenv; - }; + gcc295 = wrapGCC (import ../development/compilers/gcc-2.95 { + inherit fetchurl stdenv noSysDirs; + }); + + gcc33 = wrapGCC (import ../development/compilers/gcc-3.3 { + inherit fetchurl stdenv noSysDirs; + }); + + gcc34 = wrapGCC (import ../development/compilers/gcc-3.4 { + inherit fetchurl stdenv noSysDirs; + }); + + gcc40 = wrapGCC (import ../development/compilers/gcc-4.0 { + inherit fetchurl stdenv noSysDirs; + profiledCompiler = true; + }); + + gcc41 = wrapGCC (import ../development/compilers/gcc-4.1 { + inherit fetchurl stdenv noSysDirs; + profiledCompiler = true; + }); gcc40sparc = (import ../build-support/gcc-cross-wrapper) { nativeTools = false; @@ -677,38 +680,6 @@ rec { inherit stdenv; }; - gcc40 = (import ../build-support/gcc-wrapper) { - nativeTools = false; - nativeGlibc = false; - gcc = (import ../development/compilers/gcc-4.0) { - inherit fetchurl stdenv noSysDirs; - profiledCompiler = true; - }; - inherit (stdenv.gcc) binutils glibc; - inherit stdenv; - }; - - gcc41 = (import ../build-support/gcc-wrapper) { - nativeTools = false; - nativeGlibc = false; - gcc = (import ../development/compilers/gcc-4.1) { - inherit fetchurl stdenv noSysDirs; - profiledCompiler = true; - }; - inherit (stdenv.gcc) binutils glibc; - inherit stdenv; - }; - - gcc295 = (import ../build-support/gcc-wrapper) { - nativeTools = false; - nativeGlibc = false; - gcc = (import ../development/compilers/gcc-2.95) { - inherit fetchurl stdenv noSysDirs; - }; - inherit (stdenv.gcc) binutils glibc; - inherit stdenv; - }; - g77 = (import ../build-support/gcc-wrapper) { name = "g77"; nativeTools = false; @@ -1028,10 +999,11 @@ rec { inherit fetchurl stdenv; }; - glibc = (import ../development/libraries/glibc) { - inherit fetchurl stdenv kernelHeaders; - installLocales = true; - }; + glibc = useFromStdenv (stdenv ? glibc) stdenv.glibc + (import ../development/libraries/glibc { + inherit fetchurl stdenv kernelHeaders; + installLocales = true; + }); aterm = (import ../development/libraries/aterm) { inherit fetchurl stdenv; diff --git a/pkgs/top-level/build-for-release.nix b/pkgs/top-level/build-for-release.nix index 76c354c668a5..ccbccbf56ac4 100644 --- a/pkgs/top-level/build-for-release.nix +++ b/pkgs/top-level/build-for-release.nix @@ -40,8 +40,9 @@ let { flexnew gaim gawk + gcc + gcc34 gcc40 - gccWrapped ghcWrapper ghostscript gnugrep