2008-06-26 12:20:33 +02:00
|
|
|
{ stdenv, fetchurl, noSysDirs
|
2008-06-27 16:43:25 +02:00
|
|
|
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
|
2009-05-10 11:11:41 +02:00
|
|
|
, langJava ? false
|
2009-12-22 00:02:06 +01:00
|
|
|
, langVhdl ? false
|
2008-06-26 12:20:33 +02:00
|
|
|
, profiledCompiler ? false
|
|
|
|
, staticCompiler ? false
|
2009-11-08 01:32:12 +01:00
|
|
|
, enableShared ? true
|
2008-06-26 12:20:33 +02:00
|
|
|
, texinfo ? null
|
|
|
|
, gmp, mpfr
|
2008-06-27 16:43:25 +02:00
|
|
|
, bison ? null, flex ? null
|
2009-05-10 11:11:41 +02:00
|
|
|
, zlib ? null, boehmgc ? null
|
2008-06-27 20:26:19 +02:00
|
|
|
, enableMultilib ? false
|
2009-04-09 17:24:33 +02:00
|
|
|
, name ? "gcc"
|
My first attempt at getting cross compilers in nixpkgs.
My idea is to provide special stdenv expressions that will contain in the path
additional cross compilers. As most expressions for programs accept a stdenv parameter,
we could substitute this parameter with the special stdenv, which will have a
generic builder that attempts the usual "--target=..." and can additionally
have an env variable like "cross" with the target architecture set.
So, finally we could have additional expressions like this:
bashRealArm = makeOverridable (import ../shells/bash) {
inherit fetchurl bison;
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
};
Meanwhile it does not work - I still cannot get the cross-gcc to build.
I think it does not fill the previous expressions with a lot of noise, so I
think it may be a good path to follow.
I only touched some files of the current stdenv: gcc-4.3, kernel headers
2.6.28, glibc 2.9, ...
I tried to use the gcc-cross-wrapper, that may be very outdated. Maybe I will
update it, or update the gcc-wrapper expression to make it fit the cross tools,
but meanwhile I even cannot build gcc, so I have not tested the wrapper.
This new idea on cross compiling is not similar to that of the
nixpkgs/branches/cross-compilation, which mostly added bare new expressions for
anything to be cross compiled, if I understood it correctly.
I cared not to break anything of the usual stdenv in all this work.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18343
2009-11-14 09:11:30 +01:00
|
|
|
, cross ? null
|
|
|
|
, binutilsCross ? null
|
2009-12-04 19:42:44 +01:00
|
|
|
, libcCross ? null
|
2009-11-15 06:28:35 +01:00
|
|
|
, crossStageStatic ? true
|
2009-12-22 00:02:06 +01:00
|
|
|
, gnat ? null
|
2008-06-26 12:20:33 +02:00
|
|
|
}:
|
|
|
|
|
2008-06-27 16:43:25 +02:00
|
|
|
assert langTreelang -> bison != null && flex != null;
|
2008-06-26 12:20:33 +02:00
|
|
|
|
My first attempt at getting cross compilers in nixpkgs.
My idea is to provide special stdenv expressions that will contain in the path
additional cross compilers. As most expressions for programs accept a stdenv parameter,
we could substitute this parameter with the special stdenv, which will have a
generic builder that attempts the usual "--target=..." and can additionally
have an env variable like "cross" with the target architecture set.
So, finally we could have additional expressions like this:
bashRealArm = makeOverridable (import ../shells/bash) {
inherit fetchurl bison;
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
};
Meanwhile it does not work - I still cannot get the cross-gcc to build.
I think it does not fill the previous expressions with a lot of noise, so I
think it may be a good path to follow.
I only touched some files of the current stdenv: gcc-4.3, kernel headers
2.6.28, glibc 2.9, ...
I tried to use the gcc-cross-wrapper, that may be very outdated. Maybe I will
update it, or update the gcc-wrapper expression to make it fit the cross tools,
but meanwhile I even cannot build gcc, so I have not tested the wrapper.
This new idea on cross compiling is not similar to that of the
nixpkgs/branches/cross-compilation, which mostly added bare new expressions for
anything to be cross compiled, if I understood it correctly.
I cared not to break anything of the usual stdenv in all this work.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18343
2009-11-14 09:11:30 +01:00
|
|
|
assert cross != null -> profiledCompiler == false && enableMultilib == true;
|
2009-11-15 06:28:35 +01:00
|
|
|
assert (cross != null && crossStageStatic) -> (langCC == false && langFortran
|
|
|
|
== false && langTreelang == false);
|
My first attempt at getting cross compilers in nixpkgs.
My idea is to provide special stdenv expressions that will contain in the path
additional cross compilers. As most expressions for programs accept a stdenv parameter,
we could substitute this parameter with the special stdenv, which will have a
generic builder that attempts the usual "--target=..." and can additionally
have an env variable like "cross" with the target architecture set.
So, finally we could have additional expressions like this:
bashRealArm = makeOverridable (import ../shells/bash) {
inherit fetchurl bison;
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
};
Meanwhile it does not work - I still cannot get the cross-gcc to build.
I think it does not fill the previous expressions with a lot of noise, so I
think it may be a good path to follow.
I only touched some files of the current stdenv: gcc-4.3, kernel headers
2.6.28, glibc 2.9, ...
I tried to use the gcc-cross-wrapper, that may be very outdated. Maybe I will
update it, or update the gcc-wrapper expression to make it fit the cross tools,
but meanwhile I even cannot build gcc, so I have not tested the wrapper.
This new idea on cross compiling is not similar to that of the
nixpkgs/branches/cross-compilation, which mostly added bare new expressions for
anything to be cross compiled, if I understood it correctly.
I cared not to break anything of the usual stdenv in all this work.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18343
2009-11-14 09:11:30 +01:00
|
|
|
|
2009-12-22 00:02:06 +01:00
|
|
|
assert langVhdl -> gnat != null;
|
|
|
|
|
2009-04-09 17:24:33 +02:00
|
|
|
with stdenv.lib;
|
2008-06-26 12:20:33 +02:00
|
|
|
|
2009-11-15 06:28:35 +01:00
|
|
|
let
|
|
|
|
version = "4.3.4";
|
2010-01-15 00:03:31 +01:00
|
|
|
|
2009-11-15 06:28:35 +01:00
|
|
|
crossConfigureFlags =
|
2009-11-17 00:21:13 +01:00
|
|
|
"--target=${cross.config}" +
|
2009-11-15 06:28:35 +01:00
|
|
|
(if crossStageStatic then
|
|
|
|
" --disable-libssp --disable-nls" +
|
|
|
|
" --without-headers" +
|
|
|
|
" --disable-threads " +
|
|
|
|
" --disable-libmudflap " +
|
|
|
|
" --disable-libgomp " +
|
2009-11-15 17:48:36 +01:00
|
|
|
" --disable-shared"
|
|
|
|
else
|
2009-12-04 19:42:44 +01:00
|
|
|
" --with-headers=${libcCross}/include" +
|
2009-11-15 17:48:36 +01:00
|
|
|
" --enable-__cxa_atexit" +
|
|
|
|
" --enable-long-long" +
|
2009-11-23 18:06:57 +01:00
|
|
|
" --enable-threads=posix" +
|
|
|
|
" --enable-nls"
|
2009-11-15 06:28:35 +01:00
|
|
|
);
|
2012-12-28 19:54:15 +01:00
|
|
|
stageNameAddon = if crossStageStatic then "-stage-static" else
|
2009-11-15 06:28:35 +01:00
|
|
|
"-stage-final";
|
2012-12-28 19:54:15 +01:00
|
|
|
crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
|
2009-11-15 06:28:35 +01:00
|
|
|
in
|
2008-06-26 12:20:33 +02:00
|
|
|
|
2009-05-10 11:11:41 +02:00
|
|
|
stdenv.mkDerivation ({
|
2009-11-15 06:28:35 +01:00
|
|
|
name = "${name}-${version}" + crossNameAddon;
|
2009-04-09 17:24:33 +02:00
|
|
|
|
2008-06-26 12:20:33 +02:00
|
|
|
builder = ./builder.sh;
|
|
|
|
|
|
|
|
src =
|
|
|
|
optional /*langC*/ true (fetchurl {
|
2009-01-27 12:53:35 +01:00
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
|
2009-11-08 01:32:12 +01:00
|
|
|
sha256 = "1yk80nwyw8vkpw8d3x7lkg3zrv3ngjqlvj0i8zslzgj7a27q729i";
|
2008-06-26 12:20:33 +02:00
|
|
|
}) ++
|
|
|
|
optional langCC (fetchurl {
|
2009-01-28 14:44:44 +01:00
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
|
2009-11-08 01:32:12 +01:00
|
|
|
sha256 = "0d8pyk5c9zmph25f4fl63vd8vhljj6ildbxpz2hr594g5i6pplpq";
|
2008-06-26 12:20:33 +02:00
|
|
|
}) ++
|
2008-06-27 16:43:25 +02:00
|
|
|
optional langFortran (fetchurl {
|
2009-01-28 14:44:44 +01:00
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
|
2009-11-08 01:32:12 +01:00
|
|
|
sha256 = "1xf2njykv1qcgxiqwj693dxjf77ss1rcxirylvnsp5hs89mdlj12";
|
2009-05-10 11:11:41 +02:00
|
|
|
}) ++
|
|
|
|
optional langJava (fetchurl {
|
|
|
|
url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
|
2009-11-08 01:32:12 +01:00
|
|
|
sha256 = "1v3krhxi3zyaqfj0x8dbxvg67fjp29cr1psyf71r9zf757p3vqsw";
|
2008-06-26 12:20:33 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
patches =
|
2009-12-04 14:35:58 +01:00
|
|
|
[./pass-cxxcpp.patch ./libmudflap-cpp.patch]
|
2008-06-27 16:43:25 +02:00
|
|
|
++ optional noSysDirs ./no-sys-dirs.patch
|
2009-07-03 15:30:25 +02:00
|
|
|
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
2009-12-22 00:02:06 +01:00
|
|
|
++ optional langJava ./java-jvgenmain-link.patch
|
2012-11-13 15:15:52 +01:00
|
|
|
++ optional langVhdl ./ghdl-ortho-cflags.patch
|
|
|
|
++ optional langVhdl ./ghdl-runtime-o2.patch;
|
2008-06-26 12:20:33 +02:00
|
|
|
|
2009-11-17 00:21:13 +01:00
|
|
|
inherit noSysDirs profiledCompiler staticCompiler crossStageStatic
|
2009-12-04 19:42:44 +01:00
|
|
|
binutilsCross libcCross;
|
2012-12-28 19:54:15 +01:00
|
|
|
targetConfig = if cross != null then cross.config else null;
|
2008-06-26 12:20:33 +02:00
|
|
|
|
2008-06-27 16:43:25 +02:00
|
|
|
buildInputs = [texinfo gmp mpfr]
|
2009-05-10 11:11:41 +02:00
|
|
|
++ (optionals langTreelang [bison flex])
|
|
|
|
++ (optional (zlib != null) zlib)
|
|
|
|
++ (optional (boehmgc != null) boehmgc)
|
My first attempt at getting cross compilers in nixpkgs.
My idea is to provide special stdenv expressions that will contain in the path
additional cross compilers. As most expressions for programs accept a stdenv parameter,
we could substitute this parameter with the special stdenv, which will have a
generic builder that attempts the usual "--target=..." and can additionally
have an env variable like "cross" with the target architecture set.
So, finally we could have additional expressions like this:
bashRealArm = makeOverridable (import ../shells/bash) {
inherit fetchurl bison;
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
};
Meanwhile it does not work - I still cannot get the cross-gcc to build.
I think it does not fill the previous expressions with a lot of noise, so I
think it may be a good path to follow.
I only touched some files of the current stdenv: gcc-4.3, kernel headers
2.6.28, glibc 2.9, ...
I tried to use the gcc-cross-wrapper, that may be very outdated. Maybe I will
update it, or update the gcc-wrapper expression to make it fit the cross tools,
but meanwhile I even cannot build gcc, so I have not tested the wrapper.
This new idea on cross compiling is not similar to that of the
nixpkgs/branches/cross-compilation, which mostly added bare new expressions for
anything to be cross compiled, if I understood it correctly.
I cared not to break anything of the usual stdenv in all this work.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18343
2009-11-14 09:11:30 +01:00
|
|
|
++ (optionals (cross != null) [binutilsCross])
|
2010-01-16 00:22:28 +01:00
|
|
|
++ (optionals langVhdl [gnat])
|
2009-05-10 11:11:41 +02:00
|
|
|
;
|
2008-06-26 12:20:33 +02:00
|
|
|
|
|
|
|
configureFlags = "
|
2008-06-27 20:26:19 +02:00
|
|
|
${if enableMultilib then "" else "--disable-multilib"}
|
2009-11-08 01:32:12 +01:00
|
|
|
${if enableShared then "" else "--disable-shared"}
|
2008-06-26 12:20:33 +02:00
|
|
|
--disable-libstdcxx-pch
|
|
|
|
--with-system-zlib
|
|
|
|
--enable-languages=${
|
|
|
|
concatStrings (intersperse ","
|
2008-06-27 16:43:25 +02:00
|
|
|
( optional langC "c"
|
|
|
|
++ optional langCC "c++"
|
|
|
|
++ optional langFortran "fortran"
|
2009-05-10 11:11:41 +02:00
|
|
|
++ optional langJava "java"
|
2008-06-27 16:43:25 +02:00
|
|
|
++ optional langTreelang "treelang"
|
2009-12-22 00:02:06 +01:00
|
|
|
++ optional langVhdl "vhdl"
|
2008-06-26 12:20:33 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
${if stdenv.isi686 then "--with-arch=i686" else ""}
|
2009-11-15 06:28:35 +01:00
|
|
|
${if cross != null then crossConfigureFlags else ""}
|
2008-06-26 12:20:33 +02:00
|
|
|
";
|
My first attempt at getting cross compilers in nixpkgs.
My idea is to provide special stdenv expressions that will contain in the path
additional cross compilers. As most expressions for programs accept a stdenv parameter,
we could substitute this parameter with the special stdenv, which will have a
generic builder that attempts the usual "--target=..." and can additionally
have an env variable like "cross" with the target architecture set.
So, finally we could have additional expressions like this:
bashRealArm = makeOverridable (import ../shells/bash) {
inherit fetchurl bison;
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
};
Meanwhile it does not work - I still cannot get the cross-gcc to build.
I think it does not fill the previous expressions with a lot of noise, so I
think it may be a good path to follow.
I only touched some files of the current stdenv: gcc-4.3, kernel headers
2.6.28, glibc 2.9, ...
I tried to use the gcc-cross-wrapper, that may be very outdated. Maybe I will
update it, or update the gcc-wrapper expression to make it fit the cross tools,
but meanwhile I even cannot build gcc, so I have not tested the wrapper.
This new idea on cross compiling is not similar to that of the
nixpkgs/branches/cross-compilation, which mostly added bare new expressions for
anything to be cross compiled, if I understood it correctly.
I cared not to break anything of the usual stdenv in all this work.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18343
2009-11-14 09:11:30 +01:00
|
|
|
#Above I added a hack on making the build different than the host.
|
|
|
|
|
|
|
|
# Needed for the cross compilation to work
|
|
|
|
AR = "ar";
|
|
|
|
LD = "ld";
|
|
|
|
CC = "gcc";
|
2008-06-26 12:20:33 +02:00
|
|
|
|
|
|
|
NIX_EXTRA_LDFLAGS = if staticCompiler then "-static" else "";
|
|
|
|
|
|
|
|
inherit gmp mpfr;
|
2008-06-27 20:26:19 +02:00
|
|
|
|
2010-01-27 17:29:11 +01:00
|
|
|
passthru = { inherit langC langCC langFortran langVhdl langTreelang
|
|
|
|
enableMultilib; };
|
2008-06-26 12:20:33 +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
|
|
|
|
2008-06-26 12:20:33 +02:00
|
|
|
meta = {
|
|
|
|
homepage = "http://gcc.gnu.org/";
|
|
|
|
license = "GPL/LGPL";
|
|
|
|
description = "GNU Compiler Collection, 4.3.x";
|
2010-01-16 00:22:28 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric ludo];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
2008-06-26 12:20:33 +02:00
|
|
|
};
|
2010-01-15 00:03:31 +01:00
|
|
|
|
2009-05-10 11:11:41 +02:00
|
|
|
} // (if langJava then {
|
|
|
|
postConfigure = ''
|
|
|
|
make configure-gcc
|
|
|
|
sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${zlib}/include@ ; s@^LDFLAGS = .*@& -L${zlib}/lib@'
|
|
|
|
sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${boehmgc}/include@ ; s@^LDFLAGS = .*@& -L${boehmgc}/lib -lgc@'
|
|
|
|
'';
|
2010-01-15 00:03:31 +01:00
|
|
|
} else {})
|
|
|
|
// (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";
|
2010-01-16 00:22:28 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
2010-01-15 00:03:31 +01:00
|
|
|
};
|
|
|
|
|
2009-05-10 11:11:41 +02:00
|
|
|
} else {}))
|