nixpkgs/pkgs/stdenv/linux/make-bootstrap-tools.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.0 KiB
Nix
Raw Normal View History

2024-08-03 00:19:37 +00:00
{
pkgs ? import ../../.. { },
}:
let
inherit (pkgs) lib stdenv config;
2024-08-03 00:19:37 +00:00
libc = pkgs.stdenv.cc.libc;
2024-08-03 00:19:37 +00:00
patchelf = pkgs.patchelf.overrideAttrs (previousAttrs: {
NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or [ ]) ++ [
"-static-libgcc"
"-static-libstdc++"
];
NIX_CFLAGS_LINK = (previousAttrs.NIX_CFLAGS_LINK or [ ]) ++ [
"-static-libgcc"
"-static-libstdc++"
];
});
in
rec {
coreutilsMinimal = pkgs.coreutils.override (args: {
# We want coreutils without ACL/attr support.
aclSupport = false;
attrSupport = false;
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
singleBinary = "symlinks";
});
tarMinimal = pkgs.gnutar.override { acl = null; };
busyboxMinimal = pkgs.busybox.override {
useMusl = lib.meta.availableOn stdenv.hostPlatform pkgs.musl;
enableStatic = true;
enableMinimal = true;
extraConfig = ''
CONFIG_ASH y
CONFIG_ASH_ECHO y
CONFIG_ASH_TEST y
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
CONFIG_MKDIR y
CONFIG_TAR y
CONFIG_UNXZ y
'';
};
bootGCC = pkgs.gcc.cc.override {
enableLTO = false;
isl = null;
};
2024-08-03 00:19:37 +00:00
bootBinutils = pkgs.binutils.bintools.override {
withAllTargets = false;
# Don't need two linkers, disable whatever's not primary/default.
2022-02-10 19:50:33 +00:00
enableGold = false;
# bootstrap is easier w/static
enableShared = false;
};
build = pkgs.callPackage ./stdenv-bootstrap-tools.nix {
2024-08-03 00:19:37 +00:00
inherit
bootBinutils
coreutilsMinimal
tarMinimal
busyboxMinimal
bootGCC
libc
patchelf
;
};
inherit (build) bootstrapFiles;
bootstrapTools = import ./bootstrap-tools {
inherit (stdenv.buildPlatform) system; # Used to determine where to build
inherit (stdenv.hostPlatform) libc;
inherit lib bootstrapFiles config;
};
test = pkgs.callPackage ./test-bootstrap-tools.nix {
inherit bootstrapTools;
inherit (bootstrapFiles) busybox;
};
}