2009-07-03 18:54:28 +00:00
|
|
|
{ stdenv, fetchurl, noSysDirs
|
|
|
|
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
|
|
|
|
, langJava ? false
|
|
|
|
, profiledCompiler ? false
|
|
|
|
, staticCompiler ? false
|
|
|
|
, texinfo ? null
|
2009-07-27 15:40:01 +00:00
|
|
|
, gmp, mpfr, gettext, which
|
2009-07-18 21:37:23 +00:00
|
|
|
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework
|
2009-07-03 18:54:28 +00:00
|
|
|
, bison ? null, flex ? null
|
2009-07-27 23:09:04 +00:00
|
|
|
, zlib ? null, boehmgc ? null
|
2009-07-28 09:23:40 +00:00
|
|
|
, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null
|
2009-07-28 17:49:47 +00:00
|
|
|
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
2009-07-29 15:13:01 +00:00
|
|
|
, libXrender ? null, xproto ? null
|
2009-07-03 18:54:28 +00:00
|
|
|
, enableMultilib ? false
|
|
|
|
, name ? "gcc"
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert langTreelang -> bison != null && flex != null;
|
2009-07-29 13:57:11 +00:00
|
|
|
assert langJava -> zip != null && unzip != null
|
|
|
|
&& zlib != null && boehmgc != null;
|
2009-07-03 18:54:28 +00:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2009-07-24 13:34:57 +00:00
|
|
|
let version = "4.4.1";
|
2009-07-20 15:34:10 +00:00
|
|
|
javaEcj = fetchurl {
|
|
|
|
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
|
|
|
# `configure' time.
|
|
|
|
|
|
|
|
# XXX: Eventually we might want to take it from upstream.
|
|
|
|
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
|
|
|
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
|
|
|
};
|
2009-07-29 15:13:01 +00:00
|
|
|
xlibs = [ libX11 libXt libSM libICE libXtst libXrender xproto ];
|
|
|
|
javaAwtGtk = langJava && gtk != null;
|
2009-07-20 15:34:10 +00:00
|
|
|
|
|
|
|
in
|
2009-07-03 18:54:28 +00:00
|
|
|
|
2009-07-29 13:57:11 +00:00
|
|
|
# We need all these X libraries when building AWT with GTK+.
|
|
|
|
assert gtk != null -> (filter (x: x == null) xlibs) == [];
|
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
stdenv.mkDerivation ({
|
|
|
|
name = "${name}-${version}";
|
2009-07-27 13:50:19 +00:00
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
builder = ./builder.sh;
|
|
|
|
|
|
|
|
src =
|
|
|
|
optional /*langC*/ true (fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
|
2009-07-24 13:34:57 +00:00
|
|
|
sha256 = "0jgwa98i964jhnjg6acvvhz0wb51v00kk3gal8qbps8j09g2mgag";
|
2009-07-03 18:54:28 +00:00
|
|
|
}) ++
|
|
|
|
|
|
|
|
|
|
|
|
optional langCC (fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
|
2009-07-24 13:34:57 +00:00
|
|
|
sha256 = "1pfgfgpvkq0i4023n4v1cghzmcq8c15xn4n967n29vmdrrwk8754";
|
2009-07-03 18:54:28 +00:00
|
|
|
}) ++
|
|
|
|
|
|
|
|
optional langFortran (fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
|
2009-07-24 13:34:57 +00:00
|
|
|
sha256 = "1406r8ndl7pjyas5naw8ygqpfrl72ypyn71llfzf953j736kmi50";
|
2009-07-03 18:54:28 +00:00
|
|
|
}) ++
|
|
|
|
|
|
|
|
optional langJava (fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
|
2009-07-24 13:34:57 +00:00
|
|
|
sha256 = "07lgph5zxskqqkzbq67wma2067dqr5my110l8rgzspqjq5rhgdil";
|
2009-07-03 18:54:28 +00:00
|
|
|
});
|
2009-07-17 17:20:07 +00:00
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
patches =
|
|
|
|
[./pass-cxxcpp.patch]
|
2009-07-24 21:56:58 +00:00
|
|
|
++ optional noSysDirs ./no-sys-dirs.patch;
|
2009-07-17 16:14:28 +00:00
|
|
|
|
2009-07-27 13:50:19 +00:00
|
|
|
inherit noSysDirs profiledCompiler staticCompiler langJava;
|
2009-07-03 18:54:28 +00:00
|
|
|
|
2009-07-27 15:40:01 +00:00
|
|
|
buildInputs = [ texinfo gmp mpfr gettext which ]
|
2009-07-18 21:37:23 +00:00
|
|
|
++ (optional (ppl != null) ppl)
|
|
|
|
++ (optional (cloogppl != null) cloogppl)
|
2009-07-03 18:54:28 +00:00
|
|
|
++ (optionals langTreelang [bison flex])
|
|
|
|
++ (optional (zlib != null) zlib)
|
|
|
|
++ (optional (boehmgc != null) boehmgc)
|
2009-07-27 23:09:04 +00:00
|
|
|
++ (optionals langJava [zip unzip])
|
2009-07-29 15:13:01 +00:00
|
|
|
++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs)
|
2009-07-03 18:54:28 +00:00
|
|
|
;
|
|
|
|
|
2009-07-29 15:13:01 +00:00
|
|
|
# TODO: Use a binary distribution of Antlr for Java, needed to build
|
|
|
|
# `gjdoc' (see `--with-antlr-jar=ANTLR').
|
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
configureFlags = "
|
|
|
|
${if enableMultilib then "" else "--disable-multilib"}
|
2009-07-18 21:37:23 +00:00
|
|
|
${if ppl != null then "--with-ppl=${ppl}" else ""}
|
|
|
|
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
|
2009-07-20 15:34:10 +00:00
|
|
|
${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
|
2009-07-29 15:13:01 +00:00
|
|
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
2009-07-29 13:57:11 +00:00
|
|
|
--with-gmp=${gmp}
|
|
|
|
--with-mpfr=${mpfr}
|
2009-07-03 18:54:28 +00:00
|
|
|
--disable-libstdcxx-pch
|
2009-07-17 16:14:28 +00:00
|
|
|
--without-included-gettext
|
2009-07-03 18:54:28 +00:00
|
|
|
--with-system-zlib
|
|
|
|
--enable-languages=${
|
|
|
|
concatStrings (intersperse ","
|
|
|
|
( optional langC "c"
|
|
|
|
++ optional langCC "c++"
|
|
|
|
++ optional langFortran "fortran"
|
|
|
|
++ optional langJava "java"
|
|
|
|
++ optional langTreelang "treelang"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
${if stdenv.isi686 then "--with-arch=i686" else ""}
|
|
|
|
";
|
|
|
|
|
2009-07-29 13:57:11 +00:00
|
|
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
|
|
|
# the library headers and binaries, regarless of the language being
|
|
|
|
# compiled.
|
|
|
|
|
2009-07-29 15:13:01 +00:00
|
|
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
|
|
|
# honor `--with-gmp' et al., e.g., when building
|
|
|
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
|
|
|
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
|
|
|
2009-07-29 13:57:11 +00:00
|
|
|
CPATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/include")
|
|
|
|
([ zlib ]
|
|
|
|
++ optional langJava boehmgc
|
2009-07-29 15:13:01 +00:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 13:57:11 +00:00
|
|
|
|
|
|
|
LIBRARY_PATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/lib")
|
|
|
|
([ zlib ]
|
|
|
|
++ optional langJava boehmgc
|
2009-07-29 15:13:01 +00:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 13:57:11 +00:00
|
|
|
|
2009-07-29 08:48:09 +00:00
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
passthru = { inherit langC langCC langFortran langTreelang enableMultilib; };
|
|
|
|
|
|
|
|
meta = {
|
2009-07-28 08:44:41 +00:00
|
|
|
homepage = http://gcc.gnu.org/;
|
|
|
|
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+
|
2009-07-17 16:14:28 +00:00
|
|
|
description = "GNU Compiler Collection, version ${version}";
|
|
|
|
|
2009-07-28 08:44:41 +00:00
|
|
|
longDescription = ''
|
|
|
|
The GNU Compiler Collection includes compiler front ends for C, C++,
|
|
|
|
Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
|
|
|
|
as libraries for these languages (libstdc++, libgcj, libgomp,...).
|
|
|
|
|
|
|
|
GCC development is a part of the GNU Project, aiming to improve the
|
|
|
|
compiler used in the GNU system including the GNU/Linux variant.
|
|
|
|
'';
|
|
|
|
|
2009-07-17 16:14:28 +00:00
|
|
|
maintainers = [
|
|
|
|
# Add your name here!
|
|
|
|
stdenv.lib.maintainers.ludo
|
|
|
|
];
|
2009-07-03 18:54:28 +00:00
|
|
|
};
|
2009-07-27 13:50:19 +00:00
|
|
|
})
|