about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/minimal-bootstrap
diff options
context:
space:
mode:
authorEmily Trau <emily@downunderctf.com>2023-09-18 21:58:40 -0700
committerEmily Trau <emily@downunderctf.com>2023-09-26 22:20:34 -0700
commit4166e1fded92631a42efd5785a40fb83a9186d2a (patch)
tree0d234e6702923dc52ca390121a8821fb473dbb36 /pkgs/os-specific/linux/minimal-bootstrap
parent60ae6bf75109fb902dc67f45488f5c2ec13eaf8e (diff)
minimal-bootstrap.gawk: build with musl
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap')
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/default.nix11
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix26
2 files changed, 12 insertions, 25 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix
index 2d3eb43ddc5b8..9d14a60f74f98 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix
@@ -19,14 +19,12 @@ lib.makeScope
       bootBash = bash_2_05;
       gcc = gcc2;
       glibc = glibc22;
-      gawk = gawk-mes;
     };
 
     binutils = callPackage ./binutils {
       bash = bash_2_05;
       tinycc = tinycc-musl;
       musl = musl11;
-      gawk = gawk-mes;
     };
 
     bzip2 = callPackage ./bzip2 {
@@ -40,14 +38,12 @@ lib.makeScope
       bash = bash_2_05;
       tinycc = tinycc-musl;
       musl = musl11;
-      gawk = gawk-mes;
     };
 
     findutils = callPackage ./findutils {
       bash = bash_2_05;
       gcc = gcc2;
       glibc = glibc22;
-      gawk = gawk-mes;
     };
 
     gawk-mes = callPackage ./gawk/mes.nix {
@@ -58,8 +54,8 @@ lib.makeScope
 
     gawk = callPackage ./gawk {
       bash = bash_2_05;
-      gcc = gcc2;
-      glibc = glibc22;
+      tinycc = tinycc-musl;
+      musl = musl11;
       bootGawk = gawk-mes;
     };
 
@@ -77,13 +73,11 @@ lib.makeScope
     gcc46 = callPackage ./gcc/4.6.nix {
       gcc = gcc2;
       glibc = glibc22;
-      gawk = gawk-mes;
     };
 
     inherit (callPackage ./glibc {
       bash = bash_2_05;
       gnused = gnused-mes;
-      gawk = gawk-mes;
     }) glibc22;
 
     gnugrep = callPackage ./gnugrep {
@@ -156,7 +150,6 @@ lib.makeScope
     xz = callPackage ./xz {
       bash = bash_2_05;
       tinycc = tinycc-mes;
-      gawk = gawk-mes;
       inherit (heirloom) sed;
     };
 
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
index 935414f21760a..83a76c73b4ae5 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
@@ -3,10 +3,8 @@
 , hostPlatform
 , fetchurl
 , bash
-, gcc
-, glibc
-, binutils
-, linux-headers
+, tinycc
+, musl
 , gnumake
 , gnugrep
 , gnused
@@ -17,21 +15,18 @@
 let
   inherit (import ./common.nix { inherit lib; }) meta;
   pname = "gawk";
-  # >= 4.2.0 fails to cleanly build. may be worth investigating in the future.
-  # for now this version is sufficient to build glibc 2.16
-  version = "4.1.4";
+  version = "5.2.0";
 
   src = fetchurl {
     url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
-    sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc";
+    hash = "sha256-71r0RJywJp+vOvJL9MAic9RV8HQb88UPht3AkzLWz1Y=";
   };
 in
 bash.runCommand "${pname}-${version}" {
   inherit pname version meta;
 
   nativeBuildInputs = [
-    gcc
-    binutils
+    tinycc.compiler
     gnumake
     gnused
     gnugrep
@@ -51,18 +46,17 @@ bash.runCommand "${pname}-${version}" {
   cd gawk-${version}
 
   # Configure
-  export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include"
-  export LIBRARY_PATH="${glibc}/lib"
-  export LIBS="-lc -lnss_files -lnss_dns -lresolv"
+  export CC="tcc -B ${musl}/lib"
+  export AR="tcc -ar"
+  export LD=tcc
   bash ./configure \
     --prefix=$out \
     --build=${buildPlatform.config} \
     --host=${hostPlatform.config}
 
   # Build
-  make gawk
+  make
 
   # Install
-  install -D gawk $out/bin/gawk
-  ln -s gawk $out/bin/awk
+  make install
 ''