From d9213df2c107753963f99e34a100c8e16ed76d06 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 25 Mar 2009 17:34:38 +0000 Subject: [PATCH] * gcc-wrapper: put "gcc-wrapper" in the name, e.g. "gcc-wrapper-4.3.3" instead of "gcc-4.3.3". This fixed the long-standing annoyance that you can't distinguish the two in (say) nix-store -qR. * On x86_64-linux, put $out/lib64 in the RPATH in addition to $out/lib, because some packages (in particular GCC) put libraries in $out/lib64 and ended up linking against the wrong library. * Strip $out/lib64. * Removed g77_42 because it's exactly the same as gfortran. svn path=/nixpkgs/branches/stdenv-updates/; revision=14708 --- pkgs/build-support/gcc-wrapper/default.nix | 7 ++++-- pkgs/stdenv/generic/setup.sh | 5 +++- pkgs/stdenv/linux/default.nix | 25 +++++++++++-------- pkgs/top-level/all-packages.nix | 29 ++++++---------------- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 8d38db791f29..a87e39b56374 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -5,7 +5,7 @@ # stdenv.mkDerivation provides a wrapper that sets up the right environment # variables so that the compiler and the linker just "work". -{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" +{ name ? "gcc-wrapper", stdenv, nativeTools, nativeLibc, nativePrefix ? "" , gcc ? null, libc ? null, binutils ? null, shell ? "" }: @@ -13,7 +13,11 @@ assert nativeTools -> nativePrefix != ""; assert !nativeTools -> gcc != null && binutils != null; assert !nativeLibc -> libc != null; +let gccVersion = (builtins.parseDrvName gcc.name).version; in + stdenv.mkDerivation { + name = name + (if gcc != null && gccVersion != "" then "-" + gccVersion else ""); + builder = ./builder.sh; setupHook = ./setup-hook.sh; gccWrapper = ./gcc-wrapper.sh; @@ -25,7 +29,6 @@ stdenv.mkDerivation { libc = if nativeLibc then null else libc; binutils = if nativeTools then null else binutils; - name = if name == "" then gcc.name else name; langC = if nativeTools then true else gcc.langC; langCC = if nativeTools then true else gcc.langCC; langFortran = if nativeTools then false else gcc ? langFortran; diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index a96f46cee821..599f15f200ef 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -206,6 +206,9 @@ done # Add the output as an rpath. if test "$NIX_NO_SELF_RPATH" != "1"; then export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS" + if test -n "$NIX_LIB64_IN_SELF_RPATH"; then + export NIX_LDFLAGS="-rpath $out/lib64 $NIX_LDFLAGS" + fi fi @@ -731,7 +734,7 @@ fixupPhase() { # TODO: strip _only_ ELF executables, and return || fail here... if test -z "$dontStrip"; then - stripDebugList=${stripDebugList:-lib libexec bin sbin} + stripDebugList=${stripDebugList:-lib lib64 libexec bin sbin} if test -n "$stripDebugList"; then stripDirs "$stripDebugList" "${stripDebugFlags:--S}" fi diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 8fbaee6a86af..547cd916bf81 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -16,6 +16,14 @@ rec { else abort "unsupported platform for the pure Linux stdenv"; + commonPreHook = + '' + export NIX_ENFORCE_PURITY=1 + havePatchELF=1 + ${if system == "x86_64-linux" then "NIX_LIB64_IN_SELF_RPATH=1" else ""} + ''; + + # The bootstrap process proceeds in several steps. @@ -70,11 +78,10 @@ rec { 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 + ${commonPreHook} ''; shell = "${bootstrapTools}/bin/sh"; initialPath = [bootstrapTools] ++ extraPath; @@ -172,7 +179,7 @@ rec { inherit (stdenvLinuxBoot2Pkgs) binutils; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; - name = gcc.name; + name = "gcc-wrapper"; }; inherit fetchurl; }; @@ -196,11 +203,7 @@ rec { inherit system; - preHook = builtins.toFile "prehook.sh" - '' - export NIX_ENFORCE_PURITY=1 - havePatchELF=1 - ''; + preHook = builtins.toFile "prehook.sh" commonPreHook; initialPath = [ ((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;}) @@ -211,11 +214,11 @@ rec { inherit (stdenvLinuxBoot2Pkgs) binutils; libc = stdenvLinuxGlibc; gcc = stdenvLinuxBoot2Pkgs.gcc.gcc; - shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh"; - name = gcc.name; + shell = stdenvLinuxBoot3Pkgs.bash + "/bin/bash"; + name = "gcc-wrapper"; }; - shell = stdenvLinuxBoot3Pkgs.bash + "/bin/sh"; + shell = stdenvLinuxBoot3Pkgs.bash + "/bin/bash"; fetchurlBoot = fetchurl; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 37cc1fd3c529..e37d354ebe2d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1465,7 +1465,7 @@ let }; g77 = import ../build-support/gcc-wrapper { - name = "g77"; + name = "g77-wrapper"; nativeTools = false; nativeLibc = false; gcc = import ../development/compilers/gcc-3.3 { @@ -1478,7 +1478,7 @@ let }; g77_40 = import ../build-support/gcc-wrapper { - name = "g77-4.0"; + name = "g77-wrapper"; nativeTools = false; nativeLibc = false; gcc = import ../development/compilers/gcc-4.0 { @@ -1492,7 +1492,7 @@ let }; g77_41 = import ../build-support/gcc-wrapper { - name = "g77-4.1"; + name = "g77-wrapper"; nativeTools = false; nativeLibc = false; gcc = import ../development/compilers/gcc-4.1 { @@ -1506,23 +1506,8 @@ let inherit stdenv; }; - g77_42 = import ../build-support/gcc-wrapper { - name = "g77-4.2"; - nativeTools = false; - nativeLibc = false; - gcc = import ../development/compilers/gcc-4.2/fortran.nix { - inherit fetchurl stdenv noSysDirs; - langF77 = true; - langCC = false; - langC = false; - inherit gmp mpfr; - }; - inherit (stdenv.gcc) binutils libc; - inherit stdenv; - }; - gfortran = import ../build-support/gcc-wrapper { - name = "gfortran"; + name = "gfortran-wrapper"; nativeTools = false; nativeLibc = false; gcc = import ../development/compilers/gcc-4.2/fortran.nix { @@ -1899,7 +1884,7 @@ let /* gcj = import ../build-support/gcc-wrapper/default2.nix { - name = "gcj"; + name = "gcj-wrapper"; nativeTools = false; nativeLibc = false; gcc = import ../development/compilers/gcc-4.0 { @@ -2042,7 +2027,7 @@ let octave = import ../development/interpreters/octave { inherit stdenv fetchurl readline ncurses perl flex; - g77 = g77_42; + g77 = gfortran; }; # mercurial (hg) bleeding edge version @@ -2050,7 +2035,7 @@ let inherit fetchurl readline ncurses perl flex atlas getConfig glibc; inherit automake autoconf bison gperf lib python gnuplot texinfo texLive; # for dev Version stdenv = overrideGCC stdenv gcc40; - g77 = g77_42; + g77 = gfortran; inherit (bleedingEdgeRepos) sourceByName; };