gecko-dev/build/moz.configure/update-programs.configure

195 строки
5.6 KiB
Python

# -*- 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 == "browser"
option(
"--disable-notification-server",
when=notification_server_default,
help="Disable building the notification server",
)
set_config("MOZ_NOTIFICATION_SERVER", True, when="--enable-notification-server")