@@ -1,4 +1,4 @@
1−{ fetchurl, stdenv, fixDarwinDylibNames
1+{ fetchurl, stdenv
22, pkgconfig, gnupg
33, xapian, gmime, talloc, zlib
44, doxygen, perl
@@ -34,18 +34,11 @@ stdenv.mkDerivation rec {
3434 bash-completion # (optional) dependency to install bash completion
3535 emacs # (optional) to byte compile emacs code, also needed for tests
3636 ruby # (optional) ruby bindings
37− which dtach openssl bash # test dependencies
38− ]
39− ++ optional stdenv.isDarwin fixDarwinDylibNames
40− ++ optionals (!stdenv.isDarwin) [ gdb man ]; # test dependencies
37+ ];
4138
4239 postPatch = ''
4340 patchShebangs configure
44−
45− find test/ -type f -exec \
46− sed -i \
47− -e "1s|#!/usr/bin/env bash|#!${bash}/bin/bash|" \
48− "{}" ";"
41+ patchShebangs test/
4942
5043 for src in \
5144 util/crypto.c \
@@ -54,6 +47,9 @@ stdenv.mkDerivation rec {
5447 substituteInPlace "$src" \
5548 --replace \"gpg\" \"${gnupg}/bin/gpg\"
5649 done
50+
51+ substituteInPlace lib/Makefile.local \
52+ --replace '-install_name $(libdir)' "-install_name $out/lib"
5753 '';
5854
5955 configureFlags = [ "--zshcompletiondir=$(out)/share/zsh/site-functions" ];
@@ -64,33 +60,6 @@ stdenv.mkDerivation rec {
6460 enableParallelBuilding = true;
6561 makeFlags = "V=1";
6662
67− preFixup = optionalString stdenv.isDarwin ''
68− set -e
69−
70− die() {
71− >&2 echo "$@"
72− exit 1
73− }
74−
75− prg="$out/bin/notmuch"
76− lib="$(find "$out/lib" -name 'libnotmuch.?.dylib')"
77−
78− [[ -s "$prg" ]] || die "couldn't find notmuch binary"
79− [[ -s "$lib" ]] || die "couldn't find libnotmuch"
80−
81− badname="$(otool -L "$prg" | awk '$1 ~ /libtalloc/ { print $1 }')"
82− goodname="$(find "${talloc}/lib" -name 'libtalloc.*.*.*.dylib')"
83−
84− [[ -n "$badname" ]] || die "couldn't find libtalloc reference in binary"
85− [[ -n "$goodname" ]] || die "couldn't find libtalloc in nix store"
86−
87− echo "fixing libtalloc link in $lib"
88− install_name_tool -change "$badname" "$goodname" "$lib"
89−
90− echo "fixing libtalloc link in $prg"
91− install_name_tool -change "$badname" "$goodname" "$prg"
92− '';
93−
9463 preCheck = let
9564 test-database = fetchurl {
9665 url = "https://notmuchmail.org/releases/test-databases/database-v1.tar.xz";
@@ -99,12 +68,14 @@ stdenv.mkDerivation rec {
9968 in ''
10069 ln -s ${test-database} test/test-databases/database-v1.tar.xz
10170 '';
102− doCheck = !stdenv.isDarwin && (versionAtLeast gmime.version "3.0");
103− checkTarget = "test V=1";
104−
105− postInstall = ''
106− make install-man
107− '';
71+ doCheck = !stdenv.hostPlatform.isDarwin && (versionAtLeast gmime.version "3.0");
72+ checkTarget = "test";
73+ checkInputs = [
74+ which dtach openssl bash
75+ gdb man
76+ ];
77+
78+ installTargets = "install install-man";
10879
10980 dontGzipMan = true; # already compressed
11081