File size: 2,503 Bytes
f0f4f2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
  # documentation about the format of this file can be found under https://gyp.gsrc.io/docs/InputFormatReference.md
  # Variables can be specified when calling node-gyp as so:
  #   node-gyp configure -- -Dvarname=value
  "variables": {
    # Whether to use a system-wide installation of deltachat-core
    # using pkg-config.  Set to either "true" or "false".
    "USE_SYSTEM_LIBDELTACHAT%": "<!(echo $USE_SYSTEM_LIBDELTACHAT)",
  },
  "targets": [
    {
      "target_name": "deltachat",
      "sources": ["./src/module.c"],
      "include_dirs": ["<!(node -e \"require('napi-macros')\")"],
      "conditions": [
        [
          "OS == 'win'",
          {
            "include_dirs": ["../deltachat-ffi"],
            "libraries": [
              "../../target/release/deltachat.dll.lib",
            ],
            "conditions": [
              [
                "USE_SYSTEM_LIBDELTACHAT == 'true'",
                {
                  "cflags": ["<!(pkg-config --cflags deltachat)"],
                  "libraries": ["<!(pkg-config --libs deltachat)"],
                },
              ],
            ],
          },
        ],
        [
          "OS == 'linux' or OS == 'mac'",
          {
            "libraries": ["-lpthread"],
            "cflags": ["-std=gnu99"],
            "conditions": [
              [
                "USE_SYSTEM_LIBDELTACHAT != 'true'",
                {
                  "include_dirs": ["../deltachat-ffi"],
                  "ldflags": ["-Wl,-Bsymbolic"], # Prevent sqlite3 from electron from overriding sqlcipher
                  "libraries": [
                    "../../target/release/libdeltachat.a",
                    "-ldl",
                  ],
                  "conditions": [],
                },
                {
                  # USE_SYSTEM_LIBDELTACHAT == 'true'
                  "cflags": ["<!(pkg-config --cflags deltachat)"],
                  "libraries": ["<!(pkg-config --libs deltachat)"],
                },
              ],
              [
                "OS == 'mac'",
                {
                  "libraries": [
                    "-framework CoreFoundation",
                    "-framework CoreServices",
                    "-framework Security",
                    "-lresolv",
                  ],
                },
                {
                  # OS == 'linux'
                  "libraries": ["-lm", "-lrt"],
                },
              ],
            ],
          },
        ],
      ],
    },
  ],
}