3
0
Fork 0
forked from mirrors/nixpkgs

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.
This commit is contained in:
Vladimír Čunát 2017-08-24 10:57:50 +02:00
parent 2fc7651b25
commit 8137a8cb73
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
2 changed files with 39 additions and 28 deletions

View file

@ -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

View file

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