2016-11-20 16:55:28 +00:00
|
|
|
{ fetchurl, stdenv, fixDarwinDylibNames, gdb
|
|
|
|
, pkgconfig, gnupg
|
|
|
|
, xapian, gmime, talloc, zlib
|
|
|
|
, doxygen, perl
|
|
|
|
, pythonPackages
|
|
|
|
, bash-completion
|
|
|
|
, emacs
|
|
|
|
, ruby
|
|
|
|
, which, dtach, openssl, bash
|
2012-01-21 18:29:11 +00:00
|
|
|
}:
|
2011-02-13 01:34:49 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-01-29 16:17:53 +00:00
|
|
|
version = "0.23.5";
|
2016-08-02 07:59:41 +01:00
|
|
|
name = "notmuch-${version}";
|
2011-02-13 01:34:49 +00:00
|
|
|
|
2015-03-31 06:36:28 +01:00
|
|
|
passthru = {
|
|
|
|
pythonSourceRoot = "${name}/bindings/python";
|
2016-08-02 07:59:41 +01:00
|
|
|
inherit version;
|
2015-03-31 06:36:28 +01:00
|
|
|
};
|
|
|
|
|
2011-09-21 21:04:43 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://notmuchmail.org/releases/${name}.tar.gz";
|
2017-01-29 16:17:53 +00:00
|
|
|
sha256 = "0ry2k9sdwd1vw8cf6svch8wk98523s07mwxvsf7b8kghqnrr89n6";
|
2011-02-13 01:34:49 +00:00
|
|
|
};
|
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
buildInputs = [
|
|
|
|
pkgconfig gnupg # undefined dependencies
|
|
|
|
xapian gmime talloc zlib # dependencies described in INSTALL
|
|
|
|
doxygen perl # (optional) api docs
|
|
|
|
pythonPackages.sphinx pythonPackages.python # (optional) documentation -> doc/INSTALL
|
|
|
|
bash-completion # (optional) dependency to install bash completion
|
|
|
|
emacs # (optional) to byte compile emacs code
|
|
|
|
ruby # (optional) ruby bindings
|
|
|
|
which dtach openssl bash # test dependencies
|
|
|
|
]
|
2015-01-02 20:39:09 +00:00
|
|
|
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames
|
|
|
|
++ stdenv.lib.optional (!stdenv.isDarwin) gdb;
|
2011-04-18 18:19:44 +01:00
|
|
|
|
2016-11-20 20:33:49 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2016-11-20 16:55:28 +00:00
|
|
|
checkTarget = "test";
|
|
|
|
|
2011-04-18 18:19:44 +01:00
|
|
|
patchPhase = ''
|
2016-11-20 16:55:28 +00:00
|
|
|
# XXX: disabling few tests since i have no idea how to make them pass for now
|
|
|
|
rm -f test/T010-help-test.sh \
|
|
|
|
test/T350-crypto.sh \
|
|
|
|
test/T355-smime.sh
|
|
|
|
|
2014-10-17 17:24:27 +01:00
|
|
|
find test -type f -exec \
|
|
|
|
sed -i \
|
2016-11-20 16:55:28 +00:00
|
|
|
-e "1s|#!/usr/bin/env bash|#!${bash}/bin/bash|" \
|
|
|
|
-e "s|gpg |${gnupg}/bin/gpg2 |" \
|
|
|
|
-e "s| gpg| ${gnupg}/bin/gpg2|" \
|
|
|
|
-e "s|gpgsm |${gnupg}/bin/gpgsm |" \
|
|
|
|
-e "s| gpgsm| ${gnupg}/bin/gpgsm|" \
|
|
|
|
-e "s|crypto.gpg_path=gpg|crypto.gpg_path=${gnupg}/bin/gpg2|" \
|
2014-10-17 17:24:27 +01:00
|
|
|
"{}" ";"
|
2013-04-20 16:02:00 +01:00
|
|
|
|
|
|
|
for src in \
|
|
|
|
crypto.c \
|
2015-07-30 20:59:17 +01:00
|
|
|
notmuch-config.c \
|
2013-04-20 16:02:00 +01:00
|
|
|
emacs/notmuch-crypto.el
|
|
|
|
do
|
|
|
|
substituteInPlace "$src" \
|
|
|
|
--replace \"gpg\" \"${gnupg}/bin/gpg2\"
|
|
|
|
done
|
2011-04-18 18:19:44 +01:00
|
|
|
'';
|
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
preFixup = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
set -e
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
die() {
|
|
|
|
>&2 echo "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
prg="$out/bin/notmuch"
|
|
|
|
lib="$(find "$out/lib" -name 'libnotmuch.?.dylib')"
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
[[ -s "$prg" ]] || die "couldn't find notmuch binary"
|
|
|
|
[[ -s "$lib" ]] || die "couldn't find libnotmuch"
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
badname="$(otool -L "$prg" | awk '$1 ~ /libtalloc/ { print $1 }')"
|
|
|
|
goodname="$(find "${talloc}/lib" -name 'libtalloc.?.?.?.dylib')"
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
[[ -n "$badname" ]] || die "couldn't find libtalloc reference in binary"
|
|
|
|
[[ -n "$goodname" ]] || die "couldn't find libtalloc in nix store"
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
echo "fixing libtalloc link in $lib"
|
|
|
|
install_name_tool -change "$badname" "$goodname" "$lib"
|
2015-12-02 18:56:47 +00:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
echo "fixing libtalloc link in $prg"
|
|
|
|
install_name_tool -change "$badname" "$goodname" "$prg"
|
|
|
|
'';
|
2014-10-17 17:27:28 +01:00
|
|
|
|
2016-11-20 16:55:28 +00:00
|
|
|
postInstall = ''
|
|
|
|
make install-man
|
|
|
|
'';
|
2011-02-13 01:34:49 +00:00
|
|
|
|
|
|
|
meta = {
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "Mail indexer";
|
2011-11-20 21:49:06 +00:00
|
|
|
license = stdenv.lib.licenses.gpl3;
|
2013-02-19 03:46:47 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ chaoflow garbas ];
|
2015-12-02 18:56:47 +00:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2011-02-13 01:34:49 +00:00
|
|
|
};
|
|
|
|
}
|