2024-08-03 00:19:37 +00:00
|
|
|
{
|
|
|
|
pkgs ? import ../../.. { },
|
|
|
|
}:
|
2007-12-03 15:40:29 +00:00
|
|
|
|
2017-06-26 20:56:03 +00:00
|
|
|
let
|
2024-07-28 00:51:59 +00:00
|
|
|
inherit (pkgs) lib stdenv config;
|
2024-08-03 00:19:37 +00:00
|
|
|
|
2018-02-06 00:12:47 +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++"
|
|
|
|
];
|
2023-04-02 12:10:51 +00:00
|
|
|
});
|
2024-07-28 00:51:59 +00:00
|
|
|
in
|
|
|
|
rec {
|
|
|
|
coreutilsMinimal = pkgs.coreutils.override (args: {
|
2017-01-04 22:46:34 +00:00
|
|
|
# We want coreutils without ACL/attr support.
|
2009-01-30 09:27:15 +00:00
|
|
|
aclSupport = false;
|
2017-01-04 22:46:34 +00:00
|
|
|
attrSupport = false;
|
2016-06-28 07:48:56 +00:00
|
|
|
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
|
|
|
|
singleBinary = "symlinks";
|
2009-01-30 09:27:15 +00:00
|
|
|
});
|
|
|
|
|
2024-07-28 00:51:59 +00:00
|
|
|
tarMinimal = pkgs.gnutar.override { acl = null; };
|
2016-04-17 21:55:17 +00:00
|
|
|
|
2024-07-28 00:51:59 +00:00
|
|
|
busyboxMinimal = pkgs.busybox.override {
|
|
|
|
useMusl = lib.meta.availableOn stdenv.hostPlatform pkgs.musl;
|
2014-10-29 12:36:03 +00:00
|
|
|
enableStatic = true;
|
|
|
|
enableMinimal = true;
|
2010-08-21 12:50:49 +00:00
|
|
|
extraConfig = ''
|
|
|
|
CONFIG_ASH y
|
2017-08-14 14:41:48 +00:00
|
|
|
CONFIG_ASH_ECHO y
|
|
|
|
CONFIG_ASH_TEST y
|
2014-10-29 12:36:03 +00:00
|
|
|
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
2010-08-21 12:50:49 +00:00
|
|
|
CONFIG_MKDIR y
|
2014-10-29 12:36:03 +00:00
|
|
|
CONFIG_TAR y
|
|
|
|
CONFIG_UNXZ y
|
2010-08-21 12:50:49 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-24 09:21:59 +00:00
|
|
|
bootGCC = pkgs.gcc.cc.override {
|
|
|
|
enableLTO = false;
|
|
|
|
isl = null;
|
|
|
|
};
|
2024-08-03 00:19:37 +00:00
|
|
|
|
2024-07-28 00:51:59 +00:00
|
|
|
bootBinutils = pkgs.binutils.bintools.override {
|
2018-12-31 19:56:07 +00:00
|
|
|
withAllTargets = false;
|
|
|
|
# Don't need two linkers, disable whatever's not primary/default.
|
2022-02-10 19:50:33 +00:00
|
|
|
enableGold = false;
|
2018-12-31 19:56:07 +00:00
|
|
|
# bootstrap is easier w/static
|
|
|
|
enableShared = false;
|
|
|
|
};
|
2018-03-06 16:15:05 +00:00
|
|
|
|
2024-07-28 00:51:59 +00:00
|
|
|
build = pkgs.callPackage ./stdenv-bootstrap-tools.nix {
|
2024-08-03 00:19:37 +00:00
|
|
|
inherit
|
|
|
|
bootBinutils
|
|
|
|
coreutilsMinimal
|
|
|
|
tarMinimal
|
|
|
|
busyboxMinimal
|
|
|
|
bootGCC
|
|
|
|
libc
|
|
|
|
patchelf
|
|
|
|
;
|
2024-07-27 19:52:31 +00:00
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2024-07-27 20:02:16 +00:00
|
|
|
inherit (build) bootstrapFiles;
|
2016-03-03 12:46:21 +00:00
|
|
|
|
2024-08-03 00:16:29 +00:00
|
|
|
bootstrapTools = import ./bootstrap-tools {
|
|
|
|
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
|
|
|
inherit (stdenv.hostPlatform) libc;
|
|
|
|
inherit lib bootstrapFiles config;
|
|
|
|
};
|
2016-03-03 12:46:21 +00:00
|
|
|
|
2024-07-28 00:51:59 +00:00
|
|
|
test = pkgs.callPackage ./test-bootstrap-tools.nix {
|
2024-07-27 19:58:16 +00:00
|
|
|
inherit bootstrapTools;
|
|
|
|
inherit (bootstrapFiles) busybox;
|
2016-03-03 12:46:21 +00:00
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
}
|