Skip to content

Commit

Permalink
* gcc-wrapper: put "gcc-wrapper" in the name, e.g. "gcc-wrapper-4.3.3"
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
edolstra committed Mar 25, 2009
1 parent d0555f1 commit d9213df
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
7 changes: 5 additions & 2 deletions pkgs/build-support/gcc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
# 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 ? ""
}:

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;
Expand All @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
25 changes: 14 additions & 11 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -172,7 +179,7 @@ rec {
inherit (stdenvLinuxBoot2Pkgs) binutils;
libc = stdenvLinuxGlibc;
gcc = stdenvLinuxBoot2Pkgs.gcc.gcc;
name = gcc.name;
name = "gcc-wrapper";
};
inherit fetchurl;
};
Expand All @@ -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;})
Expand All @@ -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;

Expand Down
29 changes: 7 additions & 22 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -2042,15 +2027,15 @@ let

octave = import ../development/interpreters/octave {
inherit stdenv fetchurl readline ncurses perl flex;
g77 = g77_42;
g77 = gfortran;
};

# mercurial (hg) bleeding edge version
octaveHG = import ../development/interpreters/octave/hg.nix {
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;
};

Expand Down

0 comments on commit d9213df

Please sign in to comment.