diff options
author | Emily Trau <emily@downunderctf.com> | 2023-05-20 12:34:43 +1000 |
---|---|---|
committer | Emily Trau <emily@downunderctf.com> | 2023-05-20 12:34:43 +1000 |
commit | cf25685c7cf4dbf15fe5f29a9b4a525898812b82 (patch) | |
tree | 63ed8ee31f1e4d43c10ebbbc6463b9e915256ed5 /pkgs/os-specific/linux/minimal-bootstrap | |
parent | 1362b2c8d6d82c435bc428292b5868c42e443ad9 (diff) | |
download | nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar.gz nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar.bz2 nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar.lz nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar.xz nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.tar.zst nixlib-cf25685c7cf4dbf15fe5f29a9b4a525898812b82.zip |
minimal-bootstrap.gnused: init at 4.0.9
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap')
-rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/default.nix | 10 | ||||
-rw-r--r-- | pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix | 64 |
2 files changed, 72 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index fb4a455a3e96..423f9e3f5651 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -15,9 +15,14 @@ lib.makeScope coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; + gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; + gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; }; - gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; + gnused = callPackage ./gnused { + bash = bash_2_05; + tinycc = tinycc-mes; + }; ln-boot = callPackage ./ln-boot { }; @@ -34,9 +39,10 @@ lib.makeScope inherit (callPackage ./utils.nix { }) fetchurl derivationWithMeta writeTextFile writeText; test = kaem.runCommand "minimal-bootstrap-test" {} '' + echo ${bash_2_05.tests.get-version} + echo ${gnused.tests.get-version} echo ${mes.compiler.tests.get-version} echo ${tinycc-mes.compiler.tests.chain} - echo ${bash_2_05.tests.get-version} mkdir ''${out} ''; }) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix new file mode 100644 index 000000000000..b6b1f9f198c7 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix @@ -0,0 +1,64 @@ +{ lib +, fetchurl +, bash +, tinycc +, gnumake +}: +let + pname = "gnused"; + # last version that can be compiled with mes-libc + version = "4.0.9"; + + src = fetchurl { + url = "mirror://gnu/sed/sed-${version}.tar.gz"; + sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3"; + }; + + # Thanks to the live-bootstrap project! + # See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem + makefile = fetchurl { + url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk"; + sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya"; + }; +in +bash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + tinycc.compiler + gnumake + ]; + + passthru.tests.get-version = result: + bash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/sed --version + mkdir ''${out} + ''; + + meta = with lib; { + description = "GNU sed, a batch stream editor"; + homepage = "https://www.gnu.org/software/sed"; + license = licenses.gpl3Plus; + maintainers = teams.minimal-bootstrap.members; + mainProgram = "sed"; + platforms = platforms.unix; + }; +} '' + # Unpack + ungz --file ${src} --output sed.tar + untar --file sed.tar + rm sed.tar + cd sed-${version} + + # Configure + cp ${makefile} Makefile + catm config.h + + # Build + make \ + CC="tcc -B ${tinycc.libs}/lib" \ + LIBC=mes + + # Install + make install PREFIX=$out +'' |