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/.
9 # ==============================================================
10 @depends(build_project, target)
11 def updater_default(build_project, target):
12 if build_project == "tools/update-programs":
14 return build_project != "mobile/android" and target.os != "iOS"
19 default=updater_default,
20 help="{Enable|Disable} building the updater",
23 set_config("MOZ_UPDATER", True, when="--enable-updater")
24 set_define("MOZ_UPDATER", True, when="--enable-updater")
26 # Updates that do not verify signatures
27 # ==============================================================
30 "--enable-unverified-updates",
32 help="Enable application update without verifying MAR or updater binary signatures",
36 @depends("--enable-unverified-updates", "--enable-compile-environment")
37 def disable_unverified_updates(unverified_updates, compile_environment):
38 if unverified_updates:
39 if not compile_environment:
40 die("--enable-unverified-updates requires --enable-compile-environment")
41 return not unverified_updates
45 "MOZ_VERIFY_MAR_SIGNATURE",
46 depends_if(disable_unverified_updates)(lambda _: True),
49 "MOZ_VERIFY_MAR_SIGNATURE",
51 depends_if(disable_unverified_updates)(lambda _: True),
55 "DISABLE_UPDATER_AUTHENTICODE_CHECK",
57 depends_if("--enable-unverified-updates")(lambda _: True),
60 # Use NSS for MAR signatures even on platforms where system libraries are
61 # supported (currently Windows and macOS).
62 # ==============================================================
64 can_toggle_nss_mar = target_is_windows | target_is_osx
68 when=can_toggle_nss_mar,
69 help="Enable using NSS to check MAR signatures instead of system crypto.",
74 depends("--enable-nss-mar", when=can_toggle_nss_mar)(lambda x: x),
77 def enable_nss_mar(enabled, can_toggle_nss_mar):
78 return enabled or not can_toggle_nss_mar
81 set_config("MOZ_USE_NSS_FOR_MAR", True, when=enable_nss_mar)
83 # Maintenance service (Windows only)
84 # ==============================================================
87 @depends("--enable-updater")
88 def maintenance_service_default(updater):
93 "--enable-maintenance-service",
94 when=target_is_windows,
95 default=maintenance_service_default,
96 help="{Enable|Disable} building of maintenance service",
100 "MOZ_MAINTENANCE_SERVICE",
101 depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True),
104 "MOZ_MAINTENANCE_SERVICE",
105 depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True),
109 @depends("--enable-maintenance-service", "--enable-updater", when=target_is_windows)
110 def check_maintenance_service(mainteance_service, updater):
111 if mainteance_service and not updater:
112 die("--enable-updater is required to --enable-maintenance-service")
113 return mainteance_service
116 # Update agent (currently Windows and macOS only)
117 # This is an independent task that runs on a schedule to
118 # check for, download, and install updates.
119 # ==============================================================
122 @depends("--enable-backgroundtasks", "--enable-updater", build_project)
123 def update_agent_default(backgroundtasks, updater, build_project):
124 return bool(backgroundtasks) and bool(updater) and build_project == "browser"
128 "--disable-update-agent",
129 when=target_is_windows | target_is_osx,
130 default=update_agent_default,
131 help="{Enable|Disable} building update agent",
136 depends_if("--enable-update-agent", when=target_is_windows | target_is_osx)(
143 "--enable-update-agent",
144 "--enable-backgroundtasks",
146 when=target_is_windows | target_is_osx,
148 def check_update_agent(update_agent, backgroundtasks, updater):
149 if update_agent and not backgroundtasks:
150 die("--enable-backgroundtasks is required to --enable-update-agent")
151 if update_agent and not updater:
152 die("--enable-updater is required to --enable-update-agent")
156 # Enable or disable the default browser agent, which monitors the user's default
157 # browser setting on Windows.
158 # ==============================================================================
161 @depends(target, build_project)
162 def default_browser_agent_default(target, build_project):
163 return target.os == "WINNT" and build_project == "browser"
167 "--enable-default-browser-agent",
168 default=default_browser_agent_default,
169 help="{Enable|Disable} building the default browser agent",
173 @depends("--enable-default-browser-agent", when=target_is_windows)
174 def default_agent_flag(enabled):
179 set_config("MOZ_DEFAULT_BROWSER_AGENT", default_agent_flag)
182 # Enable or disable the notification server, which allows Windows native
183 # notifications to persist when the application is not running and relaunch as
185 # ==============================================================================
186 @depends(target, build_project)
187 def notification_server_default(target, build_project):
188 return target.os == "WINNT" and build_project in (
195 "--disable-notification-server",
196 when=notification_server_default,
197 help="Disable building the notification server",
200 set_config("MOZ_NOTIFICATION_SERVER", True, when="--enable-notification-server")