mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1776255 - Add the appropriate 'when' to all 'option' that end up calling 'pkg_check_modules' later r=firefox-build-system-reviewers,glandium
We don't check for pkg-config on some platforms (Windows, OSX, Android). On those platforms, calling 'pkg_check_modules' will not work. Adding the same 'when' used for the 'pkg_config' check to all the options that end up calling 'pkg_check_modules' effectively disables them, and prevents 'pkg_check_modules' from being called. Differential Revision: https://phabricator.services.mozilla.com/D150649
This commit is contained in:
parent
e1f378ec51
commit
9a271c3566
@ -19,10 +19,19 @@ def enable_nspr_build(enable):
|
||||
return enable
|
||||
|
||||
|
||||
system_lib_option("--with-system-nspr", help="Use system NSPR")
|
||||
system_lib_option(
|
||||
"--with-system-nspr",
|
||||
help="Use system NSPR",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@depends(enable_nspr_build, "--with-system-nspr", js_standalone)
|
||||
@depends("--with-system-nspr", when=use_pkg_config)
|
||||
def with_system_nspr_option(with_system_nspr):
|
||||
return with_system_nspr
|
||||
|
||||
|
||||
@depends(enable_nspr_build, with_system_nspr_option, js_standalone)
|
||||
def build_nspr(nspr_build, system_nspr, js_standalone):
|
||||
if nspr_build is not None and nspr_build.origin != "default":
|
||||
if nspr_build and system_nspr:
|
||||
@ -36,7 +45,7 @@ set_config("MOZ_BUILD_NSPR", True, when=build_nspr)
|
||||
set_config("MOZ_SYSTEM_NSPR", True, when="--with-system-nspr")
|
||||
|
||||
|
||||
@depends(build_nspr, "--with-system-nspr", js_standalone)
|
||||
@depends(build_nspr, with_system_nspr_option, js_standalone)
|
||||
def js_without_nspr(build_nspr, system_nspr, js_standalone):
|
||||
if js_standalone:
|
||||
return not build_nspr and not system_nspr
|
||||
@ -74,7 +83,7 @@ def nspr_pkg(nspr_pkg):
|
||||
)
|
||||
|
||||
|
||||
@depends("--with-system-nspr", nspr_minver)
|
||||
@depends(with_system_nspr_option, nspr_minver)
|
||||
def pkgconf_requires_private(system_nspr, nspr_minver):
|
||||
if not system_nspr:
|
||||
return ""
|
||||
|
@ -4,7 +4,11 @@
|
||||
# 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/.
|
||||
|
||||
system_lib_option("--with-system-nss", help="Use system NSS")
|
||||
system_lib_option(
|
||||
"--with-system-nss",
|
||||
help="Use system NSS",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
imply_option("--with-system-nspr", True, when="--with-system-nss")
|
||||
|
||||
|
@ -10,13 +10,17 @@ def pkg_config(prefixes):
|
||||
return tuple("{}pkg-config".format(p) for p in (prefixes or ()) + ("",))
|
||||
|
||||
|
||||
@depends(compile_environment, target)
|
||||
def use_pkg_config(compile_environment, target):
|
||||
return compile_environment and target.os not in ("WINNT", "OSX", "Android")
|
||||
|
||||
|
||||
pkg_config = check_prog(
|
||||
"PKG_CONFIG",
|
||||
pkg_config,
|
||||
bootstrap=depends(when=target_sysroot.bootstrapped)(lambda: "pkgconf"),
|
||||
allow_missing=True,
|
||||
when=compile_environment
|
||||
& depends(target.os)(lambda os: os not in ("WINNT", "OSX", "iOS", "Android")),
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@ -103,7 +107,12 @@ set_config("PKG_CONFIG_LIBDIR", pkg_config_vars.PKG_CONFIG_LIBDIR)
|
||||
# Returns `True` when the package description is fulfilled.
|
||||
@template
|
||||
def pkg_check_modules(
|
||||
var, package_desc, when=always, allow_missing=False, config=True, cflags_only=False
|
||||
var,
|
||||
package_desc,
|
||||
when=always,
|
||||
allow_missing=False,
|
||||
config=True,
|
||||
cflags_only=False,
|
||||
):
|
||||
@depends(dependable(package_desc), when=when)
|
||||
def package_desc(desc):
|
||||
@ -118,11 +127,11 @@ def pkg_check_modules(
|
||||
|
||||
allow_missing = dependable(allow_missing)
|
||||
|
||||
@depends(when, "--enable-compile-environment")
|
||||
def when_and_compile_environment(when, compile_environment):
|
||||
return when and compile_environment
|
||||
@depends(when, when=use_pkg_config)
|
||||
def when_and_use_pkg_config(when):
|
||||
return when
|
||||
|
||||
@depends(pkg_config, pkg_config_version, when=when_and_compile_environment)
|
||||
@depends(pkg_config, pkg_config_version, when=when_and_use_pkg_config)
|
||||
def check_pkg_config(pkg_config, version):
|
||||
min_version = "0.9.0"
|
||||
if pkg_config is None:
|
||||
@ -142,7 +151,7 @@ def pkg_check_modules(
|
||||
pkg_config_env,
|
||||
package_desc,
|
||||
allow_missing,
|
||||
when=when_and_compile_environment,
|
||||
when=when_and_use_pkg_config,
|
||||
)
|
||||
@imports("sys")
|
||||
@imports(_from="mozbuild.configure.util", _import="LineIO")
|
||||
|
@ -1208,7 +1208,11 @@ target_sysroot = sysroot(target)
|
||||
def system_lib_option(name, *args, **kwargs):
|
||||
option(name, *args, **kwargs)
|
||||
|
||||
@depends(name, target_sysroot.bootstrapped)
|
||||
@depends(
|
||||
name,
|
||||
target_sysroot.bootstrapped,
|
||||
when=kwargs.get("when"),
|
||||
)
|
||||
def no_system_lib_in_sysroot(value, bootstrapped):
|
||||
if bootstrapped and value:
|
||||
die(
|
||||
|
@ -15,10 +15,12 @@ def force_system_ffi(target):
|
||||
imply_option("--with-system-ffi", force_system_ffi, "target")
|
||||
|
||||
system_lib_option(
|
||||
"--with-system-ffi", help="Use system libffi (located with pkgconfig)"
|
||||
"--with-system-ffi",
|
||||
help="Use system libffi (located with pkgconfig)",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
use_system_ffi = depends_if("--with-system-ffi")(lambda _: True)
|
||||
use_system_ffi = depends_if("--with-system-ffi", when=use_pkg_config)(lambda _: True)
|
||||
|
||||
system_ffi = pkg_check_modules("MOZ_FFI", "libffi > 3.0.9", when=use_system_ffi)
|
||||
|
||||
|
@ -1281,12 +1281,22 @@ set_define(
|
||||
|
||||
# ECMAScript Internationalization API Support (uses ICU)
|
||||
# ======================================================
|
||||
system_lib_option("--with-system-icu", help="Use system ICU")
|
||||
system_lib_option(
|
||||
"--with-system-icu",
|
||||
help="Use system ICU",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@depends("--with-system-icu", when=use_pkg_config)
|
||||
def enable_system_icu_option(enable_system_icu):
|
||||
return enable_system_icu
|
||||
|
||||
|
||||
system_icu = pkg_check_modules("MOZ_ICU", "icu-i18n >= 73.1", when="--with-system-icu")
|
||||
|
||||
|
||||
@depends("--with-system-icu")
|
||||
@depends(enable_system_icu_option)
|
||||
def in_tree_icu(system_icu):
|
||||
return not system_icu
|
||||
|
||||
|
@ -213,6 +213,8 @@ include("build/moz.configure/bootstrap.configure")
|
||||
# check_prog to use bootstrap_search_path directly because check_prog
|
||||
# comes first, so we use a trick to allow it. Uses of check_prog
|
||||
# happening before here won't allow bootstrap.
|
||||
|
||||
|
||||
@template
|
||||
def check_prog(*args, **kwargs):
|
||||
kwargs["bootstrap_search_path"] = bootstrap_search_path
|
||||
@ -918,12 +920,18 @@ option(
|
||||
nargs="?",
|
||||
default=system_zlib_default,
|
||||
help="{Use|Do not use} system libz",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@depends("--with-system-zlib")
|
||||
@depends("--with-system-zlib", when=use_pkg_config)
|
||||
def with_system_zlib_option(with_system_zlib):
|
||||
return with_system_zlib
|
||||
|
||||
|
||||
@depends(with_system_zlib_option)
|
||||
def deprecated_system_zlib_path(value):
|
||||
if len(value) == 1:
|
||||
if value and len(value) == 1:
|
||||
die(
|
||||
"--with-system-zlib=PATH is not supported anymore. Please use "
|
||||
"--with-system-zlib and set any necessary pkg-config environment variable."
|
||||
@ -935,7 +943,7 @@ pkg_check_modules("MOZ_ZLIB", "zlib >= 1.2.3", when="--with-system-zlib")
|
||||
set_config("MOZ_SYSTEM_ZLIB", True, when="--with-system-zlib")
|
||||
|
||||
|
||||
@depends("--with-system-zlib", js_shared, moz_linker, target.os)
|
||||
@depends(with_system_zlib_option, js_shared, moz_linker, target.os)
|
||||
def zlib_in_mozglue(system_zlib, js_shared, linker, os):
|
||||
if not system_zlib and (js_shared or linker or os == "Android"):
|
||||
return True
|
||||
|
@ -730,7 +730,7 @@ class TestChecksConfigure(unittest.TestCase):
|
||||
toolchain_prefix = depends(when=True)(lambda: None)
|
||||
target_multiarch_dir = depends(when=True)(lambda: None)
|
||||
target_sysroot = depends(when=True)(lambda: %(sysroot)s)
|
||||
target = depends(when=True)(lambda: None)
|
||||
target = depends(when=True)(lambda: namespace(os="unknown"))
|
||||
include('%(topsrcdir)s/build/moz.configure/util.configure')
|
||||
include('%(topsrcdir)s/build/moz.configure/checks.configure')
|
||||
# Skip bootstrapping.
|
||||
|
@ -452,6 +452,7 @@ export var AppConstants = Object.freeze({
|
||||
false,
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
|
||||
MOZ_CAN_FOLLOW_SYSTEM_TIME:
|
||||
#ifdef XP_WIN
|
||||
true,
|
||||
@ -465,6 +466,7 @@ export var AppConstants = Object.freeze({
|
||||
#endif
|
||||
#else
|
||||
false,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MOZ_SYSTEM_POLICIES:
|
||||
|
@ -329,19 +329,30 @@ def imply_wasapi(values, target):
|
||||
|
||||
set_config("MOZ_AAUDIO", imply_aaudio, when="--enable-audio-backends")
|
||||
|
||||
imply_option("--enable-alsa", imply_alsa, reason="--enable-audio-backends")
|
||||
imply_option(
|
||||
"--enable-alsa", imply_alsa, reason="--enable-audio-backends", when=use_pkg_config
|
||||
)
|
||||
|
||||
set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends")
|
||||
|
||||
imply_option("--enable-jack", imply_jack, reason="--enable-audio-backends")
|
||||
imply_option(
|
||||
"--enable-jack", imply_jack, reason="--enable-audio-backends", when=use_pkg_config
|
||||
)
|
||||
|
||||
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-pulseaudio",
|
||||
imply_pulseaudio,
|
||||
reason="--enable-audio-backends",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
imply_option("--enable-sndio", imply_sndio, reason="--enable-audio-backends")
|
||||
imply_option(
|
||||
"--enable-sndio", imply_sndio, reason="--enable-audio-backends", when=use_pkg_config
|
||||
)
|
||||
|
||||
set_config("MOZ_SUNAUDIO", imply_sunaudio, when="--enable-audio-backends")
|
||||
|
||||
@ -349,10 +360,20 @@ set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends")
|
||||
|
||||
# ALSA cubeb backend
|
||||
# ==============================================================
|
||||
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
|
||||
option(
|
||||
"--enable-alsa",
|
||||
env="MOZ_ALSA",
|
||||
help="Enable ALSA audio backend.",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@depends("--enable-alsa", midir_linux_support)
|
||||
@depends("--enable-alsa", when=use_pkg_config)
|
||||
def enable_alsa_option(enable_alsa):
|
||||
return enable_alsa
|
||||
|
||||
|
||||
@depends(enable_alsa_option, midir_linux_support)
|
||||
def enable_alsa_or_midir_linux_support(alsa_enabled, midir_linux_support):
|
||||
return alsa_enabled or midir_linux_support
|
||||
|
||||
@ -364,7 +385,12 @@ set_define("MOZ_ALSA", True, when="--enable-alsa")
|
||||
|
||||
# JACK cubeb backend
|
||||
# ==============================================================
|
||||
system_lib_option("--enable-jack", env="MOZ_JACK", help="Enable JACK audio backend.")
|
||||
system_lib_option(
|
||||
"--enable-jack",
|
||||
env="MOZ_JACK",
|
||||
help="Enable JACK audio backend.",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
jack = pkg_check_modules("MOZ_JACK", "jack", when="--enable-jack")
|
||||
|
||||
@ -376,6 +402,7 @@ option(
|
||||
"--enable-pulseaudio",
|
||||
env="MOZ_PULSEAUDIO",
|
||||
help="{Enable|Disable} PulseAudio audio backend.",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
pulseaudio = pkg_check_modules("MOZ_PULSEAUDIO", "libpulse", when="--enable-pulseaudio")
|
||||
@ -385,7 +412,12 @@ set_define("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True))
|
||||
|
||||
# sndio cubeb backend
|
||||
# ==============================================================
|
||||
system_lib_option("--enable-sndio", env="MOZ_SNDIO", help="Enable sndio audio backend.")
|
||||
system_lib_option(
|
||||
"--enable-sndio",
|
||||
env="MOZ_SNDIO",
|
||||
help="Enable sndio audio backend.",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
sndio = pkg_check_modules("MOZ_SNDIO", "sndio", when="--enable-sndio")
|
||||
|
||||
@ -1028,10 +1060,15 @@ set_define("MOZ_TELEMETRY_ON_BY_DEFAULT", True, when=telemetry_on_by_default)
|
||||
|
||||
# gpsd support
|
||||
# ==============================================================
|
||||
system_lib_option("--enable-gpsd", env="MOZ_GPSD", help="Enable gpsd support")
|
||||
system_lib_option(
|
||||
"--enable-gpsd",
|
||||
env="MOZ_GPSD",
|
||||
help="Enable gpsd support",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
|
||||
@depends("--enable-gpsd")
|
||||
@depends("--enable-gpsd", when=use_pkg_config)
|
||||
def gpsd(value):
|
||||
return bool(value)
|
||||
|
||||
@ -1190,7 +1227,9 @@ set_config(
|
||||
)
|
||||
|
||||
system_lib_option(
|
||||
"--with-system-webp", help="Use system libwebp (located with pkgconfig)"
|
||||
"--with-system-webp",
|
||||
help="Use system libwebp (located with pkgconfig)",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
system_webp = pkg_check_modules(
|
||||
@ -2151,9 +2190,15 @@ with only_when(compile_environment):
|
||||
|
||||
with only_when(compile_environment):
|
||||
system_lib_option(
|
||||
"--with-system-libvpx", help="Use system libvpx (located with pkgconfig)"
|
||||
"--with-system-libvpx",
|
||||
help="Use system libvpx (located with pkgconfig)",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@depends("--with-system-libvpx", when=use_pkg_config)
|
||||
def with_system_libvpx_option(with_system_libvpx):
|
||||
return with_system_libvpx
|
||||
|
||||
with only_when("--with-system-libvpx"):
|
||||
vpx = pkg_check_modules("MOZ_LIBVPX", "vpx >= 1.10.0")
|
||||
|
||||
@ -2178,7 +2223,7 @@ with only_when(compile_environment):
|
||||
|
||||
set_config("MOZ_SYSTEM_LIBVPX", True)
|
||||
|
||||
@depends("--with-system-libvpx", target)
|
||||
@depends(with_system_libvpx_option, target)
|
||||
def in_tree_vpx(system_libvpx, target):
|
||||
if system_libvpx:
|
||||
return
|
||||
@ -2389,9 +2434,10 @@ with only_when(compile_environment):
|
||||
"--with-system-png",
|
||||
nargs="?",
|
||||
help="Use system libpng",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@depends("--with-system-png")
|
||||
@depends("--with-system-png", when=use_pkg_config)
|
||||
def deprecated_system_png_path(value):
|
||||
if len(value) == 1:
|
||||
die(
|
||||
@ -3089,9 +3135,10 @@ with only_when(compile_environment):
|
||||
"--with-system-libevent",
|
||||
nargs="?",
|
||||
help="Use system libevent",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@depends("--with-system-libevent")
|
||||
@depends("--with-system-libevent", when=use_pkg_config)
|
||||
def deprecated_system_libevent_path(value):
|
||||
if len(value) == 1:
|
||||
die(
|
||||
@ -3173,9 +3220,13 @@ with only_when(toolkit_gtk):
|
||||
# DBus
|
||||
# ==============================================================
|
||||
with only_when(toolkit_gtk):
|
||||
option("--disable-dbus", help="Disable dbus support")
|
||||
option("--disable-dbus", help="Disable dbus support", when=use_pkg_config)
|
||||
|
||||
with only_when("--enable-dbus"):
|
||||
@depends("--enable-dbus", when=use_pkg_config)
|
||||
def enable_dbus_option(enable_dbus):
|
||||
return enable_dbus
|
||||
|
||||
with only_when(enable_dbus_option):
|
||||
pkg_check_modules("MOZ_DBUS", "dbus-1 >= 0.60")
|
||||
|
||||
set_config("MOZ_ENABLE_DBUS", True)
|
||||
@ -3199,8 +3250,9 @@ set_define("NECKO_WIFI", True, when="--enable-necko-wifi")
|
||||
|
||||
@depends(
|
||||
depends("--enable-necko-wifi", when=necko_wifi_when)(lambda x: x),
|
||||
depends("--enable-dbus", when=toolkit_gtk)(lambda x: x),
|
||||
when=depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"),
|
||||
depends(enable_dbus_option, when=toolkit_gtk)(lambda x: x),
|
||||
when=use_pkg_config
|
||||
& depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"),
|
||||
)
|
||||
def necko_wifi_dbus(necko_wifi, dbus):
|
||||
if necko_wifi and not dbus:
|
||||
@ -3239,7 +3291,11 @@ set_define("MOZ_LAYERS_HAVE_LOG", True, when="--enable-dump-painting")
|
||||
# libproxy support
|
||||
# ==============================================================
|
||||
with only_when(toolkit_gtk):
|
||||
system_lib_option("--enable-libproxy", help="Enable libproxy support")
|
||||
system_lib_option(
|
||||
"--enable-libproxy",
|
||||
help="Enable libproxy support",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
with only_when("--enable-libproxy"):
|
||||
pkg_check_modules("MOZ_LIBPROXY", "libproxy-1.0")
|
||||
@ -3332,10 +3388,16 @@ set_define("ENABLE_SYSTEM_EXTENSION_DIRS", True, when="--enable-system-extension
|
||||
# ==============================================================
|
||||
with only_when(compile_environment):
|
||||
system_lib_option(
|
||||
"--enable-system-pixman", help="Use system pixman (located with pkgconfig)"
|
||||
"--enable-system-pixman",
|
||||
help="Use system pixman (located with pkgconfig)",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
@depends("--enable-system-pixman")
|
||||
@depends("--enable-system-pixman", when=use_pkg_config)
|
||||
def enable_system_pixman_option(enable_system_pixman):
|
||||
return enable_system_pixman
|
||||
|
||||
@depends(enable_system_pixman_option)
|
||||
def in_tree_pixman(pixman):
|
||||
return not pixman
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user