summaryrefslogtreecommitdiffstats
path: root/comm/third_party/json-c/moz.build
blob: 788f9856db331c9510528db0345cd8187a029680 (plain)
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
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

Library("json-c")
FINAL_LIBRARY = "rnp"

# Honor --with-system-jsonc
if CONFIG["MZLA_SYSTEM_JSONC"]:
    OS_LIBS += CONFIG["MZLA_JSONC_LIBS"]
else:
    include("../rnpdefs.mozbuild")

    if CONFIG["CC_TYPE"] == "clang-cl":
        COMPILE_FLAGS["WARNINGS_CFLAGS"] += [
            "-Wno-macro-redefined",
        ]

    DEFINES["_GNU_SOURCE"] = True
    DEFINES["CC"] = CONFIG["_CC"]

    CONFIGURE_DEFINE_FILES += ["config.h", "json_config.h"]

    GeneratedFile(
        "json.h",
        script="/python/mozbuild/mozbuild/action/preprocessor.py",
        entry_point="generate",
        inputs=["json.h.cmakein"],
        flags=[
            "--marker", "%",
            "-F", "substitution",
            "-DJSON_H_JSON_POINTER=#include \"json_pointer.h\""
        ]
    )

    SOURCES += [
        "arraylist.c",
        "debug.c",
        "json_c_version.c",
        "json_object.c",
        "json_object_iterator.c",
        "json_pointer.c",
        "json_tokener.c",
        "json_util.c",
        "json_visit.c",
        "linkhash.c",
        "printbuf.c",
        "random_seed.c",
        "strerror_override.c",
    ]