From 395cfc24a6f4b08cc1ef811cfd1bd58b2abd4a77 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 9 Oct 2023 21:14:13 -0700 Subject: [PATCH] minimal-bootstrap.gawk-static: init at 5.3.2 --- .../linux/minimal-bootstrap/default.nix | 16 +++- .../linux/minimal-bootstrap/gawk/static.nix | 73 +++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/gawk/static.nix diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 132ac09afbe1..f7607633618b 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -117,6 +117,7 @@ lib.makeScope # FIXME: not sure why new gawk doesn't work gawk = gawk-mes; }; + gcc46-cxx = callPackage ./gcc/4.6.cxx.nix { gcc = gcc46; gnumake = gnumake-musl; @@ -174,6 +175,7 @@ lib.makeScope tinycc = tinycc-musl; gnused = gnused-mes; }; + gnused-mes = callPackage ./gnused/mes.nix { bash = bash_2_05; tinycc = tinycc-bootstrappable; @@ -226,6 +228,7 @@ lib.makeScope ln-boot = callPackage ./ln-boot { }; mes = callPackage ./mes { }; + mes-libc = callPackage ./mes/libc.nix { }; musl11-intermediate = callPackage ./musl/1.1.nix { @@ -233,6 +236,7 @@ lib.makeScope tinycc = tinycc-mes; gnused = gnused-mes; }; + musl11 = callPackage ./musl/1.1.nix { bash = bash_2_05; tinycc = tinycc-musl-intermediate; @@ -260,7 +264,9 @@ lib.makeScope ; tinycc-bootstrappable = lib.recurseIntoAttrs (callPackage ./tinycc/bootstrappable.nix { }); + tinycc-mes = lib.recurseIntoAttrs (callPackage ./tinycc/mes.nix { }); + tinycc-musl-intermediate = lib.recurseIntoAttrs ( callPackage ./tinycc/musl.nix { bash = bash_2_05; @@ -268,6 +274,7 @@ lib.makeScope tinycc = tinycc-mes; } ); + tinycc-musl = lib.recurseIntoAttrs ( callPackage ./tinycc/musl.nix { bash = bash_2_05; @@ -276,6 +283,12 @@ lib.makeScope } ); + gawk-static = callPackage ./gawk/static.nix { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; + xz = callPackage ./xz { bash = bash_2_05; tinycc = tinycc-musl; @@ -303,8 +316,9 @@ lib.makeScope 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 ${gawk-mes.tests.get-version} + echo ${gawk-static.tests.get-version} echo ${gcc46.tests.get-version} echo ${gcc46-cxx.tests.hello-world} echo ${gcc8.tests.hello-world} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/static.nix new file mode 100644 index 000000000000..e468b9c3e704 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/static.nix @@ -0,0 +1,73 @@ +{ + 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 = "gawk-static"; + version = "5.3.2"; + + src = fetchurl { + url = "mirror://gnu/gawk/gawk-${version}.tar.gz"; + hash = "sha256-hjmhqI+0EaG+AmY3OdA+kCptMTtcb+Ak0L/rM0GhmhE="; + }; +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/awk --version + mkdir $out + ''; + } + '' + # Unpack + tar xf ${src} + cd gawk-${version} + + # Configure + bash ./configure \ + --prefix=$out \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + CC=musl-gcc \ + CFLAGS=-static + + # Build + make -j $NIX_BUILD_CORES + + # Install + make -j $NIX_BUILD_CORES install + rm $out/bin/gawkbug + ''