binutils: add support for x86_64 in i686 builds (close #857)

Also some style refactoring around repeating "stdenv.lib.optional*".
The author of the idea is @errge.
This commit is contained in:
Vladimír Čunát 2013-09-02 15:54:12 +02:00
parent 9475e4d50a
commit c074433fc6
1 changed files with 15 additions and 11 deletions

View File

@ -3,8 +3,11 @@
, deterministic ? false }: , deterministic ? false }:
let basename = "binutils-2.23.2"; in let basename = "binutils-2.23.2"; in
with { inherit (stdenv.lib) optional optionals optionalString; };
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = basename + stdenv.lib.optionalString (cross != null) "-${cross.config}"; name = basename + optionalString (cross != null) "-${cross.config}";
src = fetchurl { src = fetchurl {
url = "mirror://gnu/binutils/${basename}.tar.bz2"; url = "mirror://gnu/binutils/${basename}.tar.bz2";
@ -21,11 +24,11 @@ stdenv.mkDerivation rec {
# That requires upstream changes for things to work. So we can patch it to # That requires upstream changes for things to work. So we can patch it to
# get the old behaviour by now. # get the old behaviour by now.
./dtneeded.patch ./dtneeded.patch
] ++ (stdenv.lib.optional deterministic ./deterministic.patch); ] ++ optional deterministic ./deterministic.patch;
buildInputs = buildInputs =
[ zlib ] [ zlib ]
++ stdenv.lib.optional gold bison; ++ optional gold bison;
inherit noSysDirs; inherit noSysDirs;
@ -46,12 +49,13 @@ stdenv.mkDerivation rec {
# to the bootstrap-tools libgcc (as uses to happen on arm/mips) # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
NIX_CFLAGS_COMPILE = "-static-libgcc"; NIX_CFLAGS_COMPILE = "-static-libgcc";
configureFlags = "--disable-werror" # needed for dietlibc build configureFlags = [ "--disable-werror" ] # needed for dietlibc build
+ stdenv.lib.optionalString (stdenv.system == "mips64el-linux") ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
" --enable-fix-loongson2f-nop" ++ optional (cross != null) "--target=${cross.config}"
+ stdenv.lib.optionalString (cross != null) " --target=${cross.config}" ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
+ stdenv.lib.optionalString gold " --enable-gold --enable-plugins" ++ optional deterministic "--enable-deterministic-archives"
+ stdenv.lib.optionalString deterministic " --enable-deterministic-archives"; ++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu"
;
enableParallelBuilding = true; enableParallelBuilding = true;