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
|
2009-11-29 23:27:35 +00:00
|
|
|
, enableShared ? true
|
2009-07-03 18:54:28 +00:00
|
|
|
, 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 19:33:45 +00:00
|
|
|
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
|
2009-11-05 21:43:00 +00:00
|
|
|
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
|
2009-07-03 18:54:28 +00:00
|
|
|
, enableMultilib ? false
|
|
|
|
, name ? "gcc"
|
2009-11-29 23:27:35 +00:00
|
|
|
, cross ? null
|
|
|
|
, binutilsCross ? null
|
|
|
|
, glibcCross ? null
|
|
|
|
, crossStageStatic ? true
|
2009-07-03 18:54:28 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
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-11-05 18:46:52 +00:00
|
|
|
let version = "4.4.2";
|
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 16:18:31 +00:00
|
|
|
|
2009-07-30 16:05:39 +00:00
|
|
|
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
|
|
|
# binary distribution here to allow the whole chain to be bootstrapped.
|
|
|
|
javaAntlr = fetchurl {
|
|
|
|
url = http://www.antlr.org/download/antlr-3.1.3.jar;
|
|
|
|
sha256 = "1f41j0y4kjydl71lqlvr73yagrs2jsg1fjymzjz66mjy7al5lh09";
|
|
|
|
};
|
|
|
|
|
2009-07-29 16:18:31 +00:00
|
|
|
xlibs = [
|
2009-11-05 21:43:00 +00:00
|
|
|
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
2009-07-30 08:32:43 +00:00
|
|
|
xproto renderproto xextproto inputproto randrproto
|
2009-07-29 16:18:31 +00:00
|
|
|
];
|
|
|
|
|
2009-07-29 15:13:01 +00:00
|
|
|
javaAwtGtk = langJava && gtk != null;
|
2009-07-20 15:34:10 +00:00
|
|
|
|
2009-11-29 23:27:35 +00:00
|
|
|
crossConfigureFlags =
|
|
|
|
"--target=${cross.config}" +
|
|
|
|
(if crossStageStatic then
|
|
|
|
" --disable-libssp --disable-nls" +
|
|
|
|
" --without-headers" +
|
|
|
|
" --disable-threads " +
|
|
|
|
" --disable-libmudflap " +
|
|
|
|
" --disable-libgomp " +
|
|
|
|
" --disable-shared"
|
|
|
|
else
|
|
|
|
" --with-headers=${glibcCross}/include" +
|
|
|
|
" --enable-__cxa_atexit" +
|
|
|
|
" --enable-long-long" +
|
|
|
|
" --enable-threads=posix" +
|
|
|
|
" --enable-nls"
|
|
|
|
);
|
|
|
|
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
|
|
|
"-stage-final";
|
|
|
|
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
|
|
|
|
|
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 ({
|
2009-11-29 23:27:35 +00:00
|
|
|
name = "${name}-${version}" + crossNameAddon;
|
2009-07-27 13:50:19 +00:00
|
|
|
|
2009-07-03 18:54:28 +00:00
|
|
|
builder = ./builder.sh;
|
|
|
|
|
2009-11-05 18:46:52 +00:00
|
|
|
src = (import ./sources.nix) {
|
|
|
|
inherit fetchurl optional version;
|
|
|
|
inherit langC langCC langFortran langJava;
|
|
|
|
};
|
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
|
|
|
;
|
|
|
|
|
|
|
|
configureFlags = "
|
|
|
|
${if enableMultilib then "" else "--disable-multilib"}
|
2009-11-29 23:27:35 +00:00
|
|
|
${if enableShared then "" else "--disable-shared"}
|
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-30 16:05:39 +00:00
|
|
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" 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-11-29 23:27:35 +00:00
|
|
|
${if cross != null then crossConfigureFlags else ""}
|
2009-07-03 18:54:28 +00:00
|
|
|
";
|
|
|
|
|
2009-11-29 23:27:35 +00:00
|
|
|
targetConfig = if (cross != null) then cross.config else null;
|
|
|
|
|
|
|
|
# Needed for the cross compilation to work
|
|
|
|
AR = "ar";
|
|
|
|
LD = "ld";
|
|
|
|
CC = "gcc";
|
|
|
|
|
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")
|
2009-07-30 10:31:04 +00:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
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")
|
2009-07-30 10:31:04 +00:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
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-09-16 14:59:56 +00:00
|
|
|
|
|
|
|
# Volunteers needed for the {Cyg,Dar}win ports.
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2009-07-03 18:54:28 +00:00
|
|
|
};
|
2009-07-27 13:50:19 +00:00
|
|
|
})
|