unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help needed adapting IceCat patches to 102
@ 2022-12-24  0:34 Adam Faiz
  2022-12-24 17:32 ` Adam Faiz
  0 siblings, 1 reply; 2+ messages in thread
From: Adam Faiz @ 2022-12-24  0:34 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

Hello everyone,

I don't know what I'm doing wrong with adding configure options, but 
icecat-102.6.0-guix0-preview1/moz.configure still doesn't recognise 
--with-system-ogg after applying the attached patches.
I think the problem is that it's not registering properly in 
toolkit/moz.configure or maybe also needs to be registered elsewhere.

The other --with-system options the patches aim to fix probably also 
don't work, because it fails with ogg first before the others when I 
added all the related --with-system ones to the #:configure-flags.

I've tried a few option registration variations found in 
icecat-102.6.0-guix0-preview1/moz.configure already, but it still fails.

It also doesn't help that the patches developing cycle is at least 20 
minutes long, to extract icecat and run the phases prior to configure. 
I'm not sure if it's faster on other machines, but I'm on a Thinkpad T410.

I'm hoping that once the options are recognised, building icecat will be 
smooth sailing. The adapted patches should be sent to the linked bug 
reports[1][2].

1: https://bugzilla.mozilla.org/show_bug.cgi?id=847568
2: https://bugzilla.mozilla.org/show_bug.cgi?id=517422

[-- Attachment #2: icecat-avoid-bundled-libraries.patch --]
[-- Type: text/x-patch, Size: 2066 bytes --]

From 557c2020d765c0802dd5fd55fe0742f61fb925a5 Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Wed, 21 Dec 2022 14:32:12 +0800
Subject: [PATCH 1/3] icecat-avoid-bundled-libraries

Fixes needed when avoiding bundled libraries.
---
 dom/indexedDB/moz.build                                    | 1 -
 storage/moz.build                                          | 1 -
 third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build | 2 --
 xpcom/build/moz.build                                      | 5 -----
 4 files changed, 9 deletions(-)

diff --git a/dom/indexedDB/moz.build b/dom/indexedDB/moz.build
index 9282d91a..500366ed 100644
--- a/dom/indexedDB/moz.build
+++ b/dom/indexedDB/moz.build
@@ -116,7 +116,6 @@ LOCAL_INCLUDES += [
     "/dom/base",
     "/dom/storage",
     "/ipc/glue",
-    "/third_party/sqlite3/src",
     "/xpcom/build",
 ]
 
diff --git a/storage/moz.build b/storage/moz.build
index 3bc84420..7ce5ca26 100644
--- a/storage/moz.build
+++ b/storage/moz.build
@@ -101,7 +101,6 @@ DEFINES["SQLITE_MAX_LIKE_PATTERN_LENGTH"] = 50000
 
 LOCAL_INCLUDES += [
     "/dom/base",
-    "/third_party/sqlite3/src",
 ]
 
 CXXFLAGS += CONFIG["SQLITE_CFLAGS"]
diff --git a/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build b/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build
index 7ddc659b..0dfa27fb 100644
--- a/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build
+++ b/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build
@@ -22,8 +22,6 @@ FINAL_LIBRARY = "webrtc"
 LOCAL_INCLUDES += [
     "!/ipc/ipdl/_ipdlheaders",
     "/ipc/chromium/src",
-    "/third_party/libwebrtc/",
-    "/third_party/libwebrtc/third_party/abseil-cpp/",
     "/tools/profiler/public"
 ]
 
diff --git a/xpcom/build/moz.build b/xpcom/build/moz.build
index d86af97c..46de45da 100755
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -100,8 +100,3 @@ LOCAL_INCLUDES += [
     "/docshell/base",
     "/js/xpconnect/loader",
 ]
-
-if CONFIG["MOZ_VPX"]:
-    LOCAL_INCLUDES += [
-        "/media/libvpx",
-    ]
-- 
2.38.1


[-- Attachment #3: icecat-use-system-graphite2+harfbuzz.patch --]
[-- Type: text/x-patch, Size: 9650 bytes --]

From 8e64027b6b188d4c016fc8ca427965d1a2560687 Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Wed, 21 Dec 2022 14:37:57 +0800
Subject: [PATCH 2/3] icecat-use-system-graphite2+harfbuzz

Allow building against system-wide graphite2/harfbuzz.
See <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
Based on:
  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-bug847568?revision=472833&view=co
Modified for use with patch -p1, and to apply cleanly to GNU IceCat.
---
 config/system-headers.mozbuild  | 13 +++++++++++++
 dom/base/moz.build              |  3 +++
 gfx/graphite2/moz-gr-update.sh  |  7 ++++++-
 gfx/moz.build                   |  8 ++++++--
 gfx/skia/generate_mozbuild.py   |  3 +++
 gfx/skia/moz.build              |  3 +++
 gfx/thebes/moz.build            |  8 +++++++-
 intl/unicharutil/util/moz.build |  3 +++
 netwerk/dns/moz.build           |  3 +++
 old-configure.in                | 21 +++++++++++++++++++++
 toolkit/library/moz.build       |  6 ++++++
 toolkit/moz.configure           | 28 ++++++++++++++++++++++++++++
 12 files changed, 102 insertions(+), 4 deletions(-)

diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index 9c07dba2..5594d659 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1293,6 +1293,19 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
         'proxy.h',
     ]
 
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    system_headers += [
+        'graphite2/Font.h',
+        'graphite2/Segment.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    system_headers += [
+        'harfbuzz/hb-glib.h',
+        'harfbuzz/hb-ot.h',
+        'harfbuzz/hb.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     system_headers += [
         'vpx_mem/vpx_mem.h',
diff --git a/dom/base/moz.build b/dom/base/moz.build
index 229e06a5..64961efc 100644
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -577,6 +577,9 @@ FINAL_LIBRARY = "xul"
 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
     CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 GeneratedFile(
     "UseCounterList.h",
     script="gen-usecounters.py",
diff --git a/gfx/graphite2/moz-gr-update.sh b/gfx/graphite2/moz-gr-update.sh
index b91d9c16..a97e6eb2 100755
--- a/gfx/graphite2/moz-gr-update.sh
+++ b/gfx/graphite2/moz-gr-update.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 # Script used to update the Graphite2 library in the mozilla source tree
+# and bump version for --with-system-graphite2
 
 # This script lives in gfx/graphite2, along with the library source,
 # but must be run from the top level of the mozilla-central tree.
@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
 #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
 #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
 
+# chase version for --with-system-graphite2
+perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
+  if /GR2_VERSION_REQUIRE/" old-configure.in
+
 # summarize what's been touched
 echo Updated to $RELEASE.
 echo Here is what changed in the gfx/graphite2 directory:
 echo
 
-hg stat gfx/graphite2
+hg stat old-configure.in gfx/graphite2
 
 echo
 echo If gfx/graphite2/src/files.mk has changed, please make corresponding
diff --git a/gfx/moz.build b/gfx/moz.build
index 4d6d63da..41017975 100644
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -19,8 +19,6 @@ DIRS += [
     "qcms",
     "gl",
     "layers",
-    "graphite2/src",
-    "harfbuzz/src",
     "ots/src",
     "thebes",
     "ipc",
@@ -34,6 +32,12 @@ DIRS += [
 if CONFIG["ENABLE_TESTS"]:
     DIRS += ["tests/gtest"]
 
+if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    DIRS += ['graphite2/src' ]
+
+if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    DIRS += ['harfbuzz/src']
+
 TEST_DIRS += ["tests"]
 
 SPHINX_TREES["/gfx"] = "docs"
diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
index 5e0fd17d..860b80af 100755
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
         '-Wno-unused-private-field',
     ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
     LOCAL_INCLUDES += [
         "/gfx/cairo/cairo/src",
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
index 524bd28d..615c93b2 100755
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -488,6 +488,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
         '-Wno-unused-private-field',
     ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
     LOCAL_INCLUDES += [
         "/gfx/cairo/cairo/src",
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
index 248aa36b..83233c10 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -284,7 +284,13 @@ if CONFIG["MOZ_WAYLAND"]:
 
 LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
 
-DEFINES["GRAPHITE2_STATIC"] = True
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+else:
+    DEFINES['GRAPHITE2_STATIC'] = True
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
 
 if CONFIG["CC_TYPE"] in ("clang", "clang-cl"):
     # Suppress warnings from Skia header files.
diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build
index b5292072..c19632eb 100644
--- a/intl/unicharutil/util/moz.build
+++ b/intl/unicharutil/util/moz.build
@@ -34,6 +34,9 @@ GeneratedFile(
 
 GeneratedFile("IsCombiningDiacritic.h", script="is_combining_diacritic.py", force=True)
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 FINAL_LIBRARY = "xul"
 
 REQUIRES_UNIFIED_BUILD = True
diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build
index 5d81059e..746d69d1 100644
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -96,6 +96,9 @@ IPDL_SOURCES = [
 
 include("/ipc/chromium/chromium-config.mozbuild")
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 FINAL_LIBRARY = "xul"
 
 GeneratedFile(
diff --git a/old-configure.in b/old-configure.in
index ab6f435b..46723226 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -1136,6 +1136,27 @@ dnl ========================================================
 
 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
 
+dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
+    dnl graphite2.pc has bogus version, check manually
+    _SAVE_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
+    AC_TRY_COMPILE([ #include <graphite2/Font.h>
+                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
+                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+                               * 100 + GR2_VERSION_BUGFIX >= \
+                               (major) * 10000 + (minor) * 100 + (bugfix) )
+                   ], [
+                     #if !GR2_VERSION_REQUIRE(1,3,10)
+                     #error "Insufficient graphite2 version."
+                     #endif
+                   ], [],
+                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+    CFLAGS=$_SAVE_CFLAGS
+fi
+
 dnl ========================================================
 dnl Check for cairo
 dnl ========================================================
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index 51af6bcd..3e46b99e 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -297,6 +297,12 @@ if CONFIG["MOZ_SYSTEM_JPEG"]:
 if CONFIG["MOZ_SYSTEM_PNG"]:
     OS_LIBS += CONFIG["MOZ_PNG_LIBS"]
 
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+    OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
+
 if CONFIG["MOZ_SYSTEM_WEBP"]:
     OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
 
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index cc6e3c3f..f376fc95 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -568,6 +568,34 @@ def fc_freetype(value, toolkit):
 add_old_configure_assignment("USE_FC_FREETYPE", fc_freetype)
 set_define("USE_FC_FREETYPE", fc_freetype)
 
+# Graphite2
+# ==============================================================
+option('--with-system-graphite2',
+       help="Use system graphite2 (located with pkgconfig)")
+
+@depends("--with-system-graphite2")
+def graphite2(value):
+    return bool(value)
+
+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
+                                     when=graphite2)
+
+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
+
+# HarfBuzz
+# ==============================================================
+option('--with-system-harfbuzz',
+       help="Use system harfbuzz (located with pkgconfig)")
+
+@depends("--with-system-harfbuzz")
+def harfbuzz(value):
+    return bool(value)
+
+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.7.4',
+                                    when=harfbuzz)
+
+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
+
 # Pango
 # ==============================================================
 pkg_check_modules("MOZ_PANGO", "pango >= 1.22.0", when=toolkit_gtk)
-- 
2.38.1


[-- Attachment #4: icecat-use-system-media-libs.patch --]
[-- Type: text/x-patch, Size: 14845 bytes --]

From 3d1fb92793c773ef2a7abe17347473905e5caab9 Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Wed, 21 Dec 2022 16:21:46 +0800
Subject: [PATCH 3/3] icecat-use-system-media-libs

Support building with system media libraries.
See <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>

Based on:
  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-z-bug517422?revision=472833&view=markup

Changes to files within the bundled libraries are omitted, since those files
are removed from Guix sources.  Modified for use with patch -p1, and to apply
cleanly to GNU IceCat.
---
 build/moz.configure/old.configure |   5 ++
 config/external/moz.build         |  18 +++--
 config/system-headers.mozbuild    |  22 +++++++
 dom/media/AudioStream.cpp         |  14 +++-
 dom/media/AudioStream.h           |   4 ++
 dom/media/moz.build               |  15 +++++
 old-configure.in                  | 105 ++++++++++++++++++++++++++++++
 toolkit/library/moz.build         |  15 +++++
 toolkit/moz.configure             |  68 +++++++++++++++++++
 xpcom/build/XPCOMInit.cpp         |   4 ++
 10 files changed, 261 insertions(+), 9 deletions(-)

diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
index dc0880e3..dbe00432 100644
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -95,6 +95,11 @@ def old_configure_options(*options):
     "--libdir",
     "--prefix",
     "--with-branding",
+    "--with-system-ogg",
+    "--with-system-soundtouch",
+    "--with-system-theora",
+    "--with-system-tremor",
+    "--with-system-vorbis",
     "--with-distribution-id",
     "--with-macbundlename-prefix",
     "--x-includes",
diff --git a/config/external/moz.build b/config/external/moz.build
index 7239fc6c..c1e2bdef 100644
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -36,11 +36,20 @@ external_dirs += ["modules/woff2"]
 
 external_dirs += ["modules/xz-embedded"]
 
-if CONFIG["MOZ_VORBIS"]:
+if not CONFIG['MOZ_SYSTEM_OGG']:
+    external_dirs += ['media/libogg']
+
+if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
     external_dirs += ["media/libvorbis"]
 
-if CONFIG["MOZ_TREMOR"]:
-    external_dirs += ["media/libtremor"]
+if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
+     external_dirs += ['media/libtremor']
+
+if not CONFIG['MOZ_SYSTEM_THEORA']:
+    external_dirs += ['media/libtheora']
+
+if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    external_dirs += ['media/libsoundtouch']
 
 if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
     external_dirs += ["media/libvpx"]
@@ -69,11 +78,8 @@ external_dirs += [
     "media/libcubeb",
     "media/libmkv",
     "media/libnestegg",
-    "media/libogg",
     "media/libopus",
-    "media/libtheora",
     "media/libspeex_resampler",
-    "media/libsoundtouch",
     "media/mp4parse-rust",
     "media/psshparser",
 ]
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index 5594d659..3336216f 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1306,6 +1306,28 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
         'harfbuzz/hb.h',
     ]
 
+if CONFIG['MOZ_SYSTEM_OGG']:
+    system_headers += [
+        'ogg/ogg.h',
+        'ogg/os_types.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    system_headers += [
+        'theora/theoradec.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    system_headers += [
+        'vorbis/codec.h',
+        'vorbis/vorbisenc.h',
+    ]
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    system_headers += [
+        'tremor/ivorbiscodec.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     system_headers += [
         'vpx_mem/vpx_mem.h',
diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp
index e6c83328..a89e38bf 100644
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -137,11 +137,14 @@ class FrameHistory {
 AudioStream::AudioStream(DataSource& aSource, uint32_t aInRate,
                          uint32_t aOutputChannels,
                          AudioConfig::ChannelLayout::ChannelMap aChannelMap)
-    : mTimeStretcher(nullptr),
-      mAudioClock(aInRate),
+
+    : mAudioClock(aInRate),
       mChannelMap(aChannelMap),
       mMonitor("AudioStream"),
       mOutChannels(aOutputChannels),
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
+      mTimeStretcher(nullptr),
+#endif
       mState(INITIALIZED),
       mDataSource(aSource),
       mAudioThreadId(ProfilerThreadId{}),
@@ -170,7 +173,11 @@ size_t AudioStream::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
 nsresult AudioStream::EnsureTimeStretcherInitialized() {
   AssertIsOnAudioThread();
   if (!mTimeStretcher) {
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+    mTimeStretcher = new soundtouch::SoundTouch();
+#else
     mTimeStretcher = soundtouch::createSoundTouchObj();
+#endif
     mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
     mTimeStretcher->setChannels(mOutChannels);
     mTimeStretcher->setPitch(1.0);
@@ -410,11 +417,12 @@ Maybe<MozPromiseHolder<MediaSink::EndedPromise>> AudioStream::Shutdown(
 
   // After `cubeb_stream_stop` has been called, there is no audio thread
   // anymore. We can delete the time stretcher.
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
   if (mTimeStretcher) {
     soundtouch::destroySoundTouchObj(mTimeStretcher);
     mTimeStretcher = nullptr;
   }
-
+#endif
   mState = SHUTDOWN;
   // When shutting down, if this AudioStream is shutting down because the
   // HTMLMediaElement is now muted, hand back the ended promise, so that it can
diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h
index 86975c6a..394a26c9 100644
--- a/dom/media/AudioStream.h
+++ b/dom/media/AudioStream.h
@@ -342,7 +342,11 @@ class AudioStream final {
   bool CheckThreadIdChanged();
   void AssertIsOnAudioThread() const;
 
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+  nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
+#else
   soundtouch::SoundTouch* mTimeStretcher;
+#endif
 
   AudioClock mAudioClock;
 
diff --git a/dom/media/moz.build b/dom/media/moz.build
index aab6f2d3..ded9d0a7 100644
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -56,6 +56,21 @@ DIRS += [
     "webvtt",
 ]
 
+if CONFIG['MOZ_SYSTEM_OGG']:
+    CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
+
 if CONFIG["MOZ_ANDROID_HLS_SUPPORT"]:
     DIRS += ["hls"]
 
diff --git a/old-configure.in b/old-configure.in
index 46723226..2af3d0c1 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -63,6 +63,111 @@ if test "$COMPILE_ENVIRONMENT"; then
     MOZ_ANDROID_NDK
 fi # COMPILE_ENVIRONMENT
 
+dnl ========================================================
+dnl Check for libogg
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-ogg,
+[  --with-system-ogg       Use system libogg (located with pkgconfig)],
+MOZ_SYSTEM_OGG=1,
+MOZ_SYSTEM_OGG=)
+
+if test -n "$MOZ_SYSTEM_OGG"; then
+    PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.3)
+
+    _SAVE_LIBS=$LIBS
+    LIBS="$LIBS $MOZ_OGG_LIBS"
+    AC_CHECK_FUNC(ogg_set_mem_functions, [],
+      [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
+    LIBS=$_SAVE_LIBS
+fi
+
+AC_SUBST(MOZ_SYSTEM_OGG)
+
+dnl ========================================================
+dnl Check for libvorbis
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-vorbis,
+[  --with-system-vorbis    Use system libvorbis (located with pkgconfig)],
+MOZ_SYSTEM_VORBIS=1,
+MOZ_SYSTEM_VORBIS=)
+
+if test -n "$MOZ_SYSTEM_VORBIS"; then
+    PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.6)
+fi
+
+AC_SUBST(MOZ_SYSTEM_VORBIS)
+
+dnl ========================================================
+dnl Check for integer-only libvorbis aka tremor
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-tremor,
+[  --with-system-tremor    Use system libtremor (located with pkgconfig)],
+MOZ_SYSTEM_TREMOR=1,
+MOZ_SYSTEM_TREMOR=)
+
+if test -n "$MOZ_SYSTEM_TREMOR"; then
+    PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
+fi
+
+AC_SUBST(MOZ_SYSTEM_TREMOR)
+
+dnl ========================================================
+dnl Check for libtheora
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-theora,
+[  --with-system-theora    Use system libtheora (located with pkgconfig)],
+MOZ_SYSTEM_THEORA=1,
+MOZ_SYSTEM_THEORA=)
+
+if test -n "$MOZ_SYSTEM_THEORA"; then
+    PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
+fi
+
+AC_SUBST(MOZ_SYSTEM_THEORA)
+
+dnl ========================================================
+dnl Check for libSoundTouch
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-soundtouch,
+[  --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
+MOZ_SYSTEM_SOUNDTOUCH=1,
+MOZ_SYSTEM_SOUNDTOUCH=)
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+    PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
+
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    _SAVE_CXXFLAGS=$CXXFLAGS
+    CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
+    AC_CACHE_CHECK(for soundtouch sample type,
+                   ac_cv_soundtouch_sample_type,
+                   [AC_TRY_COMPILE([#include <SoundTouch.h>
+                                    #ifndef SOUNDTOUCH_INTEGER_SAMPLES
+                                    #error soundtouch expects float samples
+                                    #endif],
+                                   [],
+                                   [ac_cv_soundtouch_sample_type=short],
+                                   [ac_cv_soundtouch_sample_type=float])])
+    CXXFLAGS=$_SAVE_CXXFLAGS
+    AC_LANG_RESTORE
+
+    if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
+         -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
+        AC_MSG_ERROR([SoundTouch library is built with incompatible sample type. Either rebuild the library with/without --enable-integer-samples, chase default Mozilla sample type or remove --with-system-soundtouch.])
+    fi
+fi
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+    AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
+fi
+AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
+
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index 3e46b99e..545cf23c 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -306,6 +306,21 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
 if CONFIG["MOZ_SYSTEM_WEBP"]:
     OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
 
+if CONFIG['MOZ_SYSTEM_OGG']:
+    OS_LIBS += CONFIG['MOZ_OGG_LIBS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+    OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+    OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+    OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+    OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
+
 if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
     OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
 
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index f376fc95..06e00959 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -596,6 +596,74 @@ system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.7.4',
 
 set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
 
+# Ogg
+# ==============================================================
+system_lib_option(
+    "--with-system-ogg", help="Use system libogg (located with pkgconfig)"
+)
+
+system_ogg = pkg_check_modules(
+    "MOZ_OGG", "ogg >= 1.3.3", when="--with-system-ogg"
+)
+
+set_config("MOZ_SYSTEM_OGG", depends(when=system_ogg)(lambda: True))
+
+# Vorbis
+# ==============================================================
+option('--with-system-vorbis',
+       help="Use system libvorbis (located with pkgconfig)")
+
+@depends("--with-system-vorbis")
+def vorbis(value):
+    return bool(value)
+
+system_vorbis = pkg_check_modules('MOZ_VORBIS', 'vorbis vorbisenc >= 1.3.6',
+                                     when=vorbis)
+
+set_config('MOZ_SYSTEM_VORBIS', depends_if(system_vorbis)(lambda _: True))
+
+# Tremor
+# ==============================================================
+option('--with-system-tremor',
+       help="Use system libtremor (located with pkgconfig)")
+
+@depends("--with-system-tremor")
+def tremor(value):
+    return bool(value)
+
+system_tremor = pkg_check_modules('MOZ_TREMOR', 'vorbisidec >= 1.2.1',
+                                     when=tremor)
+
+set_config('MOZ_SYSTEM_TREMOR', depends_if(system_tremor)(lambda _: True))
+
+# Theora
+# ==============================================================
+option('--with-system-theora',
+       help="Use system libtheora (located with pkgconfig)")
+
+@depends("--with-system-theora")
+def theora(value):
+    return bool(value)
+
+system_theora = pkg_check_modules('MOZ_THEORA', 'theora >= 1.2',
+                                     when=theora)
+
+set_config('MOZ_SYSTEM_THEORA', depends_if(system_theora)(lambda _: True))
+
+# SoundTouch
+# ==============================================================
+option('--with-system-soundtouch',
+       help="Use system libSoundTouch (located with pkgconfig)")
+
+@depends("--with-system-soundtouch")
+def soundtouch(value):
+    return bool(value)
+
+system_soundtouch = pkg_check_modules('MOZ_SOUNDTOUCH', 'soundtouch >= 1.9.0',
+                                      when=soundtouch)
+
+set_config('MOZ_SYSTEM_SOUNDTOUCH', depends_if(system_soundtouch)(lambda _: True))
+
 # Pango
 # ==============================================================
 pkg_check_modules("MOZ_PANGO", "pango >= 1.22.0", when=toolkit_gtk)
diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp
index d13ea35e..8dad5f1a 100644
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -93,7 +93,9 @@
 
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 
+#ifndef MOZ_OGG_NO_MEM_REPORTING
 #include "ogg/ogg.h"
+#endif
 
 #include "GeckoProfiler.h"
 #include "ProfilerControl.h"
@@ -441,10 +443,12 @@ NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
   // this oddness.
   mozilla::SetICUMemoryFunctions();
 
+#ifndef MOZ_OGG_NO_MEM_REPORTING
   // Do the same for libogg.
   ogg_set_mem_functions(
       OggReporter::CountingMalloc, OggReporter::CountingCalloc,
       OggReporter::CountingRealloc, OggReporter::CountingFree);
+#endif
 
   // Initialize the JS engine.
   InitializeJS();
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Help needed adapting IceCat patches to 102
  2022-12-24  0:34 Help needed adapting IceCat patches to 102 Adam Faiz
@ 2022-12-24 17:32 ` Adam Faiz
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Faiz @ 2022-12-24 17:32 UTC (permalink / raw)
  To: guix-devel

On 12/24/22 08:34, Adam Faiz wrote:
Gentoo's patches should be tested, I don't have the time but maybe 
someone else can do it.

The relevant patches can be found in Gentoo's 102esr-patches-07j.tar.xz:
Support-system-graphite2.patch
Support-system-harfbuzz.patch
Support-system-av1.patch
fix-av1-libs.patch

The patented H264 format absolutely shouldn't be encouraged, so the 
OpenH264 patches are probably not necessary.

Other Gentoo patches that might be of interest are the following:
fix-build-on-x86.patch

There may be other patches that should be considered in a separate issue.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-24 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-24  0:34 Help needed adapting IceCat patches to 102 Adam Faiz
2022-12-24 17:32 ` Adam Faiz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).