2013-06-25 09:53:37 +02:00
|
|
|
{ stdenv, fetchurl, noSysDirs, zlib
|
2013-09-09 10:34:37 +02:00
|
|
|
, cross ? null, gold ? true, bison ? null
|
2014-01-07 13:57:42 +01:00
|
|
|
}:
|
2004-03-09 18:16:02 +01:00
|
|
|
|
2013-09-11 09:25:10 +02:00
|
|
|
let basename = "binutils-2.23.1"; in
|
2013-09-02 15:54:12 +02:00
|
|
|
|
|
|
|
with { inherit (stdenv.lib) optional optionals optionalString; };
|
|
|
|
|
2012-03-12 16:34:00 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2013-09-02 15:54:12 +02:00
|
|
|
name = basename + optionalString (cross != null) "-${cross.config}";
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2003-11-03 11:22:00 +01:00
|
|
|
src = fetchurl {
|
2011-10-03 21:11:09 +02:00
|
|
|
url = "mirror://gnu/binutils/${basename}.tar.bz2";
|
2013-09-11 09:25:10 +02:00
|
|
|
sha256 = "06bs5v5ndb4g5qx96d52lc818gkbskd1m0sz57314v887sqfbcia";
|
2003-11-03 11:22:00 +01:00
|
|
|
};
|
2008-05-29 16:16:35 +02: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
|
2012-12-20 16:20:23 +01:00
|
|
|
|
|
|
|
# Since binutils 2.22, DT_NEEDED flags aren't copied for dynamic outputs.
|
|
|
|
# That requires upstream changes for things to work. So we can patch it to
|
|
|
|
# get the old behaviour by now.
|
|
|
|
./dtneeded.patch
|
2014-01-07 13:57:42 +01:00
|
|
|
|
|
|
|
# Make binutils output deterministic by default.
|
|
|
|
./deterministic.patch
|
|
|
|
];
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2011-05-04 14:22:56 +02:00
|
|
|
buildInputs =
|
|
|
|
[ zlib ]
|
2013-09-02 15:54:12 +02:00
|
|
|
++ optional gold bison;
|
2010-12-13 00:35:16 +01:00
|
|
|
|
2004-03-29 19:23:01 +02:00
|
|
|
inherit noSysDirs;
|
2008-05-29 16:16:35 +02:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# Clear the default library search path.
|
|
|
|
if test "$noSysDirs" = "1"; then
|
2013-09-02 15:54:12 +02:00
|
|
|
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
|
2008-05-29 16:16:35 +02:00
|
|
|
fi
|
2010-01-19 18:41:54 +01:00
|
|
|
|
|
|
|
# Use symlinks instead of hard links to save space ("strip" in the
|
|
|
|
# fixup phase strips each hard link separately).
|
2014-01-07 14:55:55 +01:00
|
|
|
for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in gold/Makefile.in; do
|
2012-01-19 16:02:47 +01:00
|
|
|
sed -i "$i" -e 's|ln |ln -s |'
|
2010-01-19 18:41:54 +01:00
|
|
|
done
|
2008-05-29 16:16:35 +02:00
|
|
|
'';
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2011-10-25 20:35:17 +02: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)
|
2011-10-25 20:52:32 +02:00
|
|
|
NIX_CFLAGS_COMPILE = "-static-libgcc";
|
2011-10-25 20:35:17 +02:00
|
|
|
|
2014-01-07 13:57:42 +01:00
|
|
|
configureFlags =
|
|
|
|
[ "--enable-deterministic-archives" ]
|
2013-09-02 15:54:12 +02:00
|
|
|
++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
|
|
|
|
++ optional (cross != null) "--target=${cross.config}"
|
|
|
|
++ optionals gold [ "--enable-gold" "--enable-plugins" ]
|
2014-01-07 13:57:42 +01:00
|
|
|
++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";
|
2007-04-28 01:30:07 +02:00
|
|
|
|
2011-12-14 15:31:56 +01:00
|
|
|
enableParallelBuilding = true;
|
2013-09-02 15:54:12 +02:00
|
|
|
|
2007-04-28 01:30:07 +02:00
|
|
|
meta = {
|
2008-10-29 09:57:58 +01:00
|
|
|
description = "GNU Binutils, tools for manipulating binaries (linker, assembler, etc.)";
|
|
|
|
|
2009-02-03 20:36:56 +01: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 09:57:58 +01:00
|
|
|
homepage = http://www.gnu.org/software/binutils/;
|
|
|
|
|
|
|
|
license = "GPLv3+";
|
2007-04-28 01:30:07 +02: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";
|
|
|
|
};
|
2012-03-12 16:34:00 +01:00
|
|
|
}
|