mailutils: use checkInputs, make tests run, but disable, also cleanup

This commit is contained in:
Jan Malakhovski 2018-08-08 21:37:29 +00:00
parent 99974ea930
commit e745d7976e

View File

@ -2,9 +2,7 @@
, gdbm, pam, readline, ncurses, gnutls, guile, texinfo, gnum4, sasl, fribidi, nettools
, python, gss, mysql, sendmailPath ? "/run/wrappers/bin/sendmail" }:
let
p = "https://raw.githubusercontent.com/gentoo/gentoo/9c921e89d51876fd876f250324893fd90c019326/net-mail/mailutils/files";
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
name = "${project}-${version}";
project = "mailutils";
version = "3.2";
@ -14,9 +12,21 @@ in stdenv.mkDerivation rec {
sha256 = "0zh7xn8yvnw9zkc7gi5290i34viwxp1rn0g1q9nyvmckkvk59lwn";
};
postPatch = ''
sed -i -e '/chown root:mail/d' \
-e 's/chmod [24]755/chmod 0755/' \
*/Makefile{.in,.am}
sed -i 's:/usr/lib/mysql:${mysql.connector-c}/lib/mysql:' configure.ac
sed -i 's/0\.18/0.19/' configure.ac
sed -i -e 's:mysql/mysql.h:mysql.h:' \
-e 's:mysql/errmsg.h:errmsg.h:' \
sql/mysql.c
'';
nativeBuildInputs = [
autoreconfHook gettext pkgconfig
] ++ stdenv.lib.optional doCheck dejagnu;
];
buildInputs = [
gdbm pam readline ncurses gnutls guile texinfo gnum4 sasl fribidi nettools
gss mysql.connector-c python
@ -33,7 +43,6 @@ in stdenv.mkDerivation rec {
./path-to-cat.patch
];
doCheck = true;
enableParallelBuilding = false;
hardeningDisable = [ "format" ];
@ -44,26 +53,21 @@ in stdenv.mkDerivation rec {
"--with-path-sendmail=${sendmailPath}"
];
readmsg-tests = stdenv.lib.optionals doCheck [
readmsg-tests = let
p = "https://raw.githubusercontent.com/gentoo/gentoo/9c921e89d51876fd876f250324893fd90c019326/net-mail/mailutils/files";
in [
(fetchurl { url = "${p}/hdr.at"; sha256 = "0phpkqyhs26chn63wjns6ydx9468ng3ssbjbfhcvza8h78jlsd98"; })
(fetchurl { url = "${p}/nohdr.at"; sha256 = "1vkbkfkbqj6ml62s1am8i286hxwnpsmbhbnq0i2i0j1i7iwkk4b7"; })
(fetchurl { url = "${p}/twomsg.at"; sha256 = "15m29rg2xxa17xhx6jp4s2vwa9d4khw8092vpygqbwlhw68alk9g"; })
(fetchurl { url = "${p}/weed.at"; sha256 = "1101xakhc99f5gb9cs3mmydn43ayli7b270pzbvh7f9rbvh0d0nh"; })
];
postPatch = ''
sed -i -e '/chown root:mail/d' \
-e 's/chmod [24]755/chmod 0755/' \
*/Makefile{.in,.am}
sed -i 's:/usr/lib/mysql:${mysql.connector-c}/lib/mysql:' configure.ac
sed -i 's/0\.18/0.19/' configure.ac
sed -i -e 's:mysql/mysql.h:mysql.h:' \
-e 's:mysql/errmsg.h:errmsg.h:' \
sql/mysql.c
'';
NIX_CFLAGS_COMPILE = "-L${mysql.connector-c}/lib/mysql -I${mysql.connector-c}/include/mysql";
checkInputs = [ dejagnu ];
doCheck = false; # fails 1 out of a bunch of tests, looks like a bug
doInstallCheck = false; # fails
preCheck = ''
# Add missing test files
cp ${builtins.toString readmsg-tests} readmsg/tests/
@ -79,6 +83,7 @@ in stdenv.mkDerivation rec {
# Provide libraries for mhn.
export LD_LIBRARY_PATH=$(pwd)/lib/.libs
'';
postCheck = ''
unset LD_LIBRARY_PATH
'';