@@ -1,11 +1,13 @@
11{ stdenv, lib, buildPackages
2−, fetchurl, zlib, autoreconfHook, gettext
2+, fetchFromGitHub, fetchurl, zlib, autoreconfHook, gettext
33# Enabling all targets increases output size to a multiple.
44, withAllTargets ? false, libbfd, libopcodes
55, enableShared ? true
66, noSysDirs
77, gold ? !stdenv.buildPlatform.isDarwin || stdenv.hostPlatform == stdenv.targetPlatform
88, bison ? null
9+, flex
10+, texinfo
911}:
1012
1113let
@@ -20,16 +22,23 @@ let
2022 # PATH to both be usable.
2123 targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
2224 "${stdenv.targetPlatform.config}-";
25+ vc4-binutils-src = fetchFromGitHub {
26+ owner = "itszor";
27+ repo = "binutils-vc4";
28+ rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
29+ sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
30+ };
31+ # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
32+ normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
33+ url = "mirror://gnu/binutils/${basename}.tar.bz2";
34+ sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
35+ });
2336in
2437
2538stdenv.mkDerivation {
2639 name = targetPrefix + basename;
2740
28− # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
29− src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
30− url = "mirror://gnu/binutils/${basename}.tar.bz2";
31− sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
32− });
41+ src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src;
3342
3443 patches = [
3544 # Make binutils output deterministic by default.
@@ -54,6 +63,8 @@ stdenv.mkDerivation {
5463 # cross-compiling.
5564 ./always-search-rpath.patch
5665
66+ ] ++ lib.optionals (!stdenv.targetPlatform.isVc4)
67+ [
5768 # https://sourceware.org/bugzilla/show_bug.cgi?id=22868
5869 ./gold-symbol-visibility.patch
5970
@@ -69,9 +80,9 @@ stdenv.mkDerivation {
6980 depsBuildBuild = [ buildPackages.stdenv.cc ];
7081 nativeBuildInputs = [
7182 bison
72− ] ++ lib.optionals stdenv.targetPlatform.isiOS [
83+ ] ++ (lib.optionals stdenv.targetPlatform.isiOS [
7384 autoreconfHook
74− ];
85+ ]) ++ lib.optionals stdenv.targetPlatform.isVc4 [ texinfo flex ];
7586 buildInputs = [ zlib gettext ];
7687
7788 inherit noSysDirs;