2011-05-04 12:22:56 +00:00
|
|
|
{ stdenv, fetchurl, noSysDirs, zlib, cross ? null, gold ? false, bison ? null, flex2535 ? null, bc ? null, dejagnu ? null }:
|
2004-03-09 17:16:02 +00:00
|
|
|
|
2009-12-05 14:28:17 +00:00
|
|
|
let
|
2011-09-01 17:38:05 +00:00
|
|
|
basename = "binutils-2.21.1a";
|
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 08:11:30 +00:00
|
|
|
in
|
2008-10-29 08:57:58 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2010-10-11 23:18:00 +00:00
|
|
|
name = basename + stdenv.lib.optionalString (cross != null) "-${cross.config}";
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2011-09-06 20:47:27 +00:00
|
|
|
# WARNING: Upstream made a mistake in packaging that may mean anyone
|
|
|
|
# but the FSF hosting this tarball is accidentally in violation of
|
|
|
|
# the GPL. We can't update binutils until the next stdenv-updates,
|
|
|
|
# so we are stuck with this version. The issue is discussed in
|
|
|
|
# this email: http://sourceware.org/ml/binutils/2011-08/msg00198.html
|
|
|
|
# The tarball for this minor version will not be fixed, as only the
|
|
|
|
# tarballs for the latest minor version of each major version will
|
|
|
|
# be repackaged. The fixed sources for the closest version to this one
|
|
|
|
# can be found at mirror://gnu/binutils/binutils-2.21.1a.tar.bz2
|
|
|
|
# or http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
|
|
|
|
# The sources missing from this tarball come from cgen. It is unclear
|
|
|
|
# WHICH sources should be included, but the cvs tree can be checked out
|
|
|
|
# by:
|
|
|
|
# cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
|
|
|
|
# {enter "anoncvs" as the password}
|
|
|
|
# cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co cgen
|
2003-11-03 10:22:00 +00:00
|
|
|
src = fetchurl {
|
2011-10-03 19:11:09 +00:00
|
|
|
url = "mirror://gnu/binutils/${basename}.tar.bz2";
|
2011-09-01 17:37:50 +00:00
|
|
|
sha256 = "0m7nmd7gc9d9md43wbrv65hz6lbi2crqwryzpigv19ray1lzmv6d";
|
2003-11-03 10:22:00 +00:00
|
|
|
};
|
2008-05-29 14:16:35 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Turn on --enable-new-dtags by default to make the linker set
|
|
|
|
# RUNPATH instead of RPATH on binaries. This is important because
|
|
|
|
# RUNPATH can be overriden using LD_LIBRARY_PATH at runtime.
|
|
|
|
./new-dtags.patch
|
2010-10-11 23:18:00 +00:00
|
|
|
];
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2011-05-04 12:22:56 +00:00
|
|
|
buildInputs =
|
|
|
|
[ zlib ]
|
|
|
|
++ stdenv.lib.optional gold [dejagnu flex2535 bison /* Some Gold tests require this: */ bc];
|
2010-12-12 23:35:16 +00:00
|
|
|
|
2004-03-29 17:23:01 +00:00
|
|
|
inherit noSysDirs;
|
2008-05-29 14:16:35 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# Clear the default library search path.
|
|
|
|
if test "$noSysDirs" = "1"; then
|
2009-11-08 00:32:12 +00:00
|
|
|
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
|
2008-05-29 14:16:35 +00:00
|
|
|
fi
|
2010-01-19 17:41:54 +00:00
|
|
|
|
|
|
|
# Use symlinks instead of hard links to save space ("strip" in the
|
|
|
|
# fixup phase strips each hard link separately).
|
|
|
|
for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in; do
|
|
|
|
substituteInPlace $i --replace 'ln ' 'ln -s '
|
|
|
|
done
|
2008-05-29 14:16:35 +00:00
|
|
|
'';
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2011-10-25 18:35:17 +00:00
|
|
|
# As binutils takes part in the stdenv building, we don't want references
|
|
|
|
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
|
|
|
|
NIX_LDFLAGS = "-static-libgcc";
|
|
|
|
|
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 08:11:30 +00:00
|
|
|
configureFlags = "--disable-werror" # needed for dietlibc build
|
2010-12-12 23:35:16 +00:00
|
|
|
+ stdenv.lib.optionalString (stdenv.system == "mips64-linux")
|
|
|
|
" --enable-fix-loongson2f-nop"
|
2011-05-04 10:03:46 +00:00
|
|
|
+ stdenv.lib.optionalString (cross != null) " --target=${cross.config}"
|
2011-05-04 12:22:56 +00:00
|
|
|
+ stdenv.lib.optionalString gold " --enable-gold";
|
2007-04-27 23:30:07 +00:00
|
|
|
|
|
|
|
meta = {
|
2008-10-29 08:57:58 +00:00
|
|
|
description = "GNU Binutils, tools for manipulating binaries (linker, assembler, etc.)";
|
|
|
|
|
2009-02-03 19:36:56 +00:00
|
|
|
longDescription = ''
|
|
|
|
The GNU Binutils are a collection of binary tools. The main
|
|
|
|
ones are `ld' (the GNU linker) and `as' (the GNU assembler).
|
|
|
|
They also include the BFD (Binary File Descriptor) library,
|
|
|
|
`gprof', `nm', `strip', etc.
|
|
|
|
'';
|
|
|
|
|
2008-10-29 08:57:58 +00:00
|
|
|
homepage = http://www.gnu.org/software/binutils/;
|
|
|
|
|
|
|
|
license = "GPLv3+";
|
2007-04-27 23:30:07 +00:00
|
|
|
|
|
|
|
/* Give binutils a lower priority than gcc-wrapper to prevent a
|
|
|
|
collision due to the ld/as wrappers/symlinks in the latter. */
|
|
|
|
priority = "10";
|
|
|
|
};
|
2003-11-03 10:22:00 +00:00
|
|
|
}
|