1 { lib, stdenv, fetchurl
5 , interactive ? false, readline
6 , autoreconfHook # no-pma fix
8 /* Test suite broke on:
9 stdenv.hostPlatform.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1
10 || stdenv.hostPlatform.isDarwin # XXX: `locale' segfaults
11 || stdenv.hostPlatform.isSunOS # XXX: `_backsmalls1' fails, locale stuff?
12 || stdenv.hostPlatform.isFreeBSD
14 , doCheck ? (interactive && stdenv.hostPlatform.isLinux), glibcLocales ? null
18 assert (doCheck && stdenv.hostPlatform.isLinux) -> glibcLocales != null;
20 stdenv.mkDerivation rec {
21 pname = "gawk" + lib.optionalString interactive "-interactive";
25 url = "mirror://gnu/gawk/gawk-${version}.tar.xz";
26 hash = "sha256-aU23ZIEqYjZCPU/0DOt7bExEEwG3KtUCu1wn4AzVb3g=";
29 # PIE is incompatible with the "persistent malloc" ("pma") feature.
30 # While build system attempts to pass -no-pie to gcc. nixpkgs' `ld`
31 # wrapped still passes `-pie` flag to linker and breaks linkage.
32 # Let's disable "pie" until `ld` is fixed to do the right thing.
33 hardeningDisable = [ "pie" ];
35 # When we do build separate interactive version, it makes sense to always include man.
36 outputs = [ "out" "info" ]
37 ++ lib.optional (!interactive) "man";
45 ] ++ lib.optionals interactive [
47 ] ++ lib.optionals (doCheck && stdenv.hostPlatform.isLinux) [
51 buildInputs = lib.optionals interactive [
54 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
59 (if interactive then "--with-readline=${readline.dev}" else "--without-readline")
63 "AR=${stdenv.cc.targetPrefix}ar"
68 postInstall = (if interactive then ''
69 remove-references-to -t "$NIX_CC" "$out"/bin/gawkbug
70 patchShebangs --host "$out"/bin/gawkbug
75 ln -s gawk.1 "''${!outputMan}"/share/man/man1/awk.1
79 homepage = "https://www.gnu.org/software/gawk/";
80 description = "GNU implementation of the Awk programming language";
82 Many computer users need to manipulate text files: extract and then
83 operate on data from parts of certain lines while discarding the rest,
84 make changes in various text files wherever certain patterns appear,
85 and so on. To write a program to do these things in a language such as
86 C or Pascal is a time-consuming inconvenience that may take many lines
87 of code. The job is easy with awk, especially the GNU implementation:
90 The awk utility interprets a special-purpose programming language that
91 makes it possible to handle many data-reformatting jobs with just a few
94 license = lib.licenses.gpl3Plus;
95 platforms = lib.platforms.unix ++ lib.platforms.windows;
96 maintainers = lib.teams.helsinki-systems.members;