diff --git a/pkgs/development/compilers/gcc-4.4/builder.sh b/pkgs/development/compilers/gcc-4.4/builder.sh index 5f14ae92d1cb..c3ec4cec3155 100644 --- a/pkgs/development/compilers/gcc-4.4/builder.sh +++ b/pkgs/development/compilers/gcc-4.4/builder.sh @@ -42,22 +42,10 @@ if test "$noSysDirs" = "1"; then # Setting $CPATH makes sure both `gcc' and `xgcc' find the C # library headers, regarless of the language being compiled. - export CPATH="$NIX_FIXINC_DUMMY:$gmp/include:$mpfr/include" + export CPATH="$NIX_FIXINC_DUMMY:$CPATH" # Likewise, to help it find `crti.o' and similar files. - export LIBRARY_PATH="$glibc_libdir" - - if test "$langJava" = "1"; then - for lib in "$zlib" "$boehmgc" "$libX11" "$libXt" "$libSM" \ - "$libICE" "$libXtst" - do - if test -n "$lib" - then - export CPATH="$CPATH:$lib/include" - export LIBRARY_PATH="$LIBRARY_PATH:$lib/lib" - fi - done - fi + export LIBRARY_PATH="$glibc_libdir:$LIBRARY_PATH" echo "setting \$CPATH to \`$CPATH'" echo "setting \$LIBRARY_PATH to \`$LIBRARY_PATH'" diff --git a/pkgs/development/compilers/gcc-4.4/default.nix b/pkgs/development/compilers/gcc-4.4/default.nix index fdb26d713291..fc6592fbe7b2 100644 --- a/pkgs/development/compilers/gcc-4.4/default.nix +++ b/pkgs/development/compilers/gcc-4.4/default.nix @@ -10,15 +10,14 @@ , zlib ? null, boehmgc ? null , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null +, xproto ? null , enableMultilib ? false , name ? "gcc" }: assert langTreelang -> bison != null && flex != null; -assert langJava -> zip != null && unzip != null; -assert gtk != null -> pkgconfig != null && libart_lgpl != null - && libX11 != null && libXt != null && libSM != null - && libICE != null && libXtst != null; +assert langJava -> zip != null && unzip != null + && zlib != null && boehmgc != null; with stdenv.lib; @@ -31,9 +30,13 @@ let version = "4.4.1"; url = "ftp://sourceware.org/pub/java/ecj-4.3.jar"; sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx"; }; + xlibs = [ libX11 libXt libSM libICE libXtst xproto ]; in +# We need all these X libraries when building AWT with GTK+. +assert gtk != null -> (filter (x: x == null) xlibs) == []; + stdenv.mkDerivation ({ name = "${name}-${version}"; @@ -74,8 +77,7 @@ stdenv.mkDerivation ({ ++ (optional (zlib != null) zlib) ++ (optional (boehmgc != null) boehmgc) ++ (optionals langJava [zip unzip]) - ++ (optionals (gtk != null) - [gtk pkgconfig libart_lgpl libX11 libXt libSM libICE libXtst]) + ++ (optionals (gtk != null) [gtk pkgconfig libart_lgpl] ++ xlibs) ; configureFlags = " @@ -84,6 +86,8 @@ stdenv.mkDerivation ({ ${if cloogppl != null then "--with-cloog=${cloogppl}" else ""} ${if langJava then "--with-ecj-jar=${javaEcj}" else ""} ${if (langJava && gtk != null) then "--enable-java-awt=gtk" else ""} + --with-gmp=${gmp} + --with-mpfr=${mpfr} --disable-libstdcxx-pch --without-included-gettext --with-system-zlib @@ -100,8 +104,22 @@ stdenv.mkDerivation ({ ${if stdenv.isi686 then "--with-arch=i686" else ""} "; - inherit gmp mpfr zlib boehmgc; - inherit libX11 libXt libSM libICE libXtst; + # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find + # the library headers and binaries, regarless of the language being + # compiled. + + CPATH = concatStrings + (intersperse ":" (map (x: x + "/include") + ([ zlib ] + ++ optional langJava boehmgc + ++ optionals (gtk != null) xlibs))); + + LIBRARY_PATH = concatStrings + (intersperse ":" (map (x: x + "/lib") + ([ zlib ] + ++ optional langJava boehmgc + ++ optionals (gtk != null) xlibs))); + passthru = { inherit langC langCC langFortran langTreelang enableMultilib; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 30b37d5a06a4..f53e9e37847d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1736,7 +1736,7 @@ let inherit zip unzip zlib boehmgc gettext pkgconfig; inherit (gtkLibs) gtk; inherit (gnome) libart_lgpl; - inherit (xlibs) libX11 libXt libSM libICE libXtst; + inherit (xlibs) libX11 libXt libSM libICE libXtst xproto; }); #ghc = haskellPackages.ghc;