1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7srcs = [
8    "archivereader.cpp",
9    "updater.cpp",
10]
11
12have_progressui = 0
13
14if CONFIG["MOZ_VERIFY_MAR_SIGNATURE"]:
15    USE_LIBS += [
16        "verifymar",
17    ]
18
19if CONFIG["OS_ARCH"] == "WINNT":
20    have_progressui = 1
21    srcs += [
22        "loaddlls.cpp",
23        "progressui_win.cpp",
24    ]
25    RCINCLUDE = "%supdater.rc" % updater_rel_path
26    DEFINES["UNICODE"] = True
27    DEFINES["_UNICODE"] = True
28    USE_STATIC_LIBS = True
29
30    # Pick up nsWindowsRestart.cpp
31    LOCAL_INCLUDES += [
32        "/toolkit/xre",
33    ]
34    OS_LIBS += [
35        "comctl32",
36        "ws2_32",
37        "shell32",
38        "shlwapi",
39        "crypt32",
40        "advapi32",
41        "gdi32",
42        "user32",
43        "userenv",
44        "uuid",
45    ]
46
47USE_LIBS += [
48    "bspatch",
49    "mar",
50    "updatecommon",
51    "xz-embedded",
52]
53
54if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
55    have_progressui = 1
56    srcs += [
57        "progressui_gtk.cpp",
58    ]
59
60if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
61    have_progressui = 1
62    srcs += [
63        "launchchild_osx.mm",
64        "progressui_osx.mm",
65    ]
66    OS_LIBS += [
67        "-framework Cocoa",
68        "-framework Security",
69        "-framework SystemConfiguration",
70    ]
71    UNIFIED_SOURCES += [
72        "/toolkit/xre/updaterfileutils_osx.mm",
73    ]
74    LOCAL_INCLUDES += [
75        "/toolkit/xre",
76    ]
77
78if have_progressui == 0:
79    srcs += [
80        "progressui_null.cpp",
81    ]
82
83SOURCES += sorted(srcs)
84
85if CONFIG["MOZ_TSAN"]:
86    # Since mozglue is not linked to the updater,
87    # we need to include our own TSan suppression list.
88    SOURCES += [
89        "TsanOptions.cpp",
90    ]
91
92DEFINES["SPRINTF_H_USES_VSNPRINTF"] = True
93DEFINES["NS_NO_XPCOM"] = True
94DisableStlWrapping()
95for var in ("MAR_CHANNEL_ID", "MOZ_APP_VERSION", "MOZ_BACKGROUNDTASKS"):
96    DEFINES[var] = '"%s"' % CONFIG[var]
97
98LOCAL_INCLUDES += [
99    "/toolkit/mozapps/update/common",
100    "/xpcom/base",  # for nsVersionComparator.cpp
101]
102
103DELAYLOAD_DLLS += [
104    "crypt32.dll",
105    "comctl32.dll",
106    "userenv.dll",
107    "wsock32.dll",
108]
109
110if CONFIG["CC_TYPE"] == "clang-cl":
111    WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"]
112elif CONFIG["OS_ARCH"] == "WINNT":
113    WIN32_EXE_LDFLAGS += ["-municode"]
114
115if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
116    CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
117    OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
118
119if CONFIG["CC_TYPE"] == "gcc":
120    CXXFLAGS += ["-Wno-format-truncation"]
121