2009-07-03 20:54:28 +02:00
|
|
|
{ stdenv, fetchurl, noSysDirs
|
2011-08-28 20:41:51 +02:00
|
|
|
, langC ? true, langCC ? true, langFortran ? false
|
2009-07-03 20:54:28 +02:00
|
|
|
, 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-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
|
|
|
}:
|
|
|
|
|
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;
|
|
|
|
|
2011-10-24 03:03:16 +02:00
|
|
|
let version = "4.4.6";
|
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
|
|
|
|
2010-03-14 15:05:08 +01:00
|
|
|
/* Cross-gcc settings */
|
|
|
|
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
|
|
|
|
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
|
|
|
|
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
|
|
|
|
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
|
|
|
|
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
|
|
|
|
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
|
2010-02-27 01:52:48 +01:00
|
|
|
|
2009-11-30 00:27:35 +01:00
|
|
|
crossConfigureFlags =
|
|
|
|
"--target=${cross.config}" +
|
2010-03-14 15:05:08 +01:00
|
|
|
withArch +
|
|
|
|
withCpu +
|
|
|
|
withAbi +
|
2009-11-30 00:27:35 +01:00
|
|
|
(if crossStageStatic then
|
|
|
|
" --disable-libssp --disable-nls" +
|
|
|
|
" --without-headers" +
|
|
|
|
" --disable-threads " +
|
|
|
|
" --disable-libmudflap " +
|
|
|
|
" --disable-libgomp " +
|
2010-03-14 15:05:08 +01:00
|
|
|
" --disable-shared" +
|
|
|
|
" --disable-decimal-float" # libdecnumber requires libc
|
2009-11-30 00:27:35 +01:00
|
|
|
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" +
|
2010-03-14 15:05:08 +01:00
|
|
|
" --enable-nls" +
|
|
|
|
" --disable-decimal-float" # No final libdecnumber (it may work only in 386)
|
2009-11-30 00:27:35 +01:00
|
|
|
);
|
|
|
|
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
|
2010-04-07 17:53:34 +02:00
|
|
|
++ optional langVhdl ./ghdl-ortho-cflags.patch
|
|
|
|
++ optional (cross != null && cross.arch == "sparc64") ./pr41818.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
|
|
|
|
2010-03-06 22:41:01 +01:00
|
|
|
buildNativeInputs = [ texinfo which ];
|
|
|
|
|
|
|
|
buildInputs = [ gmp mpfr gettext ]
|
2009-07-18 23:37:23 +02:00
|
|
|
++ (optional (ppl != null) ppl)
|
|
|
|
++ (optional (cloogppl != null) cloogppl)
|
2009-07-03 20:54:28 +02:00
|
|
|
++ (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"
|
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";
|
|
|
|
|
2010-03-06 22:41:01 +01:00
|
|
|
crossAttrs = {
|
|
|
|
AR = "${stdenv.cross.config}-ar";
|
|
|
|
LD = "${stdenv.cross.config}-ld";
|
|
|
|
CC = "${stdenv.cross.config}-gcc";
|
|
|
|
CXX = "${stdenv.cross.config}-gcc";
|
|
|
|
AR_FOR_TARGET = "${stdenv.cross.config}-ar";
|
|
|
|
LD_FOR_TARGET = "${stdenv.cross.config}-ld";
|
|
|
|
CC_FOR_TARGET = "${stdenv.cross.config}-gcc";
|
|
|
|
NM_FOR_TARGET = "${stdenv.cross.config}-nm";
|
|
|
|
CXX_FOR_TARGET = "${stdenv.cross.config}-g++";
|
|
|
|
# If we are making a cross compiler, cross != null
|
|
|
|
NIX_GCC_CROSS = if cross == null then "${stdenv.gccCross}" else "";
|
|
|
|
configureFlags = "
|
|
|
|
${if enableMultilib then "" else "--disable-multilib"}
|
|
|
|
${if enableShared then "" else "--disable-shared"}
|
|
|
|
${if ppl != null then "--with-ppl=${ppl.hostDrv}" else ""}
|
|
|
|
${if cloogppl != null then "--with-cloog=${cloogppl.hostDrv}" else ""}
|
|
|
|
${if langJava then "--with-ecj-jar=${javaEcj.hostDrv}" else ""}
|
|
|
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
|
|
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.hostDrv}" else ""}
|
|
|
|
--with-gmp=${gmp.hostDrv}
|
|
|
|
--with-mpfr=${mpfr.hostDrv}
|
|
|
|
--disable-libstdcxx-pch
|
|
|
|
--without-included-gettext
|
|
|
|
--with-system-zlib
|
|
|
|
--enable-languages=${
|
|
|
|
concatStrings (intersperse ","
|
|
|
|
( optional langC "c"
|
|
|
|
++ optional langCC "c++"
|
|
|
|
++ optional langFortran "fortran"
|
|
|
|
++ optional langJava "java"
|
|
|
|
++ optional langAda "ada"
|
|
|
|
++ optional langVhdl "vhdl"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
${if langAda then " --enable-libada" else ""}
|
|
|
|
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
|
|
|
|
${if cross != null then crossConfigureFlags else ""}
|
|
|
|
--target=${stdenv.cross.config}
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2011-08-28 20:41:51 +02:00
|
|
|
passthru = { inherit langC langCC langAda langFortran langVhdl
|
2010-06-12 23:52:39 +02:00
|
|
|
enableMultilib version; };
|
2009-07-03 20:54:28 +02:00
|
|
|
|
2010-11-12 22:04:19 +01:00
|
|
|
# ghdl does not build fine with parallel building
|
|
|
|
enableParallelBuilding = if langVhdl then false else true;
|
2010-06-23 16:35:18 +02:00
|
|
|
|
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
|
|
|
|
2010-02-15 10:36:23 +01:00
|
|
|
# Volunteers needed for the {Cyg,Dar}win ports of *PPL.
|
2010-03-17 11:17:32 +01:00
|
|
|
# gnatboot is not available out of linux platforms, so we disable the darwin build
|
|
|
|
# for the gnat (ada compiler).
|
|
|
|
platforms = stdenv.lib.platforms.linux ++ optionals (langAda == false) [ "i686-darwin" ];
|
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 {}))
|