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/;