diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh index 70e8498da7bb..2e87d82f52cd 100644 --- a/pkgs/build-support/gcc-wrapper/builder.sh +++ b/pkgs/build-support/gcc-wrapper/builder.sh @@ -42,6 +42,9 @@ else gccLDFlags="$gccLDFlags -L$gcc/lib64" fi gccLDFlags="$gccLDFlags -L$gcc/lib" + if [ -n "$langVhdl" ]; then + gccLDFlags="$gccLDFlags -L$zlib/lib" + fi echo "$gccLDFlags" > $out/nix-support/gcc-ldflags # 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 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 # gcc-wrapper is installed in a user environment, as it ensures that # the right assembler is called. diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 700de9d20f49..87b2b097659a 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -6,13 +6,17 @@ # variables so that the compiler and the linker just "work". { 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 -> gcc != null && binutils != null && coreutils != 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 gccVersion = (builtins.parseDrvName gcc.name).version; @@ -44,6 +48,8 @@ stdenv.mkDerivation { langCC = if nativeTools then true else gcc.langCC; langFortran = if nativeTools then false else gcc ? langFortran; 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; meta = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 65350e041dd2..a2fef41f26cf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1999,7 +1999,7 @@ let 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; name = "ghdl"; langVhdl = true; @@ -2010,7 +2010,7 @@ let }); # 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 ppl cloogppl; name = "ghdl"; @@ -2351,20 +2351,7 @@ let inherit fetchurl stdenv visualcpp windowssdk; }; - # All these wrappers: GCC, GHDL, should be once merged into - # only one. 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; nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc; nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else ""; @@ -2373,7 +2360,7 @@ let inherit stdenv binutils coreutils zlib; }; - wrapGHDL = wrapGHDLWith (import ../build-support/ghdl-wrapper) glibc; + wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc; wrapGCCCross = {gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}: