diff options
| author | Emily Trau <emily@downunderctf.com> | 2023-09-24 20:43:25 -0700 |
|---|---|---|
| committer | Emily Trau <emily@downunderctf.com> | 2023-09-26 22:20:35 -0700 |
| commit | a680950c8828624ddc71aadcf1e0ca20db544836 (patch) | |
| tree | 157c49c676c1dde147f15398d1bd917385bc847c | |
| parent | minimal-bootstrap.gnutar-musl: init at 1.12 (diff) | |
| download | nixpkgs-a680950c8828624ddc71aadcf1e0ca20db544836.tar.gz | |
minimal-bootstrap.coreutils-musl: init at 9.4
| -rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix | 74 | ||||
| -rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/default.nix | 7 |
2 files changed, 81 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix new file mode 100644 index 000000000000..dece020a5e79 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix @@ -0,0 +1,74 @@ +{ lib +, buildPlatform +, hostPlatform +, fetchurl +, bash +, tinycc +, gnumake +, gnugrep +, gnused +, gawk +, gnutar +, gzip +}: +let + pname = "coreutils"; + 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}" + # musl 1.1.x doesn't use 64bit time_t + "--disable-year2038" + # libstdbuf.so fails in static builds + "--enable-no-install-program=stdbuf" + ]; +in +bash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + tinycc.compiler + gnumake + gnused + gnugrep + gawk + gnutar + gzip + ]; + + passthru.tests.get-version = result: + bash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/cat --version + mkdir $out + ''; + + meta = with lib; { + description = "The GNU Core Utilities"; + homepage = "https://www.gnu.org/software/coreutils"; + license = licenses.gpl3Plus; + maintainers = teams.minimal-bootstrap.members; + platforms = platforms.unix; + }; +} '' + # Unpack + tar xzf ${src} + cd coreutils-${version} + + # Configure + export CC="tcc -B ${tinycc.libs}/lib" + export LD=tcc + bash ./configure ${lib.concatStringsSep " " configureFlags} + + # Build + make -j $NIX_BUILD_CORES AR="tcc -ar" MAKEINFO="true" + + # Install + make -j $NIX_BUILD_CORES install MAKEINFO="true" +'' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 94236777384f..d5346002a29f 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -32,6 +32,12 @@ lib.makeScope }; 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; + }; diffutils = callPackage ./diffutils { bash = bash_2_05; @@ -168,6 +174,7 @@ lib.makeScope 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} |
