binutils: Modernize derivation

No hashes of any sort should be changed
This commit is contained in:
John Ericson 2017-06-03 20:28:05 -04:00
parent 0011f9065a
commit 200ac02d0f
2 changed files with 14 additions and 11 deletions

View File

@ -1,13 +1,17 @@
{ stdenv, fetchurl, noSysDirs, zlib { stdenv, buildPackages
, cross ? null, gold ? true, bison ? null , fetchurl, zlib
, buildPlatform, hostPlatform, targetPlatform
, noSysDirs, gold ? true, bison ? null
}: }:
let basename = "binutils-2.28"; in let
version = "2.28";
let inherit (stdenv.lib) optional optionals optionalString; in basename = "binutils-${version}";
inherit (stdenv.lib) optional optionals optionalString;
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = optionalString (cross != null) "${cross.config}-" + basename; name = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-" + basename;
src = fetchurl { src = fetchurl {
url = "mirror://gnu/binutils/${basename}.tar.bz2"; url = "mirror://gnu/binutils/${basename}.tar.bz2";
@ -42,9 +46,9 @@ stdenv.mkDerivation rec {
# TODO: all outputs on all platform # TODO: all outputs on all platform
outputs = [ "out" ] outputs = [ "out" ]
++ optional (cross == null && !stdenv.isDarwin) "lib" # problems in Darwin stdenv ++ optional (targetPlatform == hostPlatform && !hostPlatform.isDarwin) "lib" # problems in Darwin stdenv
++ [ "info" ] ++ [ "info" ]
++ optional (cross == null) "dev"; ++ optional (targetPlatform == hostPlatform) "dev";
nativeBuildInputs = [ bison ]; nativeBuildInputs = [ bison ];
buildInputs = [ zlib ]; buildInputs = [ zlib ];
@ -69,14 +73,14 @@ stdenv.mkDerivation rec {
# As binutils takes part in the stdenv building, we don't want references # 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) # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
NIX_CFLAGS_COMPILE = if stdenv.isDarwin NIX_CFLAGS_COMPILE = if hostPlatform.isDarwin
then "-Wno-string-plus-int -Wno-deprecated-declarations" then "-Wno-string-plus-int -Wno-deprecated-declarations"
else "-static-libgcc"; else "-static-libgcc";
configureFlags = configureFlags =
[ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ] [ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop" ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
++ optional (cross != null) "--target=${cross.config}" # TODO: make this unconditional ++ optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}" # TODO: make this unconditional
++ optionals gold [ "--enable-gold" "--enable-plugins" ] ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu"; ++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";

View File

@ -6535,7 +6535,6 @@ with pkgs;
binutils-raw = callPackage ../development/tools/misc/binutils { binutils-raw = callPackage ../development/tools/misc/binutils {
# FHS sys dirs presumably only have stuff for the build platform # FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (targetPlatform != buildPlatform) || noSysDirs; noSysDirs = (targetPlatform != buildPlatform) || noSysDirs;
cross = if targetPlatform != hostPlatform then targetPlatform else null;
}; };
binutils_nogold = lowPrio (binutils-raw.override { binutils_nogold = lowPrio (binutils-raw.override {