about summary refs log tree commit diff
path: root/pkgs/tools/text/gawk/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/text/gawk/default.nix')
-rw-r--r--pkgs/tools/text/gawk/default.nix61
1 files changed, 35 insertions, 26 deletions
diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix
index 8857fa29d1c6..977a44fae2b8 100644
--- a/pkgs/tools/text/gawk/default.nix
+++ b/pkgs/tools/text/gawk/default.nix
@@ -1,29 +1,29 @@
 { lib, stdenv, fetchurl
+, removeReferencesTo
 , runtimeShellPackage
-# TODO: links -lsigsegv but loses the reference for some reason
-, withSigsegv ? (false && stdenv.hostPlatform.system != "x86_64-cygwin"), libsigsegv
+, texinfo
 , interactive ? false, readline
 , autoreconfHook # no-pma fix
 
 /* Test suite broke on:
-       stdenv.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1
-    || stdenv.isDarwin # XXX: `locale' segfaults
-    || stdenv.isSunOS  # XXX: `_backsmalls1' fails, locale stuff?
-    || stdenv.isFreeBSD
+       stdenv.hostPlatform.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1
+    || stdenv.hostPlatform.isDarwin # XXX: `locale' segfaults
+    || stdenv.hostPlatform.isSunOS  # XXX: `_backsmalls1' fails, locale stuff?
+    || stdenv.hostPlatform.isFreeBSD
 */
-, doCheck ? (interactive && stdenv.isLinux), glibcLocales ? null
+, doCheck ? (interactive && stdenv.hostPlatform.isLinux), glibcLocales ? null
 , locale ? null
 }:
 
-assert (doCheck && stdenv.isLinux) -> glibcLocales != null;
+assert (doCheck && stdenv.hostPlatform.isLinux) -> glibcLocales != null;
 
 stdenv.mkDerivation rec {
   pname = "gawk" + lib.optionalString interactive "-interactive";
-  version = "5.2.2";
+  version = "5.3.1";
 
   src = fetchurl {
     url = "mirror://gnu/gawk/gawk-${version}.tar.xz";
-    hash = "sha256-PB/OFEa0y+4c0nO9fsZLyH2J9hU3RxzT4F4zqWWiUOk=";
+    hash = "sha256-aU23ZIEqYjZCPU/0DOt7bExEEwG3KtUCu1wn4AzVb3g=";
   };
 
   # PIE is incompatible with the "persistent malloc" ("pma") feature.
@@ -36,18 +36,26 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "info" ]
     ++ lib.optional (!interactive) "man";
 
+  strictDeps = true;
+
   # no-pma fix
-  nativeBuildInputs = [ autoreconfHook ]
-    ++ lib.optional (doCheck && stdenv.isLinux) glibcLocales;
+  nativeBuildInputs = [
+    autoreconfHook
+    texinfo
+  ] ++ lib.optionals interactive [
+    removeReferencesTo
+  ] ++ lib.optionals (doCheck && stdenv.hostPlatform.isLinux) [
+    glibcLocales
+  ];
 
-  buildInputs = [
+  buildInputs = lib.optionals interactive [
     runtimeShellPackage
-  ] ++ lib.optional withSigsegv libsigsegv
-    ++ lib.optional interactive readline
-    ++ lib.optional stdenv.isDarwin locale;
+    readline
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+    locale
+  ];
 
   configureFlags = [
-    (if withSigsegv then "--with-libsigsegv-prefix=${libsigsegv}" else "--without-libsigsegv")
     (if interactive then "--with-readline=${readline.dev}" else "--without-readline")
   ];
 
@@ -57,16 +65,17 @@ stdenv.mkDerivation rec {
 
   inherit doCheck;
 
-  postInstall = ''
+  postInstall = (if interactive then ''
+    remove-references-to -t "$NIX_CC" "$out"/bin/gawkbug
+    patchShebangs --host "$out"/bin/gawkbug
+  '' else ''
+    rm "$out"/bin/gawkbug
+  '') + ''
     rm "$out"/bin/gawk-*
     ln -s gawk.1 "''${!outputMan}"/share/man/man1/awk.1
   '';
 
-  passthru = {
-    libsigsegv = if withSigsegv then libsigsegv else null; # for stdenv bootstrap
-  };
-
-  meta = with lib; {
+  meta = {
     homepage = "https://www.gnu.org/software/gawk/";
     description = "GNU implementation of the Awk programming language";
     longDescription = ''
@@ -82,9 +91,9 @@ stdenv.mkDerivation rec {
       makes it possible to handle many data-reformatting jobs with just a few
       lines of code.
     '';
-    license = licenses.gpl3Plus;
-    platforms = platforms.unix ++ platforms.windows;
-    maintainers = [ ];
+    license = lib.licenses.gpl3Plus;
+    platforms = lib.platforms.unix ++ lib.platforms.windows;
+    maintainers = lib.teams.helsinki-systems.members;
     mainProgram = "gawk";
   };
 }