From 1ab4a9324cf8d7a49027eedbc176926f7325cf7a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 18 Sep 2004 17:23:18 +0000 Subject: [PATCH] * The `patch' command is now part of stdenv, so it no longer needs to be passed to derivations that need to apply patches. * GCC 3.4 is now the default compiler (old GCC renamed to `gcc-3.3'). * The temporary GCCs built during the stdenvLinux bootstrap are now built without C++ support and without profiling. * Remove fixincl in GCC 3.4 to prevent a retained dependency on the previous GCC. * Always set $prefix in setup.sh, even when there is no configure script. svn path=/nixpkgs/trunk/; revision=1444 --- pkgs/BUGS | 23 +++----- pkgs/TODO | 4 -- .../compilers/gcc-2.95/default.nix | 3 +- .../compilers/{gcc => gcc-3.3}/builder.sh | 0 .../compilers/{gcc => gcc-3.3}/default.nix | 0 pkgs/development/compilers/gcc-3.4/builder.sh | 4 ++ .../development/compilers/gcc-3.4/default.nix | 3 +- .../tools/build-managers/gnumake/default.nix | 3 +- .../{generic-branch => generic}/builder.sh | 0 .../default-builder.sh | 0 .../{generic-branch => generic}/default.nix | 0 .../{generic-branch => generic}/docs.txt | 0 .../{generic-branch => generic}/setup.sh | 16 +++--- pkgs/system/all-packages-generic.nix | 36 +++++++------ pkgs/system/stdenvs.nix | 52 ++++++++----------- 15 files changed, 65 insertions(+), 79 deletions(-) rename pkgs/development/compilers/{gcc => gcc-3.3}/builder.sh (100%) rename pkgs/development/compilers/{gcc => gcc-3.3}/default.nix (100%) rename pkgs/stdenv/{generic-branch => generic}/builder.sh (100%) rename pkgs/stdenv/{generic-branch => generic}/default-builder.sh (100%) rename pkgs/stdenv/{generic-branch => generic}/default.nix (100%) rename pkgs/stdenv/{generic-branch => generic}/docs.txt (100%) rename pkgs/stdenv/{generic-branch => generic}/setup.sh (100%) diff --git a/pkgs/BUGS b/pkgs/BUGS index a071583b2526..f6d40bc6947a 100644 --- a/pkgs/BUGS +++ b/pkgs/BUGS @@ -14,22 +14,6 @@ ... -* Subtle problems can occur if the Nix store directory or one of its - parents is a symlink. E.g., purity checks can barf: - - impure path `/data/nix/store/099cd9aee7d056a9922fd6dd116a3f5c-gcc-3.3.3/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.3/crtbegin.o' used in link - - (This happened because /nix was a symlink to /data/nix.) Maybe we - should disallow this entirely, since, exactly because it is - perfectly legal for a builder to expand a symlink, we can end up - with derivates referring to paths that existed in the build - environment but not in the target environment. - - Disallowing this can be highly inconvenient, since it makes it - harder to move the Nix store to a different file system. (On Linux, - `bind' mounts can help here.) - - * In libXt: /bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -DXTHREADS -DXUSE_MTSAFE_API -I/nix/store/aadf0bd4a908da11d14f6538503b8408-libX11-6.2.1/include -I/nix/store/ba366e3b944ead64ec9b0490bb615874-xproto-6.6.1/include -I./include/X11 -g -O2 -c -o ActionHook.lo `test -f 'ActionHook.c' || echo './'`ActionHook.c @@ -69,4 +53,9 @@ stdenv.mkDerivation { * Add "exit 0" at the end of configure of rte package. -* In stdenv/nix/path.nix: remove gcc. +* Starting at gcc 3.4, all C programs incur a retained dependency on + gcc through the rpath stored in the executable, even though the + executable doesn't use against any library in gcc. The reason is + that the gcc passes a `-lgcc_s' switch to the linker. Solution: + patch the linker so that rpaths are only added for libraries that we + actually use. \ No newline at end of file diff --git a/pkgs/TODO b/pkgs/TODO index 1891fe9e2b07..73c442d78885 100644 --- a/pkgs/TODO +++ b/pkgs/TODO @@ -11,10 +11,6 @@ * After building gcc, filter out references to /tmp/nix... in .../lib/libsupc++.la and .../lib/libstdc++.la -* diffutils retains a dependency on coreutils/bin/pr; causes stdenv to - depend on 2 copies of coreutils (the first one impure in - stdenv-nix-linux!) - * change dontMake & dontMakeInstall into dontBuild and dontInstall in diff --git a/pkgs/development/compilers/gcc-2.95/default.nix b/pkgs/development/compilers/gcc-2.95/default.nix index 698bea7950f6..c95a90277585 100644 --- a/pkgs/development/compilers/gcc-2.95/default.nix +++ b/pkgs/development/compilers/gcc-2.95/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, patch, noSysDirs +{ stdenv, fetchurl, noSysDirs , langC ? true, langCC ? true, langF77 ? false }: @@ -13,6 +13,5 @@ stdenv.mkDerivation { }; # !!! apply only if noSysDirs is set patches = [./no-sys-dirs.patch]; - buildInputs = [patch]; inherit noSysDirs langC langCC langF77; } diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc-3.3/builder.sh similarity index 100% rename from pkgs/development/compilers/gcc/builder.sh rename to pkgs/development/compilers/gcc-3.3/builder.sh diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc-3.3/default.nix similarity index 100% rename from pkgs/development/compilers/gcc/default.nix rename to pkgs/development/compilers/gcc-3.3/default.nix diff --git a/pkgs/development/compilers/gcc-3.4/builder.sh b/pkgs/development/compilers/gcc-3.4/builder.sh index 2d425eabc73a..60af74ed7654 100644 --- a/pkgs/development/compilers/gcc-3.4/builder.sh +++ b/pkgs/development/compilers/gcc-3.4/builder.sh @@ -71,6 +71,10 @@ postInstall() { # Remove precompiled headers for now. They are very big and # probably not very useful yet. find $out/include -name "*.gch" -exec rm -rf {} \; -prune + + # Remove `fixincl' to prevent a retained dependency on the + # previous gcc. + rm -rf $out/libexec/gcc/*/*/install-tools } diff --git a/pkgs/development/compilers/gcc-3.4/default.nix b/pkgs/development/compilers/gcc-3.4/default.nix index c29a9502854a..b766c972344e 100644 --- a/pkgs/development/compilers/gcc-3.4/default.nix +++ b/pkgs/development/compilers/gcc-3.4/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, patch, noSysDirs +{ stdenv, fetchurl, noSysDirs , langC ? true, langCC ? true, langF77 ? false , profiledCompiler ? false }: @@ -14,6 +14,5 @@ stdenv.mkDerivation { }; # !!! apply only if noSysDirs is set patches = [./no-sys-dirs.patch]; - buildInputs = [patch]; inherit noSysDirs langC langCC langF77 profiledCompiler; } diff --git a/pkgs/development/tools/build-managers/gnumake/default.nix b/pkgs/development/tools/build-managers/gnumake/default.nix index 0b7a044f258e..16347e39fd16 100644 --- a/pkgs/development/tools/build-managers/gnumake/default.nix +++ b/pkgs/development/tools/build-managers/gnumake/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, patch}: +{stdenv, fetchurl}: stdenv.mkDerivation { name = "gnumake-3.80"; @@ -7,5 +7,4 @@ stdenv.mkDerivation { md5 = "0bbd1df101bc0294d440471e50feca71"; }; patches = [./log.diff]; - buildInputs = [patch]; } diff --git a/pkgs/stdenv/generic-branch/builder.sh b/pkgs/stdenv/generic/builder.sh similarity index 100% rename from pkgs/stdenv/generic-branch/builder.sh rename to pkgs/stdenv/generic/builder.sh diff --git a/pkgs/stdenv/generic-branch/default-builder.sh b/pkgs/stdenv/generic/default-builder.sh similarity index 100% rename from pkgs/stdenv/generic-branch/default-builder.sh rename to pkgs/stdenv/generic/default-builder.sh diff --git a/pkgs/stdenv/generic-branch/default.nix b/pkgs/stdenv/generic/default.nix similarity index 100% rename from pkgs/stdenv/generic-branch/default.nix rename to pkgs/stdenv/generic/default.nix diff --git a/pkgs/stdenv/generic-branch/docs.txt b/pkgs/stdenv/generic/docs.txt similarity index 100% rename from pkgs/stdenv/generic-branch/docs.txt rename to pkgs/stdenv/generic/docs.txt diff --git a/pkgs/stdenv/generic-branch/setup.sh b/pkgs/stdenv/generic/setup.sh similarity index 100% rename from pkgs/stdenv/generic-branch/setup.sh rename to pkgs/stdenv/generic/setup.sh index 0fcbb5ee1eae..0e2dac944e3c 100644 --- a/pkgs/stdenv/generic-branch/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -424,6 +424,14 @@ configureW() { $preConfigure fi + if test -z "$prefix"; then + prefix="$out"; + fi + + if test "$useTempPrefix" = "1"; then + prefix="$NIX_BUILD_TOP/tmp_prefix"; + fi + if test -z "$configureScript"; then configureScript=./configure if ! test -x $configureScript; then @@ -439,14 +447,6 @@ configureW() { done fi - if test -z "$prefix"; then - prefix="$out"; - fi - - if test "$useTempPrefix" = "1"; then - prefix="$NIX_BUILD_TOP/tmp_prefix"; - fi - if test -z "$dontAddPrefix"; then configureFlags="--prefix=$prefix $configureFlags" fi diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix index 23417fc818b6..ff8a0b0909bf 100644 --- a/pkgs/system/all-packages-generic.nix +++ b/pkgs/system/all-packages-generic.nix @@ -2,7 +2,10 @@ # identifier and a standard build environment, returns the set of all # packages provided by the Nix Package Collection. -{stdenv, bootCurl, noSysDirs ? true}: +{ stdenv, bootCurl, noSysDirs ? true +, gccWithCC ? true +, gccWithProfiling ? true +}: rec { @@ -41,7 +44,7 @@ rec { }; diffutils = (import ../tools/text/diffutils) { - inherit fetchurl stdenv; + inherit fetchurl stdenv coreutils; }; gnupatch = (import ../tools/text/gnupatch) { @@ -218,7 +221,7 @@ rec { }; gnumake = (import ../development/tools/build-managers/gnumake) { - inherit fetchurl stdenv patch; + inherit fetchurl stdenv; }; bison = (import ../development/tools/parsing/bison) { @@ -242,8 +245,10 @@ rec { m4 = gnum4; }; - gcc = (import ../development/compilers/gcc) { + gcc = (import ../development/compilers/gcc-3.4) { inherit fetchurl stdenv noSysDirs; + langCC = gccWithCC; + profiledCompiler = gccWithProfiling; }; gcc_static = (import ../stdenv/nix-linux/gcc-static) { @@ -254,7 +259,7 @@ rec { nativeTools = false; nativeGlibc = false; gcc = (import ../development/compilers/gcc-3.4) { - inherit fetchurl stdenv patch noSysDirs; + inherit fetchurl stdenv noSysDirs; profiledCompiler = true; }; binutils = stdenv.gcc.binutils; @@ -266,7 +271,7 @@ rec { nativeTools = false; nativeGlibc = false; gcc = (import ../development/compilers/gcc-2.95) { - inherit fetchurl stdenv patch noSysDirs; + inherit fetchurl stdenv noSysDirs; }; binutils = stdenv.gcc.binutils; glibc = stdenv.gcc.glibc; @@ -277,7 +282,7 @@ rec { name = "g77"; nativeTools = false; nativeGlibc = false; - gcc = (import ../development/compilers/gcc) { + gcc = (import ../development/compilers/gcc-3.3) { inherit fetchurl stdenv noSysDirs; langF77 = true; langCC = false; @@ -399,7 +404,7 @@ rec { }; realPerl = (import ../development/interpreters/perl) { - inherit fetchurl stdenv patch; + inherit fetchurl stdenv; }; sysPerl = (import ../development/interpreters/sys-perl) { @@ -451,7 +456,8 @@ rec { }; glibc = (import ../development/libraries/glibc) { - inherit fetchurl stdenv kernelHeaders patch; + inherit fetchurl stdenv kernelHeaders; + installLocales = false; }; aterm = (import ../development/libraries/aterm) { @@ -504,7 +510,7 @@ rec { zlib = if stdenv.system == "powerpc-darwin" then (import ../development/libraries/zlib-mac-fix) { - inherit fetchurl stdenv patch; + inherit fetchurl stdenv; } else (import ../development/libraries/zlib) { @@ -609,7 +615,7 @@ rec { }; xlibs = (import ../development/libraries/xlibs) { - inherit fetchurl stdenv pkgconfig freetype expat patch; + inherit fetchurl stdenv pkgconfig freetype expat; }; mesa = (import ../development/libraries/mesa) { @@ -672,11 +678,11 @@ rec { }; utillinux = (import ../os-specific/linux/util-linux) { - inherit fetchurl stdenv patch; + inherit fetchurl stdenv; }; sysvinit = (import ../os-specific/linux/sysvinit) { - inherit fetchurl stdenv patch; + inherit fetchurl stdenv; }; e2fsprogs = (import ../os-specific/linux/e2fsprogs) { @@ -726,7 +732,7 @@ rec { }; subversionWithJava = (import ../applications/version-management/subversion-1.1rc) { - inherit fetchurl stdenv openssl db4 expat patch; + inherit fetchurl stdenv openssl db4 expat; swig = swigWithJava; localServer = true; httpServer = false; @@ -841,7 +847,7 @@ rec { ### MISC uml = (import ../misc/uml) { - inherit fetchurl stdenv perl patch; + inherit fetchurl stdenv perl; m4 = gnum4; }; diff --git a/pkgs/system/stdenvs.nix b/pkgs/system/stdenvs.nix index 3f1f3cbae938..7399767f7070 100644 --- a/pkgs/system/stdenvs.nix +++ b/pkgs/system/stdenvs.nix @@ -28,33 +28,41 @@ inherit genericStdenv gccWrapper; }; - stdenvNativePkgs = allPackages { + stdenvNativePkgsFun = bootstrap: allPackages { stdenv = stdenvNative; bootCurl = null; noSysDirs = false; + gccWithCC = !bootstrap; + gccWithProfiling = !bootstrap; }; + stdenvNativePkgs = stdenvNativePkgsFun false; + # The Nix build environment. - stdenvNix = (import ../stdenv/nix) { + stdenvNixFun = bootstrap: (import ../stdenv/nix) { stdenv = stdenvNative; - pkgs = stdenvNativePkgs; + pkgs = stdenvNativePkgsFun bootstrap; inherit genericStdenv gccWrapper; }; - stdenvNixPkgs = allPackages { - stdenv = stdenvNix; - bootCurl = stdenvNativePkgs.curl; + stdenvNix = stdenvNixFun false; + + stdenvNixPkgsFun = bootstrap: allPackages { + stdenv = stdenvNixFun bootstrap; + bootCurl = (stdenvNativePkgsFun bootstrap).curl; noSysDirs = false; }; + stdenvNixPkgs = stdenvNixPkgs false; + # The Linux build environment is a fully bootstrapped Nix # environment, that is, it should contain no external references. # 1) Build glibc in the Nix build environment. The result is # pure. - stdenvLinuxGlibc = stdenvNixPkgs.glibc; + stdenvLinuxGlibc = (stdenvNixPkgsFun true).glibc; # 2) Construct a stdenv consisting of the Nix build environment, but # with a gcc-wrapper that causes linking against the glibc from @@ -64,7 +72,7 @@ # `-lncurses'). stdenvLinuxBoot1 = (import ../stdenv/nix-linux) { stdenv = stdenvNative; - pkgs = stdenvNativePkgs; + pkgs = stdenvNativePkgsFun true; glibc = stdenvLinuxGlibc; inherit genericStdenv gccWrapper; }; @@ -76,8 +84,10 @@ # *doesn't* search in `/lib' etc. So these programs won't work. stdenvLinuxBoot1Pkgs = allPackages { stdenv = stdenvLinuxBoot1; - bootCurl = stdenvNativePkgs.curl; + bootCurl = (stdenvNativePkgsFun true).curl; noSysDirs = true; + gccWithCC = false; + gccWithProfiling = false; }; # 4) Therefore we build a new standard environment which is the same @@ -86,7 +96,7 @@ # system directories), things built by this stdenv should be pure. stdenvLinuxBoot2 = (import ../stdenv/nix-linux) { stdenv = stdenvLinuxBoot1; - pkgs = stdenvNativePkgs // { + pkgs = (stdenvNativePkgsFun true) // { inherit (stdenvLinuxBoot1Pkgs) gcc binutils; }; glibc = stdenvLinuxGlibc; @@ -96,7 +106,7 @@ # 5) So these packages should be pure. stdenvLinuxBoot2Pkgs = allPackages { stdenv = stdenvLinuxBoot2; - bootCurl = stdenvNativePkgs.curl; + bootCurl = (stdenvNativePkgsFun true).curl; }; # 6) Finally we can construct the Nix build environment from the @@ -138,7 +148,7 @@ # (essentially it's just the native environment). stdenvDarwin = (import ../stdenv/darwin) { stdenv = stdenvInitial; - genericStdenv = import ../stdenv/generic-branch; + genericStdenv = import ../stdenv/generic; inherit gccWrapper; }; @@ -147,21 +157,5 @@ bootCurl = null; noSysDirs = false; }; - - - # Testing the new stdenv-linux (TODO: remove this eventually). - stdenvLinuxTest = (import ../stdenv/nix-linux) { - stdenv = stdenvLinuxBoot2; - pkgs = stdenvLinuxBoot2Pkgs; - glibc = stdenvLinuxGlibc; - genericStdenv = import ../stdenv/generic-branch; - inherit gccWrapper; - }; - - stdenvDarwinTest = (import ../stdenv/darwin) { - stdenv = stdenvInitial; - genericStdenv = import ../stdenv/generic-branch; - inherit gccWrapper; - }; - + }