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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
# -*- 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/.
# Updater
# ==============================================================
@depends(build_project)
def updater_default(build_project):
return build_project != "mobile/android"
option(
"--enable-updater",
default=updater_default,
help="{Enable|Disable} building the updater",
)
set_config("MOZ_UPDATER", True, when="--enable-updater")
set_define("MOZ_UPDATER", True, when="--enable-updater")
# Updates that do not verify signatures
# ==============================================================
option(
"--enable-unverified-updates",
default=False,
help="Enable application update without verifying MAR or updater binary signatures",
)
@depends("--enable-unverified-updates", "--enable-compile-environment")
def disable_unverified_updates(unverified_updates, compile_environment):
if unverified_updates:
if not compile_environment:
die("--enable-unverified-updates requires --enable-compile-environment")
return not unverified_updates
set_define(
"MOZ_VERIFY_MAR_SIGNATURE",
depends_if(disable_unverified_updates)(lambda _: True),
)
set_config(
"MOZ_VERIFY_MAR_SIGNATURE",
True,
depends_if(disable_unverified_updates)(lambda _: True),
)
set_config(
"DISABLE_UPDATER_AUTHENTICODE_CHECK",
True,
depends_if("--enable-unverified-updates")(lambda _: True),
)
# Use NSS for MAR signatures even on platforms where system libraries are
# supported (currently Windows and macOS).
# ==============================================================
can_toggle_nss_mar = target_is_windows | target_is_osx
option(
"--enable-nss-mar",
when=can_toggle_nss_mar,
help="Enable using NSS to check MAR signatures instead of system crypto.",
)
@depends(
depends("--enable-nss-mar", when=can_toggle_nss_mar)(lambda x: x),
can_toggle_nss_mar,
)
def enable_nss_mar(enabled, can_toggle_nss_mar):
return enabled or not can_toggle_nss_mar
set_config("MOZ_USE_NSS_FOR_MAR", True, when=enable_nss_mar)
# Maintenance service (Windows only)
# ==============================================================
@depends("--enable-updater")
def maintenance_service_default(updater):
return bool(updater)
option(
"--enable-maintenance-service",
when=target_is_windows,
default=maintenance_service_default,
help="{Enable|Disable} building of maintenance service",
)
set_define(
"MOZ_MAINTENANCE_SERVICE",
depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True),
)
set_config(
"MOZ_MAINTENANCE_SERVICE",
depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True),
)
@depends("--enable-maintenance-service", "--enable-updater", when=target_is_windows)
def check_maintenance_service(mainteance_service, updater):
if mainteance_service and not updater:
die("--enable-updater is required to --enable-maintenance-service")
return mainteance_service
# Update agent (currently Windows and macOS only)
# This is an independent task that runs on a schedule to
# check for, download, and install updates.
# ==============================================================
@depends("--enable-backgroundtasks", "--enable-updater", build_project)
def update_agent_default(backgroundtasks, updater, build_project):
return bool(backgroundtasks) and bool(updater) and build_project == "browser"
option(
"--disable-update-agent",
when=target_is_windows | target_is_osx,
default=update_agent_default,
help="{Enable|Disable} building update agent",
)
set_config(
"MOZ_UPDATE_AGENT",
depends_if("--enable-update-agent", when=target_is_windows | target_is_osx)(
lambda _: True
),
)
@depends(
"--enable-update-agent",
"--enable-backgroundtasks",
"--enable-updater",
when=target_is_windows | target_is_osx,
)
def check_update_agent(update_agent, backgroundtasks, updater):
if update_agent and not backgroundtasks:
die("--enable-backgroundtasks is required to --enable-update-agent")
if update_agent and not updater:
die("--enable-updater is required to --enable-update-agent")
return update_agent
# Enable or disable the default browser agent, which monitors the user's default
# browser setting on Windows.
# ==============================================================================
@depends(target, build_project)
def default_browser_agent_default(target, build_project):
return target.os == "WINNT" and build_project == "browser"
option(
"--enable-default-browser-agent",
default=default_browser_agent_default,
help="{Enable|Disable} building the default browser agent",
)
@depends("--enable-default-browser-agent", when=target_is_windows)
def default_agent_flag(enabled):
if enabled:
return True
set_config("MOZ_DEFAULT_BROWSER_AGENT", default_agent_flag)
# Enable or disable the notification server, which allows Windows native
# notifications to persist when the application is not running and relaunch as
# necessary.
# ==============================================================================
@depends(target, build_project)
def notification_server_default(target, build_project):
return target.os == "WINNT" and build_project in (
"browser",
"comm/mail",
)
option(
"--disable-notification-server",
when=notification_server_default,
help="Disable building the notification server",
)
set_config("MOZ_NOTIFICATION_SERVER", True, when="--enable-notification-server")
|