Bug 1954903 - Allow to use system PipeWire libs instead of bundled r=stransky,mjf
Introduce "--with-system-pipewire" option, allowing to build Firefox against system PipeWire library and to find system PipeWire header files. Differential Revision: https://phabricator.services.mozilla.com/D242100
This commit is contained in:
@@ -584,6 +584,16 @@ def write_mozbuild(
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
if (
|
||||
relsrcdir
|
||||
in write_mozbuild_variables["INCLUDE_SYSTEM_PIPEWIRE_HANDLING"]
|
||||
):
|
||||
mb.write('CXXFLAGS += CONFIG["MOZ_PIPEWIRE_CFLAGS"]\n')
|
||||
mb.write('if not CONFIG["MOZ_SYSTEM_PIPEWIRE"]:\n')
|
||||
mb.write(' LOCAL_INCLUDES += [ "/third_party/pipewire/" ]\n')
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
if (
|
||||
relsrcdir
|
||||
|
||||
@@ -20,11 +20,12 @@ def gen_wrappers(unused, outdir, *header_list):
|
||||
for header in header_list:
|
||||
with FileAvoidWrite(os.path.join(outdir, header)) as f:
|
||||
includes = include_next_template.format(header=header)
|
||||
if header == "wayland-util.h":
|
||||
# wayland-util.h in Wayland < 1.12 includes math.h inside an
|
||||
# extern "C" block, which breaks including the header from C++.
|
||||
# This was fixed in Wayland 1.12, but for versions earlier than
|
||||
# that, we work around that by force-including math.h first.
|
||||
if header == "wayland-util.h" or header == "pipewire/pipewire.h":
|
||||
# wayland-util.h in Wayland < 1.12 and pipewire.h > 1.4 include
|
||||
# math.h inside an extern "C" block, which breaks including the
|
||||
# header from C++. This was fixed in Wayland 1.12, but for versions
|
||||
# earlier than that, we work around that by force-including math.h
|
||||
# first.
|
||||
includes = "#include <math.h>\n" + includes
|
||||
elif header == "wayland-client.h":
|
||||
# The system wayland-client.h uses quote includes for
|
||||
|
||||
@@ -1267,6 +1267,11 @@ if CONFIG["MOZ_SYSTEM_LIBDRM"]:
|
||||
"xf86drm.h",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_SYSTEM_PIPEWIRE"]:
|
||||
system_headers += [
|
||||
"pipewire/pipewire.h",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_JACK"]:
|
||||
system_headers += [
|
||||
"jack/jack.h",
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
"third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
|
||||
"third_party/libwebrtc/modules/portal/portal_gn"
|
||||
],
|
||||
"INCLUDE_SYSTEM_PIPEWIRE_HANDLING": [
|
||||
"third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
|
||||
"third_party/libwebrtc/modules/portal/portal_gn",
|
||||
"third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn"
|
||||
],
|
||||
"INCLUDE_SYSTEM_DAV1D_HANDLING": [
|
||||
"third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_gn",
|
||||
"third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn"
|
||||
|
||||
10
third_party/pipewire/libpipewire/moz.build
vendored
10
third_party/pipewire/libpipewire/moz.build
vendored
@@ -4,13 +4,13 @@
|
||||
# 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/.
|
||||
|
||||
SOURCES += [
|
||||
'mozpipewire.cpp',
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
CXXFLAGS += CONFIG['MOZ_GTK3_CFLAGS']
|
||||
|
||||
LOCAL_INCLUDES += ['/third_party/pipewire']
|
||||
if CONFIG["MOZ_SYSTEM_PIPEWIRE"]:
|
||||
OS_LIBS += CONFIG["MOZ_PIPEWIRE_LIBS"]
|
||||
else:
|
||||
SOURCES += ['mozpipewire.cpp']
|
||||
LOCAL_INCLUDES += ['/third_party/pipewire']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
@@ -678,6 +678,24 @@ def v4l2(target, toolkit_gtk):
|
||||
set_config("MOZ_ENABLE_V4L2", True, when=v4l2)
|
||||
set_define("MOZ_ENABLE_V4L2", True, when=v4l2)
|
||||
|
||||
# System PipeWire support
|
||||
# =============================================================
|
||||
with only_when(compile_environment):
|
||||
system_lib_option(
|
||||
"--with-system-pipewire",
|
||||
nargs="?",
|
||||
help="Use system PipeWire",
|
||||
when=use_pkg_config,
|
||||
)
|
||||
|
||||
pipewire_headers = pkg_check_modules(
|
||||
"MOZ_PIPEWIRE",
|
||||
"libpipewire-0.3 libspa-0.2",
|
||||
when="--with-system-pipewire",
|
||||
)
|
||||
|
||||
set_config("MOZ_SYSTEM_PIPEWIRE", True, when="--with-system-pipewire")
|
||||
|
||||
# System gbm support (for screencast support using PipeWire)
|
||||
# =============================================================
|
||||
with only_when(compile_environment):
|
||||
|
||||
Reference in New Issue
Block a user