core/pkgs/by-name/bi/binutils/packages.nix

70 lines
2.5 KiB
Nix

{ lib, noSysDirs, ... }:
res: pkgs: super:
with pkgs;
{
# Here we select the default bintools implementations to be used. Note when
# cross compiling these are used not for this stage but the *next* stage.
# That is why we choose using this stage's target platform / next stage's
# host platform.
#
# Because this is the *next* stages choice, it's a bit non-modular to put
# here. In theory, bootstraping is supposed to not be a chain but at tree,
# where each stage supports many "successor" stages, like multiple possible
# futures. We don't have a better alternative, but with this downside in
# mind, please be judicious when using this attribute. E.g. for building
# things in *this* stage you should use probably `stdenv.cc.bintools` (from a
# default or alternate `stdenv`), at build time, and try not to "force" a
# specific bintools at runtime at all.
#
# In other words, try to only use this in wrappers, and only use those
# wrappers from the next stage.
bintools-unwrapped =
let
inherit (stdenv.targetPlatform) linker;
in
if linker == "lld" then llvmPackages.bintools-unwrapped
else if linker == "cctools" then darwin.binutils-unwrapped
else if linker == "bfd" then binutils-unwrapped
else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; }
else null;
bintoolsNoLibc = wrapBintoolsWith {
bintools = bintools-unwrapped;
libc = preLibcCrossHeaders;
};
bintools = wrapBintoolsWith {
bintools = bintools-unwrapped;
};
bintoolsDualAs = wrapBintoolsWith {
bintools = darwin.binutilsDualAs-unwrapped;
wrapGas = true;
};
binutils-unwrapped = callPackage ./. {
autoreconfHook = autoreconfHook269;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
};
binutils-unwrapped-all-targets = callPackage ./. {
autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
withAllTargets = true;
};
binutils = wrapBintoolsWith {
bintools = binutils-unwrapped;
};
binutils_nogold = lowPrio (wrapBintoolsWith {
bintools = binutils-unwrapped.override {
enableGold = false;
};
});
binutilsNoLibc = wrapBintoolsWith {
bintools = binutils-unwrapped;
libc = preLibcCrossHeaders;
};
libbfd = callPackage ./libbfd.nix { };
}