about summary refs log tree commit diff
path: root/pkgs/tools/text/gawk
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-12-23 22:17:07 +0000
committerSergei Trofimovich <slyich@gmail.com>2022-12-28 09:12:32 +0000
commit3fba3bf53f2412cc5e324c3ad19215c058de5617 (patch)
tree9b39b9a9055ffa411dbe1499cf03ef9977d71a62 /pkgs/tools/text/gawk
parentb10a520017ac319c1e57b07742efd2bcc918d160 (diff)
gawk: 5.1.1 -> 5.2.1
Had to pull in yet unreleased patch to avoid persistent memory alocator
on darwin as the hack in release relies on x86_64 emulation for aarch64
ports.

changelogs:
- 5.2.1: https://lists.gnu.org/archive/html/info-gnu/2022-11/msg00008.html
- 5.2.0: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00003.html
Diffstat (limited to 'pkgs/tools/text/gawk')
-rw-r--r--pkgs/tools/text/gawk/darwin-no-pma.patch31
-rw-r--r--pkgs/tools/text/gawk/default.nix15
2 files changed, 43 insertions, 3 deletions
diff --git a/pkgs/tools/text/gawk/darwin-no-pma.patch b/pkgs/tools/text/gawk/darwin-no-pma.patch
new file mode 100644
index 0000000000000..f198acd41af16
--- /dev/null
+++ b/pkgs/tools/text/gawk/darwin-no-pma.patch
@@ -0,0 +1,31 @@
+https://git.savannah.gnu.org/cgit/gawk.git/patch/?id=e0b7737930f8a677d3c509f8ce72b9130965ec0a
+--- a/m4/pma.m4
++++ b/m4/pma.m4
+@@ -23,15 +23,18 @@ then
+ 				[LDFLAGS="${LDFLAGS} -no-pie"
+ 				export LDFLAGS])
+ 			;;
+-		*darwin*)
+-			# 23 October 2022: See README_d/README.macosx for
+-			# the details on what's happening here. See also
+-			# the manual.
+-
+-			# Compile as Intel binary all the time, even on M1.
+-			CFLAGS="${CFLAGS} -arch x86_64"
+-			LDFLAGS="${LDFLAGS} -Xlinker -no_pie"
+-			export CFLAGS LDFLAGS
++ 		*darwin*)
++			# 27 November 2022: PMA only works on Intel.
++			case $host in
++			x86_64-*)
++				LDFLAGS="${LDFLAGS} -Xlinker -no_pie"
++				export LDFLAGS
++				;;
++			*)
++				# disable on all other macOS systems
++				use_persistent_malloc=no
++				;;
++			esac
+ 			;;
+ 		*cygwin* | *CYGWIN* | *solaris2.11* | freebsd13.* | openbsd7.* )
+ 			true	# nothing do, exes on these systems are not PIE
diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix
index 3f91a301fd1b4..f07da96aa48b7 100644
--- a/pkgs/tools/text/gawk/default.nix
+++ b/pkgs/tools/text/gawk/default.nix
@@ -2,6 +2,7 @@
 # TODO: links -lsigsegv but loses the reference for some reason
 , withSigsegv ? (false && stdenv.hostPlatform.system != "x86_64-cygwin"), libsigsegv
 , interactive ? false, readline
+, autoreconfHook # no-pma fix
 
 /* Test suite broke on:
        stdenv.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1
@@ -17,18 +18,26 @@ assert (doCheck && stdenv.isLinux) -> glibcLocales != null;
 
 stdenv.mkDerivation rec {
   pname = "gawk" + lib.optionalString interactive "-interactive";
-  version = "5.1.1";
+  version = "5.2.1";
 
   src = fetchurl {
     url = "mirror://gnu/gawk/gawk-${version}.tar.xz";
-    sha256 = "18kybw47fb1sdagav7aj95r9pp09r5gm202y3ahvwjw9dqw2jxnq";
+    hash = "sha256-ZzVTuR+eGMxXku1RB1341RDJBA9VCm904Jya3SQ6fk8=";
   };
 
+  patches = [
+    # Pull upstream fix for aarch64-darwin where pma does not work.
+    # Can be removed after next gawk release.
+    ./darwin-no-pma.patch
+  ];
+
   # When we do build separate interactive version, it makes sense to always include man.
   outputs = [ "out" "info" ]
     ++ lib.optional (!interactive) "man";
 
-  nativeBuildInputs = lib.optional (doCheck && stdenv.isLinux) glibcLocales;
+  nativeBuildInputs = lib.optional (doCheck && stdenv.isLinux) glibcLocales
+    # no-pma fix
+    ++ [ autoreconfHook ];
 
   buildInputs = lib.optional withSigsegv libsigsegv
     ++ lib.optional interactive readline