mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-13 13:47:35 +00:00
binutils: inherit {build,host,target}Platform to avoid repeating ourselves
This commit is contained in:
parent
3436886724
commit
c4913fb289
@ -27,13 +27,10 @@ assert enableGold -> execFormatIsELF stdenv.targetPlatform;
|
||||
|
||||
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
reuseLibs = enableShared && withAllTargets;
|
||||
|
||||
version = "2.37";
|
||||
# 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}-";
|
||||
|
||||
srcs = {
|
||||
# HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
|
||||
@ -48,13 +45,17 @@ let
|
||||
sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
|
||||
};
|
||||
};
|
||||
|
||||
# The targetPrefix prepended to binary names to allow multiple binuntils on
|
||||
# the PATH to both be usable.
|
||||
targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = targetPrefix + "binutils";
|
||||
inherit version;
|
||||
|
||||
src = srcs.${stdenv.targetPlatform.system} or srcs.normal;
|
||||
src = srcs.${targetPlatform.system} or srcs.normal;
|
||||
|
||||
# WARN: this package is used for bootstrapping fetchurl, and thus cannot use
|
||||
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
|
||||
@ -74,7 +75,7 @@ stdenv.mkDerivation {
|
||||
# Remove on the next release
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=28138
|
||||
./fix-ld-descriptors.patch
|
||||
] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch
|
||||
] ++ lib.optional targetPlatform.isiOS ./support-ios.patch
|
||||
# This patch was suggested by Nick Clifton to fix
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=16177
|
||||
# It can be removed when that 7-year-old bug is closed.
|
||||
@ -82,8 +83,8 @@ stdenv.mkDerivation {
|
||||
# GHC will refuse to compile with a binutils suffering from it. See this
|
||||
# comment for more information:
|
||||
# https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
|
||||
++ lib.optional (stdenv.targetPlatform.isAarch32 && stdenv.hostPlatform.system != stdenv.targetPlatform.system) ./R_ARM_COPY.patch
|
||||
++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch;
|
||||
++ lib.optional (targetPlatform.isAarch32 && hostPlatform.system != targetPlatform.system) ./R_ARM_COPY.patch
|
||||
++ lib.optional targetPlatform.isWindows ./windres-locate-gcc.patch;
|
||||
|
||||
outputs = [ "out" "info" "man" ];
|
||||
|
||||
@ -92,9 +93,9 @@ stdenv.mkDerivation {
|
||||
bison
|
||||
perl
|
||||
texinfo
|
||||
] ++ (lib.optionals stdenv.targetPlatform.isiOS [
|
||||
] ++ (lib.optionals targetPlatform.isiOS [
|
||||
autoreconfHook
|
||||
]) ++ lib.optionals stdenv.targetPlatform.isVc4 [ flex ];
|
||||
]) ++ lib.optionals targetPlatform.isVc4 [ flex ];
|
||||
buildInputs = [ zlib gettext ];
|
||||
|
||||
inherit noSysDirs;
|
||||
@ -114,7 +115,7 @@ stdenv.mkDerivation {
|
||||
|
||||
# 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)
|
||||
NIX_CFLAGS_COMPILE = if stdenv.hostPlatform.isDarwin
|
||||
NIX_CFLAGS_COMPILE = if hostPlatform.isDarwin
|
||||
then "-Wno-string-plus-int -Wno-deprecated-declarations"
|
||||
else "-static-libgcc";
|
||||
|
||||
@ -161,7 +162,7 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
|
||||
# else fails with "./sanity.sh: line 36: $out/bin/size: not found"
|
||||
doInstallCheck = stdenv.buildPlatform == stdenv.hostPlatform && stdenv.hostPlatform == stdenv.targetPlatform;
|
||||
doInstallCheck = buildPlatform == hostPlatform && hostPlatform == targetPlatform;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user