2009-07-03 20:54:28 +02:00
|
|
|
{ stdenv, fetchurl, noSysDirs
|
|
|
|
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
|
|
|
|
, langJava ? false
|
2009-12-21 08:49:31 +01:00
|
|
|
, langAda ? false
|
2010-01-16 00:22:28 +01:00
|
|
|
, langVhdl ? false
|
2009-07-03 20:54:28 +02:00
|
|
|
, profiledCompiler ? false
|
|
|
|
, staticCompiler ? false
|
2009-11-30 00:27:35 +01:00
|
|
|
, enableShared ? true
|
2009-07-03 20:54:28 +02:00
|
|
|
, texinfo ? null
|
2009-07-27 17:40:01 +02:00
|
|
|
, gmp, mpfr, gettext, which
|
2009-07-18 23:37:23 +02:00
|
|
|
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework
|
2009-07-03 20:54:28 +02:00
|
|
|
, bison ? null, flex ? null
|
2009-07-28 01:09:04 +02:00
|
|
|
, zlib ? null, boehmgc ? null
|
2009-07-28 11:23:40 +02:00
|
|
|
, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null
|
2009-07-28 19:49:47 +02:00
|
|
|
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
2009-07-29 21:33:45 +02:00
|
|
|
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
|
2009-11-05 22:43:00 +01:00
|
|
|
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
|
2009-12-21 08:49:31 +01:00
|
|
|
, gnatboot ? null
|
2009-07-03 20:54:28 +02:00
|
|
|
, enableMultilib ? false
|
|
|
|
, name ? "gcc"
|
2009-11-30 00:27:35 +01:00
|
|
|
, cross ? null
|
|
|
|
, binutilsCross ? null
|
2009-12-08 10:36:19 +01:00
|
|
|
, libcCross ? null
|
2009-11-30 00:27:35 +01:00
|
|
|
, crossStageStatic ? true
|
2010-01-16 00:22:28 +01:00
|
|
|
, gnat ? null
|
2009-07-03 20:54:28 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert langTreelang -> bison != null && flex != null;
|
2009-07-29 15:57:11 +02:00
|
|
|
assert langJava -> zip != null && unzip != null
|
|
|
|
&& zlib != null && boehmgc != null;
|
2009-12-21 08:49:31 +01:00
|
|
|
assert langAda -> gnatboot != null;
|
2010-01-16 00:22:28 +01:00
|
|
|
assert langVhdl -> gnat != null;
|
2009-07-03 20:54:28 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2010-01-26 17:25:30 +01:00
|
|
|
let version = "4.4.3";
|
2009-07-20 17:34:10 +02: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 18:18:31 +02:00
|
|
|
|
2009-07-30 18:05:39 +02: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 18:18:31 +02:00
|
|
|
xlibs = [
|
2009-11-05 22:43:00 +01:00
|
|
|
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
2009-07-30 10:32:43 +02:00
|
|
|
xproto renderproto xextproto inputproto randrproto
|
2009-07-29 18:18:31 +02:00
|
|
|
];
|
|
|
|
|
2009-07-29 17:13:01 +02:00
|
|
|
javaAwtGtk = langJava && gtk != null;
|
2009-07-20 17:34:10 +02:00
|
|
|
|
2009-11-30 00:27:35 +01:00
|
|
|
crossConfigureFlags =
|
|
|
|
"--target=${cross.config}" +
|
|
|
|
(if crossStageStatic then
|
|
|
|
" --disable-libssp --disable-nls" +
|
|
|
|
" --without-headers" +
|
|
|
|
" --disable-threads " +
|
|
|
|
" --disable-libmudflap " +
|
|
|
|
" --disable-libgomp " +
|
|
|
|
" --disable-shared"
|
|
|
|
else
|
2009-12-08 10:36:19 +01:00
|
|
|
" --with-headers=${libcCross}/include" +
|
2009-11-30 00:27:35 +01:00
|
|
|
" --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 17:34:10 +02:00
|
|
|
in
|
2009-07-03 20:54:28 +02:00
|
|
|
|
2009-07-29 15:57:11 +02:00
|
|
|
# We need all these X libraries when building AWT with GTK+.
|
|
|
|
assert gtk != null -> (filter (x: x == null) xlibs) == [];
|
|
|
|
|
2009-07-03 20:54:28 +02:00
|
|
|
stdenv.mkDerivation ({
|
2009-11-30 00:27:35 +01:00
|
|
|
name = "${name}-${version}" + crossNameAddon;
|
2009-07-27 15:50:19 +02:00
|
|
|
|
2009-07-03 20:54:28 +02:00
|
|
|
builder = ./builder.sh;
|
|
|
|
|
2009-11-05 19:46:52 +01:00
|
|
|
src = (import ./sources.nix) {
|
|
|
|
inherit fetchurl optional version;
|
2009-12-21 08:49:31 +01:00
|
|
|
inherit langC langCC langFortran langJava langAda;
|
2009-11-05 19:46:52 +01:00
|
|
|
};
|
2009-07-17 19:20:07 +02:00
|
|
|
|
2009-07-03 20:54:28 +02:00
|
|
|
patches =
|
2009-12-08 10:36:19 +01:00
|
|
|
[./pass-cxxcpp.patch
|
2009-12-09 11:05:47 +01:00
|
|
|
|
|
|
|
# libmudflap and libstdc++ receive the build CPP,
|
|
|
|
# and not the target.
|
|
|
|
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42279
|
|
|
|
./target-cpp.patch
|
|
|
|
|
2010-01-26 17:25:30 +01:00
|
|
|
# Bad mixture of build/target flags
|
2009-12-09 11:05:47 +01:00
|
|
|
./libstdc++-target.patch
|
2009-12-08 10:36:19 +01:00
|
|
|
]
|
2009-12-21 08:49:31 +01:00
|
|
|
++ optional noSysDirs ./no-sys-dirs.patch
|
|
|
|
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
|
|
|
# target libraries and tools.
|
2010-01-16 00:22:28 +01:00
|
|
|
++ optional langAda ./gnat-cflags.patch
|
|
|
|
++ optional langVhdl ./ghdl-ortho-cflags.patch;
|
2009-07-17 18:14:28 +02:00
|
|
|
|
2009-12-08 10:36:19 +01:00
|
|
|
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
|
|
|
|
libcCross;
|
2009-07-03 20:54:28 +02:00
|
|
|
|
2009-07-27 17:40:01 +02:00
|
|
|
buildInputs = [ texinfo gmp mpfr gettext which ]
|
2009-07-18 23:37:23 +02:00
|
|
|
++ (optional (ppl != null) ppl)
|
|
|
|
++ (optional (cloogppl != null) cloogppl)
|
2009-07-03 20:54:28 +02:00
|
|
|
++ (optionals langTreelang [bison flex])
|
|
|
|
++ (optional (zlib != null) zlib)
|
|
|
|
++ (optional (boehmgc != null) boehmgc)
|
2009-07-28 01:09:04 +02:00
|
|
|
++ (optionals langJava [zip unzip])
|
2009-07-29 17:13:01 +02:00
|
|
|
++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs)
|
2009-12-01 11:29:22 +01:00
|
|
|
++ (optionals (cross != null) [binutilsCross])
|
2009-12-21 08:49:31 +01:00
|
|
|
++ (optionals langAda [gnatboot])
|
2010-01-16 00:22:28 +01:00
|
|
|
++ (optionals langVhdl [gnat])
|
2009-07-03 20:54:28 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
configureFlags = "
|
|
|
|
${if enableMultilib then "" else "--disable-multilib"}
|
2009-11-30 00:27:35 +01:00
|
|
|
${if enableShared then "" else "--disable-shared"}
|
2009-07-18 23:37:23 +02:00
|
|
|
${if ppl != null then "--with-ppl=${ppl}" else ""}
|
|
|
|
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
|
2009-07-20 17:34:10 +02:00
|
|
|
${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
|
2009-07-29 17:13:01 +02:00
|
|
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
2009-07-30 18:05:39 +02:00
|
|
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""}
|
2009-07-29 15:57:11 +02:00
|
|
|
--with-gmp=${gmp}
|
|
|
|
--with-mpfr=${mpfr}
|
2009-07-03 20:54:28 +02:00
|
|
|
--disable-libstdcxx-pch
|
2009-07-17 18:14:28 +02:00
|
|
|
--without-included-gettext
|
2009-07-03 20:54:28 +02:00
|
|
|
--with-system-zlib
|
|
|
|
--enable-languages=${
|
|
|
|
concatStrings (intersperse ","
|
|
|
|
( optional langC "c"
|
|
|
|
++ optional langCC "c++"
|
|
|
|
++ optional langFortran "fortran"
|
|
|
|
++ optional langJava "java"
|
|
|
|
++ optional langTreelang "treelang"
|
2009-12-21 08:49:31 +01:00
|
|
|
++ optional langAda "ada"
|
2010-01-16 00:22:28 +01:00
|
|
|
++ optional langVhdl "vhdl"
|
2009-07-03 20:54:28 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
2009-12-21 08:49:31 +01:00
|
|
|
${if langAda then " --enable-libada" else ""}
|
2010-01-23 01:24:52 +01:00
|
|
|
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
|
2009-11-30 00:27:35 +01:00
|
|
|
${if cross != null then crossConfigureFlags else ""}
|
2009-07-03 20:54:28 +02:00
|
|
|
";
|
|
|
|
|
2009-11-30 00:27:35 +01: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 15:57:11 +02: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 17:13:01 +02: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 15:57:11 +02:00
|
|
|
CPATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/include")
|
2009-07-30 12:31:04 +02:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
2009-07-29 17:13:01 +02:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 15:57:11 +02:00
|
|
|
|
|
|
|
LIBRARY_PATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/lib")
|
2009-07-30 12:31:04 +02:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
2009-07-29 17:13:01 +02:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 15:57:11 +02:00
|
|
|
|
2009-07-29 10:48:09 +02:00
|
|
|
|
2009-12-21 08:49:31 +01:00
|
|
|
passthru = { inherit langC langCC langAda langFortran langTreelang enableMultilib; };
|
2009-07-03 20:54:28 +02:00
|
|
|
|
|
|
|
meta = {
|
2009-07-28 10:44:41 +02:00
|
|
|
homepage = http://gcc.gnu.org/;
|
|
|
|
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+
|
2009-07-17 18:14:28 +02:00
|
|
|
description = "GNU Compiler Collection, version ${version}";
|
|
|
|
|
2009-07-28 10:44:41 +02: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 18:14:28 +02:00
|
|
|
maintainers = [
|
|
|
|
# Add your name here!
|
|
|
|
stdenv.lib.maintainers.ludo
|
2010-01-16 00:22:28 +01:00
|
|
|
stdenv.lib.maintainers.viric
|
2009-07-17 18:14:28 +02:00
|
|
|
];
|
2009-09-16 16:59:56 +02:00
|
|
|
|
|
|
|
# Volunteers needed for the {Cyg,Dar}win ports.
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2009-07-03 20:54:28 +02:00
|
|
|
};
|
2010-01-16 00:22:28 +01:00
|
|
|
}
|
|
|
|
// (if langVhdl then rec {
|
|
|
|
name = "ghdl-0.29";
|
|
|
|
|
|
|
|
ghdlSrc = fetchurl {
|
|
|
|
url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2";
|
|
|
|
sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Ghdl has some timestamps checks, storing file timestamps in '.cf' files.
|
|
|
|
# As we will change the timestamps to 1970-01-01 00:00:01, we also set the
|
|
|
|
# content of that .cf to that value. This way ghdl does not complain on
|
|
|
|
# the installed object files from the basic libraries (ieee, ...)
|
|
|
|
postInstallGhdl = ''
|
|
|
|
pushd $out
|
|
|
|
find . -name "*.cf" -exec \
|
|
|
|
sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \;
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
tar xvf ${ghdlSrc}
|
|
|
|
mv ghdl-*/vhdl gcc*/gcc
|
|
|
|
rm -Rf ghdl-*
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://ghdl.free.fr/";
|
|
|
|
license = "GPLv2+";
|
|
|
|
description = "Complete VHDL simulator, using the GCC technology (gcc ${version})";
|
|
|
|
maintainers = with stdenv.lib.maintainers; [viric];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
|
|
|
};
|
|
|
|
|
|
|
|
} else {}))
|