From d87231be260d3c88dfa7575eb92aa42b5ef5fd3d Mon Sep 17 00:00:00 2001 From: ganguin Date: Tue, 19 Apr 2022 08:35:29 +0000 Subject: [PATCH] Bug 1661450 - 1/2 Make webrtc depend on MOZ_X11 r=ng 1. add the MOZ_X11 config flag in build/gn.mozbuild and set the gn_vars accordingly. 2. create the new gn-config/mozconfig files and delete previous ones dom/media/webrtc/third_party_build/gn-configs/**.mozconfig with --enable-default-toolkit=cairo-gtk3-wayland-only for the non X11 version. New toolkit nmae is required to force disable X11 detection as cairo-gtk3-wayland will auto-detect X11 and make generate-gn-build-files.sh fail. 3. Add the MOZ_X11 config flag in python/mozbuild/mozbuild/gn_processor.py Then run dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh Differential Revision: https://phabricator.services.mozilla.com/D142904 --- build/gn.mozbuild | 6 ++++++ .../gn-configs/generate-gn-build-files.sh | 9 ++++++--- .../x64_False_arm64_linux_False.mozconfig | 6 ++++++ ...onfig => x64_False_arm64_linux_True.mozconfig} | 2 +- .../gn-configs/x64_False_x64_linux.mozconfig | 4 ---- .../x64_False_x64_linux_False.mozconfig | 5 +++++ .../gn-configs/x64_False_x64_linux_True.mozconfig | 4 ++++ .../x64_False_x86_linux_False.mozconfig | 6 ++++++ ...zconfig => x64_False_x86_linux_True.mozconfig} | 2 +- .../x64_True_arm64_linux_False.mozconfig | 7 +++++++ ...config => x64_True_arm64_linux_True.mozconfig} | 2 +- .../gn-configs/x64_True_x64_linux_False.mozconfig | 6 ++++++ ...ozconfig => x64_True_x64_linux_True.mozconfig} | 2 +- .../gn-configs/x64_True_x86_linux_False.mozconfig | 7 +++++++ ...ozconfig => x64_True_x86_linux_True.mozconfig} | 2 +- python/mozbuild/mozbuild/gn_processor.py | 9 ++++++++- third_party/libwebrtc/webrtc.gni | 2 +- toolkit/moz.configure | 15 ++++++++++++--- 18 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_False.mozconfig rename dom/media/webrtc/third_party_build/gn-configs/{x64_False_arm64_linux.mozconfig => x64_False_arm64_linux_True.mozconfig} (54%) delete mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux.mozconfig create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_False.mozconfig create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_True.mozconfig create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_False.mozconfig rename dom/media/webrtc/third_party_build/gn-configs/{x64_False_x86_linux.mozconfig => x64_False_x86_linux_True.mozconfig} (54%) create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_False.mozconfig rename dom/media/webrtc/third_party_build/gn-configs/{x64_True_arm64_linux.mozconfig => x64_True_arm64_linux_True.mozconfig} (63%) create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_False.mozconfig rename dom/media/webrtc/third_party_build/gn-configs/{x64_True_x64_linux.mozconfig => x64_True_x64_linux_True.mozconfig} (55%) create mode 100644 dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_False.mozconfig rename dom/media/webrtc/third_party_build/gn-configs/{x64_True_x86_linux.mozconfig => x64_True_x86_linux_True.mozconfig} (63%) diff --git a/build/gn.mozbuild b/build/gn.mozbuild index 2351aca4a3ee..5df682b6a1c7 100644 --- a/build/gn.mozbuild +++ b/build/gn.mozbuild @@ -13,6 +13,12 @@ else: os = CONFIG['OS_TARGET'] +if os == "Linux": + if CONFIG['MOZ_X11']: + gn_vars['use_x11'] = True + else: + gn_vars['use_x11'] = False + flavors = { 'WINNT': 'win', 'Android': 'android', diff --git a/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh b/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh index 73bf9471e160..d47b5da3f510 100755 --- a/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh +++ b/dom/media/webrtc/third_party_build/gn-configs/generate-gn-build-files.sh @@ -83,9 +83,12 @@ else rustup target add aarch64-unknown-linux-gnu rustup target add i686-unknown-linux-gnu - CONFIGS="x64_False_x64_linux x64_True_x64_linux" - CONFIGS="$CONFIGS x64_False_x86_linux x64_True_x86_linux" - CONFIGS="$CONFIGS x64_False_arm64_linux x64_True_arm64_linux" + CONFIGS="x64_False_x64_linux_False x64_True_x64_linux_False" + CONFIGS="$CONFIGS x64_False_x64_linux_True x64_True_x64_linux_True" + CONFIGS="$CONFIGS x64_False_x86_linux_False x64_True_x86_linux_False" + CONFIGS="$CONFIGS x64_False_x86_linux_True x64_True_x86_linux_True" + CONFIGS="$CONFIGS x64_False_arm64_linux_False x64_True_arm64_linux_False" + CONFIGS="$CONFIGS x64_False_arm64_linux_True x64_True_arm64_linux_True" CONFIGS="$CONFIGS x64_False_arm_android x64_True_arm_android" CONFIGS="$CONFIGS x64_False_x64_android x64_True_x64_android" CONFIGS="$CONFIGS x64_False_x86_android x64_True_x86_android" diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_False.mozconfig new file mode 100644 index 000000000000..23b164e13f16 --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_False.mozconfig @@ -0,0 +1,6 @@ +ac_add_options --target=aarch64 +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_False_arm64_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_True.mozconfig similarity index 54% rename from dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux.mozconfig rename to dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_True.mozconfig index 7b080cf98fec..3343ffb07f12 100644 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux.mozconfig +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_arm64_linux_True.mozconfig @@ -1,5 +1,5 @@ ac_add_options --target=aarch64 ac_add_options --enable-bootstrap -mk_add_options MOZ_OBJDIR=obj-x64_False_arm64_linux +mk_add_options MOZ_OBJDIR=obj-x64_False_arm64_linux_True diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux.mozconfig deleted file mode 100644 index 40dc5504081e..000000000000 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux.mozconfig +++ /dev/null @@ -1,4 +0,0 @@ -ac_add_options --enable-bootstrap - -mk_add_options MOZ_OBJDIR=obj-x64_False_x64_linux - diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_False.mozconfig new file mode 100644 index 000000000000..ac2361f0958e --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_False.mozconfig @@ -0,0 +1,5 @@ +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_False_x64_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_True.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_True.mozconfig new file mode 100644 index 000000000000..987900caec51 --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x64_linux_True.mozconfig @@ -0,0 +1,4 @@ +ac_add_options --enable-bootstrap + +mk_add_options MOZ_OBJDIR=obj-x64_False_x64_linux_True + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_False.mozconfig new file mode 100644 index 000000000000..1885281154e2 --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_False.mozconfig @@ -0,0 +1,6 @@ +ac_add_options --target=i686 +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_False_x86_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_True.mozconfig similarity index 54% rename from dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux.mozconfig rename to dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_True.mozconfig index b82aa241293b..1cb093358715 100644 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux.mozconfig +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_False_x86_linux_True.mozconfig @@ -1,5 +1,5 @@ ac_add_options --target=i686 ac_add_options --enable-bootstrap -mk_add_options MOZ_OBJDIR=obj-x64_False_x86_linux +mk_add_options MOZ_OBJDIR=obj-x64_False_x86_linux_True diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_False.mozconfig new file mode 100644 index 000000000000..533ff003f24b --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_False.mozconfig @@ -0,0 +1,7 @@ +ac_add_options --enable-debug +ac_add_options --target=aarch64 +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_True_arm64_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_True.mozconfig similarity index 63% rename from dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux.mozconfig rename to dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_True.mozconfig index dfc19e5a929a..c489492e1d53 100644 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux.mozconfig +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_arm64_linux_True.mozconfig @@ -2,5 +2,5 @@ ac_add_options --enable-debug ac_add_options --target=aarch64 ac_add_options --enable-bootstrap -mk_add_options MOZ_OBJDIR=obj-x64_True_arm64_linux +mk_add_options MOZ_OBJDIR=obj-x64_True_arm64_linux_True diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_False.mozconfig new file mode 100644 index 000000000000..1064c870f854 --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_False.mozconfig @@ -0,0 +1,6 @@ +ac_add_options --enable-debug +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_True_x64_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_True.mozconfig similarity index 55% rename from dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux.mozconfig rename to dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_True.mozconfig index ed55467b38b1..7030314a9588 100644 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux.mozconfig +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x64_linux_True.mozconfig @@ -1,5 +1,5 @@ ac_add_options --enable-debug ac_add_options --enable-bootstrap -mk_add_options MOZ_OBJDIR=obj-x64_True_x64_linux +mk_add_options MOZ_OBJDIR=obj-x64_True_x64_linux_True diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_False.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_False.mozconfig new file mode 100644 index 000000000000..7238a98260e5 --- /dev/null +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_False.mozconfig @@ -0,0 +1,7 @@ +ac_add_options --enable-debug +ac_add_options --target=i686 +ac_add_options --enable-bootstrap +ac_add_options --enable-default-toolkit=cairo-gtk3-wayland-only + +mk_add_options MOZ_OBJDIR=obj-x64_True_x86_linux_False + diff --git a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux.mozconfig b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_True.mozconfig similarity index 63% rename from dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux.mozconfig rename to dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_True.mozconfig index b14d8cc20476..43f98803e40b 100644 --- a/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux.mozconfig +++ b/dom/media/webrtc/third_party_build/gn-configs/x64_True_x86_linux_True.mozconfig @@ -2,5 +2,5 @@ ac_add_options --enable-debug ac_add_options --target=i686 ac_add_options --enable-bootstrap -mk_add_options MOZ_OBJDIR=obj-x64_True_x86_linux +mk_add_options MOZ_OBJDIR=obj-x64_True_x86_linux_True diff --git a/python/mozbuild/mozbuild/gn_processor.py b/python/mozbuild/mozbuild/gn_processor.py index e358f770db0d..ead9a4cf28cd 100644 --- a/python/mozbuild/mozbuild/gn_processor.py +++ b/python/mozbuild/mozbuild/gn_processor.py @@ -153,7 +153,13 @@ def filter_gn_config(gn_result, config, sandbox_vars, input_vars, gn_target): # mozbuild configuration. gn_out = {"targets": {}, "sandbox_vars": sandbox_vars, "gn_gen_args": input_vars} - gn_mozbuild_vars = ("MOZ_DEBUG", "OS_TARGET", "HOST_CPU_ARCH", "CPU_ARCH") + gn_mozbuild_vars = ( + "MOZ_DEBUG", + "OS_TARGET", + "HOST_CPU_ARCH", + "CPU_ARCH", + "MOZ_X11", + ) mozbuild_args = {k: config.substs.get(k) for k in gn_mozbuild_vars} gn_out["mozbuild_args"] = mozbuild_args @@ -486,6 +492,7 @@ def write_mozbuild( ("OS_TARGET",), ("CPU_ARCH",), ("MOZ_DEBUG", "OS_TARGET"), + ("OS_TARGET", "MOZ_X11"), ("OS_TARGET", "CPU_ARCH"), ("OS_TARGET", "CPU_ARCH", "MOZ_DEBUG"), ("MOZ_DEBUG", "OS_TARGET", "CPU_ARCH", "HOST_CPU_ARCH"), diff --git a/third_party/libwebrtc/webrtc.gni b/third_party/libwebrtc/webrtc.gni index 7f9f89213aab..0daaac710284 100644 --- a/third_party/libwebrtc/webrtc.gni +++ b/third_party/libwebrtc/webrtc.gni @@ -122,7 +122,7 @@ declare_args() { rtc_build_tools = false # Set this to false to skip building code that requires X11. - rtc_use_x11 = is_desktop_linux + rtc_use_x11 = use_x11 # Set this to use PipeWire on the Wayland display server. # By default it's only enabled on desktop Linux (excludes ChromeOS) and diff --git a/toolkit/moz.configure b/toolkit/moz.configure index c5aa45b2ad82..0dd52bd5203b 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -407,7 +407,12 @@ def toolkit_choices(target): elif target.os == "Android": return ("cairo-android",) else: - return ("cairo-gtk3", "cairo-gtk3-wayland", "cairo-gtk3-x11-wayland") + return ( + "cairo-gtk3", + "cairo-gtk3-wayland", + "cairo-gtk3-wayland-only", + "cairo-gtk3-x11-wayland", + ) @depends(toolkit_choices) @@ -1377,7 +1382,9 @@ x11_headers = pkg_check_modules( "MOZ_X11", x11_libs, allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3-wayland"), - when=toolkit_gtk, + when=depends(full_toolkit)( + lambda t: t in ("cairo-gtk3", "cairo-gtk3-wayland", "cairo-gtk3-x11-wayland") + ), ) @@ -1389,7 +1396,9 @@ pkg_check_modules( ["ice", "sm"], cflags_only=True, allow_missing=depends(full_toolkit)(lambda t: t == "cairo-gtk3-wayland"), - when=toolkit_gtk, + when=depends(full_toolkit)( + lambda t: t in ("cairo-gtk3", "cairo-gtk3-wayland", "cairo-gtk3-x11-wayland") + ), )