1 Support building with system media libraries.
2 See <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
5 https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-z-bug517422?revision=472833&view=markup
7 Changes to files within the bundled libraries are omitted, since those files
8 are removed from Guix sources. Modified for use with patch -p1, and to apply
11 --- icecat-60.2.0/build/moz.configure/old.configure
12 +++ icecat-60.2.0/build/moz.configure/old.configure
14 '--with-system-libvpx',
17 + '--with-system-ogg',
19 + '--with-system-soundtouch',
20 + '--with-system-theora',
21 + '--with-system-tremor',
22 + '--with-system-vorbis',
25 '--with-thumb-interwork',
26 --- icecat-60.2.0/config/external/moz.build
27 +++ icecat-60.2.0/config/external/moz.build
30 external_dirs += ['modules/xz-embedded']
32 -if CONFIG['MOZ_VORBIS']:
33 +if not CONFIG['MOZ_SYSTEM_OGG']:
34 + external_dirs += ['media/libogg']
36 +if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
37 external_dirs += ['media/libvorbis']
39 -if CONFIG['MOZ_TREMOR']:
40 +if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
41 external_dirs += ['media/libtremor']
43 +if not CONFIG['MOZ_SYSTEM_THEORA']:
44 + external_dirs += ['media/libtheora']
46 +if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
47 + external_dirs += ['media/libsoundtouch']
49 if CONFIG['MOZ_WEBM_ENCODER']:
50 external_dirs += ['media/libmkv']
59 'media/libspeex_resampler',
60 - 'media/libsoundtouch',
61 'media/mp4parse-rust',
64 --- icecat-60.2.0/config/system-headers.mozbuild
65 +++ icecat-60.2.0/config/system-headers.mozbuild
66 @@ -1324,6 +1324,28 @@
70 +if CONFIG['MOZ_SYSTEM_OGG']:
76 +if CONFIG['MOZ_SYSTEM_THEORA']:
78 + 'theora/theoradec.h',
81 +if CONFIG['MOZ_SYSTEM_VORBIS']:
84 + 'vorbis/vorbisenc.h',
87 +if CONFIG['MOZ_SYSTEM_TREMOR']:
89 + 'tremor/ivorbiscodec.h',
92 if CONFIG['MOZ_SYSTEM_LIBVPX']:
95 --- icecat-60.2.0/dom/media/AudioStream.cpp
96 +++ icecat-60.2.0/dom/media/AudioStream.cpp
98 : mMonitor("AudioStream")
101 +#ifndef MOZ_SYSTEM_SOUNDTOUCH
102 , mTimeStretcher(nullptr)
105 , mState(INITIALIZED)
106 , mDataSource(aSource)
111 +#ifndef MOZ_SYSTEM_SOUNDTOUCH
112 if (mTimeStretcher) {
113 soundtouch::destroySoundTouchObj(mTimeStretcher);
117 if (XRE_IsContentProcess()) {
118 audio::AudioNotificationReceiver::Unregister(this);
121 mMonitor.AssertCurrentThreadOwns();
122 if (!mTimeStretcher) {
123 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
124 + mTimeStretcher = new soundtouch::SoundTouch();
126 mTimeStretcher = soundtouch::createSoundTouchObj();
128 mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
129 mTimeStretcher->setChannels(mOutChannels);
130 mTimeStretcher->setPitch(1.0);
131 --- icecat-60.2.0/dom/media/AudioStream.h
132 +++ icecat-60.2.0/dom/media/AudioStream.h
134 #include "mozilla/TimeStamp.h"
135 #include "mozilla/UniquePtr.h"
136 #include "CubebUtils.h"
137 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
138 +#include "soundtouch/SoundTouch.h"
140 #include "soundtouch/SoundTouchFactory.h"
144 #include "mozilla/audio/AudioNotificationReceiver.h"
147 uint32_t mOutChannels;
148 AudioClock mAudioClock;
149 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
150 + nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
152 soundtouch::SoundTouch* mTimeStretcher;
155 // Output file for dumping audio
157 --- icecat-60.2.0/dom/media/moz.build
158 +++ icecat-60.2.0/dom/media/moz.build
161 DEFINES['MOZILLA_INTERNAL_API'] = True
163 +if CONFIG['MOZ_SYSTEM_OGG']:
164 + CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
166 +if CONFIG['MOZ_SYSTEM_THEORA']:
167 + CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
169 +if CONFIG['MOZ_SYSTEM_VORBIS']:
170 + CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
172 +if CONFIG['MOZ_SYSTEM_TREMOR']:
173 + CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
175 +if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
176 + CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
178 if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
179 DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True
181 --- icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
182 +++ icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
187 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
188 +#include "nsXPCOMPrivate.h" // for XUL_DLL
190 // We use a known symbol located in lgpllibs to determine its location.
191 // soundtouch happens to be always included in lgpllibs
192 #include "soundtouch/SoundTouch.h"
199 sLinkStatus = LinkStatus_FAILED;
201 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
202 + // We retrieve the path of the XUL library as this is where mozavcodec and
203 + // mozavutil libs are located.
205 + PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
207 // We retrieve the path of the lgpllibs library as this is where mozavcodec
208 // and mozavutil libs are located.
209 PathString lgpllibsname = GetLibraryName(nullptr, "lgpllibs");
212 GetLibraryFilePathname(lgpllibsname.get(),
213 (PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
215 if (path.IsEmpty()) {
218 --- icecat-60.2.0/old-configure.in
219 +++ icecat-60.2.0/old-configure.in
220 @@ -2451,6 +2451,111 @@
222 fi # COMPILE_ENVIRONMENT
224 +dnl ========================================================
225 +dnl Check for libogg
226 +dnl ========================================================
228 +MOZ_ARG_WITH_BOOL(system-ogg,
229 +[ --with-system-ogg Use system libogg (located with pkgconfig)],
233 +if test -n "$MOZ_SYSTEM_OGG"; then
234 + PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.3)
237 + LIBS="$LIBS $MOZ_OGG_LIBS"
238 + AC_CHECK_FUNC(ogg_set_mem_functions, [],
239 + [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
243 +AC_SUBST(MOZ_SYSTEM_OGG)
245 +dnl ========================================================
246 +dnl Check for libvorbis
247 +dnl ========================================================
249 +MOZ_ARG_WITH_BOOL(system-vorbis,
250 +[ --with-system-vorbis Use system libvorbis (located with pkgconfig)],
251 +MOZ_SYSTEM_VORBIS=1,
254 +if test -n "$MOZ_SYSTEM_VORBIS"; then
255 + PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.6)
258 +AC_SUBST(MOZ_SYSTEM_VORBIS)
260 +dnl ========================================================
261 +dnl Check for integer-only libvorbis aka tremor
262 +dnl ========================================================
264 +MOZ_ARG_WITH_BOOL(system-tremor,
265 +[ --with-system-tremor Use system libtremor (located with pkgconfig)],
266 +MOZ_SYSTEM_TREMOR=1,
269 +if test -n "$MOZ_SYSTEM_TREMOR"; then
270 + PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
273 +AC_SUBST(MOZ_SYSTEM_TREMOR)
275 +dnl ========================================================
276 +dnl Check for libtheora
277 +dnl ========================================================
279 +MOZ_ARG_WITH_BOOL(system-theora,
280 +[ --with-system-theora Use system libtheora (located with pkgconfig)],
281 +MOZ_SYSTEM_THEORA=1,
284 +if test -n "$MOZ_SYSTEM_THEORA"; then
285 + PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
288 +AC_SUBST(MOZ_SYSTEM_THEORA)
290 +dnl ========================================================
291 +dnl Check for libSoundTouch
292 +dnl ========================================================
294 +MOZ_ARG_WITH_BOOL(system-soundtouch,
295 +[ --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
296 +MOZ_SYSTEM_SOUNDTOUCH=1,
297 +MOZ_SYSTEM_SOUNDTOUCH=)
299 +if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
300 + PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
304 + _SAVE_CXXFLAGS=$CXXFLAGS
305 + CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
306 + AC_CACHE_CHECK(for soundtouch sample type,
307 + ac_cv_soundtouch_sample_type,
308 + [AC_TRY_COMPILE([#include <SoundTouch.h>
309 + #ifndef SOUNDTOUCH_INTEGER_SAMPLES
310 + #error soundtouch expects float samples
313 + [ac_cv_soundtouch_sample_type=short],
314 + [ac_cv_soundtouch_sample_type=float])])
315 + CXXFLAGS=$_SAVE_CXXFLAGS
318 + if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
319 + -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
320 + 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.])
324 +if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
325 + AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
327 +AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
329 dnl system libvpx Support
330 dnl ========================================================
331 MOZ_ARG_WITH_BOOL(system-libvpx,
332 --- icecat-60.2.0/toolkit/library/moz.build
333 +++ icecat-60.2.0/toolkit/library/moz.build
335 if CONFIG['MOZ_SYSTEM_HUNSPELL']:
336 OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
338 +if CONFIG['MOZ_SYSTEM_OGG']:
339 + OS_LIBS += CONFIG['MOZ_OGG_LIBS']
341 +if CONFIG['MOZ_SYSTEM_THEORA']:
342 + OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
344 +if CONFIG['MOZ_SYSTEM_VORBIS']:
345 + OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
347 +if CONFIG['MOZ_SYSTEM_TREMOR']:
348 + OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
350 +if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
351 + OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
353 if CONFIG['MOZ_SYSTEM_LIBEVENT']:
354 OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
356 --- icecat-60.2.0/xpcom/build/XPCOMInit.cpp
357 +++ icecat-60.2.0/xpcom/build/XPCOMInit.cpp
360 #include "mozilla/ipc/GeckoChildProcessHost.h"
362 +#ifndef MOZ_OGG_NO_MEM_REPORTING
365 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
366 #if defined(HAVE_STDINT_H)
367 // mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
368 @@ -639,11 +641,13 @@
370 mozilla::SetICUMemoryFunctions();
372 +#ifndef MOZ_OGG_NO_MEM_REPORTING
373 // Do the same for libogg.
374 ogg_set_mem_functions(OggReporter::CountingMalloc,
375 OggReporter::CountingCalloc,
376 OggReporter::CountingRealloc,
377 OggReporter::CountingFree);
380 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)