presenterm: 0.9.0 -> 0.10.0 (#378946)
[NixPkgs.git] / pkgs / by-name / li / libdeltachat / package.nix
blobf3e7bc07a86446b3470bc4d67229f53d323a394b
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cargo
5 , cmake
6 , deltachat-desktop
7 , deltachat-repl
8 , deltachat-rpc-server
9 , openssl
10 , perl
11 , pkg-config
12 , python3
13 , rustPlatform
14 , sqlcipher
15 , sqlite
16 , fixDarwinDylibNames
17 , darwin
18 , libiconv
21 stdenv.mkDerivation rec {
22   pname = "libdeltachat";
23   version = "1.155.1";
25   src = fetchFromGitHub {
26     owner = "deltachat";
27     repo = "deltachat-core-rust";
28     tag = "v${version}";
29     hash = "sha256-XZLKvOvdyvR5poRY/oo9MHi1f2XzBmSDR8VqjW3wq74=";
30   };
32   patches = [
33     ./no-static-lib.patch
34   ];
36   cargoDeps = rustPlatform.fetchCargoVendor {
37     pname = "deltachat-core-rust";
38     inherit version src;
39     hash = "sha256-ZxKR1M9wqmzKVbSdBKzTsKF9tDVRGHnd+Ra9Jy5CQQY=";
40   };
42   nativeBuildInputs = [
43     cmake
44     perl
45     pkg-config
46     rustPlatform.cargoSetupHook
47     cargo
48   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
49     fixDarwinDylibNames
50   ];
52   buildInputs = [
53     openssl
54     sqlcipher
55     sqlite
56   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
57     darwin.apple_sdk.frameworks.CoreFoundation
58     darwin.apple_sdk.frameworks.Security
59     darwin.apple_sdk.frameworks.SystemConfiguration
60     libiconv
61   ];
63   nativeCheckInputs = with rustPlatform; [
64     cargoCheckHook
65   ];
67   # Sometimes -fmacro-prefix-map= can redirect __FILE__ to non-existent
68   # paths. This breaks packages like `python3.pkgs.deltachat`. We embed
69   # absolute path to headers by expanding `__FILE__`.
70   postInstall = ''
71     substituteInPlace $out/include/deltachat.h \
72       --replace __FILE__ '"${placeholder "out"}/include/deltachat.h"'
73   '';
75   env = {
76     CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTarget;
77     CARGO_BUILD_RUSTFLAGS = "-C linker=${stdenv.cc.targetPrefix}cc";
78   };
80   passthru = {
81     tests = {
82       inherit deltachat-desktop deltachat-repl deltachat-rpc-server;
83       python = python3.pkgs.deltachat;
84     };
85   };
87   meta = with lib; {
88     description = "Delta Chat Rust Core library";
89     homepage = "https://github.com/deltachat/deltachat-core-rust/";
90     changelog = "https://github.com/deltachat/deltachat-core-rust/blob/${src.tag}/CHANGELOG.md";
91     license = licenses.mpl20;
92     maintainers = with maintainers; [ dotlambda ];
93     platforms = platforms.unix;
94   };