nixpkgs/pkgs/tools/text/gawk/default.nix
Vladimír Čunát 8137a8cb73
gawk: refactor
- Don't build with libsigsegv by default.  The build apparently attempted
  to link against it, but it never retained the reference anyway...
- Side effect: stdenv bootstrapping needs no libsigsegv anymore.
- Run checks, but only in the interactive gawk by default on Linux,
  so that stdenv bootstrap isn't slowed down (by glibc locales, etc.).
- xz should be no longer needed in inputs, as we have it in stdenvs now.

The whole change was triggered by some used kernel versions still
breaking libsigsegv tests #28464.
2017-08-24 11:06:53 +02:00

81 lines
2.5 KiB
Nix

{ stdenv, fetchurl
# TODO: links -lsigsegv but loses the reference for some reason
, withSigsegv ? (false && stdenv.system != "x86_64-cygwin"), libsigsegv
, interactive ? false, readline
/* 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
*/
, doCheck ? (interactive && stdenv.isLinux), glibcLocales ? null
, locale ? null
}:
assert (doCheck && stdenv.isLinux) -> glibcLocales != null;
let
inherit (stdenv.lib) optional;
in
stdenv.mkDerivation rec {
name = "gawk-4.1.4";
src = fetchurl {
url = "mirror://gnu/gawk/${name}.tar.xz";
sha256 = "0rn2mmjxm767zliqzd67j7h2ncjn4j0321c60y9fy3grs3i89qak";
};
# When we do build separate interactive version, it makes sense to always include man.
outputs = [ "out" "info" ] ++ optional (!interactive) "man";
nativeBuildInputs = optional (doCheck && stdenv.isLinux) glibcLocales;
buildInputs =
optional withSigsegv libsigsegv
++ optional interactive readline
++ optional stdenv.isDarwin locale;
configureFlags = [
(if withSigsegv then "--with-libsigsegv-prefix=${libsigsegv}" else "--without-libsigsegv")
(if interactive then "--with-readline=${readline.dev}" else "--without-readline")
];
inherit doCheck;
postInstall = ''
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 stdenv.lib; {
homepage = http://www.gnu.org/software/gawk/;
description = "GNU implementation of the Awk programming language";
longDescription = ''
Many computer users need to manipulate text files: extract and then
operate on data from parts of certain lines while discarding the rest,
make changes in various text files wherever certain patterns appear,
and so on. To write a program to do these things in a language such as
C or Pascal is a time-consuming inconvenience that may take many lines
of code. The job is easy with awk, especially the GNU implementation:
Gawk.
The awk utility interprets a special-purpose programming language that
makes it possible to handle many data-reformatting jobs with just a few
lines of code.
'';
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = [ ];
};
}