2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-08 07:49:35 +03:00
|
|
|
# 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/.
|
2016-03-09 09:59:39 +03:00
|
|
|
|
2019-01-15 18:28:00 +03:00
|
|
|
# Set the MOZ_CONFIGURE_OPTIONS variable with all the options that
|
|
|
|
# were passed somehow (environment, command line, mozconfig)
|
|
|
|
@dependable
|
|
|
|
@imports(_from="mozbuild.shellutil", _import="quote")
|
2019-10-02 02:58:35 +03:00
|
|
|
@imports(_from="mozbuild.util", _import="ensure_unicode")
|
|
|
|
@imports(_from="mozbuild.util", _import="system_encoding")
|
2019-01-15 18:28:00 +03:00
|
|
|
@imports("__sandbox__")
|
|
|
|
def all_configure_options():
|
|
|
|
result = []
|
|
|
|
previous = None
|
2022-01-26 00:38:47 +03:00
|
|
|
for option in __sandbox__._options.values():
|
2019-01-15 18:28:00 +03:00
|
|
|
# __sandbox__._options contains items for both option.name and
|
|
|
|
# option.env. But it's also an OrderedDict, meaning both are
|
|
|
|
# consecutive.
|
|
|
|
# Also ignore OLD_CONFIGURE and MOZCONFIG because they're not
|
|
|
|
# interesting.
|
|
|
|
if option == previous or option.env in ("OLD_CONFIGURE", "MOZCONFIG"):
|
|
|
|
continue
|
|
|
|
previous = option
|
|
|
|
value = __sandbox__._value_for(option)
|
|
|
|
# We only want options that were explicitly given on the command
|
|
|
|
# line, the environment, or mozconfig, and that differ from the
|
|
|
|
# defaults.
|
|
|
|
if (
|
|
|
|
value is not None
|
|
|
|
and value.origin not in ("default", "implied")
|
|
|
|
and value != option.default
|
|
|
|
):
|
2019-10-02 02:58:35 +03:00
|
|
|
result.append(
|
|
|
|
ensure_unicode(__sandbox__._raw_options[option], system_encoding)
|
|
|
|
)
|
2019-01-15 18:28:00 +03:00
|
|
|
# We however always include options that are sent to old configure
|
|
|
|
# because we don't know their actual defaults. (Keep the conditions
|
|
|
|
# separate for ease of understanding and ease of removal)
|
|
|
|
elif (
|
|
|
|
option.help == "Help missing for old configure options"
|
|
|
|
and option in __sandbox__._raw_options
|
|
|
|
):
|
2019-10-02 02:58:35 +03:00
|
|
|
result.append(
|
|
|
|
ensure_unicode(__sandbox__._raw_options[option], system_encoding)
|
|
|
|
)
|
2019-01-15 18:28:00 +03:00
|
|
|
|
2019-11-13 17:28:49 +03:00
|
|
|
# We shouldn't need this, but currently, quote will return a byte string
|
|
|
|
# if result is empty, and that's not wanted here.
|
|
|
|
if not result:
|
|
|
|
return ""
|
|
|
|
|
2019-01-15 18:28:00 +03:00
|
|
|
return quote(*result)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_CONFIGURE_OPTIONS", all_configure_options)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-17 09:56:23 +03:00
|
|
|
|
2020-05-29 15:15:51 +03:00
|
|
|
@depends(target)
|
|
|
|
def fold_libs(target):
|
|
|
|
return target.os in ("WINNT", "OSX", "Android")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-05-29 15:15:51 +03:00
|
|
|
|
|
|
|
set_config("MOZ_FOLD_LIBS", fold_libs)
|
|
|
|
|
2016-03-17 09:56:23 +03:00
|
|
|
# Profiling
|
|
|
|
# ==============================================================
|
|
|
|
# Some of the options here imply an option from js/moz.configure,
|
|
|
|
# so, need to be declared before the include.
|
|
|
|
|
2016-03-17 10:05:10 +03:00
|
|
|
option(
|
|
|
|
"--enable-jprof",
|
|
|
|
env="MOZ_JPROF",
|
|
|
|
help="Enable jprof profiling tool (needs mozilla/tools/jprof)",
|
|
|
|
)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-17 10:05:10 +03:00
|
|
|
@depends("--enable-jprof")
|
|
|
|
def jprof(value):
|
|
|
|
if value:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
2016-03-17 10:05:10 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_JPROF", jprof)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_JPROF", jprof)
|
2016-03-23 08:18:57 +03:00
|
|
|
imply_option("--enable-profiling", jprof)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-17 10:05:10 +03:00
|
|
|
|
2016-03-17 10:08:53 +03:00
|
|
|
@depends(target)
|
2017-01-25 01:08:15 +03:00
|
|
|
def gecko_profiler(target):
|
2016-03-17 10:08:53 +03:00
|
|
|
if target.os == "Android":
|
2019-01-09 00:43:48 +03:00
|
|
|
return target.cpu in ("aarch64", "arm", "x86", "x86_64")
|
2016-03-17 10:08:53 +03:00
|
|
|
elif target.kernel == "Linux":
|
2019-01-09 00:43:48 +03:00
|
|
|
return target.cpu in ("aarch64", "arm", "x86", "x86_64", "mips64")
|
2020-05-06 20:44:19 +03:00
|
|
|
elif target.kernel == "FreeBSD":
|
|
|
|
return target.cpu in ("aarch64", "x86_64")
|
2016-03-17 10:08:53 +03:00
|
|
|
return target.os in ("OSX", "WINNT")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-17 10:08:53 +03:00
|
|
|
|
2017-01-25 01:08:15 +03:00
|
|
|
@depends(gecko_profiler)
|
|
|
|
def gecko_profiler_define(value):
|
2016-03-17 10:08:53 +03:00
|
|
|
if value:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-01-25 01:08:15 +03:00
|
|
|
set_config("MOZ_GECKO_PROFILER", gecko_profiler_define)
|
|
|
|
set_define("MOZ_GECKO_PROFILER", gecko_profiler_define)
|
2016-03-17 10:08:53 +03:00
|
|
|
|
|
|
|
|
2018-10-02 04:49:13 +03:00
|
|
|
# Whether code to parse ELF binaries should be compiled for the Gecko profiler
|
|
|
|
# (for symbol table dumping).
|
|
|
|
@depends(gecko_profiler, target)
|
|
|
|
def gecko_profiler_parse_elf(value, target):
|
2020-05-06 20:44:19 +03:00
|
|
|
# Currently we only want to build this code on Linux (including Android) and BSD.
|
2019-08-23 08:45:16 +03:00
|
|
|
# For Android, this is in order to dump symbols from Android system, where
|
|
|
|
# on other platforms there exist alternatives that don't require bloating
|
|
|
|
# up our binary size. For Linux more generally, we use this in profile
|
|
|
|
# pre-symbolication support, since MozDescribeCodeAddress doesn't do
|
|
|
|
# anything useful on that platform. (Ideally, we would update
|
|
|
|
# MozDescribeCodeAddress to call into some Rust crates that parse ELF and
|
|
|
|
# DWARF data, but build system issues currently prevent Rust from being
|
|
|
|
# used in mozglue.)
|
2020-05-06 20:44:19 +03:00
|
|
|
if value and (target.kernel == "Linux" or target.kernel == "FreeBSD"):
|
2018-10-02 04:49:13 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-02 04:49:13 +03:00
|
|
|
set_config("MOZ_GECKO_PROFILER_PARSE_ELF", gecko_profiler_parse_elf)
|
|
|
|
set_define("MOZ_GECKO_PROFILER_PARSE_ELF", gecko_profiler_parse_elf)
|
|
|
|
|
2018-10-10 05:29:02 +03:00
|
|
|
# enable this by default if the profiler is enabled
|
|
|
|
# Note: also requires jemalloc
|
|
|
|
set_config("MOZ_PROFILER_MEMORY", gecko_profiler_define)
|
|
|
|
set_define("MOZ_PROFILER_MEMORY", gecko_profiler_define)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
|
|
|
|
Bug 1530562 - Enable DMD by default when possible. r=mshal
And remove the manual --enable-dmd in in-tree mozconfigs, as well as
--enable-profiling, which is implied by --enable-dmd.
This disables DMD on add-on-devel builds, which don't look like they
were actually meant to have DMD enabled in the first place (they only do
because they use the nightly mozconfig on all branches, and as a matter
of fact, the nightly mozconfig didn't enable DMD before bug 1409739)
This enables DMD on mingw builds with the same conditions applied as
other platforms, meaning that it's not enabled on opt builds on release
branches.
And this enables DMD on plain builds, which, from this perspective,
reflect local developer builds, and this is the expected effect.
Depends on D21161
Differential Revision: https://phabricator.services.mozilla.com/D21162
--HG--
extra : moz-landing-system : lando
2019-02-27 01:07:04 +03:00
|
|
|
@depends(
|
|
|
|
"--enable-debug",
|
|
|
|
milestone,
|
|
|
|
build_project,
|
|
|
|
# Artifact builds are included because the downloaded artifacts can
|
|
|
|
# have DMD enabled.
|
|
|
|
when=artifact_builds | depends(when="--enable-replace-malloc")(lambda: True),
|
|
|
|
)
|
|
|
|
def dmd_default(debug, milestone, build_project):
|
|
|
|
return bool(build_project == "browser" and (debug or milestone.is_nightly))
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-dmd",
|
|
|
|
env="MOZ_DMD",
|
|
|
|
default=dmd_default,
|
|
|
|
help="{Enable|Disable} Dark Matter Detector (heap profiler). "
|
2016-03-17 10:22:18 +03:00
|
|
|
"Also enables jemalloc, replace-malloc and profiling",
|
|
|
|
)
|
|
|
|
|
Bug 1530562 - Enable DMD by default when possible. r=mshal
And remove the manual --enable-dmd in in-tree mozconfigs, as well as
--enable-profiling, which is implied by --enable-dmd.
This disables DMD on add-on-devel builds, which don't look like they
were actually meant to have DMD enabled in the first place (they only do
because they use the nightly mozconfig on all branches, and as a matter
of fact, the nightly mozconfig didn't enable DMD before bug 1409739)
This enables DMD on mingw builds with the same conditions applied as
other platforms, meaning that it's not enabled on opt builds on release
branches.
And this enables DMD on plain builds, which, from this perspective,
reflect local developer builds, and this is the expected effect.
Depends on D21161
Differential Revision: https://phabricator.services.mozilla.com/D21162
--HG--
extra : moz-landing-system : lando
2019-02-27 01:07:04 +03:00
|
|
|
|
2016-03-17 10:22:18 +03:00
|
|
|
@depends("--enable-dmd")
|
|
|
|
def dmd(value):
|
|
|
|
if value:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
2016-03-17 10:22:18 +03:00
|
|
|
|
Bug 1530562 - Enable DMD by default when possible. r=mshal
And remove the manual --enable-dmd in in-tree mozconfigs, as well as
--enable-profiling, which is implied by --enable-dmd.
This disables DMD on add-on-devel builds, which don't look like they
were actually meant to have DMD enabled in the first place (they only do
because they use the nightly mozconfig on all branches, and as a matter
of fact, the nightly mozconfig didn't enable DMD before bug 1409739)
This enables DMD on mingw builds with the same conditions applied as
other platforms, meaning that it's not enabled on opt builds on release
branches.
And this enables DMD on plain builds, which, from this perspective,
reflect local developer builds, and this is the expected effect.
Depends on D21161
Differential Revision: https://phabricator.services.mozilla.com/D21162
--HG--
extra : moz-landing-system : lando
2019-02-27 01:07:04 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_DMD", dmd)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_DMD", dmd)
|
2016-03-23 08:18:57 +03:00
|
|
|
imply_option("--enable-profiling", dmd)
|
Bug 1530562 - Enable DMD by default when possible. r=mshal
And remove the manual --enable-dmd in in-tree mozconfigs, as well as
--enable-profiling, which is implied by --enable-dmd.
This disables DMD on add-on-devel builds, which don't look like they
were actually meant to have DMD enabled in the first place (they only do
because they use the nightly mozconfig on all branches, and as a matter
of fact, the nightly mozconfig didn't enable DMD before bug 1409739)
This enables DMD on mingw builds with the same conditions applied as
other platforms, meaning that it's not enabled on opt builds on release
branches.
And this enables DMD on plain builds, which, from this perspective,
reflect local developer builds, and this is the expected effect.
Depends on D21161
Differential Revision: https://phabricator.services.mozilla.com/D21162
--HG--
extra : moz-landing-system : lando
2019-02-27 01:07:04 +03:00
|
|
|
imply_option("--enable-jemalloc", dmd, when=compile_environment)
|
|
|
|
imply_option("--enable-replace-malloc", dmd, when=compile_environment)
|
2016-03-17 10:22:18 +03:00
|
|
|
|
2021-12-29 11:14:52 +03:00
|
|
|
# midir-based Web MIDI support
|
2018-03-19 02:46:16 +03:00
|
|
|
# ==============================================================
|
2021-12-21 14:34:52 +03:00
|
|
|
@depends(target)
|
2021-12-29 11:14:52 +03:00
|
|
|
def midir_linux_support(target):
|
2022-09-15 07:37:30 +03:00
|
|
|
return (
|
|
|
|
target.kernel == "Linux" and target.os != "Android" and target.cpu != "riscv64"
|
|
|
|
)
|
2021-12-21 14:34:52 +03:00
|
|
|
|
|
|
|
|
2021-12-29 11:14:52 +03:00
|
|
|
@depends(target, midir_linux_support)
|
|
|
|
def midir_support(target, midir_linux_support):
|
|
|
|
if target.os in ("WINNT", "OSX") or midir_linux_support:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_WEBMIDI_MIDIR_IMPL", midir_support)
|
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
# Enable various cubeb backends
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target)
|
|
|
|
def audio_backends_default(target):
|
|
|
|
if target.os == "Android":
|
|
|
|
return (
|
|
|
|
"aaudio",
|
|
|
|
"opensl",
|
|
|
|
)
|
|
|
|
elif target.os in ("DragonFly", "FreeBSD", "SunOS"):
|
|
|
|
return ("oss",)
|
|
|
|
elif target.os == "OpenBSD":
|
|
|
|
return ("sndio",)
|
|
|
|
elif target.os == "OSX":
|
|
|
|
return ("audiounit",)
|
2023-01-24 15:44:26 +03:00
|
|
|
elif target.os == "NetBSD":
|
|
|
|
return ("sunaudio",)
|
|
|
|
elif target.os == "SunOS":
|
|
|
|
return ("sunaudio",)
|
2022-03-28 23:48:52 +03:00
|
|
|
elif target.os == "WINNT":
|
|
|
|
return ("wasapi",)
|
|
|
|
else:
|
|
|
|
return ("pulseaudio",)
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-audio-backends",
|
|
|
|
nargs="+",
|
|
|
|
choices=(
|
|
|
|
"aaudio",
|
|
|
|
"alsa",
|
|
|
|
"audiounit",
|
|
|
|
"jack",
|
|
|
|
"opensl",
|
|
|
|
"oss",
|
|
|
|
"pulseaudio",
|
|
|
|
"sndio",
|
2023-01-24 15:44:26 +03:00
|
|
|
"sunaudio",
|
2022-03-28 23:48:52 +03:00
|
|
|
"wasapi",
|
|
|
|
),
|
|
|
|
default=audio_backends_default,
|
|
|
|
help="{Enable|Disable} various cubeb backends",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_aaudio(values, target):
|
|
|
|
if any("aaudio" in value for value in values) and target.os != "Android":
|
|
|
|
die("Cannot enable AAudio on %s", target.os)
|
|
|
|
return any("aaudio" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_alsa(values, target):
|
|
|
|
if (
|
|
|
|
any("alsa" in value for value in values)
|
|
|
|
and target.kernel != "Linux"
|
|
|
|
and target.os != "FreeBSD"
|
|
|
|
):
|
|
|
|
die("Cannot enable ALSA on %s", target.os)
|
|
|
|
return any("alsa" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_audiounit(values, target):
|
|
|
|
if (
|
|
|
|
any("audiounit" in value for value in values)
|
|
|
|
and target.os != "OSX"
|
|
|
|
and target.kernel != "Darwin"
|
|
|
|
):
|
|
|
|
die("Cannot enable AudioUnit on %s", target.os)
|
|
|
|
return any("audiounit" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends")
|
|
|
|
def imply_jack(values):
|
|
|
|
return any("jack" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_opensl(values, target):
|
|
|
|
if any("opensl" in value for value in values) and target.os != "Android":
|
|
|
|
die("Cannot enable OpenSL on %s", target.os)
|
|
|
|
return any("opensl" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_oss(values, target):
|
|
|
|
if any("oss" in value for value in values) and (
|
|
|
|
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
|
|
|
|
):
|
|
|
|
die("Cannot enable OSS on %s", target.os)
|
|
|
|
return any("oss" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_pulseaudio(values, target):
|
|
|
|
if any("pulseaudio" in value for value in values) and (
|
|
|
|
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
|
|
|
|
):
|
|
|
|
die("Cannot enable PulseAudio on %s", target.os)
|
|
|
|
return any("pulseaudio" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_sndio(values, target):
|
|
|
|
if any("sndio" in value for value in values) and (
|
|
|
|
target.os == "Android" or target.os == "OSX" or target.os == "WINNT"
|
|
|
|
):
|
|
|
|
die("Cannot enable sndio on %s", target.os)
|
|
|
|
return any("sndio" in value for value in values) or None
|
|
|
|
|
|
|
|
|
2023-01-24 15:44:26 +03:00
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_sunaudio(values, target):
|
|
|
|
if any("sunaudio" in value for value in values) and (
|
|
|
|
target.os != "NetBSD" and target.os != "SunOS"
|
|
|
|
):
|
|
|
|
die("Cannot enable sunaudio on %s", target.os)
|
|
|
|
return any("sunaudio" in value for value in values) or None
|
|
|
|
|
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
@depends("--enable-audio-backends", target)
|
|
|
|
def imply_wasapi(values, target):
|
|
|
|
if any("wasapi" in value for value in values) and target.os != "WINNT":
|
|
|
|
die("Cannot enable WASAPI on %s", target.os)
|
|
|
|
return any("wasapi" in value for value in values) or None
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_AAUDIO", imply_aaudio, when="--enable-audio-backends")
|
|
|
|
|
|
|
|
imply_option("--enable-alsa", imply_alsa, reason="--enable-audio-backends")
|
|
|
|
|
|
|
|
set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends")
|
|
|
|
|
|
|
|
imply_option("--enable-jack", imply_jack, reason="--enable-audio-backends")
|
|
|
|
|
|
|
|
set_config("MOZ_OPENSL", imply_opensl, when="--enable-audio-backends")
|
|
|
|
|
|
|
|
set_config("MOZ_OSS", imply_oss, when="--enable-audio-backends")
|
|
|
|
|
|
|
|
imply_option("--enable-pulseaudio", imply_pulseaudio, reason="--enable-audio-backends")
|
|
|
|
|
|
|
|
imply_option("--enable-sndio", imply_sndio, reason="--enable-audio-backends")
|
|
|
|
|
2023-01-24 15:44:26 +03:00
|
|
|
set_config("MOZ_SUNAUDIO", imply_sunaudio, when="--enable-audio-backends")
|
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends")
|
|
|
|
|
2021-12-29 11:14:52 +03:00
|
|
|
# ALSA cubeb backend
|
|
|
|
# ==============================================================
|
2022-11-27 01:13:36 +03:00
|
|
|
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
|
2021-12-21 14:34:52 +03:00
|
|
|
|
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--enable-alsa", midir_linux_support)
|
2021-12-29 11:14:52 +03:00
|
|
|
def enable_alsa_or_midir_linux_support(alsa_enabled, midir_linux_support):
|
|
|
|
return alsa_enabled or midir_linux_support
|
2021-12-21 14:34:52 +03:00
|
|
|
|
2018-03-19 02:46:16 +03:00
|
|
|
|
2021-12-29 11:14:52 +03:00
|
|
|
pkg_check_modules("MOZ_ALSA", "alsa", when=enable_alsa_or_midir_linux_support)
|
2018-03-19 02:46:16 +03:00
|
|
|
|
2021-12-21 14:34:52 +03:00
|
|
|
set_config("MOZ_ALSA", True, when="--enable-alsa")
|
2023-01-11 23:59:15 +03:00
|
|
|
set_define("MOZ_ALSA", True, when="--enable-alsa")
|
2018-03-19 02:46:16 +03:00
|
|
|
|
2016-07-18 14:28:39 +03:00
|
|
|
# JACK cubeb backend
|
|
|
|
# ==============================================================
|
2022-11-27 01:13:36 +03:00
|
|
|
system_lib_option("--enable-jack", env="MOZ_JACK", help="Enable JACK audio backend.")
|
2016-07-18 14:28:39 +03:00
|
|
|
|
2018-03-19 02:42:22 +03:00
|
|
|
jack = pkg_check_modules("MOZ_JACK", "jack", when="--enable-jack")
|
2016-07-18 14:28:39 +03:00
|
|
|
|
2018-03-19 02:42:22 +03:00
|
|
|
set_config("MOZ_JACK", depends_if(jack)(lambda _: True))
|
2016-07-18 14:28:39 +03:00
|
|
|
|
2018-03-19 02:55:25 +03:00
|
|
|
# PulseAudio cubeb backend
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--enable-pulseaudio",
|
|
|
|
env="MOZ_PULSEAUDIO",
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Enable|Disable} PulseAudio audio backend.",
|
|
|
|
)
|
2018-03-19 02:55:25 +03:00
|
|
|
|
|
|
|
pulseaudio = pkg_check_modules("MOZ_PULSEAUDIO", "libpulse", when="--enable-pulseaudio")
|
|
|
|
|
|
|
|
set_config("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True))
|
2023-01-11 23:59:15 +03:00
|
|
|
set_define("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True))
|
2018-03-19 02:55:25 +03:00
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
# sndio cubeb backend
|
2019-07-10 11:06:12 +03:00
|
|
|
# ==============================================================
|
2022-11-27 01:13:36 +03:00
|
|
|
system_lib_option("--enable-sndio", env="MOZ_SNDIO", help="Enable sndio audio backend.")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
sndio = pkg_check_modules("MOZ_SNDIO", "sndio", when="--enable-sndio")
|
2019-07-10 11:06:12 +03:00
|
|
|
|
2022-03-28 23:48:52 +03:00
|
|
|
set_config("MOZ_SNDIO", depends_if(sndio)(lambda _: True))
|
2019-07-10 11:06:12 +03:00
|
|
|
|
2016-03-17 09:56:23 +03:00
|
|
|
# Javascript engine
|
|
|
|
# ==============================================================
|
2016-03-09 09:59:39 +03:00
|
|
|
include("../js/moz.configure")
|
2016-03-16 07:10:54 +03:00
|
|
|
|
|
|
|
|
2018-07-04 00:24:58 +03:00
|
|
|
# NodeJS
|
|
|
|
# ==============================================================
|
|
|
|
include("../build/moz.configure/node.configure")
|
2016-12-16 00:40:06 +03:00
|
|
|
|
2022-07-08 16:32:37 +03:00
|
|
|
# JsonCpp
|
|
|
|
# ==============================================================
|
|
|
|
set_define("JSON_USE_EXCEPTION", 0)
|
|
|
|
|
2016-03-17 02:38:52 +03:00
|
|
|
# L10N
|
|
|
|
# ==============================================================
|
|
|
|
option("--with-l10n-base", nargs=1, env="L10NBASEDIR", help="Path to l10n repositories")
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-12-23 23:47:47 +03:00
|
|
|
@depends("--with-l10n-base", "MOZ_AUTOMATION", build_environment)
|
2016-11-04 00:50:43 +03:00
|
|
|
@imports(_from="os.path", _import="isdir")
|
bug 1370506, for Nightly builds, automatically clone l10n repos for localized installers, r=glandium
Making more decisions on behalf of developers:
L10NBASEDIR is always defined, if not specified, it's ~/.mozbuild/l10n-central,
or in MOZBUILD_STATE_PATH/l10n-central if the state path in defined in the
environment.
If a locale isn't checked out, do that. The targets for which that works are
merge-%, installers-%, langpack-%
But only do that for Nightly builds, as for Beta and beyond, we have
explicit revisions to use for the builds, and we don't want to break release
builds silently with this.
MozReview-Commit-ID: EhGJPLuiyYO
--HG--
extra : rebase_source : 61a92396920965107a8811679552c1992b29155e
2017-06-15 20:47:28 +03:00
|
|
|
@imports(_from="os.path", _import="expanduser")
|
|
|
|
@imports(_from="os", _import="environ")
|
2020-02-20 01:20:11 +03:00
|
|
|
def l10n_base(value, automation, build_env):
|
2016-03-17 02:38:52 +03:00
|
|
|
if value:
|
|
|
|
path = value[0]
|
2016-11-04 00:50:43 +03:00
|
|
|
if not isdir(path):
|
2016-03-25 09:48:21 +03:00
|
|
|
die("Invalid value --with-l10n-base, %s doesn't exist", path)
|
2019-01-07 22:21:21 +03:00
|
|
|
elif automation:
|
2020-02-20 01:20:11 +03:00
|
|
|
path = os.path.join(build_env.topsrcdir, "../l10n-central")
|
bug 1370506, for Nightly builds, automatically clone l10n repos for localized installers, r=glandium
Making more decisions on behalf of developers:
L10NBASEDIR is always defined, if not specified, it's ~/.mozbuild/l10n-central,
or in MOZBUILD_STATE_PATH/l10n-central if the state path in defined in the
environment.
If a locale isn't checked out, do that. The targets for which that works are
merge-%, installers-%, langpack-%
But only do that for Nightly builds, as for Beta and beyond, we have
explicit revisions to use for the builds, and we don't want to break release
builds silently with this.
MozReview-Commit-ID: EhGJPLuiyYO
--HG--
extra : rebase_source : 61a92396920965107a8811679552c1992b29155e
2017-06-15 20:47:28 +03:00
|
|
|
else:
|
|
|
|
path = os.path.join(
|
|
|
|
environ.get(
|
|
|
|
"MOZBUILD_STATE_PATH", expanduser(os.path.join("~", ".mozbuild"))
|
|
|
|
),
|
|
|
|
"l10n-central",
|
|
|
|
)
|
|
|
|
return os.path.realpath(os.path.abspath(path))
|
2016-03-17 02:38:52 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("L10NBASEDIR", l10n_base)
|
2016-03-17 02:38:52 +03:00
|
|
|
|
|
|
|
|
2016-03-16 07:10:54 +03:00
|
|
|
# Default toolkit
|
|
|
|
# ==============================================================
|
2019-01-17 19:04:29 +03:00
|
|
|
@depends(target)
|
|
|
|
def toolkit_choices(target):
|
2016-03-16 07:10:54 +03:00
|
|
|
if target.os == "WINNT":
|
2019-01-17 19:04:29 +03:00
|
|
|
return ("cairo-windows",)
|
2016-03-16 07:10:54 +03:00
|
|
|
elif target.os == "OSX":
|
2019-01-17 19:04:29 +03:00
|
|
|
return ("cairo-cocoa",)
|
2016-03-16 07:10:54 +03:00
|
|
|
elif target.os == "Android":
|
2019-01-17 19:04:29 +03:00
|
|
|
return ("cairo-android",)
|
2016-03-16 07:10:54 +03:00
|
|
|
else:
|
2023-06-22 16:42:37 +03:00
|
|
|
# cairo-gtk3 - X11 backend with optional Wayland backend (auto detected)
|
|
|
|
# cairo-gtk3-wayland - Wayland backend with optional X11 backend (auto detected)
|
|
|
|
# cairo-gtk3-x11-wayland - builds explicitly with X11 & Wayland backends
|
2022-04-20 12:32:10 +03:00
|
|
|
return (
|
|
|
|
"cairo-gtk3",
|
|
|
|
"cairo-gtk3-wayland",
|
2023-06-22 15:05:40 +03:00
|
|
|
"cairo-gtk3-x11-wayland",
|
2023-06-22 16:42:37 +03:00
|
|
|
"cairo-gtk3-wayland-only",
|
|
|
|
"cairo-gtk3-x11-only",
|
2022-04-20 12:32:10 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 07:10:54 +03:00
|
|
|
|
2019-01-17 19:04:29 +03:00
|
|
|
@depends(toolkit_choices)
|
|
|
|
def toolkit_default(choices):
|
|
|
|
return choices[0]
|
|
|
|
|
2016-03-16 07:10:54 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2016-08-16 07:45:12 +03:00
|
|
|
"--enable-default-toolkit",
|
2020-10-26 21:34:53 +03:00
|
|
|
nargs=1,
|
2019-01-17 19:04:29 +03:00
|
|
|
choices=toolkit_choices,
|
|
|
|
default=toolkit_default,
|
|
|
|
help="Select default toolkit",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-12-16 10:48:36 +03:00
|
|
|
@depends("--enable-default-toolkit")
|
2019-01-17 19:04:29 +03:00
|
|
|
def full_toolkit(value):
|
2021-12-16 10:48:36 +03:00
|
|
|
if value:
|
|
|
|
return value[0]
|
2016-03-16 07:10:54 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-11-15 01:50:43 +03:00
|
|
|
@depends(full_toolkit)
|
2016-03-16 07:10:54 +03:00
|
|
|
def toolkit(toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
if toolkit.startswith("cairo-gtk3"):
|
|
|
|
widget_toolkit = "gtk"
|
2016-03-16 07:10:54 +03:00
|
|
|
else:
|
|
|
|
widget_toolkit = toolkit.replace("cairo-", "")
|
|
|
|
return widget_toolkit
|
2016-03-16 08:56:24 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_WIDGET_TOOLKIT", toolkit)
|
2016-03-23 10:34:59 +03:00
|
|
|
add_old_configure_assignment("MOZ_WIDGET_TOOLKIT", toolkit)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
@depends(toolkit)
|
|
|
|
def toolkit_define(toolkit):
|
2018-11-14 02:16:59 +03:00
|
|
|
if toolkit != "windows":
|
2016-03-23 04:22:08 +03:00
|
|
|
return "MOZ_WIDGET_%s" % toolkit.upper()
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
|
|
|
|
set_define(toolkit_define, True)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-11-14 02:16:59 +03:00
|
|
|
@depends(toolkit)
|
|
|
|
def toolkit_gtk(toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
return toolkit == "gtk"
|
2016-03-16 08:56:24 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-06-22 16:42:37 +03:00
|
|
|
@depends(toolkit_gtk, full_toolkit)
|
|
|
|
def toolkit_gtk_x11(toolkit_gtk, full_toolkit):
|
|
|
|
return toolkit_gtk and full_toolkit != "cairo-gtk3-wayland-only"
|
|
|
|
|
|
|
|
|
|
|
|
@depends(full_toolkit)
|
|
|
|
def toolkit_gtk_x11_optional(full_toolkit):
|
|
|
|
return full_toolkit == "cairo-gtk3-wayland"
|
|
|
|
|
|
|
|
|
|
|
|
@depends(toolkit_gtk, full_toolkit)
|
|
|
|
def toolkit_gtk_wayland(toolkit_gtk, full_toolkit):
|
|
|
|
return toolkit_gtk and full_toolkit != "cairo-gtk3-x11-only"
|
|
|
|
|
|
|
|
|
|
|
|
@depends(full_toolkit)
|
|
|
|
def toolkit_gtk_wayland_optional(full_toolkit):
|
|
|
|
return full_toolkit == "cairo-gtk3"
|
|
|
|
|
|
|
|
|
2017-04-06 11:40:27 +03:00
|
|
|
# Wayland support
|
|
|
|
# ==============================================================
|
2018-11-06 18:29:24 +03:00
|
|
|
wayland_headers = pkg_check_modules(
|
2020-07-26 16:20:13 +03:00
|
|
|
"MOZ_WAYLAND",
|
2023-05-26 09:37:37 +03:00
|
|
|
"gtk+-wayland-3.0 >= 3.14 xkbcommon >= 0.4.1",
|
2023-06-22 16:42:37 +03:00
|
|
|
allow_missing=toolkit_gtk_wayland_optional,
|
|
|
|
when=toolkit_gtk_wayland,
|
2018-11-15 01:50:43 +03:00
|
|
|
)
|
2017-04-06 11:40:27 +03:00
|
|
|
|
2018-11-17 00:20:19 +03:00
|
|
|
|
2023-06-22 16:42:37 +03:00
|
|
|
@depends(wayland_headers, toolkit_gtk, artifact_builds, toolkit_gtk_wayland)
|
|
|
|
def wayland_headers(wayland, toolkit_gtk, artifacts, toolkit_gtk_wayland):
|
|
|
|
if not toolkit_gtk_wayland:
|
|
|
|
return False
|
2018-11-17 00:20:19 +03:00
|
|
|
if toolkit_gtk and artifacts:
|
|
|
|
return True
|
|
|
|
return wayland
|
|
|
|
|
|
|
|
|
2017-04-06 11:40:27 +03:00
|
|
|
set_config("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
|
|
|
|
set_define("MOZ_WAYLAND", depends_if(wayland_headers)(lambda _: True))
|
|
|
|
|
2023-06-22 15:05:40 +03:00
|
|
|
|
2023-06-22 16:42:37 +03:00
|
|
|
# Hardware-accelerated video decode with VAAPI and V4L2 on Linux
|
|
|
|
# ==============================================================
|
2023-06-23 12:16:25 +03:00
|
|
|
@depends(target, toolkit_gtk)
|
|
|
|
def vaapi(target, toolkit_gtk):
|
2023-06-22 16:42:37 +03:00
|
|
|
# VAAPI is mostly used on x86(-64) but is sometimes used on ARM/ARM64 SOCs.
|
2023-06-23 12:16:25 +03:00
|
|
|
if target.cpu in ("arm", "aarch64", "x86", "x86_64") and toolkit_gtk:
|
2023-05-31 09:13:29 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
2023-06-23 12:16:25 +03:00
|
|
|
@depends(target, toolkit_gtk)
|
|
|
|
def v4l2(target, toolkit_gtk):
|
2023-06-22 16:42:37 +03:00
|
|
|
# V4L2 decode is only used in GTK/Linux and generally only appears on
|
|
|
|
# embedded SOCs.
|
2023-06-23 12:16:25 +03:00
|
|
|
if target.cpu in ("arm", "aarch64", "riscv64") and toolkit_gtk:
|
2023-05-31 09:13:29 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_ENABLE_VAAPI", True, when=vaapi)
|
|
|
|
set_config("MOZ_ENABLE_V4L2", True, when=v4l2)
|
|
|
|
set_define("MOZ_ENABLE_VAAPI", True, when=vaapi)
|
|
|
|
set_define("MOZ_ENABLE_V4L2", True, when=v4l2)
|
|
|
|
|
2023-06-22 16:42:37 +03:00
|
|
|
|
2016-03-16 09:14:20 +03:00
|
|
|
# GL Provider
|
|
|
|
# ==============================================================
|
|
|
|
option("--with-gl-provider", nargs=1, help="Set GL provider backend type")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 09:14:20 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
@depends("--with-gl-provider")
|
|
|
|
def gl_provider(value):
|
2016-03-16 09:14:20 +03:00
|
|
|
if value:
|
2016-03-23 04:22:08 +03:00
|
|
|
return value[0]
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
@depends(gl_provider)
|
|
|
|
def gl_provider_define(provider):
|
|
|
|
if provider:
|
|
|
|
return "GLContextProvider%s" % provider
|
2020-10-26 21:34:53 +03:00
|
|
|
|
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_GL_PROVIDER", gl_provider_define)
|
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
|
2023-05-25 10:19:27 +03:00
|
|
|
@depends(gl_provider, toolkit_gtk)
|
|
|
|
def gl_default_provider(value, toolkit_gtk):
|
2016-03-22 08:21:32 +03:00
|
|
|
if value:
|
|
|
|
return value
|
2018-10-04 16:54:18 +03:00
|
|
|
elif toolkit_gtk:
|
2023-05-25 10:19:27 +03:00
|
|
|
return "EGL"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_GL_PROVIDER", gl_provider)
|
|
|
|
set_config("MOZ_GL_DEFAULT_PROVIDER", gl_default_provider)
|
2016-03-16 10:10:40 +03:00
|
|
|
|
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
@depends(gl_default_provider)
|
|
|
|
def gl_provider_define(provider):
|
|
|
|
if provider:
|
|
|
|
return "GL_PROVIDER_%s" % provider
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-23 04:22:08 +03:00
|
|
|
|
|
|
|
set_define(gl_provider_define, True)
|
|
|
|
|
|
|
|
|
2016-03-16 10:10:40 +03:00
|
|
|
# PDF printing
|
|
|
|
# ==============================================================
|
|
|
|
@depends(toolkit)
|
|
|
|
def pdf_printing(toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
if toolkit in ("windows", "gtk", "android"):
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_PDF_PRINTING", pdf_printing)
|
2021-07-30 02:38:31 +03:00
|
|
|
set_define("MOZ_PDF_PRINTING", pdf_printing)
|
2016-03-16 10:19:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Event loop instrumentation
|
|
|
|
# ==============================================================
|
|
|
|
option(env="MOZ_INSTRUMENT_EVENT_LOOP", help="Force-enable event loop instrumentation")
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 10:19:03 +03:00
|
|
|
@depends("MOZ_INSTRUMENT_EVENT_LOOP", toolkit)
|
|
|
|
def instrument_event_loop(value, toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
if value or (
|
|
|
|
toolkit in ("windows", "gtk", "cocoa", "android") and value.origin == "default"
|
|
|
|
):
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_INSTRUMENT_EVENT_LOOP", instrument_event_loop)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_INSTRUMENT_EVENT_LOOP", instrument_event_loop)
|
2016-03-16 10:23:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Fontconfig Freetype
|
|
|
|
# ==============================================================
|
|
|
|
option(env="USE_FC_FREETYPE", help="Force-enable the use of fontconfig freetype")
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 10:23:30 +03:00
|
|
|
@depends("USE_FC_FREETYPE", toolkit)
|
|
|
|
def fc_freetype(value, toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
if value or (toolkit == "gtk" and value.origin == "default"):
|
2016-03-23 10:34:59 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-07-30 02:38:31 +03:00
|
|
|
set_define("USE_FC_FREETYPE", fc_freetype)
|
2016-03-16 11:37:42 +03:00
|
|
|
|
2016-10-14 21:06:30 +03:00
|
|
|
# Pango
|
|
|
|
# ==============================================================
|
2021-07-30 14:39:37 +03:00
|
|
|
pkg_check_modules("MOZ_PANGO", "pango >= 1.22.0", when=toolkit_gtk)
|
2016-03-16 11:37:42 +03:00
|
|
|
|
2016-10-14 21:06:31 +03:00
|
|
|
# Fontconfig
|
|
|
|
# ==============================================================
|
|
|
|
fontconfig_info = pkg_check_modules(
|
|
|
|
"_FONTCONFIG", "fontconfig >= 2.7.0", when=fc_freetype
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-10-14 21:06:31 +03:00
|
|
|
|
2016-10-14 21:06:31 +03:00
|
|
|
@depends(fc_freetype)
|
|
|
|
def check_for_freetype2(fc_freetype):
|
|
|
|
if fc_freetype:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-10-14 21:06:31 +03:00
|
|
|
# Check for freetype2. Flags are combined with fontconfig flags.
|
|
|
|
freetype2_info = pkg_check_modules(
|
2021-12-23 23:50:39 +03:00
|
|
|
"_FT2", "freetype2 >= 9.10.3", when=check_for_freetype2
|
2016-10-14 21:06:31 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-10-14 21:06:31 +03:00
|
|
|
|
|
|
|
@depends(fontconfig_info, freetype2_info)
|
|
|
|
def freetype2_combined_info(fontconfig_info, freetype2_info):
|
|
|
|
if not freetype2_info:
|
|
|
|
return
|
|
|
|
if not fontconfig_info:
|
|
|
|
return freetype2_info
|
|
|
|
return namespace(
|
|
|
|
cflags=freetype2_info.cflags + fontconfig_info.cflags,
|
|
|
|
libs=freetype2_info.libs + fontconfig_info.libs,
|
|
|
|
)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-07-30 02:38:31 +03:00
|
|
|
set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
|
2016-10-14 21:06:31 +03:00
|
|
|
|
2016-03-16 11:37:42 +03:00
|
|
|
# Apple platform decoder support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(toolkit)
|
|
|
|
def applemedia(toolkit):
|
|
|
|
if toolkit in ("cocoa", "uikit"):
|
|
|
|
return True
|
2016-03-16 11:42:57 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_APPLEMEDIA", applemedia)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_APPLEMEDIA", applemedia)
|
2016-03-16 11:42:57 +03:00
|
|
|
|
|
|
|
# Windows Media Foundation support
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-wmf", help="Disable support for Windows Media Foundation")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 11:42:57 +03:00
|
|
|
|
2023-02-14 04:58:06 +03:00
|
|
|
@depends("--disable-wmf", target, "--help")
|
|
|
|
def wmf(value, target, _):
|
2016-03-16 11:42:57 +03:00
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == "default":
|
|
|
|
# Enable Windows Media Foundation support by default.
|
|
|
|
# Note our minimum SDK version is Windows 7 SDK, so we are (currently)
|
|
|
|
# guaranteed to have a recent-enough SDK to build WMF.
|
|
|
|
enabled = target.os == "WINNT"
|
|
|
|
if enabled and target.os != "WINNT":
|
2016-03-25 09:48:21 +03:00
|
|
|
die("Cannot enable Windows Media Foundation support on %s", target.os)
|
2016-03-16 11:42:57 +03:00
|
|
|
if enabled:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
2016-03-16 11:46:13 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2022-07-01 01:34:22 +03:00
|
|
|
@depends(c_compiler, when=wmf)
|
|
|
|
def wmfmediaengine(c_compiler):
|
|
|
|
return c_compiler and c_compiler.type == "clang-cl"
|
|
|
|
|
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_WMF", wmf)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_WMF", wmf)
|
2016-03-16 11:46:13 +03:00
|
|
|
|
2022-07-01 01:34:22 +03:00
|
|
|
set_config("MOZ_WMF_MEDIA_ENGINE", True, when=wmfmediaengine)
|
|
|
|
set_define("MOZ_WMF_MEDIA_ENGINE", True, when=wmfmediaengine)
|
|
|
|
|
2016-03-16 11:46:13 +03:00
|
|
|
# FFmpeg H264/AAC Decoding Support
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-ffmpeg", help="Disable FFmpeg for fragmented H264/AAC decoding")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 11:46:13 +03:00
|
|
|
|
|
|
|
@depends("--disable-ffmpeg", target)
|
|
|
|
def ffmpeg(value, target):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == "default":
|
|
|
|
enabled = target.os not in ("Android", "WINNT")
|
|
|
|
if enabled:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
2016-03-16 11:50:42 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_FFMPEG", ffmpeg)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_FFMPEG", ffmpeg)
|
2016-03-23 08:18:57 +03:00
|
|
|
imply_option("--enable-fmp4", ffmpeg, "--enable-ffmpeg")
|
2016-03-16 11:50:42 +03:00
|
|
|
|
2019-02-06 00:19:05 +03:00
|
|
|
# AV1 Video Codec Support
|
2017-04-18 19:08:18 +03:00
|
|
|
# ==============================================================
|
2019-02-06 00:19:05 +03:00
|
|
|
option("--disable-av1", help="Disable av1 video support")
|
2017-04-18 19:08:18 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-02-15 00:45:27 +03:00
|
|
|
@depends("--enable-av1")
|
|
|
|
def av1(value):
|
|
|
|
if value:
|
2017-04-18 19:08:18 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-02-23 04:26:43 +03:00
|
|
|
@depends(target, when=av1 & compile_environment)
|
|
|
|
def dav1d_asm(target):
|
|
|
|
if target.cpu in ("aarch64", "x86", "x86_64"):
|
2020-07-15 12:06:46 +03:00
|
|
|
return True
|
2019-02-06 00:19:07 +03:00
|
|
|
|
|
|
|
|
2021-02-23 04:26:43 +03:00
|
|
|
@depends(target, when=av1 & compile_environment)
|
|
|
|
def dav1d_nasm(target):
|
|
|
|
if target.cpu in ("x86", "x86_64"):
|
|
|
|
return namespace(version="2.14", what="AV1")
|
|
|
|
|
|
|
|
|
2019-02-06 00:19:07 +03:00
|
|
|
set_config("MOZ_DAV1D_ASM", dav1d_asm)
|
2019-03-07 12:32:15 +03:00
|
|
|
set_define("MOZ_DAV1D_ASM", dav1d_asm)
|
2017-04-18 19:08:18 +03:00
|
|
|
set_config("MOZ_AV1", av1)
|
|
|
|
set_define("MOZ_AV1", av1)
|
|
|
|
|
2021-05-06 05:00:55 +03:00
|
|
|
# JXL Image Codec Support
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-jxl", help="Disable jxl image support")
|
|
|
|
|
|
|
|
|
2021-05-19 20:46:23 +03:00
|
|
|
@depends("--disable-jxl", milestone.is_nightly)
|
|
|
|
def jxl(value, is_nightly):
|
|
|
|
if is_nightly and value:
|
2021-05-06 05:00:55 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_JXL", jxl)
|
|
|
|
set_define("MOZ_JXL", jxl)
|
|
|
|
|
2016-03-16 11:50:42 +03:00
|
|
|
# Built-in fragmented MP4 support.
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--disable-fmp4",
|
|
|
|
env="MOZ_FMP4",
|
|
|
|
help="Disable support for in built Fragmented MP4 parsing",
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 11:50:42 +03:00
|
|
|
|
|
|
|
@depends("--disable-fmp4", target, wmf, applemedia)
|
|
|
|
def fmp4(value, target, wmf, applemedia):
|
|
|
|
enabled = bool(value)
|
|
|
|
if value.origin == "default":
|
|
|
|
# target.os == 'Android' includes all B2G versions
|
|
|
|
enabled = wmf or applemedia or target.os == "Android"
|
|
|
|
if enabled:
|
2016-03-22 08:21:32 +03:00
|
|
|
return True
|
2016-03-16 11:52:20 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-22 08:21:32 +03:00
|
|
|
set_config("MOZ_FMP4", fmp4)
|
2016-03-23 04:22:08 +03:00
|
|
|
set_define("MOZ_FMP4", fmp4)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-03-16 11:52:20 +03:00
|
|
|
|
2023-08-08 15:12:44 +03:00
|
|
|
set_config("MOZ_SAMPLE_TYPE_FLOAT32", True)
|
|
|
|
set_define("MOZ_SAMPLE_TYPE_FLOAT32", True)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-08-08 15:12:44 +03:00
|
|
|
set_define("MOZ_VORBIS", True)
|
|
|
|
set_config("MOZ_VORBIS", True)
|
2018-05-10 00:26:31 +03:00
|
|
|
|
2022-11-29 18:29:08 +03:00
|
|
|
option(
|
|
|
|
"--disable-real-time-tracing",
|
|
|
|
help="Disable tracing of real-time audio callbacks",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_REAL_TIME_TRACING", True, when="--enable-real-time-tracing")
|
|
|
|
set_define("MOZ_REAL_TIME_TRACING", True, when="--enable-real-time-tracing")
|
|
|
|
|
2018-04-18 05:38:12 +03:00
|
|
|
# OpenMAX IL Decoding Support
|
|
|
|
# ==============================================================
|
|
|
|
option("--enable-openmax", help="Enable OpenMAX IL for video/audio decoding")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-04-18 05:38:12 +03:00
|
|
|
|
|
|
|
@depends("--enable-openmax")
|
|
|
|
def openmax(value):
|
|
|
|
enabled = bool(value)
|
|
|
|
if enabled:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-04-18 05:38:12 +03:00
|
|
|
set_config("MOZ_OMX", openmax)
|
|
|
|
set_define("MOZ_OMX", openmax)
|
|
|
|
|
2016-03-16 11:52:20 +03:00
|
|
|
# EME Support
|
|
|
|
# ==============================================================
|
2023-02-14 04:58:06 +03:00
|
|
|
@depends(target, wmf)
|
|
|
|
def eme_choices(target, wmf):
|
2019-02-19 03:49:25 +03:00
|
|
|
if (
|
2020-11-11 05:37:57 +03:00
|
|
|
target.kernel in ("WINNT", "Linux")
|
2020-05-15 06:56:16 +03:00
|
|
|
and target.os != "Android"
|
2019-02-19 03:49:25 +03:00
|
|
|
and target.cpu in ("x86", "x86_64")
|
|
|
|
):
|
2023-02-14 04:58:06 +03:00
|
|
|
if wmf:
|
|
|
|
return ("widevine", "wmfcdm")
|
2019-02-19 03:49:25 +03:00
|
|
|
return ("widevine",)
|
2019-03-05 11:41:04 +03:00
|
|
|
if target.kernel == "WINNT" and target.cpu == "aarch64":
|
|
|
|
return ("widevine",)
|
2020-11-11 05:37:57 +03:00
|
|
|
if target.os in ("OSX"):
|
|
|
|
return ("widevine",)
|
2019-02-19 03:49:25 +03:00
|
|
|
|
|
|
|
|
2019-03-05 11:41:04 +03:00
|
|
|
# Widevine is enabled by default in desktop browser builds, except
|
|
|
|
# on aarch64 Windows.
|
|
|
|
@depends(build_project, eme_choices, target)
|
|
|
|
def eme_default(build_project, choices, target):
|
2016-07-29 08:14:55 +03:00
|
|
|
if build_project == "browser":
|
2019-03-05 11:41:04 +03:00
|
|
|
if target.kernel != "WINNT" or target.cpu != "aarch64":
|
|
|
|
return choices
|
2019-02-19 03:49:25 +03:00
|
|
|
|
2016-07-29 08:14:55 +03:00
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-eme",
|
2019-02-19 03:49:25 +03:00
|
|
|
nargs="+",
|
|
|
|
choices=eme_choices,
|
2016-07-29 08:14:55 +03:00
|
|
|
default=eme_default,
|
2019-02-19 03:49:25 +03:00
|
|
|
when=eme_choices,
|
2018-10-24 12:04:00 +03:00
|
|
|
help="{Enable|Disable} support for Encrypted Media Extensions",
|
|
|
|
)
|
2016-03-16 11:52:20 +03:00
|
|
|
|
2016-08-17 12:40:43 +03:00
|
|
|
|
2019-02-19 03:49:25 +03:00
|
|
|
@depends("--enable-eme", fmp4, when=eme_choices)
|
|
|
|
def eme(enabled, fmp4):
|
|
|
|
if enabled and enabled.origin != "default" and not fmp4:
|
2016-03-25 09:48:21 +03:00
|
|
|
die("Encrypted Media Extension support requires " "Fragmented MP4 support")
|
2016-03-22 08:21:32 +03:00
|
|
|
|
2019-02-19 03:49:25 +03:00
|
|
|
|
|
|
|
@depends("--enable-eme", when=eme_choices)
|
2016-03-22 08:21:32 +03:00
|
|
|
def eme_modules(value):
|
2016-08-19 11:42:04 +03:00
|
|
|
return value
|
2016-03-22 08:21:32 +03:00
|
|
|
|
2019-02-19 03:49:25 +03:00
|
|
|
|
|
|
|
# Fallback to an empty list when eme_choices is empty, setting eme_modules to
|
|
|
|
# None.
|
|
|
|
set_config("MOZ_EME_MODULES", eme_modules | dependable([]))
|
2016-04-14 22:26:38 +03:00
|
|
|
|
2019-03-05 11:41:04 +03:00
|
|
|
|
|
|
|
@depends(eme_modules, target, when=eme_modules)
|
|
|
|
def eme_win32_artifact(modules, target):
|
|
|
|
if "widevine" in modules and target.kernel == "WINNT" and target.cpu == "aarch64":
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_EME_WIN32_ARTIFACT", eme_win32_artifact)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-02-14 04:58:06 +03:00
|
|
|
|
|
|
|
# Media Foundation CDM support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(eme_modules, when=wmfmediaengine)
|
|
|
|
def wmfcdm(modules):
|
|
|
|
if "wmfcdm" in modules:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_WMF_CDM", True, when=wmfcdm)
|
|
|
|
set_define("MOZ_WMF_CDM", True, when=wmfcdm)
|
|
|
|
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2016-04-14 22:26:38 +03:00
|
|
|
name="--enable-chrome-format",
|
|
|
|
help="Select FORMAT of chrome files during packaging.",
|
2020-10-26 21:34:53 +03:00
|
|
|
nargs=1,
|
2016-04-14 22:26:38 +03:00
|
|
|
choices=("omni", "jar", "flat"),
|
|
|
|
default="omni",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2019-03-05 11:41:04 +03:00
|
|
|
|
2016-04-14 22:26:38 +03:00
|
|
|
|
|
|
|
@depends("--enable-chrome-format")
|
|
|
|
def packager_format(value):
|
|
|
|
return value[0]
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-04-14 22:26:38 +03:00
|
|
|
set_config("MOZ_PACKAGER_FORMAT", packager_format)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2022-03-02 20:43:47 +03:00
|
|
|
# The packager minifies two different types of files: non-JS (mostly property
|
|
|
|
# files for l10n), and JS. Setting MOZ_PACKAGER_MINIFY only minifies the
|
|
|
|
# former. Firefox doesn't yet minify JS, due to concerns about debuggability.
|
|
|
|
#
|
|
|
|
# Also, the JS minification setup really only works correctly on Android:
|
|
|
|
# we need extra setup to use the newly-built shell for Linux and Windows,
|
|
|
|
# and cross-compilation for macOS requires some extra care.
|
|
|
|
|
|
|
|
|
|
|
|
@depends(target_is_android, "--enable-debug", milestone.is_nightly)
|
|
|
|
def enable_minify_default(is_android, debug, is_nightly):
|
|
|
|
if is_android and not debug and not is_nightly:
|
|
|
|
return ("properties", "js")
|
|
|
|
return ("properties",)
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
name="--enable-minify",
|
|
|
|
help="Select types of files to minify during packaging.",
|
|
|
|
nargs="*",
|
|
|
|
choices=("properties", "js"),
|
|
|
|
default=enable_minify_default,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-minify")
|
|
|
|
def enable_minify(value):
|
|
|
|
if "js" in value and "properties" not in value:
|
|
|
|
die("--enable-minify=js requires --enable-minify=properties.")
|
|
|
|
return namespace(
|
|
|
|
properties="properties" in value,
|
|
|
|
js="js" in value,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_PACKAGER_MINIFY", True, when=enable_minify.properties)
|
|
|
|
set_config("MOZ_PACKAGER_MINIFY_JS", True, when=enable_minify.js)
|
|
|
|
|
2016-04-14 22:26:38 +03:00
|
|
|
|
2016-05-01 02:02:43 +03:00
|
|
|
@depends(host, build_project)
|
|
|
|
def jar_maker_format(host, build_project):
|
|
|
|
# Multilocales for mobile/android use the same mergedirs for all locales,
|
|
|
|
# so we can't use symlinks for those builds.
|
|
|
|
if host.os == "WINNT" or build_project == "mobile/android":
|
|
|
|
return "flat"
|
|
|
|
return "symlink"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
|
|
|
|
2016-04-14 22:26:38 +03:00
|
|
|
set_config("MOZ_JAR_MAKER_FILE_FORMAT", jar_maker_format)
|
|
|
|
|
|
|
|
|
|
|
|
@depends(toolkit)
|
|
|
|
def omnijar_name(toolkit):
|
|
|
|
# Fennec's static resources live in the assets/ folder of the
|
|
|
|
# APK. Adding a path to the name here works because we only
|
|
|
|
# have one omnijar file in the final package (which is not the
|
2019-03-02 00:49:47 +03:00
|
|
|
# case on desktop).
|
2016-04-14 22:26:38 +03:00
|
|
|
return "assets/omni.ja" if toolkit == "android" else "omni.ja"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-04-14 22:26:38 +03:00
|
|
|
|
|
|
|
set_config("OMNIJAR_NAME", omnijar_name)
|
2016-04-20 12:47:33 +03:00
|
|
|
|
2016-05-12 21:55:58 +03:00
|
|
|
project_flag("MOZ_PLACES", help="Build Places if required", set_as_define=True)
|
|
|
|
|
2016-05-12 21:55:59 +03:00
|
|
|
project_flag(
|
|
|
|
"MOZ_SERVICES_HEALTHREPORT",
|
|
|
|
help="Build Firefox Health Reporter Service",
|
|
|
|
set_as_define=True,
|
|
|
|
)
|
|
|
|
|
2019-08-07 02:54:34 +03:00
|
|
|
project_flag(
|
|
|
|
"MOZ_NORMANDY",
|
|
|
|
help="Enable Normandy recipe runner",
|
|
|
|
set_as_define=True,
|
|
|
|
)
|
|
|
|
|
2016-05-12 21:55:59 +03:00
|
|
|
project_flag("MOZ_SERVICES_SYNC", help="Build Sync Services if required")
|
|
|
|
|
2016-05-18 00:40:03 +03:00
|
|
|
project_flag(
|
|
|
|
"MOZ_ANDROID_HISTORY",
|
|
|
|
help="Enable Android History instead of Places",
|
|
|
|
set_as_define=True,
|
|
|
|
)
|
2018-09-22 02:32:55 +03:00
|
|
|
|
|
|
|
project_flag(
|
|
|
|
"MOZ_DEDICATED_PROFILES",
|
|
|
|
help="Enable dedicated profiles per install",
|
|
|
|
set_as_define=True,
|
|
|
|
)
|
|
|
|
|
|
|
|
project_flag(
|
|
|
|
"MOZ_BLOCK_PROFILE_DOWNGRADE",
|
|
|
|
help="Block users from starting profiles last used by a newer build",
|
|
|
|
set_as_define=True,
|
|
|
|
)
|
2016-05-18 00:40:03 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-05-18 00:40:03 +03:00
|
|
|
@depends("MOZ_PLACES", "MOZ_ANDROID_HISTORY")
|
|
|
|
def check_places_and_android_history(places, android_history):
|
|
|
|
if places and android_history:
|
|
|
|
die("Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.")
|
|
|
|
|
2019-05-08 17:33:54 +03:00
|
|
|
|
2019-05-08 17:33:56 +03:00
|
|
|
option(
|
|
|
|
env="MOZ_TELEMETRY_REPORTING",
|
|
|
|
default=mozilla_official,
|
2019-05-08 17:33:54 +03:00
|
|
|
help="Enable telemetry reporting",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_define("MOZ_TELEMETRY_REPORTING", True, when="MOZ_TELEMETRY_REPORTING")
|
|
|
|
|
|
|
|
|
2021-03-24 23:06:24 +03:00
|
|
|
@depends("MOZ_TELEMETRY_REPORTING", milestone.is_nightly)
|
|
|
|
def telemetry_on_by_default(reporting, is_nightly):
|
|
|
|
return reporting and is_nightly
|
2019-05-08 17:33:54 +03:00
|
|
|
|
|
|
|
|
|
|
|
set_define("MOZ_TELEMETRY_ON_BY_DEFAULT", True, when=telemetry_on_by_default)
|
|
|
|
|
|
|
|
|
2016-07-22 12:52:09 +03:00
|
|
|
# gpsd support
|
|
|
|
# ==============================================================
|
2022-11-27 01:13:36 +03:00
|
|
|
system_lib_option("--enable-gpsd", env="MOZ_GPSD", help="Enable gpsd support")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-07-22 12:52:09 +03:00
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--enable-gpsd")
|
2016-07-22 12:52:09 +03:00
|
|
|
def gpsd(value):
|
|
|
|
return bool(value)
|
|
|
|
|
|
|
|
|
2016-08-18 01:02:31 +03:00
|
|
|
system_gpsd = pkg_check_modules("MOZ_GPSD", "libgps >= 3.11", when=gpsd)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-10-14 21:06:30 +03:00
|
|
|
set_config("MOZ_GPSD", depends_if(system_gpsd)(lambda _: True))
|
2016-07-22 12:52:09 +03:00
|
|
|
|
2016-04-20 12:47:33 +03:00
|
|
|
# Miscellaneous programs
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
check_prog("TAR", ("gnutar", "gtar", "tar"))
|
|
|
|
check_prog("UNZIP", ("unzip",))
|
2016-08-09 12:15:53 +03:00
|
|
|
|
|
|
|
# Key files
|
|
|
|
# ==============================================================
|
|
|
|
include("../build/moz.configure/keyfiles.configure")
|
|
|
|
|
|
|
|
simple_keyfile("Mozilla API")
|
|
|
|
|
2019-03-10 18:29:41 +03:00
|
|
|
simple_keyfile("Google Location Service API")
|
|
|
|
|
|
|
|
simple_keyfile("Google Safebrowsing API")
|
2016-08-09 12:15:53 +03:00
|
|
|
|
|
|
|
id_and_secret_keyfile("Bing API")
|
|
|
|
|
|
|
|
simple_keyfile("Adjust SDK")
|
2016-08-12 10:14:08 +03:00
|
|
|
|
2017-05-26 22:31:20 +03:00
|
|
|
id_and_secret_keyfile("Leanplum SDK")
|
|
|
|
|
2017-08-09 22:11:10 +03:00
|
|
|
simple_keyfile("Pocket API")
|
|
|
|
|
2016-08-30 23:10:00 +03:00
|
|
|
|
2019-07-03 23:53:54 +03:00
|
|
|
# WebRender Debugger integration
|
2018-12-10 18:47:36 +03:00
|
|
|
# ==============================================================
|
|
|
|
|
2019-04-25 22:31:16 +03:00
|
|
|
option(
|
|
|
|
"--enable-webrender-debugger", help="Build the websocket debug server in WebRender"
|
|
|
|
)
|
|
|
|
|
2019-07-03 23:53:54 +03:00
|
|
|
set_config(
|
|
|
|
"MOZ_WEBRENDER_DEBUGGER", depends_if("--enable-webrender-debugger")(lambda _: True)
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2017-02-06 19:42:53 +03:00
|
|
|
|
2019-09-17 12:54:33 +03:00
|
|
|
# Additional system headers defined at the application level
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-app-system-headers",
|
|
|
|
env="MOZ_APP_SYSTEM_HEADERS",
|
|
|
|
help="Use additional system headers defined in $MOZ_BUILD_APP/app-system-headers.mozbuild",
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-17 12:54:33 +03:00
|
|
|
|
|
|
|
@depends("--enable-app-system-headers")
|
|
|
|
def app_system_headers(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-17 12:54:33 +03:00
|
|
|
set_config("MOZ_APP_SYSTEM_HEADERS", app_system_headers)
|
|
|
|
set_define("MOZ_APP_SYSTEM_HEADERS", app_system_headers)
|
|
|
|
|
2016-08-16 07:28:33 +03:00
|
|
|
# Printing
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-printing", help="Disable printing support")
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 07:28:33 +03:00
|
|
|
@depends("--disable-printing")
|
|
|
|
def printing(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 07:28:33 +03:00
|
|
|
set_config("NS_PRINTING", printing)
|
|
|
|
set_define("NS_PRINTING", printing)
|
|
|
|
set_define("NS_PRINT_PREVIEW", printing)
|
2016-08-16 07:45:12 +03:00
|
|
|
|
|
|
|
# Speech-dispatcher support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(toolkit)
|
|
|
|
def no_speechd_on_non_gtk(toolkit):
|
2019-08-21 15:25:42 +03:00
|
|
|
if toolkit != "gtk":
|
2016-08-16 07:45:12 +03:00
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
imply_option(
|
|
|
|
"--enable-synth-speechd", no_speechd_on_non_gtk, reason="--enable-default-toolkit"
|
|
|
|
)
|
|
|
|
|
|
|
|
option("--disable-synth-speechd", help="Disable speech-dispatcher support")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 07:45:12 +03:00
|
|
|
set_config("MOZ_SYNTH_SPEECHD", depends_if("--disable-synth-speechd")(lambda _: True))
|
2016-08-16 07:57:56 +03:00
|
|
|
|
2016-08-16 08:26:00 +03:00
|
|
|
# Speech API
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-webspeech", help="Disable support for HTML Speech API")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 08:26:00 +03:00
|
|
|
|
2018-12-11 22:34:28 +03:00
|
|
|
@depends("--disable-webspeech")
|
|
|
|
def webspeech(value):
|
2016-08-16 08:26:00 +03:00
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 08:26:00 +03:00
|
|
|
set_config("MOZ_WEBSPEECH", webspeech)
|
|
|
|
set_define("MOZ_WEBSPEECH", webspeech)
|
|
|
|
|
2016-08-16 08:33:09 +03:00
|
|
|
# Speech API test backend
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--enable-webspeechtestbackend",
|
|
|
|
default=webspeech,
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Enable|Disable} support for HTML Speech API Test Backend",
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 08:33:09 +03:00
|
|
|
|
|
|
|
@depends_if("--enable-webspeechtestbackend")
|
|
|
|
def webspeech_test_backend(value):
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2016-08-16 08:33:09 +03:00
|
|
|
set_config("MOZ_WEBSPEECH_TEST_BACKEND", webspeech_test_backend)
|
|
|
|
set_define("MOZ_WEBSPEECH_TEST_BACKEND", webspeech_test_backend)
|
|
|
|
|
2016-08-26 01:55:16 +03:00
|
|
|
# Graphics
|
|
|
|
# ==============================================================
|
2021-07-30 02:29:44 +03:00
|
|
|
@depends(target, milestone)
|
|
|
|
def skia_pdf_default(target, milestone):
|
|
|
|
return milestone.is_nightly and target.os != "WINNT"
|
2016-10-26 21:23:07 +03:00
|
|
|
|
|
|
|
|
2021-07-30 02:29:44 +03:00
|
|
|
option("--enable-skia-pdf", default=skia_pdf_default, help="{Enable|Disable} Skia PDF")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-07-30 02:29:44 +03:00
|
|
|
set_config("MOZ_ENABLE_SKIA_PDF", True, when="--enable-skia-pdf")
|
|
|
|
set_define("MOZ_ENABLE_SKIA_PDF", True, when="--enable-skia-pdf")
|
2021-06-15 20:53:35 +03:00
|
|
|
|
2021-07-30 02:29:43 +03:00
|
|
|
set_config(
|
|
|
|
"SKIA_INCLUDES",
|
|
|
|
[
|
|
|
|
"/gfx/skia",
|
|
|
|
"/gfx/skia/skia",
|
|
|
|
],
|
|
|
|
)
|
2018-10-04 00:40:47 +03:00
|
|
|
|
2021-07-16 23:51:27 +03:00
|
|
|
system_lib_option(
|
2022-11-27 01:13:36 +03:00
|
|
|
"--with-system-webp", help="Use system libwebp (located with pkgconfig)"
|
2021-07-16 23:51:27 +03:00
|
|
|
)
|
2018-10-04 00:40:47 +03:00
|
|
|
|
2016-08-18 01:02:31 +03:00
|
|
|
system_webp = pkg_check_modules(
|
2019-01-21 15:36:03 +03:00
|
|
|
"MOZ_WEBP", "libwebp >= 1.0.2 libwebpdemux >= 1.0.2", when="--with-system-webp"
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
2018-10-04 00:40:47 +03:00
|
|
|
set_config("MOZ_SYSTEM_WEBP", depends(when=system_webp)(lambda: True))
|
|
|
|
|
2017-06-30 03:17:46 +03:00
|
|
|
# Build Freetype in the tree
|
|
|
|
# ==============================================================
|
2021-07-30 02:29:44 +03:00
|
|
|
@depends(target, "--enable-skia-pdf")
|
2017-06-30 03:17:46 +03:00
|
|
|
def tree_freetype(target, skia_pdf):
|
|
|
|
if target.os == "Android" or (skia_pdf and target.os == "WINNT"):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_define("MOZ_TREE_FREETYPE", tree_freetype)
|
|
|
|
set_config("MOZ_TREE_FREETYPE", tree_freetype)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-06-30 03:17:46 +03:00
|
|
|
set_define("HAVE_FT_BITMAP_SIZE_Y_PPEM", tree_freetype)
|
|
|
|
set_define("HAVE_FT_GLYPHSLOT_EMBOLDEN", tree_freetype)
|
|
|
|
set_define("HAVE_FT_LOAD_SFNT_TABLE", tree_freetype)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-06-30 03:17:46 +03:00
|
|
|
|
2021-12-23 23:47:47 +03:00
|
|
|
@depends(freetype2_combined_info, tree_freetype, build_environment)
|
2017-06-30 03:17:46 +03:00
|
|
|
def ft2_info(freetype2_combined_info, tree_freetype, build_env):
|
|
|
|
if tree_freetype:
|
|
|
|
return namespace(
|
|
|
|
cflags=("-I%s/modules/freetype2/include" % build_env.topsrcdir,), libs=()
|
|
|
|
)
|
|
|
|
if freetype2_combined_info:
|
|
|
|
return freetype2_combined_info
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-06-30 03:17:46 +03:00
|
|
|
set_config("FT2_LIBS", ft2_info.libs)
|
2021-12-30 03:54:01 +03:00
|
|
|
|
|
|
|
|
|
|
|
@depends(target, tree_freetype, freetype2_info)
|
|
|
|
def enable_cairo_ft(target, tree_freetype, freetype2_info):
|
|
|
|
# Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
|
|
|
|
# "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
|
|
|
|
return freetype2_info or (tree_freetype and target.os != "WINNT")
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_ENABLE_CAIRO_FT", True, when=enable_cairo_ft)
|
|
|
|
set_config("CAIRO_FT_CFLAGS", ft2_info.cflags, when=enable_cairo_ft)
|
|
|
|
|
2017-06-30 03:17:46 +03:00
|
|
|
|
2021-05-25 12:13:28 +03:00
|
|
|
# WebDriver (HTTP / BiDi)
|
2019-03-08 19:43:29 +03:00
|
|
|
# ==============================================================
|
|
|
|
#
|
2021-05-25 12:13:28 +03:00
|
|
|
# WebDriver is a remote control interface that enables introspection and
|
|
|
|
# control of user agents. It provides a platform- and language-neutral wire
|
|
|
|
# protocol as a way for out-of-process programs to remotely instruct the
|
|
|
|
# behavior of web browsers.
|
|
|
|
#
|
|
|
|
# The Gecko implementation is backed by Marionette and Remote Agent.
|
|
|
|
# Both protocols are not really toolkit features, as much as Gecko engine
|
|
|
|
# features. But they are enabled based on the toolkit, so here it lives.
|
|
|
|
#
|
2017-05-26 18:27:07 +03:00
|
|
|
# Marionette remote protocol
|
2021-05-25 12:13:28 +03:00
|
|
|
# -----------------------------------------------------------
|
2017-05-26 18:27:07 +03:00
|
|
|
#
|
|
|
|
# Marionette is the Gecko remote protocol used for various remote control,
|
2021-05-25 12:13:28 +03:00
|
|
|
# automation, and testing purposes throughout Gecko-based applications like
|
|
|
|
# Firefox, Thunderbird, and any mobile browser built upon GeckoView.
|
2017-05-26 18:27:07 +03:00
|
|
|
#
|
|
|
|
# It also backs ../testing/geckodriver, which is Mozilla's WebDriver
|
|
|
|
# implementation.
|
|
|
|
#
|
2021-05-31 20:36:06 +03:00
|
|
|
# The source of Marionette lives in ../remote/marionette.
|
2021-05-25 12:13:28 +03:00
|
|
|
#
|
|
|
|
# For more information, see:
|
|
|
|
# https://firefox-source-docs.mozilla.org/testing/marionette/index.html
|
|
|
|
#
|
|
|
|
# Remote Agent (WebDriver BiDi / partial CDP)
|
|
|
|
# -----------------------------------------------------------
|
|
|
|
#
|
|
|
|
# The primary purpose is the implementation of the WebDriver BiDi specification.
|
|
|
|
# But it also complements the existing Firefox Developer Tools Remote Debugging
|
|
|
|
# Protocol (RDP) by implementing a subset of the Chrome DevTools Protocol (CDP).
|
|
|
|
#
|
|
|
|
# The source of Remote Agent lives in ../remote.
|
|
|
|
#
|
|
|
|
# For more information, see:
|
|
|
|
# https://firefox-source-docs.mozilla.org/remote/index.html
|
2016-12-17 02:49:14 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-05-25 12:13:28 +03:00
|
|
|
option(
|
|
|
|
"--disable-webdriver",
|
|
|
|
help="Disable support for WebDriver remote protocols",
|
|
|
|
)
|
2016-12-17 02:49:14 +03:00
|
|
|
|
2021-05-25 12:13:28 +03:00
|
|
|
|
|
|
|
@depends("--disable-webdriver")
|
|
|
|
def webdriver(enabled):
|
|
|
|
if enabled:
|
2016-12-17 02:49:14 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-05-25 12:13:28 +03:00
|
|
|
set_config("ENABLE_WEBDRIVER", webdriver)
|
|
|
|
set_define("ENABLE_WEBDRIVER", webdriver)
|
|
|
|
|
2019-03-08 19:43:29 +03:00
|
|
|
|
2017-05-27 20:51:40 +03:00
|
|
|
# geckodriver WebDriver implementation
|
|
|
|
# ==============================================================
|
2018-08-22 19:26:10 +03:00
|
|
|
#
|
|
|
|
# Turn off geckodriver for build configs we don't handle yet,
|
|
|
|
# but allow --enable-geckodriver to override when compile environment is available.
|
|
|
|
# --disable-tests implies disabling geckodriver.
|
2020-05-14 23:47:13 +03:00
|
|
|
# Disable building in CI
|
2017-05-27 20:51:40 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-05-14 23:47:13 +03:00
|
|
|
@depends(
|
|
|
|
"--enable-tests", target, cross_compiling, hazard_analysis, asan, "MOZ_AUTOMATION"
|
|
|
|
)
|
|
|
|
def geckodriver_default(enable_tests, target, cross_compile, hazard, asan, automation):
|
2018-08-22 19:26:10 +03:00
|
|
|
if not enable_tests:
|
|
|
|
return False
|
|
|
|
if hazard or target.os == "Android" or (asan and cross_compile):
|
|
|
|
return False
|
2020-05-14 23:47:13 +03:00
|
|
|
if automation:
|
|
|
|
return False
|
2018-08-22 19:26:10 +03:00
|
|
|
return True
|
2017-05-27 20:51:40 +03:00
|
|
|
|
2018-08-22 19:26:10 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-01-02 17:35:17 +03:00
|
|
|
"--enable-geckodriver",
|
|
|
|
default=geckodriver_default,
|
2018-08-22 19:26:10 +03:00
|
|
|
when="--enable-compile-environment",
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Build|Do not build} geckodriver",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-08-22 19:26:10 +03:00
|
|
|
@depends("--enable-geckodriver", when="--enable-compile-environment")
|
|
|
|
def geckodriver(enabled):
|
|
|
|
if enabled:
|
|
|
|
return True
|
2017-05-27 20:51:40 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-03-09 02:44:25 +03:00
|
|
|
set_config("MOZ_GECKODRIVER", geckodriver)
|
2017-07-13 20:12:23 +03:00
|
|
|
|
2019-03-08 19:43:29 +03:00
|
|
|
|
2017-09-21 02:29:39 +03:00
|
|
|
# WebRTC
|
|
|
|
# ========================================================
|
|
|
|
@depends(target)
|
|
|
|
def webrtc_default(target):
|
|
|
|
# Turn off webrtc for OS's we don't handle yet, but allow
|
|
|
|
# --enable-webrtc to override.
|
2023-07-07 14:02:14 +03:00
|
|
|
os_match = target.kernel in (
|
|
|
|
"Linux",
|
|
|
|
"WINNT",
|
|
|
|
"DragonFly",
|
|
|
|
"FreeBSD",
|
|
|
|
"kFreeBSD",
|
|
|
|
"NetBSD",
|
|
|
|
"OpenBSD",
|
|
|
|
)
|
2017-09-21 02:29:39 +03:00
|
|
|
|
2023-07-13 09:50:55 +03:00
|
|
|
if not os_match:
|
|
|
|
os_match = target.os in ("OSX",)
|
|
|
|
|
2023-07-07 14:02:14 +03:00
|
|
|
cpu_match = target.cpu in (
|
|
|
|
"x86_64",
|
|
|
|
"arm",
|
|
|
|
"aarch64",
|
|
|
|
"x86",
|
|
|
|
"ia64",
|
|
|
|
"ppc",
|
|
|
|
"ppc64",
|
|
|
|
"riscv64",
|
|
|
|
)
|
2023-07-07 00:32:31 +03:00
|
|
|
|
2023-07-07 14:02:15 +03:00
|
|
|
if not cpu_match:
|
|
|
|
cpu_match = target.endianness == "little" and target.cpu in ("mips32", "mips64")
|
|
|
|
|
2023-07-07 14:02:14 +03:00
|
|
|
return os_match and cpu_match
|
2017-09-21 02:29:39 +03:00
|
|
|
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-01-02 17:35:17 +03:00
|
|
|
"--disable-webrtc",
|
|
|
|
default=webrtc_default,
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Enable|Disable} support for WebRTC",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2017-09-21 02:29:39 +03:00
|
|
|
@depends("--disable-webrtc")
|
|
|
|
def webrtc(enabled):
|
|
|
|
if enabled:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-09-21 02:29:39 +03:00
|
|
|
set_config("MOZ_WEBRTC", webrtc)
|
|
|
|
set_define("MOZ_WEBRTC", webrtc)
|
2018-10-01 21:51:27 +03:00
|
|
|
set_config("MOZ_SCTP", webrtc)
|
|
|
|
set_define("MOZ_SCTP", webrtc)
|
|
|
|
set_config("MOZ_SRTP", webrtc)
|
|
|
|
set_define("MOZ_SRTP", webrtc)
|
2017-09-21 02:29:39 +03:00
|
|
|
set_config("MOZ_WEBRTC_SIGNALING", webrtc)
|
|
|
|
set_define("MOZ_WEBRTC_SIGNALING", webrtc)
|
|
|
|
set_config("MOZ_PEERCONNECTION", webrtc)
|
|
|
|
set_define("MOZ_PEERCONNECTION", webrtc)
|
|
|
|
# MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
|
|
|
|
# opt/production builds (via MOZ_CRASH())
|
|
|
|
set_config("MOZ_WEBRTC_ASSERT_ALWAYS", webrtc)
|
|
|
|
set_define("MOZ_WEBRTC_ASSERT_ALWAYS", webrtc)
|
|
|
|
|
2018-10-01 21:51:27 +03:00
|
|
|
# RAW media
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-01 21:51:27 +03:00
|
|
|
@depends(target, webrtc)
|
|
|
|
def raw_media_default(target, webrtc):
|
|
|
|
if target.os == "Android":
|
|
|
|
return True
|
|
|
|
if webrtc:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2018-10-01 21:51:27 +03:00
|
|
|
"--enable-raw",
|
2018-10-16 14:28:12 +03:00
|
|
|
default=raw_media_default,
|
|
|
|
help="{Enable|Disable} support for RAW media",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
2018-10-01 21:51:27 +03:00
|
|
|
set_config("MOZ_RAW", depends_if("--enable-raw")(lambda _: True))
|
|
|
|
set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True))
|
|
|
|
|
2021-07-30 14:39:39 +03:00
|
|
|
|
|
|
|
# X11
|
|
|
|
# ==============================================================
|
|
|
|
@depends(webrtc, when=toolkit_gtk)
|
|
|
|
def x11_libs(webrtc):
|
|
|
|
libs = [
|
|
|
|
"x11",
|
|
|
|
"xcb",
|
|
|
|
"xcb-shm",
|
|
|
|
"x11-xcb",
|
|
|
|
"xext",
|
2021-09-28 20:26:30 +03:00
|
|
|
"xrandr >= 1.4.0",
|
2021-07-30 14:39:39 +03:00
|
|
|
]
|
|
|
|
if webrtc:
|
|
|
|
# third_party/libwebrtc/webrtc/webrtc_gn/moz.build adds those
|
|
|
|
# manually, ensure they're available.
|
|
|
|
libs += [
|
|
|
|
"xcomposite",
|
|
|
|
"xcursor",
|
|
|
|
"xdamage",
|
|
|
|
"xfixes",
|
|
|
|
"xi",
|
2021-11-24 05:35:13 +03:00
|
|
|
"xtst",
|
2021-07-30 14:39:39 +03:00
|
|
|
]
|
2021-10-28 01:30:28 +03:00
|
|
|
return libs
|
2021-07-30 14:39:39 +03:00
|
|
|
|
|
|
|
|
2022-04-20 12:32:09 +03:00
|
|
|
x11_headers = pkg_check_modules(
|
|
|
|
"MOZ_X11",
|
|
|
|
x11_libs,
|
2023-06-22 16:42:37 +03:00
|
|
|
allow_missing=toolkit_gtk_x11_optional,
|
|
|
|
when=toolkit_gtk_x11,
|
2022-04-20 12:32:09 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_X11", True, when=x11_headers)
|
|
|
|
set_define("MOZ_X11", True, when=x11_headers)
|
|
|
|
|
|
|
|
pkg_check_modules(
|
|
|
|
"MOZ_X11_SM",
|
|
|
|
["ice", "sm"],
|
|
|
|
cflags_only=True,
|
2023-06-22 16:42:37 +03:00
|
|
|
allow_missing=toolkit_gtk_x11_optional,
|
|
|
|
when=toolkit_gtk_x11,
|
2022-04-20 12:32:09 +03:00
|
|
|
)
|
2021-07-30 14:39:39 +03:00
|
|
|
|
|
|
|
|
2017-07-31 16:13:38 +03:00
|
|
|
# ASan Reporter Addon
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--enable-address-sanitizer-reporter",
|
|
|
|
help="Enable Address Sanitizer Reporter Extension",
|
|
|
|
)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-07-31 16:13:38 +03:00
|
|
|
@depends("--enable-address-sanitizer-reporter")
|
|
|
|
def enable_asan_reporter(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2017-07-31 16:13:38 +03:00
|
|
|
set_config("MOZ_ASAN_REPORTER", enable_asan_reporter)
|
|
|
|
set_define("MOZ_ASAN_REPORTER", enable_asan_reporter)
|
2017-11-16 01:52:26 +03:00
|
|
|
|
2023-06-27 11:56:17 +03:00
|
|
|
# Checks for library functions
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT")):
|
|
|
|
set_define("HAVE_STAT64", check_symbol("stat64"))
|
|
|
|
set_define("HAVE_LSTAT64", check_symbol("lstat64"))
|
|
|
|
set_define("HAVE_TRUNCATE64", check_symbol("truncate64"))
|
|
|
|
set_define("HAVE_STATVFS64", check_symbol("statvfs64"))
|
|
|
|
set_define("HAVE_STATVFS", check_symbol("statvfs"))
|
|
|
|
set_define("HAVE_STATFS64", check_symbol("statfs64"))
|
|
|
|
set_define("HAVE_STATFS", check_symbol("statfs"))
|
|
|
|
set_define("HAVE_LUTIMES", check_symbol("lutimes"))
|
|
|
|
set_define("HAVE_POSIX_FADVISE", check_symbol("posix_fadvise"))
|
|
|
|
set_define("HAVE_POSIX_FALLOCATE", check_symbol("posix_fallocate"))
|
2023-06-28 11:36:08 +03:00
|
|
|
set_define("HAVE_EVENTFD", check_symbol("eventfd"))
|
2023-06-27 11:56:17 +03:00
|
|
|
|
|
|
|
have_arc4random = check_symbol("arc4random")
|
|
|
|
set_define("HAVE_ARC4RANDOM", have_arc4random)
|
|
|
|
set_define("HAVE_ARC4RANDOM_BUF", check_symbol("arc4random_buf"))
|
|
|
|
set_define("HAVE_MALLINFO", check_symbol("mallinfo"))
|
|
|
|
|
2023-07-20 10:16:55 +03:00
|
|
|
# Checks for headers
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT")):
|
|
|
|
set_define("HAVE_SYSIOCCOM_H", check_header("sys/ioccom.h"))
|
|
|
|
|
2017-11-16 01:52:26 +03:00
|
|
|
# Elfhack
|
|
|
|
# ==============================================================
|
2018-07-05 03:23:56 +03:00
|
|
|
with only_when("--enable-compile-environment"):
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-07-05 03:23:56 +03:00
|
|
|
@depends(host, target)
|
|
|
|
def has_elfhack(host, target):
|
|
|
|
return (
|
|
|
|
target.kernel == "Linux"
|
|
|
|
and host.kernel == "Linux"
|
2021-12-30 23:52:55 +03:00
|
|
|
and target.cpu in ("arm", "aarch64", "x86", "x86_64")
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2018-07-05 03:23:56 +03:00
|
|
|
|
2020-08-05 00:56:41 +03:00
|
|
|
@depends("--enable-release", enable_linker)
|
|
|
|
def default_elfhack(release, linker):
|
|
|
|
# Disable elfhack when explicitly building with --enable-linker=lld
|
2022-09-09 14:01:50 +03:00
|
|
|
if linker and linker.origin != "default" and linker[0] in ("lld", "mold"):
|
2020-08-05 00:56:41 +03:00
|
|
|
return False
|
2018-07-05 03:23:56 +03:00
|
|
|
return bool(release)
|
2017-11-16 01:52:26 +03:00
|
|
|
|
2023-06-27 11:56:17 +03:00
|
|
|
option(
|
|
|
|
"--disable-elf-hack",
|
|
|
|
default=default_elfhack,
|
|
|
|
help="{Enable|Disable} elf hacks",
|
|
|
|
when=has_elfhack,
|
|
|
|
)
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
have_arc4random,
|
|
|
|
android_version,
|
|
|
|
depends("--enable-elf-hack", when=has_elfhack)(lambda x: x),
|
|
|
|
when=target_has_linux_kernel,
|
|
|
|
)
|
|
|
|
def may_use_pack_relative_relocs(have_arc4random, android_version, elfhack):
|
|
|
|
# Packed relative relocations are only supported on Android since
|
|
|
|
# version 11 (API 30), and in glibc since version 2.36.
|
|
|
|
# glibc 2.36 also added the arc4random function, which is our proxy
|
|
|
|
# to detect this (or newer) version being used.
|
|
|
|
# When targetting those newer versions, we allow ourselves to use
|
|
|
|
# packed relative relocations rather than elfhack. We still prefer
|
|
|
|
# elfhack when explicitly enabled.
|
|
|
|
if elfhack and elfhack.origin != "default":
|
|
|
|
return False
|
|
|
|
if android_version:
|
|
|
|
return android_version >= 30
|
|
|
|
return have_arc4random
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
c_compiler,
|
|
|
|
extra_toolchain_flags,
|
|
|
|
linker_ldflags,
|
|
|
|
readelf,
|
|
|
|
configure_cache,
|
|
|
|
when=may_use_pack_relative_relocs,
|
|
|
|
)
|
|
|
|
@checking("for -z pack-relative-relocs option to ld", bool)
|
|
|
|
@imports(_from="__builtin__", _import="FileNotFoundError")
|
|
|
|
@imports("os")
|
|
|
|
@imports(_from="tempfile", _import="mkstemp")
|
|
|
|
@imports("textwrap")
|
|
|
|
def pack_relative_relocs(
|
|
|
|
c_compiler,
|
|
|
|
extra_toolchain_flags,
|
|
|
|
linker_ldflags,
|
|
|
|
readelf,
|
|
|
|
configure_cache,
|
|
|
|
):
|
|
|
|
try:
|
|
|
|
fd, path = mkstemp(prefix="conftest.")
|
|
|
|
os.close(fd)
|
|
|
|
|
|
|
|
pack_rel_relocs = ["-Wl,-z,pack-relative-relocs"]
|
|
|
|
if (
|
|
|
|
try_invoke_compiler(
|
|
|
|
configure_cache,
|
|
|
|
[c_compiler.compiler] + c_compiler.flags,
|
|
|
|
c_compiler.language,
|
2023-07-05 10:51:16 +03:00
|
|
|
# The resulting binary is expected to have relative
|
|
|
|
# relocations, the `ptr` variable attempts to ensure
|
|
|
|
# there is at least one.
|
|
|
|
"int main() { return 0; }\nint (*ptr)() = main;",
|
2023-06-27 11:56:17 +03:00
|
|
|
pack_rel_relocs
|
|
|
|
+ ["-o", path]
|
|
|
|
+ (extra_toolchain_flags or [])
|
|
|
|
+ linker_ldflags,
|
|
|
|
wrapper=c_compiler.wrapper,
|
|
|
|
onerror=lambda: None,
|
|
|
|
)
|
|
|
|
is not None
|
|
|
|
):
|
|
|
|
# BFD ld ignores options it doesn't understand. So check
|
|
|
|
# that we did get packed relative relocations (DT_RELR).
|
|
|
|
env = os.environ.copy()
|
|
|
|
env["LANG"] = "C"
|
|
|
|
dyn = check_cmd_output(readelf, "-d", path, env=env)
|
|
|
|
tags = [
|
|
|
|
int(l.split()[0], 16)
|
|
|
|
for l in dyn.splitlines()
|
|
|
|
if l.strip().startswith("0x")
|
|
|
|
]
|
|
|
|
# Older versions of readelf don't know about DT_RELR but will
|
|
|
|
# still display the tag number.
|
|
|
|
if 0x23 in tags:
|
|
|
|
return pack_rel_relocs
|
|
|
|
finally:
|
|
|
|
try:
|
|
|
|
os.remove(path)
|
|
|
|
except FileNotFoundError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
add_old_configure_assignment("PACK_REL_RELOC_FLAGS", pack_relative_relocs)
|
2017-11-16 01:52:26 +03:00
|
|
|
|
2023-06-27 11:56:17 +03:00
|
|
|
@depends(
|
|
|
|
select_linker,
|
|
|
|
pack_relative_relocs,
|
|
|
|
"--enable-elf-hack",
|
|
|
|
when=has_elfhack,
|
|
|
|
)
|
|
|
|
def use_elf_hack(linker, pack_relative_relocs, elfhack):
|
|
|
|
if elfhack:
|
|
|
|
# If elfhack was not manually enabled and packed relative relocations
|
|
|
|
# can be used, then don't enable elfhack even if it would normally have.
|
|
|
|
if elfhack.origin == "default" and pack_relative_relocs:
|
|
|
|
return
|
2022-11-03 09:09:28 +03:00
|
|
|
if linker and linker.KIND == "lld":
|
|
|
|
die(
|
|
|
|
"Cannot enable elfhack with lld."
|
|
|
|
" Use --enable-linker=bfd, --enable-linker=gold, or --disable-elf-hack"
|
|
|
|
)
|
|
|
|
return True
|
|
|
|
|
2023-06-27 11:56:17 +03:00
|
|
|
set_config("USE_ELF_HACK", use_elf_hack)
|
2018-01-25 00:55:05 +03:00
|
|
|
|
|
|
|
|
2021-12-23 23:47:47 +03:00
|
|
|
@depends(build_environment)
|
2018-01-25 00:55:05 +03:00
|
|
|
def idl_roots(build_env):
|
|
|
|
return namespace(
|
|
|
|
ipdl_root=os.path.join(build_env.topobjdir, "ipc", "ipdl"),
|
|
|
|
webidl_root=os.path.join(build_env.topobjdir, "dom", "bindings"),
|
2018-12-13 05:29:57 +03:00
|
|
|
xpcom_root=os.path.join(build_env.topobjdir, "xpcom", "components"),
|
|
|
|
)
|
2018-01-25 00:55:05 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-01-25 00:55:05 +03:00
|
|
|
set_config("WEBIDL_ROOT", idl_roots.webidl_root)
|
|
|
|
set_config("IPDL_ROOT", idl_roots.ipdl_root)
|
2018-12-13 05:29:57 +03:00
|
|
|
set_config("XPCOM_ROOT", idl_roots.xpcom_root)
|
2018-02-02 15:45:00 +03:00
|
|
|
|
|
|
|
# Proxy bypass protection
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-proxy-bypass-protection",
|
|
|
|
help="Prevent suspected or confirmed proxy bypasses",
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-02-02 15:45:00 +03:00
|
|
|
|
|
|
|
@depends_if("--enable-proxy-bypass-protection")
|
|
|
|
def proxy_bypass_protection(_):
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-02-02 15:45:00 +03:00
|
|
|
set_config("MOZ_PROXY_BYPASS_PROTECTION", proxy_bypass_protection)
|
|
|
|
set_define("MOZ_PROXY_BYPASS_PROTECTION", proxy_bypass_protection)
|
2018-05-28 10:15:13 +03:00
|
|
|
|
2021-07-19 20:24:29 +03:00
|
|
|
# Proxy direct failover
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--disable-proxy-direct-failover",
|
|
|
|
help="Disable direct failover for system requests",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends_if("--disable-proxy-direct-failover")
|
|
|
|
def proxy_direct_failover(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_PROXY_DIRECT_FAILOVER", proxy_direct_failover)
|
|
|
|
set_define("MOZ_PROXY_DIRECT_FAILOVER", proxy_direct_failover)
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
# MIDL
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
@depends(c_compiler, toolchain_prefix)
|
|
|
|
def midl_names(c_compiler, toolchain_prefix):
|
|
|
|
if c_compiler and c_compiler.type in ["gcc", "clang"]:
|
|
|
|
# mingw
|
|
|
|
widl = ("widl",)
|
|
|
|
if toolchain_prefix:
|
|
|
|
prefixed = tuple("%s%s" % (p, "widl") for p in toolchain_prefix)
|
|
|
|
widl = prefixed + widl
|
|
|
|
return widl
|
|
|
|
|
2020-03-04 20:13:24 +03:00
|
|
|
return ("midl.exe",)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
@depends(target, "--enable-compile-environment")
|
|
|
|
def check_for_midl(target, compile_environment):
|
|
|
|
if target.os != "WINNT":
|
|
|
|
return
|
|
|
|
|
|
|
|
if compile_environment:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2019-01-11 02:37:46 +03:00
|
|
|
midl = check_prog(
|
2022-04-13 01:52:54 +03:00
|
|
|
"MIDL",
|
|
|
|
midl_names,
|
|
|
|
when=check_for_midl,
|
|
|
|
allow_missing=True,
|
|
|
|
paths=sdk_bin_path,
|
|
|
|
# MIDL being used from a python wrapper script, we can live with it
|
|
|
|
# having spaces.
|
|
|
|
allow_spaces=True,
|
2019-01-11 02:37:46 +03:00
|
|
|
)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2020-05-22 04:16:59 +03:00
|
|
|
option(env="MIDL_FLAGS", nargs=1, help="Extra flags to pass to MIDL")
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-05-22 04:16:59 +03:00
|
|
|
@depends(
|
|
|
|
"MIDL_FLAGS",
|
|
|
|
target,
|
|
|
|
midl,
|
2018-12-29 17:09:45 +03:00
|
|
|
when=depends(midl, target)(lambda m, t: m and t.kernel == "WINNT"),
|
|
|
|
)
|
2022-01-26 01:43:56 +03:00
|
|
|
def midl_flags(flags, target, midl):
|
2020-05-22 04:16:59 +03:00
|
|
|
if flags:
|
|
|
|
flags = flags[0].split()
|
|
|
|
else:
|
|
|
|
flags = []
|
|
|
|
|
|
|
|
if not midl.endswith("widl"):
|
2018-10-04 03:29:29 +03:00
|
|
|
env = {
|
|
|
|
"x86": "win32",
|
|
|
|
"x86_64": "x64",
|
|
|
|
"aarch64": "arm64",
|
|
|
|
}[target.cpu]
|
2022-01-26 01:43:56 +03:00
|
|
|
return flags + ["-nologo", "-no_cpp", "-env", env]
|
2020-05-22 04:16:59 +03:00
|
|
|
|
|
|
|
# widl
|
|
|
|
return flags + {
|
2018-10-04 03:29:29 +03:00
|
|
|
"x86": ["--win32", "-m32"],
|
|
|
|
"x86_64": ["--win64", "-m64"],
|
|
|
|
}[target.cpu]
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MIDL_FLAGS", midl_flags)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
# Accessibility
|
|
|
|
# ==============================================================
|
|
|
|
|
2019-02-15 05:50:50 +03:00
|
|
|
option("--disable-accessibility", help="Disable accessibility support")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2019-01-11 03:20:35 +03:00
|
|
|
@depends("--enable-accessibility", check_for_midl, midl, c_compiler)
|
2018-10-04 03:29:29 +03:00
|
|
|
def accessibility(value, check_for_midl, midl, c_compiler):
|
|
|
|
enabled = bool(value)
|
|
|
|
|
|
|
|
if not enabled:
|
|
|
|
return
|
|
|
|
|
|
|
|
if check_for_midl and not midl:
|
|
|
|
if c_compiler and c_compiler.type in ("gcc", "clang"):
|
|
|
|
die(
|
|
|
|
"You have accessibility enabled, but widl could not be found. "
|
|
|
|
"Add --disable-accessibility to your mozconfig or install widl. "
|
|
|
|
"See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details."
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
die(
|
|
|
|
"MIDL could not be found. "
|
|
|
|
"Building accessibility without MIDL is not supported."
|
|
|
|
)
|
|
|
|
|
|
|
|
return enabled
|
|
|
|
|
|
|
|
|
|
|
|
set_config("ACCESSIBILITY", accessibility)
|
|
|
|
set_define("ACCESSIBILITY", accessibility)
|
|
|
|
|
2021-07-13 11:43:52 +03:00
|
|
|
|
2021-12-30 01:12:46 +03:00
|
|
|
@depends(moz_debug, developer_options)
|
|
|
|
def a11y_log(debug, developer_options):
|
|
|
|
return debug or developer_options
|
|
|
|
|
|
|
|
|
|
|
|
set_config("A11Y_LOG", True, when=a11y_log)
|
|
|
|
set_define("A11Y_LOG", True, when=a11y_log)
|
|
|
|
|
|
|
|
|
2018-05-28 10:15:13 +03:00
|
|
|
# Addon signing
|
|
|
|
# ==============================================================
|
2021-07-13 11:43:52 +03:00
|
|
|
@depends(milestone)
|
|
|
|
def require_signing(milestone):
|
|
|
|
return milestone.is_release_or_beta and not milestone.is_esr
|
|
|
|
|
2018-05-28 10:15:13 +03:00
|
|
|
|
2021-05-25 23:00:05 +03:00
|
|
|
option(
|
|
|
|
env="MOZ_REQUIRE_SIGNING",
|
2021-07-13 11:43:52 +03:00
|
|
|
default=require_signing,
|
2021-05-25 23:00:05 +03:00
|
|
|
help="Enforce that add-ons are signed by the trusted root",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_REQUIRE_SIGNING", True, when="MOZ_REQUIRE_SIGNING")
|
|
|
|
set_define("MOZ_REQUIRE_SIGNING", True, when="MOZ_REQUIRE_SIGNING")
|
|
|
|
|
2018-05-28 10:15:13 +03:00
|
|
|
option(
|
|
|
|
"--with-unsigned-addon-scopes",
|
|
|
|
nargs="+",
|
|
|
|
choices=("app", "system"),
|
|
|
|
help="Addon scopes where signature is not required",
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-05-28 10:15:13 +03:00
|
|
|
|
|
|
|
@depends("--with-unsigned-addon-scopes")
|
|
|
|
def unsigned_addon_scopes(scopes):
|
|
|
|
return namespace(
|
|
|
|
app="app" in scopes or None,
|
|
|
|
system="system" in scopes or None,
|
|
|
|
)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-05-28 10:15:13 +03:00
|
|
|
set_config("MOZ_UNSIGNED_APP_SCOPE", unsigned_addon_scopes.app)
|
|
|
|
set_config("MOZ_UNSIGNED_SYSTEM_SCOPE", unsigned_addon_scopes.system)
|
2018-07-24 00:58:45 +03:00
|
|
|
|
2021-07-13 11:43:53 +03:00
|
|
|
|
2020-02-05 02:27:10 +03:00
|
|
|
# Addon sideloading
|
|
|
|
# ==============================================================
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-02-05 02:27:10 +03:00
|
|
|
"--allow-addon-sideload",
|
2021-07-13 11:43:53 +03:00
|
|
|
default=milestone.is_esr,
|
2020-02-05 02:27:10 +03:00
|
|
|
help="Addon sideloading is allowed",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-07-13 11:43:53 +03:00
|
|
|
set_config("MOZ_ALLOW_ADDON_SIDELOAD", True, when="--allow-addon-sideload")
|
2020-02-05 02:27:10 +03:00
|
|
|
|
2021-06-11 21:58:11 +03:00
|
|
|
# WebExtensions API WebIDL bindings
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
|
|
|
|
@depends(milestone)
|
|
|
|
def extensions_webidl_bindings_default(milestone):
|
|
|
|
# Only enable the webidl bindings for the WebExtensions APIs
|
|
|
|
# in Nightly.
|
|
|
|
return milestone.is_nightly
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-extensions-webidl-bindings",
|
|
|
|
default=extensions_webidl_bindings_default,
|
|
|
|
help="{Enable|Disable} building experimental WebExtensions WebIDL bindings",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends("--enable-extensions-webidl-bindings")
|
|
|
|
def extensions_webidl_enabled(value):
|
|
|
|
return bool(value)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_WEBEXT_WEBIDL_ENABLED", extensions_webidl_enabled)
|
|
|
|
|
2018-07-24 00:58:45 +03:00
|
|
|
# Launcher process (Windows only)
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-02-27 00:11:51 +03:00
|
|
|
@depends(target)
|
|
|
|
def launcher_process_default(target):
|
|
|
|
return target.os == "WINNT"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-09-26 21:46:24 +03:00
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-launcher-process",
|
|
|
|
default=launcher_process_default,
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Enable|Disable} launcher process by default",
|
|
|
|
)
|
2018-07-24 00:58:45 +03:00
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-07-24 00:58:45 +03:00
|
|
|
@depends("--enable-launcher-process", target)
|
|
|
|
def launcher(value, target):
|
|
|
|
enabled = bool(value)
|
|
|
|
if enabled and target.os != "WINNT":
|
|
|
|
die("Cannot enable launcher process on %s", target.os)
|
|
|
|
if enabled:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-07-24 00:58:45 +03:00
|
|
|
set_config("MOZ_LAUNCHER_PROCESS", launcher)
|
|
|
|
set_define("MOZ_LAUNCHER_PROCESS", launcher)
|
2018-08-27 23:07:51 +03:00
|
|
|
|
2019-08-21 07:34:32 +03:00
|
|
|
# llvm-dlltool (Windows only)
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-08-21 07:34:32 +03:00
|
|
|
@depends(build_project, target, "--enable-compile-environment")
|
|
|
|
def check_for_llvm_dlltool(build_project, target, compile_environment):
|
|
|
|
if build_project != "browser":
|
|
|
|
return
|
|
|
|
|
|
|
|
if target.os != "WINNT":
|
|
|
|
return
|
|
|
|
|
|
|
|
return compile_environment
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-08-21 07:34:32 +03:00
|
|
|
llvm_dlltool = check_prog(
|
|
|
|
"LLVM_DLLTOOL",
|
|
|
|
("llvm-dlltool",),
|
|
|
|
what="llvm-dlltool",
|
|
|
|
when=check_for_llvm_dlltool,
|
2021-01-15 07:26:05 +03:00
|
|
|
paths=clang_search_path,
|
2019-08-21 07:34:32 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-08-21 07:34:32 +03:00
|
|
|
|
|
|
|
@depends(target, when=llvm_dlltool)
|
|
|
|
def llvm_dlltool_flags(target):
|
|
|
|
arch = {
|
|
|
|
"x86": "i386",
|
|
|
|
"x86_64": "i386:x86-64",
|
|
|
|
"aarch64": "arm64",
|
|
|
|
}[target.cpu]
|
|
|
|
|
|
|
|
return ["-m", arch]
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-08-21 07:34:32 +03:00
|
|
|
|
|
|
|
set_config("LLVM_DLLTOOL_FLAGS", llvm_dlltool_flags)
|
|
|
|
|
2019-03-22 01:43:41 +03:00
|
|
|
# BITS download (Windows only)
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-bits-download",
|
|
|
|
when=target_is_windows,
|
|
|
|
default=target_is_windows,
|
|
|
|
help="{Enable|Disable} building BITS download support",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_define(
|
|
|
|
"MOZ_BITS_DOWNLOAD",
|
|
|
|
depends_if("--enable-bits-download", when=target_is_windows)(lambda _: True),
|
|
|
|
)
|
|
|
|
set_config(
|
|
|
|
"MOZ_BITS_DOWNLOAD",
|
|
|
|
depends_if("--enable-bits-download", when=target_is_windows)(lambda _: True),
|
|
|
|
)
|
|
|
|
|
2018-10-01 21:51:28 +03:00
|
|
|
# Bundled fonts on desktop platform
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-01 21:51:28 +03:00
|
|
|
@depends(target)
|
|
|
|
def bundled_fonts_default(target):
|
|
|
|
return target.os == "WINNT" or target.kernel == "Linux"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-01 21:51:28 +03:00
|
|
|
|
|
|
|
@depends(build_project)
|
|
|
|
def allow_bundled_fonts(project):
|
2019-05-08 01:20:32 +03:00
|
|
|
return project == "browser" or project == "comm/mail"
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-01 21:51:28 +03:00
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-bundled-fonts",
|
|
|
|
default=bundled_fonts_default,
|
|
|
|
when=allow_bundled_fonts,
|
2018-10-16 14:28:12 +03:00
|
|
|
help="{Enable|Disable} support for bundled fonts on desktop platforms",
|
|
|
|
)
|
2018-10-01 21:51:28 +03:00
|
|
|
|
|
|
|
set_define(
|
|
|
|
"MOZ_BUNDLED_FONTS",
|
|
|
|
depends_if("--enable-bundled-fonts", when=allow_bundled_fonts)(lambda _: True),
|
|
|
|
)
|
2018-10-01 21:51:28 +03:00
|
|
|
|
2018-10-01 21:51:27 +03:00
|
|
|
# Reflow counting
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-12-11 22:34:28 +03:00
|
|
|
@depends(moz_debug)
|
|
|
|
def reflow_perf(debug):
|
2018-10-01 21:51:27 +03:00
|
|
|
if debug:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-10-16 14:28:12 +03:00
|
|
|
option(
|
|
|
|
"--enable-reflow-perf",
|
|
|
|
default=reflow_perf,
|
|
|
|
help="{Enable|Disable} reflow performance tracing",
|
|
|
|
)
|
2018-10-01 21:51:27 +03:00
|
|
|
|
|
|
|
# The difference in conditions here comes from the initial implementation
|
|
|
|
# in old-configure, which was unexplained there as well.
|
|
|
|
set_define("MOZ_REFLOW_PERF", depends_if("--enable-reflow-perf")(lambda _: True))
|
|
|
|
set_define("MOZ_REFLOW_PERF_DSP", reflow_perf)
|
2018-12-10 18:47:36 +03:00
|
|
|
|
|
|
|
# Layout debugger
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2018-12-11 22:34:28 +03:00
|
|
|
@depends(moz_debug)
|
|
|
|
def layout_debugger(debug):
|
2018-12-10 18:47:36 +03:00
|
|
|
if debug:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-05-21 02:44:49 +03:00
|
|
|
"--enable-layout-debugger",
|
2018-12-10 18:47:36 +03:00
|
|
|
default=layout_debugger,
|
|
|
|
help="{Enable|Disable} layout debugger",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
2020-05-21 02:44:49 +03:00
|
|
|
set_config("MOZ_LAYOUT_DEBUGGER", True, when="--enable-layout-debugger")
|
|
|
|
set_define("MOZ_LAYOUT_DEBUGGER", True, when="--enable-layout-debugger")
|
2018-12-14 17:56:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Shader Compiler for Windows (and MinGW Cross Compile)
|
|
|
|
# ==============================================================
|
|
|
|
|
2018-12-15 20:44:59 +03:00
|
|
|
with only_when(compile_environment):
|
2019-01-11 02:37:46 +03:00
|
|
|
fxc = check_prog(
|
|
|
|
"FXC",
|
|
|
|
("fxc.exe", "fxc2.exe"),
|
|
|
|
when=depends(target)(lambda t: t.kernel == "WINNT"),
|
|
|
|
paths=sdk_bin_path,
|
2022-04-13 01:52:54 +03:00
|
|
|
# FXC being used from a python wrapper script, we can live with it
|
|
|
|
# having spaces.
|
|
|
|
allow_spaces=True,
|
2019-01-11 02:37:46 +03:00
|
|
|
)
|
2018-12-19 14:39:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
# VPX
|
|
|
|
# ===
|
|
|
|
|
|
|
|
with only_when(compile_environment):
|
2021-07-16 23:51:27 +03:00
|
|
|
system_lib_option(
|
2022-11-27 01:13:36 +03:00
|
|
|
"--with-system-libvpx", help="Use system libvpx (located with pkgconfig)"
|
2021-07-16 23:51:27 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-01-11 01:00:41 +03:00
|
|
|
with only_when("--with-system-libvpx"):
|
2022-10-19 05:54:40 +03:00
|
|
|
vpx = pkg_check_modules("MOZ_LIBVPX", "vpx >= 1.10.0")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-01-11 01:00:41 +03:00
|
|
|
check_header(
|
|
|
|
"vpx/vpx_decoder.h",
|
|
|
|
flags=vpx.cflags,
|
|
|
|
onerror=lambda: die(
|
2018-12-19 14:39:08 +03:00
|
|
|
"Couldn't find vpx/vpx_decoder.h, which is required to build "
|
|
|
|
"with system libvpx. Use --without-system-libvpx to build "
|
|
|
|
"with in-tree libvpx."
|
|
|
|
),
|
2019-01-11 01:00:41 +03:00
|
|
|
)
|
2018-12-19 14:39:08 +03:00
|
|
|
|
2019-01-11 01:00:41 +03:00
|
|
|
check_symbol(
|
|
|
|
"vpx_codec_dec_init_ver",
|
2018-12-19 14:39:08 +03:00
|
|
|
flags=vpx.libs,
|
2019-01-11 01:00:41 +03:00
|
|
|
onerror=lambda: die(
|
|
|
|
"--with-system-libvpx requested but symbol vpx_codec_dec_init_ver "
|
2018-12-19 14:39:08 +03:00
|
|
|
"not found"
|
2020-10-26 21:34:53 +03:00
|
|
|
),
|
2019-01-11 01:00:41 +03:00
|
|
|
)
|
2020-10-22 03:51:06 +03:00
|
|
|
|
2019-01-11 01:00:41 +03:00
|
|
|
set_config("MOZ_SYSTEM_LIBVPX", True)
|
2020-10-24 03:36:18 +03:00
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--with-system-libvpx", target)
|
2021-02-23 04:26:44 +03:00
|
|
|
def in_tree_vpx(system_libvpx, target):
|
2018-12-19 14:39:08 +03:00
|
|
|
if system_libvpx:
|
|
|
|
return
|
|
|
|
|
2021-02-23 04:26:44 +03:00
|
|
|
arm_asm = (target.cpu == "arm") or None
|
|
|
|
return namespace(arm_asm=arm_asm)
|
2018-12-19 14:39:08 +03:00
|
|
|
|
2021-02-23 04:26:44 +03:00
|
|
|
@depends(target, when=in_tree_vpx)
|
|
|
|
def vpx_nasm(target):
|
|
|
|
if target.cpu in ("x86", "x86_64"):
|
2018-12-21 18:47:22 +03:00
|
|
|
if target.kernel == "WINNT":
|
2021-02-23 04:26:44 +03:00
|
|
|
# Version 2.03 is needed for automatic safeseh support.
|
|
|
|
return namespace(version="2.03", what="VPX")
|
|
|
|
return namespace(what="VPX")
|
2018-12-19 14:39:08 +03:00
|
|
|
|
2022-09-20 12:12:31 +03:00
|
|
|
@depends(in_tree_vpx, vpx_nasm, target, neon_flags)
|
|
|
|
def vpx_as_flags(vpx, vpx_nasm, target, neon_flags):
|
2018-12-19 14:39:08 +03:00
|
|
|
if vpx and vpx.arm_asm:
|
|
|
|
# These flags are a lie; they're just used to enable the requisite
|
|
|
|
# opcodes; actual arch detection is done at runtime.
|
2022-09-20 12:12:31 +03:00
|
|
|
return neon_flags
|
2021-02-23 04:26:44 +03:00
|
|
|
elif vpx and vpx_nasm and target.os != "WINNT" and target.cpu != "x86_64":
|
2022-09-20 12:12:31 +03:00
|
|
|
return ("-DPIC",)
|
2018-12-19 14:39:08 +03:00
|
|
|
|
2021-02-23 04:26:44 +03:00
|
|
|
set_config("VPX_USE_NASM", True, when=vpx_nasm)
|
2018-12-19 14:39:08 +03:00
|
|
|
set_config("VPX_ASFLAGS", vpx_as_flags)
|
2018-12-21 18:47:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
# JPEG
|
|
|
|
# ====
|
|
|
|
|
|
|
|
with only_when(compile_environment):
|
2021-07-16 23:51:27 +03:00
|
|
|
system_lib_option(
|
2018-12-21 18:47:22 +03:00
|
|
|
"--with-system-jpeg",
|
|
|
|
nargs="?",
|
|
|
|
help="Use system libjpeg (installed at given prefix)",
|
|
|
|
)
|
|
|
|
|
|
|
|
@depends_if("--with-system-jpeg")
|
|
|
|
def jpeg_flags(value):
|
|
|
|
if len(value):
|
|
|
|
return namespace(
|
|
|
|
cflags=("-I%s/include" % value[0],),
|
|
|
|
ldflags=("-L%s/lib" % value[0], "-ljpeg"),
|
|
|
|
)
|
|
|
|
return namespace(
|
|
|
|
ldflags=("-ljpeg",),
|
|
|
|
)
|
|
|
|
|
|
|
|
with only_when("--with-system-jpeg"):
|
|
|
|
check_symbol(
|
|
|
|
"jpeg_destroy_compress",
|
|
|
|
flags=jpeg_flags.ldflags,
|
|
|
|
onerror=lambda: die(
|
|
|
|
"--with-system-jpeg requested but symbol "
|
|
|
|
"jpeg_destroy_compress not found."
|
2020-10-26 21:34:53 +03:00
|
|
|
),
|
2018-12-21 18:47:22 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=[
|
|
|
|
"stdio.h",
|
|
|
|
"sys/types.h",
|
|
|
|
"jpeglib.h",
|
|
|
|
],
|
|
|
|
body="""
|
|
|
|
#if JPEG_LIB_VERSION < 62
|
|
|
|
#error Insufficient JPEG library version
|
|
|
|
#endif
|
|
|
|
""",
|
2019-01-02 16:54:07 +03:00
|
|
|
flags=jpeg_flags.cflags,
|
2018-12-21 18:47:22 +03:00
|
|
|
check_msg="for sufficient jpeg library version",
|
|
|
|
onerror=lambda: die(
|
|
|
|
"Insufficient JPEG library version for "
|
|
|
|
"--with-system-jpeg (62 required)"
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=[
|
|
|
|
"stdio.h",
|
|
|
|
"sys/types.h",
|
|
|
|
"jpeglib.h",
|
|
|
|
],
|
|
|
|
body="""
|
|
|
|
#ifndef JCS_EXTENSIONS
|
|
|
|
#error libjpeg-turbo JCS_EXTENSIONS required
|
|
|
|
#endif
|
|
|
|
""",
|
2019-01-02 16:54:07 +03:00
|
|
|
flags=jpeg_flags.cflags,
|
2018-12-21 18:47:22 +03:00
|
|
|
check_msg="for sufficient libjpeg-turbo JCS_EXTENSIONS",
|
|
|
|
onerror=lambda: die(
|
|
|
|
"libjpeg-turbo JCS_EXTENSIONS required for " "--with-system-jpeg"
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_JPEG_CFLAGS", jpeg_flags.cflags)
|
|
|
|
set_config("MOZ_JPEG_LIBS", jpeg_flags.ldflags)
|
|
|
|
|
2022-09-20 12:12:31 +03:00
|
|
|
@depends("--with-system-jpeg", target, neon_flags)
|
|
|
|
def in_tree_jpeg_arm(system_jpeg, target, neon_flags):
|
2021-09-14 00:55:12 +03:00
|
|
|
if system_jpeg:
|
|
|
|
return
|
|
|
|
|
|
|
|
if target.cpu == "arm":
|
2022-09-20 12:12:31 +03:00
|
|
|
return neon_flags
|
2021-09-14 00:55:12 +03:00
|
|
|
elif target.cpu == "aarch64":
|
|
|
|
return ("-march=armv8-a",)
|
|
|
|
|
2018-12-21 18:47:22 +03:00
|
|
|
@depends("--with-system-jpeg", target)
|
2021-12-07 03:27:11 +03:00
|
|
|
def in_tree_jpeg_mips64(system_jpeg, target):
|
2018-12-21 18:47:22 +03:00
|
|
|
if system_jpeg:
|
|
|
|
return
|
|
|
|
|
2021-12-07 03:27:11 +03:00
|
|
|
if target.cpu == "mips64":
|
|
|
|
return ("-Wa,-mloongson-mmi", "-mloongson-ext")
|
|
|
|
|
|
|
|
# Compiler check from https://github.com/libjpeg-turbo/libjpeg-turbo/blob/57ba02a408a9a55ccff25aae8b164632a3a4f177/simd/CMakeLists.txt#L419
|
|
|
|
jpeg_mips64_mmi = c_compiler.try_compile(
|
|
|
|
body='int c = 0, a = 0, b = 0; asm("paddb %0, %1, %2" : "=f" (c) : "f" (a), "f" (b));',
|
|
|
|
check_msg="for loongson mmi support",
|
|
|
|
flags=in_tree_jpeg_mips64,
|
|
|
|
when=in_tree_jpeg_mips64,
|
|
|
|
)
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
"--with-system-jpeg",
|
|
|
|
target,
|
|
|
|
in_tree_jpeg_arm,
|
|
|
|
in_tree_jpeg_mips64,
|
|
|
|
jpeg_mips64_mmi,
|
|
|
|
)
|
|
|
|
def in_tree_jpeg(
|
|
|
|
system_jpeg, target, in_tree_jpeg_arm, in_tree_jpeg_mips64, jpeg_mips64_mmi
|
|
|
|
):
|
|
|
|
if system_jpeg:
|
|
|
|
return
|
|
|
|
|
|
|
|
if target.cpu in ("arm", "aarch64"):
|
|
|
|
return in_tree_jpeg_arm
|
2021-09-14 00:55:12 +03:00
|
|
|
elif target.kernel == "Darwin":
|
2018-12-21 18:47:22 +03:00
|
|
|
if target.cpu == "x86":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-DPIC", "-DMACHO")
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.cpu == "x86_64":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-D__x86_64__", "-DPIC", "-DMACHO")
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.kernel == "WINNT":
|
|
|
|
if target.cpu == "x86":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-DPIC", "-DWIN32")
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.cpu == "x86_64":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-D__x86_64__", "-DPIC", "-DWIN64", "-DMSVC")
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.cpu == "mips32":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-mdspr2",)
|
2021-12-07 03:27:11 +03:00
|
|
|
elif target.cpu == "mips64" and jpeg_mips64_mmi:
|
|
|
|
return in_tree_jpeg_mips64
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.cpu == "x86":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-DPIC", "-DELF")
|
2018-12-21 18:47:22 +03:00
|
|
|
elif target.cpu == "x86_64":
|
2021-02-23 04:26:45 +03:00
|
|
|
return ("-D__x86_64__", "-DPIC", "-DELF")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-12-07 03:27:11 +03:00
|
|
|
@depends(target, when=depends("--with-system-jpeg")(lambda x: not x))
|
2021-02-23 04:26:45 +03:00
|
|
|
def jpeg_nasm(target):
|
2018-12-21 18:47:22 +03:00
|
|
|
if target.cpu in ("x86", "x86_64"):
|
2021-02-23 04:26:45 +03:00
|
|
|
# libjpeg-turbo 2.0.6 requires nasm 2.10.
|
|
|
|
return namespace(version="2.10", what="JPEG")
|
2018-12-21 18:47:22 +03:00
|
|
|
|
2021-12-07 03:27:11 +03:00
|
|
|
# Compiler checks from https://github.com/libjpeg-turbo/libjpeg-turbo/blob/57ba02a408a9a55ccff25aae8b164632a3a4f177/simd/CMakeLists.txt#L258
|
2021-09-14 00:55:12 +03:00
|
|
|
jpeg_arm_neon_vld1_s16_x3 = c_compiler.try_compile(
|
|
|
|
includes=["arm_neon.h"],
|
|
|
|
body="int16_t input[12] = {}; int16x4x3_t output = vld1_s16_x3(input);",
|
|
|
|
check_msg="for vld1_s16_x3 in arm_neon.h",
|
|
|
|
flags=in_tree_jpeg_arm,
|
|
|
|
when=in_tree_jpeg_arm,
|
|
|
|
)
|
|
|
|
|
|
|
|
jpeg_arm_neon_vld1_u16_x2 = c_compiler.try_compile(
|
|
|
|
includes=["arm_neon.h"],
|
|
|
|
body="uint16_t input[8] = {}; uint16x4x2_t output = vld1_u16_x2(input);",
|
|
|
|
check_msg="for vld1_u16_x2 in arm_neon.h",
|
|
|
|
flags=in_tree_jpeg_arm,
|
|
|
|
when=in_tree_jpeg_arm,
|
|
|
|
)
|
|
|
|
|
|
|
|
jpeg_arm_neon_vld1q_u8_x4 = c_compiler.try_compile(
|
|
|
|
includes=["arm_neon.h"],
|
|
|
|
body="uint8_t input[64] = {}; uint8x16x4_t output = vld1q_u8_x4(input);",
|
|
|
|
check_msg="for vld1q_u8_x4 in arm_neon.h",
|
|
|
|
flags=in_tree_jpeg_arm,
|
|
|
|
when=in_tree_jpeg_arm,
|
|
|
|
)
|
|
|
|
|
2021-02-23 04:26:45 +03:00
|
|
|
set_config("LIBJPEG_TURBO_USE_NASM", True, when=jpeg_nasm)
|
2021-09-14 00:55:12 +03:00
|
|
|
set_config("LIBJPEG_TURBO_SIMD_FLAGS", in_tree_jpeg)
|
|
|
|
set_config("LIBJPEG_TURBO_HAVE_VLD1_S16_X3", jpeg_arm_neon_vld1_s16_x3)
|
|
|
|
set_config("LIBJPEG_TURBO_HAVE_VLD1_U16_X2", jpeg_arm_neon_vld1_u16_x2)
|
|
|
|
set_config("LIBJPEG_TURBO_HAVE_VLD1Q_U8_X4", jpeg_arm_neon_vld1q_u8_x4)
|
|
|
|
set_config(
|
|
|
|
"LIBJPEG_TURBO_NEON_INTRINSICS",
|
|
|
|
jpeg_arm_neon_vld1_s16_x3
|
|
|
|
& jpeg_arm_neon_vld1_u16_x2
|
|
|
|
& jpeg_arm_neon_vld1q_u8_x4,
|
|
|
|
)
|
2018-12-21 18:47:22 +03:00
|
|
|
|
|
|
|
|
2021-12-15 10:10:09 +03:00
|
|
|
# PNG
|
|
|
|
# ===
|
|
|
|
with only_when(compile_environment):
|
|
|
|
system_lib_option(
|
|
|
|
"--with-system-png",
|
|
|
|
nargs="?",
|
|
|
|
help="Use system libpng",
|
|
|
|
)
|
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--with-system-png")
|
2021-12-15 10:10:09 +03:00
|
|
|
def deprecated_system_png_path(value):
|
|
|
|
if len(value) == 1:
|
|
|
|
die(
|
|
|
|
"--with-system-png=PATH is not supported anymore. Please use "
|
|
|
|
"--with-system-png and set any necessary pkg-config environment variable."
|
|
|
|
)
|
|
|
|
|
|
|
|
png = pkg_check_modules("MOZ_PNG", "libpng >= 1.6.35", when="--with-system-png")
|
|
|
|
|
|
|
|
check_symbol(
|
|
|
|
"png_get_acTL",
|
|
|
|
flags=png.libs,
|
|
|
|
onerror=lambda: die(
|
|
|
|
"--with-system-png won't work because the system's libpng doesn't have APNG support"
|
|
|
|
),
|
|
|
|
when="--with-system-png",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_SYSTEM_PNG", True, when="--with-system-png")
|
|
|
|
|
|
|
|
|
2021-02-23 01:11:26 +03:00
|
|
|
# FFmpeg's ffvpx configuration
|
2019-01-11 01:00:41 +03:00
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-01-11 01:00:41 +03:00
|
|
|
@depends(target)
|
|
|
|
def libav_fft(target):
|
2023-03-16 03:35:11 +03:00
|
|
|
if target.os == "Android" and target.cpu != "arm":
|
|
|
|
return True
|
2022-06-29 12:55:59 +03:00
|
|
|
return target.kernel in ("WINNT", "Darwin") or target.cpu == "x86_64"
|
2019-01-11 01:00:41 +03:00
|
|
|
|
|
|
|
set_config("MOZ_LIBAV_FFT", depends(when=libav_fft)(lambda: True))
|
|
|
|
set_define("MOZ_LIBAV_FFT", depends(when=libav_fft)(lambda: True))
|
2019-01-11 21:17:36 +03:00
|
|
|
|
|
|
|
|
2019-02-19 08:48:27 +03:00
|
|
|
# Artifact builds need MOZ_FFVPX defined as if compilation happened.
|
|
|
|
with only_when(compile_environment | artifact_builds):
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-02-23 04:26:45 +03:00
|
|
|
@depends(target)
|
|
|
|
def ffvpx(target):
|
|
|
|
enable = use_nasm = True
|
2021-02-23 01:11:26 +03:00
|
|
|
flac_only = False
|
2019-01-11 21:17:36 +03:00
|
|
|
flags = []
|
2021-02-23 01:11:26 +03:00
|
|
|
|
|
|
|
if target.kernel == "WINNT":
|
|
|
|
if target.cpu == "x86":
|
|
|
|
# 32-bit windows need to prefix symbols with an underscore.
|
|
|
|
flags = ["-DPIC", "-DWIN32", "-DPREFIX", "-Pconfig_win32.asm"]
|
|
|
|
elif target.cpu == "x86_64":
|
|
|
|
flags = [
|
|
|
|
"-D__x86_64__",
|
|
|
|
"-DPIC",
|
|
|
|
"-DWIN64",
|
|
|
|
"-DMSVC",
|
|
|
|
"-Pconfig_win64.asm",
|
|
|
|
]
|
|
|
|
elif target.cpu == "aarch64":
|
|
|
|
flags = ["-DPIC", "-DWIN64"]
|
2021-02-23 04:26:45 +03:00
|
|
|
use_nasm = False
|
2021-02-23 01:11:26 +03:00
|
|
|
elif target.kernel == "Darwin":
|
2022-06-29 12:55:59 +03:00
|
|
|
# 32/64-bit macosx assemblers need to prefix symbols with an
|
|
|
|
# underscore.
|
2022-06-29 13:14:03 +03:00
|
|
|
flags = ["-DPIC", "-DMACHO", "-DPREFIX"]
|
2021-02-23 01:11:26 +03:00
|
|
|
if target.cpu == "x86_64":
|
2022-06-29 12:55:59 +03:00
|
|
|
flags += [
|
2021-02-23 01:11:26 +03:00
|
|
|
"-D__x86_64__",
|
|
|
|
"-Pconfig_darwin64.asm",
|
|
|
|
]
|
2022-06-29 12:55:59 +03:00
|
|
|
elif target.cpu == "aarch64":
|
|
|
|
use_nasm = False
|
2021-02-23 01:11:26 +03:00
|
|
|
elif target.cpu == "x86_64":
|
|
|
|
flags = ["-D__x86_64__", "-DPIC", "-DELF", "-Pconfig_unix64.asm"]
|
2021-02-23 04:26:45 +03:00
|
|
|
elif target.cpu in ("x86", "arm", "aarch64"):
|
2021-02-23 01:11:26 +03:00
|
|
|
flac_only = True
|
|
|
|
else:
|
|
|
|
enable = False
|
|
|
|
|
|
|
|
if flac_only or not enable:
|
2021-02-23 04:26:45 +03:00
|
|
|
use_nasm = False
|
2019-01-11 21:17:36 +03:00
|
|
|
|
|
|
|
return namespace(
|
|
|
|
enable=enable,
|
2021-02-23 04:26:45 +03:00
|
|
|
use_nasm=use_nasm,
|
2019-01-11 21:17:36 +03:00
|
|
|
flac_only=flac_only,
|
|
|
|
flags=flags,
|
|
|
|
)
|
|
|
|
|
2021-02-23 04:26:45 +03:00
|
|
|
@depends(when=ffvpx.use_nasm)
|
|
|
|
def ffvpx_nasm():
|
|
|
|
# nasm 2.10 for AVX-2 support.
|
|
|
|
return namespace(version="2.10", what="FFVPX")
|
|
|
|
|
|
|
|
# ffvpx_nasm can't indirectly depend on vpx_as_flags, because it depends
|
|
|
|
# on a compiler test, so we have to do a little bit of dance here.
|
|
|
|
@depends(ffvpx, vpx_as_flags, target)
|
|
|
|
def ffvpx(ffvpx, vpx_as_flags, target):
|
2021-02-23 06:05:43 +03:00
|
|
|
if ffvpx and vpx_as_flags and target.cpu in ("arm", "aarch64"):
|
2021-02-23 04:26:45 +03:00
|
|
|
ffvpx.flags.extend(vpx_as_flags)
|
|
|
|
return ffvpx
|
|
|
|
|
2019-01-11 21:17:36 +03:00
|
|
|
set_config("MOZ_FFVPX", True, when=ffvpx.enable)
|
|
|
|
set_define("MOZ_FFVPX", True, when=ffvpx.enable)
|
2019-09-25 00:02:07 +03:00
|
|
|
set_config("MOZ_FFVPX_AUDIOONLY", True, when=ffvpx.flac_only)
|
|
|
|
set_define("MOZ_FFVPX_AUDIOONLY", True, when=ffvpx.flac_only)
|
2019-01-11 21:17:36 +03:00
|
|
|
set_config("FFVPX_ASFLAGS", ffvpx.flags)
|
2021-02-23 04:26:45 +03:00
|
|
|
set_config("FFVPX_USE_NASM", True, when=ffvpx.use_nasm)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
|
|
|
|
2021-02-23 04:26:43 +03:00
|
|
|
# nasm detection
|
|
|
|
# ==============================================================
|
2021-02-23 06:34:04 +03:00
|
|
|
@depends(dav1d_nasm, vpx_nasm, jpeg_nasm, ffvpx_nasm, when=compile_environment)
|
2021-02-23 04:26:43 +03:00
|
|
|
def need_nasm(*requirements):
|
|
|
|
requires = {
|
|
|
|
x.what: x.version if hasattr(x, "version") else True for x in requirements if x
|
|
|
|
}
|
|
|
|
if requires:
|
|
|
|
items = sorted(requires.keys())
|
|
|
|
if len(items) > 1:
|
|
|
|
what = " and ".join((", ".join(items[:-1]), items[-1]))
|
|
|
|
else:
|
|
|
|
what = items[0]
|
|
|
|
versioned = {k: v for (k, v) in requires.items() if v is not True}
|
|
|
|
return namespace(what=what, versioned=versioned)
|
|
|
|
|
|
|
|
|
|
|
|
nasm = check_prog(
|
|
|
|
"NASM",
|
|
|
|
["nasm"],
|
|
|
|
allow_missing=True,
|
2021-02-24 05:01:33 +03:00
|
|
|
bootstrap="nasm",
|
2021-02-23 04:26:43 +03:00
|
|
|
when=need_nasm,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@depends(nasm, need_nasm.what)
|
|
|
|
def check_nasm(nasm, what):
|
|
|
|
if not nasm and what:
|
|
|
|
die("Nasm is required to build with %s, but it was not found." % what)
|
|
|
|
return nasm
|
|
|
|
|
|
|
|
|
|
|
|
@depends_if(check_nasm)
|
|
|
|
@checking("nasm version")
|
|
|
|
def nasm_version(nasm):
|
|
|
|
version = (
|
|
|
|
check_cmd_output(nasm, "-v", onerror=lambda: die("Failed to get nasm version."))
|
|
|
|
.splitlines()[0]
|
|
|
|
.split()[2]
|
|
|
|
)
|
|
|
|
return Version(version)
|
|
|
|
|
|
|
|
|
|
|
|
@depends(nasm_version, need_nasm.versioned, when=need_nasm.versioned)
|
|
|
|
def check_nasm_version(nasm_version, versioned):
|
|
|
|
by_version = sorted(versioned.items(), key=lambda x: x[1])
|
|
|
|
what, version = by_version[-1]
|
|
|
|
if nasm_version < version:
|
|
|
|
die(
|
|
|
|
"Nasm version %s or greater is required to build with %s." % (version, what)
|
|
|
|
)
|
|
|
|
return nasm_version
|
|
|
|
|
|
|
|
|
|
|
|
@depends(target, when=check_nasm_version)
|
|
|
|
def nasm_asflags(target):
|
|
|
|
asflags = {
|
|
|
|
("OSX", "x86"): ["-f", "macho32"],
|
|
|
|
("OSX", "x86_64"): ["-f", "macho64"],
|
|
|
|
("WINNT", "x86"): ["-f", "win32"],
|
|
|
|
("WINNT", "x86_64"): ["-f", "win64"],
|
|
|
|
}.get((target.os, target.cpu), None)
|
|
|
|
if asflags is None:
|
|
|
|
# We're assuming every x86 platform we support that's
|
|
|
|
# not Windows or Mac is ELF.
|
|
|
|
if target.cpu == "x86":
|
|
|
|
asflags = ["-f", "elf32"]
|
|
|
|
elif target.cpu == "x86_64":
|
|
|
|
asflags = ["-f", "elf64"]
|
|
|
|
return asflags
|
|
|
|
|
|
|
|
|
|
|
|
set_config("NASM_ASFLAGS", nasm_asflags)
|
|
|
|
|
|
|
|
|
2019-01-12 01:21:24 +03:00
|
|
|
# ANGLE OpenGL->D3D translator for WebGL
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
with only_when(compile_environment & target_is_windows):
|
|
|
|
set_config("MOZ_ANGLE_RENDERER", True)
|
2019-02-06 22:09:06 +03:00
|
|
|
|
|
|
|
# Remoting protocol support
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-02-06 22:09:06 +03:00
|
|
|
@depends(toolkit)
|
|
|
|
def has_remote(toolkit):
|
2019-12-13 12:20:24 +03:00
|
|
|
if toolkit in ("gtk", "windows", "cocoa"):
|
2019-02-06 22:09:06 +03:00
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-02-06 22:09:06 +03:00
|
|
|
set_config("MOZ_HAS_REMOTE", has_remote)
|
|
|
|
set_define("MOZ_HAS_REMOTE", has_remote)
|
2019-05-03 02:01:57 +03:00
|
|
|
|
2019-12-20 01:17:13 +03:00
|
|
|
# RLBox Library Sandboxing wasm support
|
2019-09-20 22:44:33 +03:00
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
def wasm_sandboxing_libraries():
|
2020-04-22 14:16:10 +03:00
|
|
|
return (
|
|
|
|
"graphite",
|
|
|
|
"ogg",
|
2021-01-14 23:12:19 +03:00
|
|
|
"hunspell",
|
2021-11-26 00:53:32 +03:00
|
|
|
"expat",
|
2021-11-29 09:21:59 +03:00
|
|
|
"woff2",
|
2020-04-22 14:16:10 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
|
2022-12-14 03:52:16 +03:00
|
|
|
@depends(dependable(wasm_sandboxing_libraries), build_project)
|
|
|
|
def default_wasm_sandboxing_libraries(libraries, build_project):
|
|
|
|
if build_project != "tools/rusttests":
|
|
|
|
non_default_libs = set()
|
2021-10-28 00:52:39 +03:00
|
|
|
|
2022-12-14 03:52:16 +03:00
|
|
|
return tuple(l for l in libraries if l not in non_default_libs)
|
2021-08-18 04:09:58 +03:00
|
|
|
|
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
option(
|
|
|
|
"--with-wasm-sandboxed-libraries",
|
2020-01-07 13:28:47 +03:00
|
|
|
env="WASM_SANDBOXED_LIBRARIES",
|
2021-08-18 04:09:58 +03:00
|
|
|
help="{Enable wasm sandboxing for the selected libraries|Disable wasm sandboxing}",
|
2019-09-20 22:44:33 +03:00
|
|
|
nargs="+",
|
|
|
|
choices=dependable(wasm_sandboxing_libraries),
|
2021-08-18 04:09:58 +03:00
|
|
|
default=default_wasm_sandboxing_libraries,
|
2019-09-20 22:44:33 +03:00
|
|
|
)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2022-12-08 04:19:17 +03:00
|
|
|
@depends("--with-wasm-sandboxed-libraries")
|
|
|
|
def requires_wasm_sandboxing(libraries):
|
2019-09-20 22:44:33 +03:00
|
|
|
if libraries:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
set_config("MOZ_USING_WASM_SANDBOXING", requires_wasm_sandboxing)
|
2019-12-20 01:17:13 +03:00
|
|
|
set_define("MOZ_USING_WASM_SANDBOXING", requires_wasm_sandboxing)
|
2019-09-20 22:44:33 +03:00
|
|
|
|
2020-01-10 22:56:17 +03:00
|
|
|
with only_when(requires_wasm_sandboxing & compile_environment):
|
2020-01-10 22:56:05 +03:00
|
|
|
option(
|
|
|
|
"--with-wasi-sysroot",
|
|
|
|
env="WASI_SYSROOT",
|
|
|
|
nargs=1,
|
|
|
|
help="Path to wasi sysroot for wasm sandboxing",
|
|
|
|
)
|
|
|
|
|
2021-07-30 02:49:33 +03:00
|
|
|
@depends("--with-wasi-sysroot", requires_wasm_sandboxing)
|
|
|
|
def bootstrap_wasi_sysroot(wasi_sysroot, requires_wasm_sandboxing):
|
|
|
|
return requires_wasm_sandboxing and not wasi_sysroot
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
"--with-wasi-sysroot",
|
2021-08-13 10:07:45 +03:00
|
|
|
bootstrap_path("sysroot-wasm32-wasi", when=bootstrap_wasi_sysroot),
|
2021-07-30 02:49:33 +03:00
|
|
|
)
|
2020-01-10 22:56:05 +03:00
|
|
|
@imports("os")
|
2023-01-19 02:39:05 +03:00
|
|
|
def wasi_sysroot(wasi_sysroot, bootstrapped_sysroot):
|
2020-01-10 22:56:05 +03:00
|
|
|
if not wasi_sysroot:
|
2021-07-30 02:49:33 +03:00
|
|
|
return bootstrapped_sysroot
|
2020-01-10 22:56:05 +03:00
|
|
|
|
|
|
|
wasi_sysroot = wasi_sysroot[0]
|
|
|
|
if not os.path.isdir(wasi_sysroot):
|
|
|
|
die("Argument to --with-wasi-sysroot must be a directory")
|
|
|
|
if not os.path.isabs(wasi_sysroot):
|
|
|
|
die("Argument to --with-wasi-sysroot must be an absolute path")
|
|
|
|
|
|
|
|
return wasi_sysroot
|
|
|
|
|
2023-01-19 02:39:05 +03:00
|
|
|
@depends(wasi_sysroot)
|
|
|
|
def wasi_sysroot_flags(wasi_sysroot):
|
2023-01-19 02:39:05 +03:00
|
|
|
if wasi_sysroot:
|
|
|
|
log.info("Using wasi sysroot in %s", wasi_sysroot)
|
|
|
|
return ["--sysroot=%s" % wasi_sysroot]
|
|
|
|
return []
|
2023-01-19 02:39:05 +03:00
|
|
|
|
2020-01-10 22:56:05 +03:00
|
|
|
set_config("WASI_SYSROOT", wasi_sysroot)
|
|
|
|
|
2023-01-19 02:39:05 +03:00
|
|
|
def wasm_compiler_with_flags(compiler, sysroot_flags):
|
|
|
|
if compiler:
|
2021-08-14 03:53:52 +03:00
|
|
|
return (
|
2023-01-19 02:39:05 +03:00
|
|
|
compiler.wrapper + [compiler.compiler] + compiler.flags + sysroot_flags
|
2020-01-10 22:56:05 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-01-19 02:39:05 +03:00
|
|
|
@template
|
|
|
|
def wasm_compiler_error(msg):
|
|
|
|
@depends("--with-wasm-sandboxed-libraries")
|
|
|
|
def wasm_compiler_error(sandboxed_libs):
|
|
|
|
suggest_disable = ""
|
|
|
|
if sandboxed_libs.origin == "default":
|
|
|
|
suggest_disable = " Or build with --without-wasm-sandboxed-libraries."
|
|
|
|
return lambda: die(msg + suggest_disable)
|
|
|
|
|
|
|
|
return wasm_compiler_error
|
|
|
|
|
|
|
|
@template
|
|
|
|
def check_wasm_compiler(compiler, language):
|
|
|
|
compiler.try_compile(
|
|
|
|
includes=["cstring" if language == "C++" else "string.h"],
|
|
|
|
flags=wasi_sysroot_flags,
|
|
|
|
check_msg="the wasm %s compiler can find wasi headers" % language,
|
|
|
|
onerror=wasm_compiler_error(
|
|
|
|
"Cannot find wasi headers or problem with the wasm compiler. "
|
|
|
|
"Please fix the problem."
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
compiler.try_run(
|
|
|
|
flags=wasi_sysroot_flags,
|
|
|
|
check_msg="the wasm %s linker can find wasi libraries" % language,
|
|
|
|
onerror=wasm_compiler_error(
|
|
|
|
"Cannot find wasi libraries or problem with the wasm linker. "
|
|
|
|
"Please fix the problem."
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
2021-08-14 03:53:52 +03:00
|
|
|
wasm_cc = compiler("C", wasm, other_compiler=c_compiler)
|
2023-01-19 02:39:05 +03:00
|
|
|
check_wasm_compiler(wasm_cc, "C")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-01-19 02:39:05 +03:00
|
|
|
@depends(wasm_cc, wasi_sysroot_flags)
|
|
|
|
def wasm_cc_with_flags(wasm_cc, wasi_sysroot_flags):
|
|
|
|
return wasm_compiler_with_flags(wasm_cc, wasi_sysroot_flags)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-01-10 22:56:05 +03:00
|
|
|
set_config("WASM_CC", wasm_cc_with_flags)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2021-08-14 03:53:52 +03:00
|
|
|
wasm_cxx = compiler(
|
|
|
|
"C++",
|
|
|
|
wasm,
|
|
|
|
c_compiler=wasm_cc,
|
|
|
|
other_compiler=cxx_compiler,
|
|
|
|
other_c_compiler=c_compiler,
|
2020-01-10 22:56:05 +03:00
|
|
|
)
|
2023-01-19 02:39:05 +03:00
|
|
|
check_wasm_compiler(wasm_cxx, "C++")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2023-01-19 02:39:05 +03:00
|
|
|
@depends(wasm_cxx, wasi_sysroot_flags)
|
|
|
|
def wasm_cxx_with_flags(wasm_cxx, wasi_sysroot_flags):
|
|
|
|
return wasm_compiler_with_flags(wasm_cxx, wasi_sysroot_flags)
|
2020-01-10 22:56:05 +03:00
|
|
|
|
|
|
|
set_config("WASM_CXX", wasm_cxx_with_flags)
|
|
|
|
|
2022-10-18 22:46:44 +03:00
|
|
|
wasm_compile_flags = dependable(["-fno-exceptions", "-fno-strict-aliasing"])
|
2020-01-10 22:56:05 +03:00
|
|
|
option(env="WASM_CFLAGS", nargs=1, help="Options to pass to WASM_CC")
|
|
|
|
|
|
|
|
@depends("WASM_CFLAGS", wasm_compile_flags)
|
|
|
|
def wasm_cflags(value, wasm_compile_flags):
|
|
|
|
if value:
|
|
|
|
return wasm_compile_flags + value
|
|
|
|
else:
|
|
|
|
return wasm_compile_flags
|
|
|
|
|
|
|
|
set_config("WASM_CFLAGS", wasm_cflags)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-01-10 22:56:05 +03:00
|
|
|
option(env="WASM_CXXFLAGS", nargs=1, help="Options to pass to WASM_CXX")
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-01-10 22:56:05 +03:00
|
|
|
@depends("WASM_CXXFLAGS", wasm_compile_flags)
|
|
|
|
def wasm_cxxflags(value, wasm_compile_flags):
|
|
|
|
if value:
|
|
|
|
return wasm_compile_flags + value
|
|
|
|
else:
|
|
|
|
return wasm_compile_flags
|
|
|
|
|
|
|
|
set_config("WASM_CXXFLAGS", wasm_cxxflags)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-02-14 00:20:34 +03:00
|
|
|
|
2021-09-29 06:58:46 +03:00
|
|
|
@depends("--with-wasm-sandboxed-libraries")
|
|
|
|
def wasm_sandboxing(libraries):
|
2019-09-20 22:44:33 +03:00
|
|
|
if not libraries:
|
|
|
|
return
|
|
|
|
|
|
|
|
return namespace(**{name: True for name in libraries})
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
@template
|
|
|
|
def wasm_sandboxing_config_defines():
|
|
|
|
for lib in wasm_sandboxing_libraries():
|
|
|
|
set_config(
|
|
|
|
"MOZ_WASM_SANDBOXING_%s" % lib.upper(), getattr(wasm_sandboxing, lib)
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2019-09-20 22:44:33 +03:00
|
|
|
set_define(
|
|
|
|
"MOZ_WASM_SANDBOXING_%s" % lib.upper(), getattr(wasm_sandboxing, lib)
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
2019-09-20 22:44:33 +03:00
|
|
|
|
|
|
|
wasm_sandboxing_config_defines()
|
|
|
|
|
|
|
|
|
2019-05-03 02:02:13 +03:00
|
|
|
# new Notification Store implementation
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-05-03 02:02:13 +03:00
|
|
|
@depends(milestone)
|
|
|
|
def new_notification_store(milestone):
|
|
|
|
if milestone.is_nightly:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2019-05-03 02:02:13 +03:00
|
|
|
set_config("MOZ_NEW_NOTIFICATION_STORE", True, when=new_notification_store)
|
|
|
|
set_define("MOZ_NEW_NOTIFICATION_STORE", True, when=new_notification_store)
|
2019-11-22 23:38:50 +03:00
|
|
|
|
|
|
|
|
2023-08-01 11:02:34 +03:00
|
|
|
# Auxiliary files persistence on application close
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-disk-remnant-avoidance",
|
|
|
|
help="Prevent persistence of auxiliary files on application close",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set_config(
|
|
|
|
"MOZ_AVOID_DISK_REMNANT_ON_CLOSE",
|
|
|
|
True,
|
|
|
|
when="--enable-disk-remnant-avoidance",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-03-31 11:24:40 +03:00
|
|
|
# Glean SDK Integration Crate
|
2019-11-22 23:38:50 +03:00
|
|
|
# ==============================================================
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-11-11 00:55:57 +03:00
|
|
|
@depends(target)
|
2021-03-04 14:15:12 +03:00
|
|
|
def glean_android(target):
|
|
|
|
return target.os == "Android"
|
2019-11-22 23:38:50 +03:00
|
|
|
|
2020-01-16 17:14:13 +03:00
|
|
|
|
2021-03-04 14:15:12 +03:00
|
|
|
set_config("MOZ_GLEAN_ANDROID", True, when=glean_android)
|
|
|
|
set_define("MOZ_GLEAN_ANDROID", True, when=glean_android)
|
2020-04-27 08:40:52 +03:00
|
|
|
|
2020-05-27 08:51:39 +03:00
|
|
|
|
2020-01-16 17:14:13 +03:00
|
|
|
# dump_syms
|
|
|
|
# ==============================================================
|
|
|
|
|
2020-02-26 23:51:04 +03:00
|
|
|
check_prog(
|
|
|
|
"DUMP_SYMS",
|
|
|
|
["dump_syms"],
|
|
|
|
allow_missing=True,
|
2021-02-24 05:01:33 +03:00
|
|
|
bootstrap="dump_syms",
|
2020-07-23 20:01:39 +03:00
|
|
|
when=compile_environment,
|
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-02-14 19:50:33 +03:00
|
|
|
|
2022-10-19 10:13:15 +03:00
|
|
|
@depends(valid_windows_sdk_dir, host)
|
|
|
|
@imports(_from="os", _import="environ")
|
|
|
|
def pdbstr_paths(valid_windows_sdk_dir, host):
|
|
|
|
if not valid_windows_sdk_dir:
|
|
|
|
return
|
|
|
|
|
|
|
|
vc_host = {
|
|
|
|
"x86": "x86",
|
|
|
|
"x86_64": "x64",
|
|
|
|
}.get(host.cpu)
|
|
|
|
|
|
|
|
return [
|
|
|
|
environ["PATH"],
|
|
|
|
os.path.join(valid_windows_sdk_dir.path, "Debuggers", vc_host, "srcsrv"),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2020-01-10 22:56:05 +03:00
|
|
|
check_prog(
|
2020-10-26 21:34:53 +03:00
|
|
|
"PDBSTR",
|
2020-05-07 03:34:36 +03:00
|
|
|
["pdbstr.exe"],
|
|
|
|
allow_missing=True,
|
2020-03-27 13:41:06 +03:00
|
|
|
when=compile_environment & target_is_windows,
|
2022-10-19 10:13:15 +03:00
|
|
|
paths=pdbstr_paths,
|
|
|
|
allow_spaces=True,
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2020-03-16 21:32:51 +03:00
|
|
|
|
2020-03-18 07:21:18 +03:00
|
|
|
|
2020-03-27 01:13:14 +03:00
|
|
|
@depends("MOZ_AUTOMATION", c_compiler)
|
|
|
|
def allow_missing_winchecksec(automation, c_compiler):
|
|
|
|
if not automation:
|
|
|
|
return True
|
|
|
|
if c_compiler and c_compiler.type != "clang-cl":
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-05-07 03:34:36 +03:00
|
|
|
check_prog(
|
|
|
|
"WINCHECKSEC",
|
|
|
|
["winchecksec.exe", "winchecksec"],
|
2021-02-24 05:01:33 +03:00
|
|
|
bootstrap="winchecksec",
|
2020-03-27 01:13:14 +03:00
|
|
|
allow_missing=allow_missing_winchecksec,
|
2020-03-27 13:41:06 +03:00
|
|
|
when=compile_environment & target_is_windows,
|
|
|
|
)
|
2020-03-27 01:13:14 +03:00
|
|
|
|
2020-02-14 19:50:33 +03:00
|
|
|
# Fork server
|
|
|
|
@depends(target, build_project)
|
|
|
|
def forkserver_default(target, build_project):
|
|
|
|
return build_project == "browser" and (
|
2021-06-03 11:23:36 +03:00
|
|
|
(target.os == "GNU" and target.kernel == "Linux")
|
|
|
|
or target.os == "FreeBSD"
|
|
|
|
or target.os == "OpenBSD"
|
2020-02-14 19:50:33 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-01-02 17:35:17 +03:00
|
|
|
"--enable-forkserver",
|
|
|
|
default=forkserver_default,
|
2020-02-14 19:50:33 +03:00
|
|
|
env="MOZ_ENABLE_FORKSERVER",
|
|
|
|
help="{Enable|Disable} fork server",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-02-14 19:50:33 +03:00
|
|
|
@depends("--enable-forkserver", target)
|
|
|
|
def forkserver_flag(value, target):
|
|
|
|
if (
|
|
|
|
target.os == "Android"
|
|
|
|
or (target.os == "GNU" and target.kernel == "Linux")
|
|
|
|
or target.os == "FreeBSD"
|
2021-06-03 11:23:36 +03:00
|
|
|
or target.os == "OpenBSD"
|
2020-02-14 19:50:33 +03:00
|
|
|
):
|
|
|
|
return bool(value)
|
|
|
|
pass
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-02-14 19:50:33 +03:00
|
|
|
set_config("MOZ_ENABLE_FORKSERVER", forkserver_flag)
|
|
|
|
set_define("MOZ_ENABLE_FORKSERVER", forkserver_flag, forkserver_flag)
|
2020-02-22 03:54:32 +03:00
|
|
|
|
2020-03-20 01:52:26 +03:00
|
|
|
# Crash Reporter
|
|
|
|
# ==============================================================
|
|
|
|
|
2022-11-24 03:46:13 +03:00
|
|
|
with only_when(compile_environment & target_has_linux_kernel):
|
2020-03-20 01:52:26 +03:00
|
|
|
# Check if we need to use the breakpad_getcontext fallback.
|
|
|
|
getcontext = check_symbol("getcontext")
|
|
|
|
set_config("HAVE_GETCONTEXT", getcontext)
|
|
|
|
set_define("HAVE_GETCONTEXT", getcontext)
|
|
|
|
|
2020-05-29 20:02:09 +03:00
|
|
|
# NSS
|
2020-07-09 02:01:36 +03:00
|
|
|
# ==============================================================
|
|
|
|
include("../build/moz.configure/nss.configure")
|
2020-05-29 20:02:09 +03:00
|
|
|
|
2021-04-11 23:50:15 +03:00
|
|
|
|
|
|
|
# Enable or disable running in background task mode: headless for
|
|
|
|
# periodic, short-lived, maintenance tasks.
|
|
|
|
# ==============================================================================
|
|
|
|
option(
|
|
|
|
"--disable-backgroundtasks",
|
|
|
|
help="Disable running in background task mode",
|
|
|
|
)
|
2022-11-10 12:57:26 +03:00
|
|
|
set_config("MOZ_BACKGROUNDTASKS", True, when="--enable-backgroundtasks")
|
|
|
|
set_define("MOZ_BACKGROUNDTASKS", True, when="--enable-backgroundtasks")
|
2021-04-11 23:50:15 +03:00
|
|
|
|
|
|
|
|
2020-07-09 02:01:36 +03:00
|
|
|
# Update-related programs: updater, maintenance service, update agent,
|
|
|
|
# default browser agent.
|
|
|
|
# ==============================================================
|
|
|
|
include("../build/moz.configure/update-programs.configure")
|
2020-08-03 16:36:59 +03:00
|
|
|
|
2021-04-11 23:50:15 +03:00
|
|
|
|
2020-08-03 16:36:59 +03:00
|
|
|
# Mobile optimizations
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--enable-mobile-optimize",
|
|
|
|
default=target_is_android,
|
2020-08-06 06:19:41 +03:00
|
|
|
help="{Enable|Disable} mobile optimizations",
|
|
|
|
)
|
2020-08-03 16:36:59 +03:00
|
|
|
|
|
|
|
set_define("MOZ_GFX_OPTIMIZE_MOBILE", True, when="--enable-mobile-optimize")
|
|
|
|
# We ignore "paint will resample" on mobile for performance.
|
|
|
|
# We may want to revisit this later.
|
|
|
|
set_define("MOZ_IGNORE_PAINT_WILL_RESAMPLE", True, when="--enable-mobile-optimize")
|
2020-08-05 03:26:16 +03:00
|
|
|
|
|
|
|
# Pref extensions
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-pref-extensions", help="Disable pref extensions such as autoconfig")
|
|
|
|
set_config("MOZ_PREF_EXTENSIONS", True, when="--enable-pref-extensions")
|
2020-08-05 03:28:34 +03:00
|
|
|
|
|
|
|
# Offer a way to disable the startup cache
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-startupcache", help="Disable startup cache")
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-08-05 03:28:34 +03:00
|
|
|
@depends("--enable-startupcache")
|
|
|
|
def enable_startupcache(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-08-05 03:28:34 +03:00
|
|
|
set_define(
|
|
|
|
"MOZ_DISABLE_STARTUPCACHE", True, when=depends(enable_startupcache)(lambda x: not x)
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
2020-08-11 18:58:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Branding
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
env="MOZ_APP_REMOTINGNAME",
|
|
|
|
nargs=1,
|
|
|
|
help="Used for the internal program name, which affects profile name "
|
2022-01-28 11:00:27 +03:00
|
|
|
"and remoting. If not set, defaults to MOZ_APP_NAME if the update channel "
|
|
|
|
"is release, and MOZ_APP_NAME-MOZ_UPDATE_CHANNEL otherwise.",
|
2020-08-11 18:58:52 +03:00
|
|
|
)
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-08-11 18:58:52 +03:00
|
|
|
|
2022-01-28 11:00:27 +03:00
|
|
|
@depends("MOZ_APP_REMOTINGNAME", moz_app_name, update_channel)
|
|
|
|
def moz_app_remotingname(value, moz_app_name, update_channel):
|
2020-08-11 18:58:52 +03:00
|
|
|
if value:
|
|
|
|
return value[0]
|
2022-01-28 11:00:27 +03:00
|
|
|
if update_channel == "release":
|
|
|
|
return moz_app_name
|
|
|
|
return moz_app_name + "-" + update_channel
|
2020-08-11 18:58:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_APP_REMOTINGNAME", moz_app_remotingname)
|
|
|
|
|
2020-10-26 21:34:53 +03:00
|
|
|
option(
|
2020-08-11 18:58:52 +03:00
|
|
|
env="ANDROID_PACKAGE_NAME",
|
2020-10-26 21:34:53 +03:00
|
|
|
nargs=1,
|
2020-08-11 18:58:52 +03:00
|
|
|
help="Name of the Android package (default org.mozilla.$MOZ_APP_NAME)",
|
2020-10-26 21:34:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-08-11 18:58:52 +03:00
|
|
|
@depends("ANDROID_PACKAGE_NAME", moz_app_name)
|
|
|
|
def android_package_name(value, moz_app_name):
|
|
|
|
if value:
|
|
|
|
return value[0]
|
|
|
|
if moz_app_name == "fennec":
|
|
|
|
return "org.mozilla.fennec_aurora"
|
|
|
|
return "org.mozilla.%s" % moz_app_name
|
2020-10-26 21:34:53 +03:00
|
|
|
|
2020-08-11 18:58:52 +03:00
|
|
|
|
|
|
|
set_config("ANDROID_PACKAGE_NAME", android_package_name)
|
2020-08-18 19:05:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Miscellaneous options
|
|
|
|
# ==============================================================
|
|
|
|
option(env="MOZ_WINCONSOLE", nargs="?", help="Whether we can create a console window.")
|
|
|
|
set_define("MOZ_WINCONSOLE", True, when=depends("MOZ_WINCONSOLE")(lambda x: x))
|
2020-08-22 01:48:09 +03:00
|
|
|
|
2021-01-19 12:08:55 +03:00
|
|
|
|
2021-02-24 12:46:59 +03:00
|
|
|
# Alternative Crashreporter setting
|
|
|
|
option(
|
|
|
|
"--with-crashreporter-url",
|
|
|
|
env="MOZ_CRASHREPORTER_URL",
|
|
|
|
default="https://crash-reports.mozilla.com/",
|
|
|
|
nargs=1,
|
|
|
|
help="Set an alternative crashreporter url",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config(
|
|
|
|
"MOZ_CRASHREPORTER_URL",
|
|
|
|
depends("--with-crashreporter-url")(lambda x: x[0].rstrip("/")),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-01-19 12:08:55 +03:00
|
|
|
# Crash reporter options
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target)
|
|
|
|
def oxidized_breakpad(target):
|
2023-07-21 15:05:38 +03:00
|
|
|
if target.kernel == "Linux":
|
|
|
|
return target.cpu in ("aarch64", "arm", "x86", "x86_64")
|
2021-01-28 17:17:34 +03:00
|
|
|
return False
|
2021-01-19 12:08:55 +03:00
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_OXIDIZED_BREAKPAD", True, when=oxidized_breakpad)
|
|
|
|
set_define("MOZ_OXIDIZED_BREAKPAD", True, when=oxidized_breakpad)
|
2021-09-23 02:54:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Wine
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target, host)
|
|
|
|
def want_wine(target, host):
|
|
|
|
return target.kernel == "WINNT" and host.kernel != "WINNT"
|
|
|
|
|
|
|
|
|
|
|
|
wine = check_prog(
|
|
|
|
"WINE",
|
|
|
|
["wine64", "wine"],
|
|
|
|
when=want_wine,
|
|
|
|
bootstrap="wine/bin",
|
|
|
|
)
|
2021-10-06 21:43:01 +03:00
|
|
|
|
|
|
|
# DOM Streams
|
|
|
|
# ==============================================================
|
2022-04-13 21:57:48 +03:00
|
|
|
# Set this to true so the JS engine knows we're doing a browser build.
|
|
|
|
set_config("MOZ_DOM_STREAMS", True)
|
|
|
|
set_define("MOZ_DOM_STREAMS", True)
|
2021-12-15 10:10:10 +03:00
|
|
|
|
|
|
|
# libevent
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
system_lib_option(
|
|
|
|
"--with-system-libevent",
|
|
|
|
nargs="?",
|
|
|
|
help="Use system libevent",
|
|
|
|
)
|
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--with-system-libevent")
|
2021-12-15 10:10:10 +03:00
|
|
|
def deprecated_system_libevent_path(value):
|
|
|
|
if len(value) == 1:
|
|
|
|
die(
|
|
|
|
"--with-system-libevent=PATH is not supported anymore. Please use "
|
|
|
|
"--with-system-libevent and set any necessary pkg-config environment variable."
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_check_modules("MOZ_LIBEVENT", "libevent", when="--with-system-libevent")
|
|
|
|
|
|
|
|
set_config("MOZ_SYSTEM_LIBEVENT", True, when="--with-system-libevent")
|
2021-12-16 10:48:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Crash reporting
|
|
|
|
# ==============================================================
|
2022-01-28 19:33:39 +03:00
|
|
|
@depends(target, developer_options, artifact_builds)
|
|
|
|
def crashreporter_default(target, developer_options, artifacts):
|
2021-12-16 10:48:36 +03:00
|
|
|
if target.kernel in ("WINNT", "Darwin"):
|
|
|
|
return True
|
|
|
|
if target.kernel == "Linux" and target.cpu in ("x86", "x86_64", "arm", "aarch64"):
|
|
|
|
# The crash reporter prevents crash stacktraces to be logged in the
|
|
|
|
# logs on Android, so we leave it out by default in developer builds.
|
2022-01-28 19:33:39 +03:00
|
|
|
return target.os != "Android" or not developer_options or artifacts
|
2021-12-16 10:48:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-crashreporter",
|
|
|
|
default=crashreporter_default,
|
|
|
|
help="{Enable|Disable} crash reporting",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_CRASHREPORTER", True, when="--enable-crashreporter")
|
|
|
|
set_define("MOZ_CRASHREPORTER", True, when="--enable-crashreporter")
|
|
|
|
|
|
|
|
with only_when(compile_environment):
|
|
|
|
with only_when("--enable-crashreporter"):
|
|
|
|
pkg_check_modules(
|
|
|
|
"MOZ_GTHREAD",
|
|
|
|
"gthread-2.0",
|
|
|
|
when=depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"),
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config(
|
|
|
|
"MOZ_CRASHREPORTER_INJECTOR",
|
|
|
|
True,
|
|
|
|
when=depends(target)(lambda t: t.os == "WINNT" and t.bitness == 32),
|
|
|
|
)
|
|
|
|
set_define(
|
|
|
|
"MOZ_CRASHREPORTER_INJECTOR",
|
|
|
|
True,
|
|
|
|
when=depends(target)(lambda t: t.os == "WINNT" and t.bitness == 32),
|
|
|
|
)
|
2021-12-16 10:48:36 +03:00
|
|
|
|
|
|
|
|
2022-12-13 00:43:52 +03:00
|
|
|
# If we have any service that uploads data (and requires data submission
|
|
|
|
# policy alert), set MOZ_DATA_REPORTING.
|
|
|
|
# ==============================================================
|
|
|
|
@depends(
|
|
|
|
"MOZ_TELEMETRY_REPORTING",
|
|
|
|
"MOZ_SERVICES_HEALTHREPORT",
|
|
|
|
"--enable-crashreporter",
|
|
|
|
"MOZ_NORMANDY",
|
|
|
|
)
|
|
|
|
def data_reporting(telemetry, healthreport, crashreporter, normandy):
|
|
|
|
return telemetry or healthreport or crashreporter or normandy
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_DATA_REPORTING", True, when=data_reporting)
|
|
|
|
set_define("MOZ_DATA_REPORTING", True, when=data_reporting)
|
|
|
|
|
|
|
|
|
2021-12-23 23:29:08 +03:00
|
|
|
# Gtk+
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(toolkit_gtk):
|
|
|
|
pkg_check_modules(
|
|
|
|
"MOZ_GTK3",
|
2023-05-26 09:37:37 +03:00
|
|
|
"gtk+-3.0 >= 3.14.0 gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0",
|
2021-12-23 23:29:08 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set_define("GDK_VERSION_MIN_REQUIRED", "GDK_VERSION_3_14")
|
|
|
|
set_define("GDK_VERSION_MAX_ALLOWED", "GDK_VERSION_3_14")
|
|
|
|
|
|
|
|
pkg_check_modules("GLIB", "glib-2.0 >= 2.42 gobject-2.0")
|
|
|
|
|
|
|
|
set_define("GLIB_VERSION_MIN_REQUIRED", "GLIB_VERSION_2_42")
|
|
|
|
set_define("GLIB_VERSION_MAX_ALLOWED", "GLIB_VERSION_2_42")
|
|
|
|
|
|
|
|
set_define("MOZ_ACCESSIBILITY_ATK", True, when=accessibility)
|
|
|
|
|
2021-12-16 10:48:36 +03:00
|
|
|
# DBus
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(toolkit_gtk):
|
2022-11-27 01:13:36 +03:00
|
|
|
option("--disable-dbus", help="Disable dbus support")
|
2021-12-16 10:48:36 +03:00
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
with only_when("--enable-dbus"):
|
2021-12-16 10:48:36 +03:00
|
|
|
pkg_check_modules("MOZ_DBUS", "dbus-1 >= 0.60")
|
|
|
|
pkg_check_modules("MOZ_DBUS_GLIB", "dbus-glib-1 >= 0.60")
|
|
|
|
|
|
|
|
set_config("MOZ_ENABLE_DBUS", True)
|
|
|
|
set_define("MOZ_ENABLE_DBUS", True)
|
2021-12-16 10:48:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Necko's wifi scanner
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target)
|
|
|
|
def necko_wifi_when(target):
|
|
|
|
return target.os in ("WINNT", "OSX", "DragonFly", "FreeBSD") or (
|
|
|
|
target.kernel == "Linux" and target.os == "GNU"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
option("--disable-necko-wifi", help="Disable necko wifi scanner", when=necko_wifi_when)
|
|
|
|
|
|
|
|
set_config("NECKO_WIFI", True, when="--enable-necko-wifi")
|
|
|
|
set_define("NECKO_WIFI", True, when="--enable-necko-wifi")
|
|
|
|
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
depends("--enable-necko-wifi", when=necko_wifi_when)(lambda x: x),
|
2022-11-27 01:13:36 +03:00
|
|
|
depends("--enable-dbus", when=toolkit_gtk)(lambda x: x),
|
2021-12-16 10:48:36 +03:00
|
|
|
when=depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"),
|
|
|
|
)
|
|
|
|
def necko_wifi_dbus(necko_wifi, dbus):
|
|
|
|
if necko_wifi and not dbus:
|
|
|
|
die(
|
|
|
|
"Necko WiFi scanning needs DBus on your platform, remove --disable-dbus"
|
|
|
|
" or use --disable-necko-wifi"
|
|
|
|
)
|
|
|
|
return necko_wifi and dbus
|
|
|
|
|
|
|
|
|
|
|
|
set_config("NECKO_WIFI_DBUS", True, when=necko_wifi_dbus)
|
2023-05-13 03:36:00 +03:00
|
|
|
set_define("NECKO_WIFI_DBUS", True, when=necko_wifi_dbus)
|
2021-12-16 10:48:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Frontend JS debug mode
|
|
|
|
# ==============================================================
|
|
|
|
option("--enable-debug-js-modules", help="Enable debug mode for frontend JS libraries")
|
|
|
|
|
|
|
|
set_config("DEBUG_JS_MODULES", True, when="--enable-debug-js-modules")
|
2021-12-16 10:48:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
# moz_dump_painting
|
|
|
|
# ==============================================================
|
|
|
|
option("--enable-dump-painting", help="Enable paint debugging")
|
|
|
|
|
|
|
|
set_define(
|
|
|
|
"MOZ_DUMP_PAINTING",
|
|
|
|
True,
|
|
|
|
when=depends("--enable-dump-painting", "--enable-debug")(
|
|
|
|
lambda painting, debug: painting or debug
|
|
|
|
),
|
|
|
|
)
|
|
|
|
set_define("MOZ_LAYERS_HAVE_LOG", True, when="--enable-dump-painting")
|
2021-12-18 03:32:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
# libproxy support
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(toolkit_gtk):
|
2022-11-27 01:13:36 +03:00
|
|
|
system_lib_option("--enable-libproxy", help="Enable libproxy support")
|
2021-12-18 03:32:35 +03:00
|
|
|
|
|
|
|
with only_when("--enable-libproxy"):
|
|
|
|
pkg_check_modules("MOZ_LIBPROXY", "libproxy-1.0")
|
|
|
|
|
|
|
|
set_config("MOZ_ENABLE_LIBPROXY", True)
|
|
|
|
set_define("MOZ_ENABLE_LIBPROXY", True)
|
2021-12-18 03:32:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Enable runtime logging
|
|
|
|
# ==============================================================
|
|
|
|
set_define("MOZ_LOGGING", True)
|
|
|
|
set_define("FORCE_PR_LOG", True)
|
|
|
|
|
|
|
|
# This will enable logging of addref, release, ctor, dtor.
|
|
|
|
# ==============================================================
|
|
|
|
option(
|
|
|
|
"--enable-logrefcnt",
|
|
|
|
default=moz_debug,
|
|
|
|
help="{Enable|Disable} logging of refcounts",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_define("NS_BUILD_REFCNT_LOGGING", True, when="--enable-logrefcnt")
|
2021-12-18 03:32:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
# NegotiateAuth
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-negotiateauth", help="Disable GSS-API negotiation")
|
|
|
|
|
|
|
|
set_config("MOZ_AUTH_EXTENSION", True, when="--enable-negotiateauth")
|
|
|
|
set_define("MOZ_AUTH_EXTENSION", True, when="--enable-negotiateauth")
|
2021-12-18 03:32:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Parental control
|
|
|
|
# ==============================================================
|
|
|
|
option("--disable-parental-controls", help="Do not build parental controls")
|
|
|
|
|
|
|
|
set_config(
|
|
|
|
"MOZ_DISABLE_PARENTAL_CONTROLS",
|
|
|
|
True,
|
|
|
|
when=depends("--enable-parental-controls")(lambda x: not x),
|
|
|
|
)
|
|
|
|
set_define(
|
|
|
|
"MOZ_DISABLE_PARENTAL_CONTROLS",
|
|
|
|
True,
|
|
|
|
when=depends("--enable-parental-controls")(lambda x: not x),
|
|
|
|
)
|
2021-12-18 03:41:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Sandboxing support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target, tsan, asan)
|
|
|
|
def sandbox_default(target, tsan, asan):
|
|
|
|
# Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
|
|
|
|
if target.kernel == "Linux" and target.os == "GNU":
|
|
|
|
# Bug 1182565: TSan conflicts with sandboxing on Linux.
|
|
|
|
# Bug 1287971: LSan also conflicts with sandboxing on Linux.
|
|
|
|
if tsan or asan:
|
|
|
|
return False
|
|
|
|
# Linux sandbox is only available on x86{,_64} and arm{,64}.
|
|
|
|
return target.cpu in ("x86", "x86_64", "arm", "aarch64")
|
|
|
|
return target.kernel in ("WINNT", "Darwin", "OpenBSD")
|
|
|
|
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-sandbox",
|
|
|
|
default=sandbox_default,
|
|
|
|
help="{Enable|Disable} sandboxing support",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_SANDBOX", True, when="--enable-sandbox")
|
|
|
|
set_define("MOZ_SANDBOX", True, when="--enable-sandbox")
|
2021-12-22 00:36:41 +03:00
|
|
|
|
2023-02-24 11:44:41 +03:00
|
|
|
with only_when(depends(target.kernel)(lambda k: k not in ("Darwin", "WINNT"))):
|
|
|
|
set_define("MOZ_CONTENT_TEMP_DIR", True, when="--enable-sandbox")
|
2021-12-22 00:36:41 +03:00
|
|
|
|
|
|
|
# Searching of system directories for extensions.
|
|
|
|
# ==============================================================
|
|
|
|
# Note: this switch is meant to be used for test builds whose behavior should
|
|
|
|
# not depend on what happens to be installed on the local machine.
|
|
|
|
option(
|
|
|
|
"--disable-system-extension-dirs",
|
|
|
|
help="Disable searching system- and account-global directories for extensions"
|
|
|
|
" of any kind; use only profile-specific extension directories",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_define("ENABLE_SYSTEM_EXTENSION_DIRS", True, when="--enable-system-extension-dirs")
|
2021-12-22 00:36:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Pixman
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
system_lib_option(
|
2022-11-27 01:13:36 +03:00
|
|
|
"--enable-system-pixman", help="Use system pixman (located with pkgconfig)"
|
2021-12-22 00:36:41 +03:00
|
|
|
)
|
|
|
|
|
2022-11-27 01:13:36 +03:00
|
|
|
@depends("--enable-system-pixman")
|
2021-12-22 00:36:41 +03:00
|
|
|
def in_tree_pixman(pixman):
|
|
|
|
return not pixman
|
|
|
|
|
|
|
|
set_config("MOZ_TREE_PIXMAN", True, when=in_tree_pixman)
|
|
|
|
set_define("MOZ_TREE_PIXMAN", True, when=in_tree_pixman)
|
|
|
|
|
|
|
|
pkg_check_modules("MOZ_PIXMAN", "pixman-1 >= 0.36.0", when="--enable-system-pixman")
|
|
|
|
# Set MOZ_PIXMAN_CFLAGS to an explicit empty value when --enable-system-pixman is *not* used,
|
|
|
|
# for layout/style/extra-bindgen-flags
|
|
|
|
set_config("MOZ_PIXMAN_CFLAGS", [], when=in_tree_pixman)
|
2021-12-22 00:36:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Universalchardet
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
option("--disable-universalchardet", help="Disable universal encoding detection")
|
|
|
|
|
|
|
|
set_config("MOZ_UNIVERSALCHARDET", True, when="--enable-universalchardet")
|
2021-12-22 00:36:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Disable zipwriter
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
option("--disable-zipwriter", help="Disable zipwriter component")
|
|
|
|
|
|
|
|
set_config("MOZ_ZIPWRITER", True, when="--enable-zipwriter")
|
2021-12-22 00:36:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Location of the mozilla user directory
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
|
|
|
|
@depends(target)
|
|
|
|
def default_user_appdir(target):
|
|
|
|
if target.kernel in ("WINNT", "Darwin"):
|
|
|
|
return "Mozilla"
|
|
|
|
return ".mozilla"
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--with-user-appdir",
|
|
|
|
nargs=1,
|
|
|
|
default=default_user_appdir,
|
|
|
|
help="Set user-specific appdir",
|
|
|
|
)
|
|
|
|
|
|
|
|
@depends("--with-user-appdir")
|
|
|
|
def user_appdir(appdir):
|
|
|
|
if not appdir:
|
|
|
|
die("--without-user-appdir is not a valid option.")
|
|
|
|
if "/" in appdir[0]:
|
|
|
|
die("--with-user-appdir must be a single relative path.")
|
|
|
|
return '"{}"'.format(appdir[0])
|
|
|
|
|
|
|
|
set_define("MOZ_USER_DIR", user_appdir)
|
2021-12-23 23:50:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
have_sin_len = c_compiler.try_compile(
|
|
|
|
includes=["netinet/in.h"],
|
|
|
|
body="struct sockaddr_in x; void *foo = (void*) &x.sin_len;",
|
|
|
|
check_msg="for sin_len in struct sockaddr_in",
|
|
|
|
)
|
|
|
|
have_sin6_len = c_compiler.try_compile(
|
|
|
|
includes=["netinet/in.h"],
|
|
|
|
body="struct sockaddr_in6 x; void *foo = (void*) &x.sin6_len;",
|
|
|
|
check_msg="for sin_len6 in struct sockaddr_in6",
|
|
|
|
)
|
|
|
|
set_define("HAVE_SIN_LEN", have_sin_len)
|
|
|
|
set_define("HAVE_SIN6_LEN", have_sin6_len)
|
|
|
|
# HAVE_CONN_LEN must be the same as HAVE_SIN_LEN and HAVE_SIN6_LEN
|
|
|
|
set_define("HAVE_SCONN_LEN", have_sin_len & have_sin6_len)
|
|
|
|
set_define(
|
|
|
|
"HAVE_SA_LEN",
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=["netinet/in.h"],
|
|
|
|
body="struct sockaddr x; void *foo = (void*) &x.sa_len;",
|
|
|
|
check_msg="for sa_len in struct sockaddr",
|
|
|
|
),
|
|
|
|
)
|
2021-12-30 01:12:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Check for pthread_cond_timedwait_monotonic_np
|
|
|
|
# ==============================================================
|
|
|
|
with only_when(compile_environment):
|
|
|
|
set_define(
|
|
|
|
"HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC",
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=["pthread.h"],
|
|
|
|
body="pthread_cond_timedwait_monotonic_np(0, 0, 0);",
|
|
|
|
# -Werror to catch any "implicit declaration" warning that means the function
|
|
|
|
# is not supported.
|
2022-01-25 12:17:39 +03:00
|
|
|
flags=["-Werror=implicit-function-declaration"],
|
2021-12-30 01:12:45 +03:00
|
|
|
check_msg="for pthread_cond_timedwait_monotonic_np",
|
|
|
|
),
|
|
|
|
)
|
2021-12-30 01:12:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Custom dynamic linker for Android
|
|
|
|
# ==============================================================
|
2022-11-24 03:46:13 +03:00
|
|
|
with only_when(target_has_linux_kernel & compile_environment):
|
2021-12-30 01:12:45 +03:00
|
|
|
option(
|
|
|
|
env="MOZ_LINKER",
|
|
|
|
default=depends(target.os, when="--enable-jemalloc")(
|
|
|
|
lambda os: os == "Android"
|
|
|
|
),
|
|
|
|
help="{Enable|Disable} custom dynamic linker",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_LINKER", True, when="MOZ_LINKER")
|
|
|
|
set_define("MOZ_LINKER", True, when="MOZ_LINKER")
|
|
|
|
add_old_configure_assignment("MOZ_LINKER", True, when="MOZ_LINKER")
|
2021-12-30 01:12:45 +03:00
|
|
|
|
|
|
|
moz_linker = depends(when="MOZ_LINKER")(lambda: True)
|
2021-12-30 03:54:00 +03:00
|
|
|
|
|
|
|
|
|
|
|
# 32-bits ethtool_cmd.speed
|
|
|
|
# ==============================================================
|
2022-11-24 03:46:13 +03:00
|
|
|
with only_when(target_has_linux_kernel & compile_environment):
|
2021-12-30 03:54:00 +03:00
|
|
|
set_config(
|
|
|
|
"MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI",
|
|
|
|
c_compiler.try_compile(
|
|
|
|
includes=["linux/ethtool.h"],
|
|
|
|
body="struct ethtool_cmd cmd; cmd.speed_hi = 0;",
|
|
|
|
check_msg="for 32-bits ethtool_cmd.speed",
|
|
|
|
),
|
|
|
|
)
|
2021-12-30 03:54:01 +03:00
|
|
|
|
|
|
|
# Gamepad support
|
|
|
|
# ==============================================================
|
|
|
|
check_header(
|
|
|
|
"linux/joystick.h",
|
|
|
|
onerror=lambda: die(
|
|
|
|
"Can't find header linux/joystick.h, needed for gamepad support."
|
|
|
|
" Please install Linux kernel headers."
|
|
|
|
),
|
2022-11-24 03:46:13 +03:00
|
|
|
when=target_has_linux_kernel & compile_environment,
|
2021-12-30 03:54:01 +03:00
|
|
|
)
|
2021-12-30 03:54:02 +03:00
|
|
|
|
|
|
|
# Smart card support
|
|
|
|
# ==============================================================
|
|
|
|
@depends(build_project)
|
|
|
|
def disable_smart_cards(build_project):
|
|
|
|
return build_project == "mobile/android"
|
|
|
|
|
|
|
|
|
|
|
|
set_config("MOZ_NO_SMART_CARDS", True, when=disable_smart_cards)
|
|
|
|
set_define("MOZ_NO_SMART_CARDS", True, when=disable_smart_cards)
|
2022-01-21 00:01:20 +03:00
|
|
|
|
2022-08-03 21:59:36 +03:00
|
|
|
# Enable UniFFI fixtures
|
|
|
|
# ==============================================================
|
|
|
|
# These are used to test the uniffi-bindgen-gecko-js code generation. They
|
|
|
|
# should not be enabled in release builds.
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--enable-uniffi-fixtures",
|
|
|
|
help="Enable UniFFI Fixtures/Examples",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_UNIFFI_FIXTURES", True, when="--enable-uniffi-fixtures")
|
|
|
|
|
2022-08-16 17:42:20 +03:00
|
|
|
# System policies
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--disable-system-policies",
|
|
|
|
help="Disable reading policies from Windows registry, macOS's file system attributes, and /etc/firefox",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_SYSTEM_POLICIES", True, when="--enable-system-policies")
|
Bug 1829049 - Unambiguously enable STL wrapping on all platforms. r=firefox-build-system-reviewers,ahochheiden
First, the setup in js/src/old-configure.in was actually doing nothing
for js, since there weren't corresponding AC_SUBST/AC_SUBST_LIST.
As mentioned in the commit message for bug 1274334, libmozglue contains
operator new/operator delete overrides, so this didn't cause much harm,
especially because js has limited use of plain operator new.
Second, we take on the occasion to move the definitions to python
configure. To match when the STL wrapping was enabled, we move it to
toolkit/moz.configure, which is included by all Gecko-based projects,
but explicitly not by standalone js (preserving its previous behavior,
which is actually desirable for standalone js), and not by other
projects such as tools/crashreporter/injects.
Differential Revision: https://phabricator.services.mozilla.com/D175980
2023-04-27 09:11:36 +03:00
|
|
|
|
2023-05-15 18:44:05 +03:00
|
|
|
# Allow disabling the creation a legacy profile
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
option(
|
|
|
|
"--disable-legacy-profile-creation",
|
|
|
|
help="Disable the creation a legacy profile, to be used by old versions "
|
|
|
|
"of Firefox, when no profiles exist.",
|
|
|
|
)
|
|
|
|
|
|
|
|
set_config("MOZ_CREATE_LEGACY_PROFILE", True, when="--enable-legacy-profile-creation")
|
|
|
|
|
Bug 1829049 - Unambiguously enable STL wrapping on all platforms. r=firefox-build-system-reviewers,ahochheiden
First, the setup in js/src/old-configure.in was actually doing nothing
for js, since there weren't corresponding AC_SUBST/AC_SUBST_LIST.
As mentioned in the commit message for bug 1274334, libmozglue contains
operator new/operator delete overrides, so this didn't cause much harm,
especially because js has limited use of plain operator new.
Second, we take on the occasion to move the definitions to python
configure. To match when the STL wrapping was enabled, we move it to
toolkit/moz.configure, which is included by all Gecko-based projects,
but explicitly not by standalone js (preserving its previous behavior,
which is actually desirable for standalone js), and not by other
projects such as tools/crashreporter/injects.
Differential Revision: https://phabricator.services.mozilla.com/D175980
2023-04-27 09:11:36 +03:00
|
|
|
|
|
|
|
# STL wrapping
|
|
|
|
# ==============================================================
|
|
|
|
set_config("WRAP_STL_INCLUDES", True)
|
|
|
|
set_config(
|
|
|
|
"STL_FLAGS",
|
|
|
|
depends(build_environment.dist)(lambda dist: [f"-I{dist}/stl_wrappers"]),
|
|
|
|
)
|
2023-05-11 01:12:49 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Perl detection
|
|
|
|
# ==============================================================
|
|
|
|
@depends(target)
|
|
|
|
def need_perl(target):
|
|
|
|
# Ideally, we'd also depend on gnu_as here, but that adds complications.
|
|
|
|
return target.cpu == "arm"
|
|
|
|
|
|
|
|
|
|
|
|
perl = check_prog("PERL", ("perl5", "perl"), when=need_perl)
|
|
|
|
|
|
|
|
|
|
|
|
@template
|
|
|
|
def perl_version_check(min_version):
|
|
|
|
@depends(perl)
|
|
|
|
@checking("for minimum required perl version >= %s" % min_version)
|
|
|
|
def get_perl_version(perl):
|
|
|
|
return Version(
|
|
|
|
check_cmd_output(
|
|
|
|
perl,
|
|
|
|
"-e",
|
|
|
|
"print $]",
|
|
|
|
onerror=lambda: die("Failed to get perl version."),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
@depends(get_perl_version)
|
|
|
|
def check_perl_version(version):
|
|
|
|
if version < min_version:
|
|
|
|
die("Perl %s or higher is required.", min_version)
|
|
|
|
|
|
|
|
@depends(perl)
|
|
|
|
@checking("for full perl installation")
|
|
|
|
@imports("subprocess")
|
|
|
|
def has_full_perl_installation(perl):
|
|
|
|
ret = subprocess.call([perl, "-e", "use Config; exit(!-d $Config{archlib})"])
|
|
|
|
return ret == 0
|
|
|
|
|
|
|
|
@depends(has_full_perl_installation)
|
|
|
|
def require_full_perl_installation(has_full_perl_installation):
|
|
|
|
if not has_full_perl_installation:
|
|
|
|
die(
|
|
|
|
"Cannot find Config.pm or $Config{archlib}. "
|
|
|
|
"A full perl installation is required."
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
with only_when(need_perl):
|
|
|
|
perl_version_check("5.006")
|