From 008ce6610abdeb4c8e42d2cad8f7e91f1fd193c5 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Thu, 10 Feb 2022 12:02:30 -0800 Subject: [PATCH] binutils: join srcs in an attrset --- .../tools/misc/binutils/default.nix | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 84043a583da6..24d8d1b52827 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -34,30 +34,31 @@ let reuseLibs = enableShared && withAllTargets; version = "2.37"; - basename = "binutils"; # The targetPrefix prepended to binary names to allow multiple binuntils on the # PATH to both be usable. targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) - "${stdenv.targetPlatform.config}-"; - vc4-binutils-src = fetchFromGitHub { - owner = "itszor"; - repo = "binutils-vc4"; - rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36"; - sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"; - }; + "${stdenv.targetPlatform.config}-"; - # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM - normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl { - url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2"; - sha256 = "sha256-Z/waQDDQjuh3pIZ9PcqzWCgUj4fh/QXabbWF7VoWa9Q="; - }); + srcs = { + # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM + normal = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl { + url = "mirror://gnu/binutils/binutils-${version}.tar.bz2"; + sha256 = "sha256-Z/waQDDQjuh3pIZ9PcqzWCgUj4fh/QXabbWF7VoWa9Q="; + }); + vc4-none = fetchFromGitHub { + owner = "itszor"; + repo = "binutils-vc4"; + rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36"; + sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"; + }; + }; in stdenv.mkDerivation { - pname = targetPrefix + basename; + pname = targetPrefix + "binutils"; inherit version; - src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src; + src = srcs.${stdenv.targetPlatform.system} or srcs.normal; patches = [ # Make binutils output deterministic by default.