From 8137a8cb73833432e8da8281663b56ac01d3ba0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Thu, 24 Aug 2017 10:57:50 +0200 Subject: [PATCH] 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. --- pkgs/stdenv/linux/default.nix | 5 ++- pkgs/tools/text/gawk/default.nix | 62 ++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 5c03d83d5f7b..48deb9a5c02c 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -303,7 +303,10 @@ in gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl ] # Library dependencies - ++ map getLib [ attr acl zlib pcre libsigsegv ] + ++ map getLib ( + [ attr acl zlib pcre ] + ++ lib.optional (gawk.libsigsegv != null) gawk.libsigsegv + ) # More complicated cases ++ [ glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix index dec7af045251..415a2ade28db 100644 --- a/pkgs/tools/text/gawk/default.nix +++ b/pkgs/tools/text/gawk/default.nix @@ -1,5 +1,19 @@ -{ stdenv, fetchurl, xz, libsigsegv, readline, interactive ? false -, locale ? null }: +{ 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; @@ -13,36 +27,30 @@ stdenv.mkDerivation rec { }; # When we do build separate interactive version, it makes sense to always include man. - outputs = [ "out" "info" ] ++ stdenv.lib.optional (!interactive) "man"; + outputs = [ "out" "info" ] ++ optional (!interactive) "man"; - # FIXME: 4.1.4 testsuite breaks when only C locales are available - doCheck = false /*!( - stdenv.isCygwin # XXX: `test-dup2' segfaults on Cygwin 6.1 - || stdenv.isDarwin # XXX: `locale' segfaults - || stdenv.isSunOS # XXX: `_backsmalls1' fails, locale stuff? - || stdenv.isFreeBSD - )*/; + nativeBuildInputs = optional (doCheck && stdenv.isLinux) glibcLocales; - nativeBuildInputs = [ xz.bin ]; buildInputs = - stdenv.lib.optional (stdenv.system != "x86_64-cygwin") libsigsegv - ++ stdenv.lib.optional interactive readline - ++ stdenv.lib.optional stdenv.isDarwin locale; + optional withSigsegv libsigsegv + ++ optional interactive readline + ++ optional stdenv.isDarwin locale; - configureFlags = stdenv.lib.optional (stdenv.system != "x86_64-cygwin") "--with-libsigsegv-prefix=${libsigsegv}" - ++ [(if interactive then "--with-readline=${readline.dev}" else "--without-readline")]; + configureFlags = [ + (if withSigsegv then "--with-libsigsegv-prefix=${libsigsegv}" else "--without-libsigsegv") + (if interactive then "--with-readline=${readline.dev}" else "--without-readline") + ]; - postInstall = - if interactive then - '' - rm "$out"/bin/gawk-* - ln -s gawk.1 "''${!outputMan}"/share/man/man1/awk.1 - '' - else # TODO: remove this other branch on a stdenv rebuild - '' - rm $out/bin/gawk-* - ln -s $man/share/man/man1/gawk.1 $man/share/man/man1/awk.1 - ''; + 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/;