minimal-bootstrap.coreutils-static: init at 9.4

This commit is contained in:
Emily Trau
2025-12-17 12:39:55 -05:00
committed by dish
parent f575f2e29d
commit b707bde4ea
5 changed files with 135 additions and 56 deletions
@@ -0,0 +1,10 @@
{ lib }:
{
meta = {
description = "The GNU Core Utilities";
homepage = "https://www.gnu.org/software/coreutils";
license = lib.licenses.gpl3Plus;
teams = [ lib.teams.minimal-bootstrap ];
platforms = lib.platforms.unix;
};
}
@@ -7,6 +7,7 @@
gnupatch,
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "bootstrap-coreutils";
version = "5.0";
@@ -73,21 +74,13 @@ let
in
kaem.runCommand "${pname}-${version}"
{
inherit pname version;
inherit pname version meta;
nativeBuildInputs = [
tinycc.compiler
gnumake
gnupatch
];
meta = {
description = "GNU Core Utilities";
homepage = "https://www.gnu.org/software/coreutils";
license = lib.licenses.gpl3Plus;
teams = [ lib.teams.minimal-bootstrap ];
platforms = lib.platforms.unix;
};
}
''
# Unpack
@@ -13,6 +13,7 @@
gzip,
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "bootstrap-coreutils-musl";
version = "9.4";
@@ -36,7 +37,7 @@ let
in
bash.runCommand "${pname}-${version}"
{
inherit pname version;
inherit pname version meta;
nativeBuildInputs = [
tinycc.compiler
@@ -54,14 +55,6 @@ bash.runCommand "${pname}-${version}"
${result}/bin/cat --version
mkdir $out
'';
meta = {
description = "GNU Core Utilities";
homepage = "https://www.gnu.org/software/coreutils";
license = lib.licenses.gpl3Plus;
teams = [ lib.teams.minimal-bootstrap ];
platforms = lib.platforms.unix;
};
}
''
# Unpack
@@ -0,0 +1,78 @@
{
lib,
buildPlatform,
hostPlatform,
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
gnugrep,
gawk,
diffutils,
findutils,
gnutar,
gzip,
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "coreutils-static";
version = "9.4";
src = fetchurl {
url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz";
hash = "sha256-X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
};
configureFlags = [
"--prefix=${placeholder "out"}"
"--build=${buildPlatform.config}"
"--host=${hostPlatform.config}"
# libstdbuf.so fails in static builds
"--enable-no-install-program=stdbuf"
"--enable-single-binary=symlinks"
"CC=musl-gcc"
"CFLAGS=-static"
];
in
bash.runCommand "${pname}-${version}"
{
inherit pname version meta;
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
gnugrep
gawk
diffutils
findutils
gnutar
gzip
];
passthru.tests.get-version =
result:
bash.runCommand "${pname}-get-version-${version}" { } ''
${result}/bin/coreutils --version
mkdir $out
'';
}
''
# Unpack
tar xzf ${src}
cd coreutils-${version}
# Configure
bash ./configure ${lib.concatStringsSep " " configureFlags}
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
''
@@ -52,13 +52,18 @@ lib.makeScope
gnutar = gnutar-musl;
};
coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
coreutils-musl = callPackage ./coreutils/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
coreutils-musl = callPackage ./coreutils/musl.nix {
bash = bash_2_05;
tinycc = tinycc-musl;
gnumake = gnumake-musl;
gnutar = gnutar-musl;
};
coreutils-static = callPackage ./coreutils/static.nix {
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
diffutils = callPackage ./diffutils {
bash = bash_2_05;
@@ -234,34 +239,34 @@ lib.makeScope
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
test = kaem.runCommand "minimal-bootstrap-test" { } ''
echo ${bash.tests.get-version}
echo ${bash_2_05.tests.get-version}
echo ${binutils.tests.get-version}
echo ${bzip2.tests.get-version}
echo ${coreutils-musl.tests.get-version}
echo ${diffutils.tests.get-version}
echo ${findutils.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc8.tests.hello-world}
echo ${gcc-latest.tests.hello-world}
echo ${gnugrep.tests.get-version}
echo ${gnused.tests.get-version}
echo ${gnused-mes.tests.get-version}
echo ${gnutar.tests.get-version}
echo ${gnutar-musl.tests.get-version}
echo ${gnutar-latest.tests.get-version}
echo ${gzip.tests.get-version}
echo ${heirloom.tests.get-version}
echo ${mes.compiler.tests.get-version}
echo ${musl.tests.hello-world}
echo ${tinycc-mes.compiler.tests.chain}
echo ${tinycc-musl.compiler.tests.hello-world}
echo ${xz.tests.get-version}
mkdir ''${out}
'';
}
)
test = kaem.runCommand "minimal-bootstrap-test" {} ''
echo ${bash.tests.get-version}
echo ${bash_2_05.tests.get-version}
echo ${binutils.tests.get-version}
echo ${bzip2.tests.get-version}
echo ${coreutils-musl.tests.get-version}
echo ${coreutils-static.tests.get-version}
echo ${diffutils.tests.get-version}
echo ${findutils.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc8.tests.hello-world}
echo ${gcc-latest.tests.hello-world}
echo ${gnugrep.tests.get-version}
echo ${gnused.tests.get-version}
echo ${gnused-mes.tests.get-version}
echo ${gnutar.tests.get-version}
echo ${gnutar-musl.tests.get-version}
echo ${gnutar-latest.tests.get-version}
echo ${gzip.tests.get-version}
echo ${heirloom.tests.get-version}
echo ${mes.compiler.tests.get-version}
echo ${musl.tests.hello-world}
echo ${tinycc-mes.compiler.tests.chain}
echo ${tinycc-musl.compiler.tests.hello-world}
echo ${xz.tests.get-version}
mkdir ''${out}
'';
})