From 5be78a1b0f33657b7ba4430e72f836908941b179 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 22 May 2023 13:41:51 +1000 Subject: [PATCH 1/3] minimal-bootstrap.gnutar: init at 1.12 --- .../linux/minimal-bootstrap/default.nix | 6 ++ .../minimal-bootstrap/gnutar/default.nix | 65 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 0fb708b1892..f02cd3790c6 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -34,6 +34,11 @@ lib.makeScope tinycc = tinycc-mes; }; + gnutar = callPackage ./gnutar { + bash = bash_2_05; + tinycc = tinycc-mes; + }; + ln-boot = callPackage ./ln-boot { }; mes = callPackage ./mes { }; @@ -53,6 +58,7 @@ lib.makeScope echo ${gawk.tests.get-version} echo ${gnugrep.tests.get-version} echo ${gnused.tests.get-version} + echo ${gnutar.tests.get-version} echo ${mes.compiler.tests.get-version} echo ${tinycc-mes.compiler.tests.chain} mkdir ''${out} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix new file mode 100644 index 00000000000..446f7109eda --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix @@ -0,0 +1,65 @@ +{ lib +, buildPlatform +, hostPlatform +, fetchurl +, bash +, tinycc +, gnumake +, gnused +, gnugrep +}: +let + pname = "gnutar"; + # >= 1.13 is incompatible with mes-libc + version = "1.12"; + + src = fetchurl { + url = "mirror://gnu/tar/tar-${version}.tar.gz"; + sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6"; + }; +in +bash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + tinycc.compiler + gnumake + gnused + gnugrep + ]; + + passthru.tests.get-version = result: + bash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/tar --version + mkdir $out + ''; + + meta = with lib; { + description = "GNU implementation of the `tar' archiver"; + homepage = "https://www.gnu.org/software/tar"; + license = licenses.gpl3Plus; + maintainers = teams.minimal-bootstrap.members; + mainProgram = "tar"; + platforms = platforms.unix; + }; +} '' + # Unpack + ungz --file ${src} --output tar.tar + untar --file tar.tar + rm tar.tar + cd tar-${version} + + # Configure + export CC="tcc -static -B ${tinycc.libs}/lib" + bash ./configure \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + --disable-nls \ + --prefix=$out + + # Build + make AR="tcc -ar" + + # Install + make install +'' From d8e94638d1082e9d8c78e2b548b26fef2d46638c Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 22 May 2023 14:02:16 +1000 Subject: [PATCH 2/3] minimal-bootstrap.gzip: init at 1.2.4 --- .../linux/minimal-bootstrap/default.nix | 6 ++ .../linux/minimal-bootstrap/gzip/default.nix | 58 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index f02cd3790c6..97ce4089ea9 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -39,6 +39,11 @@ lib.makeScope tinycc = tinycc-mes; }; + gzip = callPackage ./gzip { + bash = bash_2_05; + tinycc = tinycc-mes; + }; + ln-boot = callPackage ./ln-boot { }; mes = callPackage ./mes { }; @@ -59,6 +64,7 @@ lib.makeScope echo ${gnugrep.tests.get-version} echo ${gnused.tests.get-version} echo ${gnutar.tests.get-version} + echo ${gzip.tests.get-version} echo ${mes.compiler.tests.get-version} echo ${tinycc-mes.compiler.tests.chain} mkdir ''${out} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix new file mode 100644 index 00000000000..b02486b4d1e --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix @@ -0,0 +1,58 @@ +{ lib +, fetchurl +, bash +, tinycc +, gnumake +, gnused +, gnugrep +}: +let + pname = "gzip"; + version = "1.2.4"; + + src = fetchurl { + url = "mirror://gnu/gzip/gzip-${version}.tar.gz"; + sha256 = "0ryr5b00qz3xcdcv03qwjdfji8pasp0007ay3ppmk71wl8c1i90w"; + }; +in +bash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + tinycc.compiler + gnumake + gnused + gnugrep + ]; + + passthru.tests.get-version = result: + bash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/gzip --version + mkdir $out + ''; + + meta = with lib; { + description = "GNU zip compression program"; + homepage = "https://www.gnu.org/software/gzip"; + license = licenses.gpl3Plus; + maintainers = teams.minimal-bootstrap.members; + platforms = platforms.unix; + }; +} '' + # Unpack + ungz --file ${src} --output gzip.tar + untar --file gzip.tar + rm gzip.tar + cd gzip-${version} + + # Configure + export CC="tcc -static -B ${tinycc.libs}/lib -Dstrlwr=unused" + bash ./configure --prefix=$out + + # Build + make + + # Install + mkdir $out + make install +'' From 27cba6ca2e190acd655f2abd77a81c9ccfdbf383 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 22 May 2023 14:58:11 +1000 Subject: [PATCH 3/3] minimal-bootstrap.bzip2: init at 1.0.8 --- .../linux/minimal-bootstrap/bzip2/default.nix | 70 +++++++++++++++++++ .../linux/minimal-bootstrap/default.nix | 6 ++ 2 files changed, 76 insertions(+) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix new file mode 100644 index 00000000000..cce36a22950 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix @@ -0,0 +1,70 @@ +{ lib +, fetchurl +, bash +, tinycc +, gnumake +, gnupatch +, gzip +}: +let + pname = "bzip2"; + version = "1.0.8"; + + src = fetchurl { + url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz"; + sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb"; + }; + + patches = [ + # mes libc has no time support, so we remove that. + # It also does not have fch{own,mod}, which we don't care about in the bootstrap + # anyway, so we can null-op those calls. + (fetchurl { + url = "https://github.com/fosslinux/live-bootstrap/raw/87e9d7db9d22b400d1c05247254ac39ee2577e80/sysa/bzip2-1.0.8/patches/mes-libc.patch"; + sha256 = "14dciwib28h413skzfkh7samzh8x87dmwhldyxxphff04pvl1j3c"; + }) + ]; +in +bash.runCommand "${pname}-${version}" { + inherit pname version; + + nativeBuildInputs = [ + tinycc.compiler + gnumake + gnupatch + gzip + ]; + + passthru.tests.get-version = result: + bash.runCommand "${pname}-get-version-${version}" {} '' + ${result}/bin/bzip2 --version --help + mkdir $out + ''; + + meta = with lib; { + description = "High-quality data compression program"; + homepage = "https://www.sourceware.org/bzip2"; + license = licenses.bsdOriginal; + maintainers = teams.minimal-bootstrap.members; + platforms = platforms.unix; + }; +} '' + # Unpack + cp ${src} bzip2.tar.gz + gunzip bzip2.tar.gz + untar --file bzip2.tar + rm bzip2.tar + cd bzip2-${version} + + # Patch + ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} + + # Build + make \ + CC="tcc -static -B ${tinycc.libs}/lib -I ." \ + AR="tcc -ar" \ + bzip2 bzip2recover + + # Install + make install PREFIX=$out +'' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 97ce4089ea9..dad27cc927e 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -13,6 +13,11 @@ lib.makeScope bash_2_05 = callPackage ./bash/2.nix { tinycc = tinycc-mes; }; + bzip2 = callPackage ./bzip2 { + bash = bash_2_05; + tinycc = tinycc-mes; + }; + coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; gawk = callPackage ./gawk { @@ -60,6 +65,7 @@ lib.makeScope test = kaem.runCommand "minimal-bootstrap-test" {} '' echo ${bash_2_05.tests.get-version} + echo ${bzip2.tests.get-version} echo ${gawk.tests.get-version} echo ${gnugrep.tests.get-version} echo ${gnused.tests.get-version}