firefox/bmo-1559213-Support-system-...

92 lines
3.7 KiB
Diff

diff -up firefox-122.0/config/external/moz.build.system-av1 firefox-122.0/config/external/moz.build
--- firefox-122.0/config/external/moz.build.system-av1 2024-01-18 21:41:20.000000000 +0100
+++ firefox-122.0/config/external/moz.build 2024-01-19 18:27:03.512034790 +0100
@@ -40,8 +40,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
external_dirs += ["media/libvpx"]
if CONFIG["MOZ_AV1"]:
- external_dirs += ["media/libaom"]
- external_dirs += ["media/libdav1d"]
+ if not CONFIG["MOZ_SYSTEM_AV1"]:
+ external_dirs += ["media/libaom"]
+ external_dirs += ["media/libdav1d"]
if not CONFIG["MOZ_SYSTEM_PNG"]:
external_dirs += ["media/libpng"]
diff -up firefox-122.0/config/system-headers.mozbuild.system-av1 firefox-122.0/config/system-headers.mozbuild
--- firefox-122.0/config/system-headers.mozbuild.system-av1 2024-01-19 18:27:03.513034826 +0100
+++ firefox-122.0/config/system-headers.mozbuild 2024-01-19 19:02:54.515493457 +0100
@@ -1304,6 +1304,14 @@ if CONFIG["MOZ_ENABLE_LIBPROXY"]:
"proxy.h",
]
+if CONFIG['MOZ_SYSTEM_AV1']:
+ system_headers += [
+ 'aom/aom_decoder.h',
+ 'aom/aomdx.h',
+ 'aom/aom_image.h',
+ 'dav1d/dav1d.h',
+ ]
+
if CONFIG["MOZ_SYSTEM_ICU"]:
system_headers += [
"unicode/calendar.h",
diff -up firefox-122.0/dom/media/platforms/moz.build.system-av1 firefox-122.0/dom/media/platforms/moz.build
--- firefox-122.0/dom/media/platforms/moz.build.system-av1 2024-01-18 21:41:21.000000000 +0100
+++ firefox-122.0/dom/media/platforms/moz.build 2024-01-19 18:27:03.513034826 +0100
@@ -81,6 +81,11 @@ if CONFIG["MOZ_AV1"]:
"agnostic/AOMDecoder.cpp",
"agnostic/DAV1DDecoder.cpp",
]
+ if CONFIG["MOZ_SYSTEM_AV1"]:
+ CXXFLAGS += CONFIG["MOZ_SYSTEM_LIBAOM_CFLAGS"]
+ OS_LIBS += CONFIG["MOZ_SYSTEM_LIBAOM_LIBS"]
+ CXXFLAGS += CONFIG["MOZ_SYSTEM_LIBDAV1D_CFLAGS"]
+ OS_LIBS += CONFIG["MOZ_SYSTEM_LIBDAV1D_LIBS"]
if CONFIG["MOZ_OMX"]:
EXPORTS += [
diff -up firefox-122.0/toolkit/moz.configure.system-av1 firefox-122.0/toolkit/moz.configure
--- firefox-122.0/toolkit/moz.configure.system-av1 2024-01-19 18:27:03.495034173 +0100
+++ firefox-122.0/toolkit/moz.configure 2024-01-19 18:27:03.514034863 +0100
@@ -743,14 +743,29 @@ def av1(value):
if value:
return True
+option("--with-system-av1", help="Use system av1 (located with pkg-config)")
-@depends(target, when=av1 & compile_environment)
+system_libaom_info = pkg_check_modules('MOZ_SYSTEM_LIBAOM', 'aom >= 1.0.0',
+ when='--with-system-av1')
+
+system_libdav1d_info = pkg_check_modules('MOZ_SYSTEM_LIBDAV1D', 'dav1d >= 0.1.1',
+ when='--with-system-av1')
+
+@depends(system_libaom_info, system_libdav1d_info)
+def system_av1(system_libaom_info, system_libdav1d_info):
+ has_av1_libs = False
+ if system_libaom_info and system_libdav1d_info:
+ has_av1_libs = True
+ return has_av1_libs
+
+
+@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
def dav1d_asm(target):
if target.cpu in ("aarch64", "x86", "x86_64"):
return True
-@depends(target, when=av1 & compile_environment)
+@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
def dav1d_nasm(target):
if target.cpu in ("x86", "x86_64"):
return namespace(version="2.14", what="AV1")
@@ -760,6 +775,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
set_define("MOZ_DAV1D_ASM", dav1d_asm)
set_config("MOZ_AV1", av1)
set_define("MOZ_AV1", av1)
+set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
# JXL Image Codec Support
# ==============================================================