2024-08-03 01:19:37 +01:00
|
|
|
{
|
|
|
|
pkgs ? import ../../.. { },
|
|
|
|
}:
|
2007-12-03 15:40:29 +00:00
|
|
|
|
2017-06-26 21:56:03 +01:00
|
|
|
let
|
2024-07-28 01:51:59 +01:00
|
|
|
inherit (pkgs) lib stdenv config;
|
2024-08-03 01:19:37 +01:00
|
|
|
|
2018-02-06 00:12:47 +00:00
|
|
|
libc = pkgs.stdenv.cc.libc;
|
2024-08-03 01:19:37 +01: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 13:10:51 +01:00
|
|
|
});
|
2024-07-28 01:51:59 +01: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 08:48:56 +01: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 01:51:59 +01:00
|
|
|
tarMinimal = pkgs.gnutar.override { acl = null; };
|
2016-04-17 22:55:17 +01:00
|
|
|
|
2024-07-28 01:51:59 +01: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 13:50:49 +01:00
|
|
|
extraConfig = ''
|
|
|
|
CONFIG_ASH y
|
2017-08-14 15:41:48 +01: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 13:50:49 +01:00
|
|
|
CONFIG_MKDIR y
|
2014-10-29 12:36:03 +00:00
|
|
|
CONFIG_TAR y
|
|
|
|
CONFIG_UNXZ y
|
2010-08-21 13:50:49 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-24 10:21:59 +01:00
|
|
|
bootGCC = pkgs.gcc.cc.override {
|
|
|
|
enableLTO = false;
|
|
|
|
isl = null;
|
|
|
|
};
|
2024-08-03 01:19:37 +01:00
|
|
|
|
2024-07-28 01:51:59 +01: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 01:51:59 +01:00
|
|
|
build = pkgs.callPackage ./stdenv-bootstrap-tools.nix {
|
2024-08-03 01:19:37 +01:00
|
|
|
inherit
|
|
|
|
bootBinutils
|
|
|
|
coreutilsMinimal
|
|
|
|
tarMinimal
|
|
|
|
busyboxMinimal
|
|
|
|
bootGCC
|
|
|
|
libc
|
|
|
|
patchelf
|
|
|
|
;
|
2024-07-27 20:52:31 +01:00
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2024-07-27 21:02:16 +01:00
|
|
|
inherit (build) bootstrapFiles;
|
2016-03-03 12:46:21 +00:00
|
|
|
|
2024-08-03 01:16:29 +01: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 01:51:59 +01:00
|
|
|
test = pkgs.callPackage ./test-bootstrap-tools.nix {
|
2024-07-27 20:58:16 +01:00
|
|
|
inherit bootstrapTools;
|
|
|
|
inherit (bootstrapFiles) busybox;
|
2016-03-03 12:46:21 +00:00
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
}
|