summary refs log tree commit diff
path: root/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix')
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
new file mode 100644
index 00000000000..879b98bf00c
--- /dev/null
+++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
@@ -0,0 +1,61 @@
+{ lib
+, buildPlatform
+, hostPlatform
+, fetchurl
+, bash
+, tinycc
+, gnumake
+, gnugrep
+, gnused
+, gnutar
+, gzip
+, bootGawk
+}:
+let
+  inherit (import ./common.nix { inherit lib; }) meta;
+  pname = "gawk";
+  version = "5.2.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
+    hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
+  };
+in
+bash.runCommand "${pname}-${version}" {
+  inherit pname version meta;
+
+  nativeBuildInputs = [
+    tinycc.compiler
+    gnumake
+    gnused
+    gnugrep
+    gnutar
+    gzip
+    bootGawk
+  ];
+
+  passthru.tests.get-version = result:
+    bash.runCommand "${pname}-get-version-${version}" {} ''
+      ${result}/bin/awk --version
+      mkdir $out
+    '';
+} ''
+  # Unpack
+  tar xzf ${src}
+  cd gawk-${version}
+
+  # Configure
+  export CC="tcc -B ${tinycc.libs}/lib"
+  export AR="tcc -ar"
+  export LD=tcc
+  bash ./configure \
+    --prefix=$out \
+    --build=${buildPlatform.config} \
+    --host=${hostPlatform.config}
+
+  # Build
+  make -j $NIX_BUILD_CORES
+
+  # Install
+  make -j $NIX_BUILD_CORES install
+''