Merging the ghdl-wrapper and gcc-wrapper into one.

I will remove the ghdl-wrapper files later, if all this works.


svn path=/nixpkgs/branches/stdenv-updates/; revision=19493
This commit is contained in:
Lluís Batlle i Rossell 2010-01-16 21:41:27 +00:00
parent e72908036f
commit 08eb3243c9
3 changed files with 18 additions and 17 deletions

View File

@ -42,6 +42,9 @@ else
gccLDFlags="$gccLDFlags -L$gcc/lib64" gccLDFlags="$gccLDFlags -L$gcc/lib64"
fi fi
gccLDFlags="$gccLDFlags -L$gcc/lib" gccLDFlags="$gccLDFlags -L$gcc/lib"
if [ -n "$langVhdl" ]; then
gccLDFlags="$gccLDFlags -L$zlib/lib"
fi
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not # GCC shows $gcc/lib in `gcc -print-search-dirs', but not
@ -154,6 +157,11 @@ mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
if [ -f $gccPath/ghdl ]; then
ln -sf $gccPath/ghdl $out/bin/ghdl
fi
# Create a symlink to as (the assembler). This is useful when a # Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that # gcc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called. # the right assembler is called.

View File

@ -6,13 +6,17 @@
# variables so that the compiler and the linker just "work". # variables so that the compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "",
zlib ? null
}: }:
assert nativeTools -> nativePrefix != ""; assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null && coreutils != null; assert !nativeTools -> gcc != null && binutils != null && coreutils != null;
assert !nativeLibc -> libc != null; assert !nativeLibc -> libc != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper
assert (gcc != null && gcc ? langVhdl) -> zlib != null;
let let
gccVersion = (builtins.parseDrvName gcc.name).version; gccVersion = (builtins.parseDrvName gcc.name).version;
@ -44,6 +48,8 @@ stdenv.mkDerivation {
langCC = if nativeTools then true else gcc.langCC; langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran; langFortran = if nativeTools then false else gcc ? langFortran;
langAda = if nativeTools then false else gcc ? langAda; langAda = if nativeTools then false else gcc ? langAda;
langVhdl = if nativeTools then false else gcc ? langVhdl;
zlib = if (gcc != null && gcc ? langVhdl) then zlib else null;
shell = if shell == "" then stdenv.shell else shell; shell = if shell == "" then stdenv.shell else shell;
meta = meta =

View File

@ -1999,7 +1999,7 @@ let
inherit fetchurl stdenv; inherit fetchurl stdenv;
}); });
ghdl = wrapGHDL (import ../development/compilers/gcc-4.3 { ghdl = wrapGCC (import ../development/compilers/gcc-4.3 {
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs gnat; inherit stdenv fetchurl texinfo gmp mpfr noSysDirs gnat;
name = "ghdl"; name = "ghdl";
langVhdl = true; langVhdl = true;
@ -2010,7 +2010,7 @@ let
}); });
# Not officially supported version for ghdl # Not officially supported version for ghdl
ghdl_gcc44 = lowPrio (wrapGHDL (import ../development/compilers/gcc-4.4 { ghdl_gcc44 = lowPrio (wrapGCC (import ../development/compilers/gcc-4.4 {
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs gnat gettext which inherit stdenv fetchurl texinfo gmp mpfr noSysDirs gnat gettext which
ppl cloogppl; ppl cloogppl;
name = "ghdl"; name = "ghdl";
@ -2351,20 +2351,7 @@ let
inherit fetchurl stdenv visualcpp windowssdk; inherit fetchurl stdenv visualcpp windowssdk;
}; };
# All these wrappers: GCC, GHDL, should be once merged into
# only one.
wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper { wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc;
nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else "";
gcc = baseGCC;
libc = glibc;
inherit stdenv binutils coreutils;
};
wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
wrapGHDLWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools; nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc; nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc;
nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else ""; nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else "";
@ -2373,7 +2360,7 @@ let
inherit stdenv binutils coreutils zlib; inherit stdenv binutils coreutils zlib;
}; };
wrapGHDL = wrapGHDLWith (import ../build-support/ghdl-wrapper) glibc; wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
wrapGCCCross = wrapGCCCross =
{gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}: {gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}: