1{ stdenv, lib, fetchFromGitHub, cmake, libetpan, icu, cyrus_sasl, libctemplate
2, libuchardet, pkgconfig, glib, libtidy, libxml2, libuuid, openssl
3}:
4
5stdenv.mkDerivation rec {
6 name = "mailcore2-${version}";
7
8 version = "0.5.1";
9
10 src = fetchFromGitHub {
11 owner = "MailCore";
12 repo = "mailcore2";
13 rev = version;
14 sha256 = "1k0l59cdk8np4pff1my07dp7ivf3nchlhcpvm9xizp0my9rqgbxb";
15 };
16
17 nativeBuildInputs = [ pkgconfig ];
18 buildInputs = [
19 libetpan cmake icu cyrus_sasl libctemplate libuchardet glib
20 libtidy libxml2 libuuid openssl
21 ];
22
23 postPatch = ''
24 substituteInPlace CMakeLists.txt \
25 --replace " icule iculx" "" \
26 --replace "tidy/tidy.h" "tidy.h" \
27 --replace "/usr/include/tidy" "${libtidy}/include" \
28 --replace "/usr/include/libxml2" "${libxml2.dev}/include/libxml2"
29 substituteInPlace src/core/basetypes/MCHTMLCleaner.cpp \
30 --replace buffio.h tidybuffio.h
31 '';
32
33 cmakeFlags = [
34 "-DBUILD_SHARED_LIBS=ON"
35 ];
36
37 installPhase = ''
38 mkdir $out
39 cp -r src/include $out
40
41 mkdir $out/lib
42 cp src/libMailCore.so $out/lib
43 '';
44
45 doCheck = true;
46 checkPhase = ''
47 (
48 cd unittest
49 LD_LIBRARY_PATH="$(cd ../src; pwd)" TZ=PST8PDT ./unittestcpp ../../unittest/data
50 )
51 '';
52
53 meta = with lib; {
54 description = "A simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP";
55 homepage = http://libmailcore.com;
56 license = licenses.bsd3;
57 maintainers = with maintainers; [ cstrahan ];
58 };
59}