2009-07-03 19:54:28 +01:00
|
|
|
{ stdenv, fetchurl, noSysDirs
|
|
|
|
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
|
|
|
|
, langJava ? false
|
2009-12-21 07:49:31 +00:00
|
|
|
, langAda ? false
|
2010-01-15 23:22:28 +00:00
|
|
|
, langVhdl ? false
|
2009-07-03 19:54:28 +01:00
|
|
|
, profiledCompiler ? false
|
|
|
|
, staticCompiler ? false
|
2009-11-29 23:27:35 +00:00
|
|
|
, enableShared ? true
|
2009-07-03 19:54:28 +01:00
|
|
|
, texinfo ? null
|
2009-07-27 16:40:01 +01:00
|
|
|
, gmp, mpfr, gettext, which
|
2009-07-18 22:37:23 +01:00
|
|
|
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework
|
2009-07-03 19:54:28 +01:00
|
|
|
, bison ? null, flex ? null
|
2009-07-28 00:09:04 +01:00
|
|
|
, zlib ? null, boehmgc ? null
|
2009-07-28 10:23:40 +01:00
|
|
|
, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null
|
2009-07-28 18:49:47 +01:00
|
|
|
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
2009-07-29 20:33:45 +01: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-12-21 07:49:31 +00:00
|
|
|
, gnatboot ? null
|
2009-07-03 19:54:28 +01:00
|
|
|
, enableMultilib ? false
|
|
|
|
, name ? "gcc"
|
2009-11-29 23:27:35 +00:00
|
|
|
, cross ? null
|
|
|
|
, binutilsCross ? null
|
2009-12-08 09:36:19 +00:00
|
|
|
, libcCross ? null
|
2009-11-29 23:27:35 +00:00
|
|
|
, crossStageStatic ? true
|
2010-01-15 23:22:28 +00:00
|
|
|
, gnat ? null
|
2009-07-03 19:54:28 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert langTreelang -> bison != null && flex != null;
|
2009-07-29 14:57:11 +01:00
|
|
|
assert langJava -> zip != null && unzip != null
|
|
|
|
&& zlib != null && boehmgc != null;
|
2009-12-21 07:49:31 +00:00
|
|
|
assert langAda -> gnatboot != null;
|
2010-01-15 23:22:28 +00:00
|
|
|
assert langVhdl -> gnat != null;
|
2009-07-03 19:54:28 +01:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
2010-01-26 16:25:30 +00:00
|
|
|
let version = "4.4.3";
|
2009-07-20 16:34:10 +01: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 17:18:31 +01:00
|
|
|
|
2009-07-30 17:05:39 +01: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 17:18:31 +01:00
|
|
|
xlibs = [
|
2009-11-05 21:43:00 +00:00
|
|
|
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
2009-07-30 09:32:43 +01:00
|
|
|
xproto renderproto xextproto inputproto randrproto
|
2009-07-29 17:18:31 +01:00
|
|
|
];
|
|
|
|
|
2009-07-29 16:13:01 +01:00
|
|
|
javaAwtGtk = langJava && gtk != null;
|
2009-07-20 16:34:10 +01:00
|
|
|
|
2010-03-14 14:05:08 +00: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 00:52:48 +00:00
|
|
|
|
2009-11-29 23:27:35 +00:00
|
|
|
crossConfigureFlags =
|
|
|
|
"--target=${cross.config}" +
|
2010-03-14 14:05:08 +00:00
|
|
|
withArch +
|
|
|
|
withCpu +
|
|
|
|
withAbi +
|
2009-11-29 23:27:35 +00:00
|
|
|
(if crossStageStatic then
|
|
|
|
" --disable-libssp --disable-nls" +
|
|
|
|
" --without-headers" +
|
|
|
|
" --disable-threads " +
|
|
|
|
" --disable-libmudflap " +
|
|
|
|
" --disable-libgomp " +
|
2010-03-14 14:05:08 +00:00
|
|
|
" --disable-shared" +
|
|
|
|
" --disable-decimal-float" # libdecnumber requires libc
|
2009-11-29 23:27:35 +00:00
|
|
|
else
|
2009-12-08 09:36:19 +00:00
|
|
|
" --with-headers=${libcCross}/include" +
|
2009-11-29 23:27:35 +00:00
|
|
|
" --enable-__cxa_atexit" +
|
|
|
|
" --enable-long-long" +
|
|
|
|
" --enable-threads=posix" +
|
2010-03-14 14:05:08 +00:00
|
|
|
" --enable-nls" +
|
|
|
|
" --disable-decimal-float" # No final libdecnumber (it may work only in 386)
|
2009-11-29 23:27:35 +00:00
|
|
|
);
|
|
|
|
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
|
|
|
"-stage-final";
|
|
|
|
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
|
|
|
|
|
2009-07-20 16:34:10 +01:00
|
|
|
in
|
2009-07-03 19:54:28 +01:00
|
|
|
|
2009-07-29 14:57:11 +01:00
|
|
|
# We need all these X libraries when building AWT with GTK+.
|
|
|
|
assert gtk != null -> (filter (x: x == null) xlibs) == [];
|
|
|
|
|
2009-07-03 19:54:28 +01:00
|
|
|
stdenv.mkDerivation ({
|
2009-11-29 23:27:35 +00:00
|
|
|
name = "${name}-${version}" + crossNameAddon;
|
2009-07-27 14:50:19 +01:00
|
|
|
|
2009-07-03 19:54:28 +01:00
|
|
|
builder = ./builder.sh;
|
|
|
|
|
2009-11-05 18:46:52 +00:00
|
|
|
src = (import ./sources.nix) {
|
|
|
|
inherit fetchurl optional version;
|
2009-12-21 07:49:31 +00:00
|
|
|
inherit langC langCC langFortran langJava langAda;
|
2009-11-05 18:46:52 +00:00
|
|
|
};
|
2009-07-17 18:20:07 +01:00
|
|
|
|
2009-07-03 19:54:28 +01:00
|
|
|
patches =
|
2009-12-08 09:36:19 +00:00
|
|
|
[./pass-cxxcpp.patch
|
2009-12-09 10:05:47 +00: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 16:25:30 +00:00
|
|
|
# Bad mixture of build/target flags
|
2009-12-09 10:05:47 +00:00
|
|
|
./libstdc++-target.patch
|
2009-12-08 09:36:19 +00:00
|
|
|
]
|
2009-12-21 07:49:31 +00: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-15 23:22:28 +00:00
|
|
|
++ optional langAda ./gnat-cflags.patch
|
2010-04-07 16:53:34 +01:00
|
|
|
++ optional langVhdl ./ghdl-ortho-cflags.patch
|
|
|
|
++ optional (cross != null && cross.arch == "sparc64") ./pr41818.patch;
|
2009-07-17 17:14:28 +01:00
|
|
|
|
2009-12-08 09:36:19 +00:00
|
|
|
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
|
|
|
|
libcCross;
|
2009-07-03 19:54:28 +01:00
|
|
|
|
2009-07-27 16:40:01 +01:00
|
|
|
buildInputs = [ texinfo gmp mpfr gettext which ]
|
2009-07-18 22:37:23 +01:00
|
|
|
++ (optional (ppl != null) ppl)
|
|
|
|
++ (optional (cloogppl != null) cloogppl)
|
2009-07-03 19:54:28 +01:00
|
|
|
++ (optionals langTreelang [bison flex])
|
|
|
|
++ (optional (zlib != null) zlib)
|
|
|
|
++ (optional (boehmgc != null) boehmgc)
|
2009-07-28 00:09:04 +01:00
|
|
|
++ (optionals langJava [zip unzip])
|
2009-07-29 16:13:01 +01:00
|
|
|
++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs)
|
2009-12-01 10:29:22 +00:00
|
|
|
++ (optionals (cross != null) [binutilsCross])
|
2009-12-21 07:49:31 +00:00
|
|
|
++ (optionals langAda [gnatboot])
|
2010-01-15 23:22:28 +00:00
|
|
|
++ (optionals langVhdl [gnat])
|
2009-07-03 19:54:28 +01: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 22:37:23 +01:00
|
|
|
${if ppl != null then "--with-ppl=${ppl}" else ""}
|
|
|
|
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
|
2009-07-20 16:34:10 +01:00
|
|
|
${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
|
2009-07-29 16:13:01 +01:00
|
|
|
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
2009-07-30 17:05:39 +01:00
|
|
|
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""}
|
2009-07-29 14:57:11 +01:00
|
|
|
--with-gmp=${gmp}
|
|
|
|
--with-mpfr=${mpfr}
|
2009-07-03 19:54:28 +01:00
|
|
|
--disable-libstdcxx-pch
|
2009-07-17 17:14:28 +01:00
|
|
|
--without-included-gettext
|
2009-07-03 19:54:28 +01: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 07:49:31 +00:00
|
|
|
++ optional langAda "ada"
|
2010-01-15 23:22:28 +00:00
|
|
|
++ optional langVhdl "vhdl"
|
2009-07-03 19:54:28 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
2009-12-21 07:49:31 +00:00
|
|
|
${if langAda then " --enable-libada" else ""}
|
2010-01-23 00:24:52 +00:00
|
|
|
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
|
2009-11-29 23:27:35 +00:00
|
|
|
${if cross != null then crossConfigureFlags else ""}
|
2009-07-03 19:54:28 +01: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 14:57:11 +01: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 16:13:01 +01: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 14:57:11 +01:00
|
|
|
CPATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/include")
|
2009-07-30 11:31:04 +01:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
2009-07-29 16:13:01 +01:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 14:57:11 +01:00
|
|
|
|
|
|
|
LIBRARY_PATH = concatStrings
|
|
|
|
(intersperse ":" (map (x: x + "/lib")
|
2009-07-30 11:31:04 +01:00
|
|
|
(optionals langJava [ boehmgc zlib ]
|
2009-07-29 16:13:01 +01:00
|
|
|
++ optionals javaAwtGtk xlibs
|
|
|
|
++ optionals javaAwtGtk [ gmp mpfr ])));
|
2009-07-29 14:57:11 +01:00
|
|
|
|
2009-07-29 09:48:09 +01:00
|
|
|
|
2010-01-27 16:29:11 +00:00
|
|
|
passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl
|
2010-06-12 22:52:39 +01:00
|
|
|
enableMultilib version; };
|
2009-07-03 19:54:28 +01:00
|
|
|
|
Enable parallel building of gcc, glibc, gmp, mpfr, ncurses, coreutils, perl, python, git, and qt4.
If a build expressions has set "enableParallelBuilding = true", then the
generic builder may utilize more than one CPU core to build that particular
expression. This feature works out of the box for GNU Make. Expressions that
use other build drivers like Boost.Jam or SCons have to specify appropriate
flags such as "-j${NIX_BUILD_CORES}" themselves.
svn path=/nixpkgs/trunk/; revision=23042
2010-08-08 19:51:42 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2009-07-03 19:54:28 +01:00
|
|
|
meta = {
|
2009-07-28 09:44:41 +01:00
|
|
|
homepage = http://gcc.gnu.org/;
|
|
|
|
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+
|
2009-07-17 17:14:28 +01:00
|
|
|
description = "GNU Compiler Collection, version ${version}";
|
|
|
|
|
2009-07-28 09:44:41 +01: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 17:14:28 +01:00
|
|
|
maintainers = [
|
|
|
|
# Add your name here!
|
|
|
|
stdenv.lib.maintainers.ludo
|
2010-01-15 23:22:28 +00:00
|
|
|
stdenv.lib.maintainers.viric
|
2009-07-17 17:14:28 +01:00
|
|
|
];
|
2009-09-16 15:59:56 +01:00
|
|
|
|
2010-02-15 09:36:23 +00:00
|
|
|
# Volunteers needed for the {Cyg,Dar}win ports of *PPL.
|
2010-03-17 10:17:32 +00: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 19:54:28 +01:00
|
|
|
};
|
2010-01-15 23:22:28 +00: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 {}))
|