binutils: Move patches in versioned dir

We'll have multiple binutils to contend with.
This commit is contained in:
Samuel Dionne-Riel 2020-11-09 17:47:50 -05:00
parent 46db711cda
commit dbe556af9c
12 changed files with 18 additions and 15 deletions

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = binutils-unwrapped.patches ++ [ patches = binutils-unwrapped.patches ++ [
../../tools/misc/binutils/build-components-separately.patch (binutils-unwrapped.patchesDir + "/build-components-separately.patch")
(fetchpatch { (fetchpatch {
url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch"; url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q"; sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";

View File

@ -10,7 +10,7 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = binutils-unwrapped.patches ++ [ patches = binutils-unwrapped.patches ++ [
../../tools/misc/binutils/build-components-separately.patch (binutils-unwrapped.patchesDir + "/build-components-separately.patch")
]; ];
# We just want to build libopcodes # We just want to build libopcodes

View File

@ -38,6 +38,7 @@ let
url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2"; url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2";
sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z"; sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
}); });
patchesDir = ./patches + "/${minorVersion}";
in in
stdenv.mkDerivation { stdenv.mkDerivation {
@ -48,18 +49,18 @@ stdenv.mkDerivation {
patches = [ patches = [
# Make binutils output deterministic by default. # Make binutils output deterministic by default.
./deterministic.patch "${patchesDir}/deterministic.patch"
# Bfd looks in BINDIR/../lib for some plugins that don't # Bfd looks in BINDIR/../lib for some plugins that don't
# exist. This is pointless (since users can't install plugins # exist. This is pointless (since users can't install plugins
# there) and causes a cycle between the lib and bin outputs, so # there) and causes a cycle between the lib and bin outputs, so
# get rid of it. # get rid of it.
./no-plugins.patch "${patchesDir}/no-plugins.patch"
# Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and # Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and
# elf32-littlearm-vxworks in favor of the first. # elf32-littlearm-vxworks in favor of the first.
# https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766 # https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766
./disambiguate-arm-targets.patch "${patchesDir}/disambiguate-arm-targets.patch"
# For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's # For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
# not clear why this behavior was decided upon but it has the unfortunate # not clear why this behavior was decided upon but it has the unfortunate
@ -67,19 +68,21 @@ stdenv.mkDerivation {
# shared objects when cross-compiling. Consequently, we are forced to # shared objects when cross-compiling. Consequently, we are forced to
# override this behavior, forcing ld to search DT_RPATH even when # override this behavior, forcing ld to search DT_RPATH even when
# cross-compiling. # cross-compiling.
./always-search-rpath.patch "${patchesDir}/always-search-rpath.patch"
]
] ++ lib.optionals (!stdenv.targetPlatform.isVc4) # For version 2.31 exclusively
[ ++ lib.optionals (!stdenv.targetPlatform.isVc4 && minorVersion == "2.31") [
# https://sourceware.org/bugzilla/show_bug.cgi?id=22868 # https://sourceware.org/bugzilla/show_bug.cgi?id=22868
./gold-symbol-visibility.patch ./patches/2.31/gold-symbol-visibility.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=23428 # https://sourceware.org/bugzilla/show_bug.cgi?id=23428
# un-break features so linking against musl doesn't produce crash-only binaries # un-break features so linking against musl doesn't produce crash-only binaries
./0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch ./patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
./0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch ./patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
./0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch ./patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch; ]
++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch
;
outputs = [ "out" "info" "man" ]; outputs = [ "out" "info" "man" ];
@ -149,7 +152,7 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
passthru = { passthru = {
inherit targetPrefix; inherit targetPrefix patchesDir;
}; };
meta = with lib; { meta = with lib; {