1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= rustless-firefox
8 SDESC[standard]= Legacy web browser built without Rust compiler
9 HOMEPAGE= https://www.mozilla.org/en-US/firefox/organizations/
13 SITES[main]= https://archive.mozilla.org/pub/firefox/releases/52.7.3esr/source/
14 DISTFILE[1]= firefox-52.7.3esr.source.tar.xz:main
16 SPKGS[standard]= single
18 OPTIONS_AVAILABLE= DBUS
19 OPTIONS_STANDARD= DBUS
22 BUILD_DEPENDS= python-sqlite3:single:py27
23 video4linux:headers:standard
24 autoconf213:single:standard
28 BUILDRUN_DEPENDS= nss:primary:standard
29 libevent:single:standard
30 harfbuzz:primary:standard
31 libvorbis:primary:standard
32 libogg:primary:standard
33 libvpx:single:standard
34 libffi:single:standard
35 sqlite:single:standard
36 video4linux:primary:standard
37 hunspell:single:standard
40 ffmpeg:primary:standard
42 USES= cpe gmake jpeg png pkgconfig zlib perl:build
43 python:py27,build desktop-utils:single
44 GNOME_COMPONENTS= gdkpixbuf gtk2 gtk3 gconf
45 XORG_COMPONENTS= xcb pixman
47 DISTNAME= firefox-52.7.3esr
52 CONFIGURE_OUTSOURCE= yes
54 SUB_FILES= firefox.desktop
57 SUB_LIST= FIREFOX_ICON=firefox.png
59 MOZILLA_BIN=firefox-bin
61 MOZDIR={{PREFIX}}/lib/firefox
63 QMAKE_ARGS= --prefix={{PREFIX:Q}}
71 --disable-debug-symbols
78 --enable-system-hunspell
79 --enable-system-pixman
80 --enable-system-sqlite
81 --with-system-libevent
82 --with-system-harfbuzz
83 --with-system-graphite2
92 --with-system-jpeg={{LOCALBASE}}
93 --with-system-png={{LOCALBASE}}
97 --enable-chrome-format=omni
98 --enable-default-toolkit=cairo-gtk3
99 --enable-update-channel=esr
104 --enable-install-strip
105 --enable-application=browser
106 --enable-official-branding
107 VAR_OPSYS[freebsd]= CONFIGURE_ARGS=--enable-jemalloc=4
109 [DBUS].DESCRIPTION= D-Bus IPC system support
110 [DBUS].BUILDRUN_DEPENDS_ON= dbus:single:standard
111 dbus-glib:primary:standard
112 startup-notification:single:standard
113 libnotify:primary:standard
114 [DBUS].QMAKE_ARGS_OFF= --disable-dbus
115 [DBUS].QMAKE_ARGS_ON= --enable-startup-notification
118 ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
119 ${WRKSRC}/browser/app/nsBrowserApp.cpp
120 ${REINPLACE_CMD} -e 's|%%MOZILLA%%|firefox|g' \
121 ${WRKSRC}/config/baseconfig.mk; \
122 ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g ; \
123 s|%%LOCALBASE%%|${LOCALBASE}|g' \
124 ${WRKSRC}/build/unix/run-mozilla.sh
125 ${REINPLACE_CMD} -e 's|/usr/local/netscape|${LOCALBASE}|g ; \
126 s|/usr/local/lib/netscape|${LOCALBASE}/lib|g' \
127 ${WRKSRC}/xpcom/io/SpecialSystemDirectory.cpp
128 ${REINPLACE_CMD} -e 's|/etc|${PREFIX}&|g' \
129 ${WRKSRC}/xpcom/build/nsXPCOMPrivate.h
130 ${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
131 -e 's|mozilla/plugins|browser_plugins|g' \
132 -e 's|share/mozilla/extensions|lib/xpi|g' \
133 ${WRKSRC}/xpcom/io/nsAppFileLocationProvider.cpp \
134 ${WRKSRC}/toolkit/xre/nsXREDirProvider.cpp
135 ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
136 ${WRKSRC}/extensions/spellcheck/hunspell/*/mozHunspell.cpp
137 ${REINPLACE_CMD} -Ee 's|-lc_r|-pthread|g ; \
138 s|-l?pthread|-pthread|g ; \
139 s|echo aout|echo elf|g ; \
140 s|/usr/X11R6|${LOCALBASE}|g' \
141 ${WRKSRC}/js/src/Makefile.in \
142 ${WRKSRC}/js/src/configure \
144 ${REINPLACE_CMD} -Ee '/^MOZ_FIX_LINK_PATHS=/ s|"|"-Wl,-rpath,${PREFIX}/lib/firefox |' \
145 ${WRKSRC}/js/src/old-configure.in \
146 ${WRKSRC}/old-configure.in
148 for arg in ${QMAKE_ARGS} ; do \
149 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ; \
151 ${ECHO_CMD} mk_add_options MOZ_OBJDIR="${BUILD_WRKSRC}" \
152 >> ${WRKSRC}/.mozconfig
153 ${ECHO_CMD} export MOZ_OPTIMIZE_FLAGS="-O${OPTIMIZER_LEVEL}" \
154 >> ${WRKSRC}/.mozconfig
155 ${ECHO_CMD} export PERL="${PERL}" >> ${WRKSRC}/.mozconfig
158 @${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps \
159 ${STAGEDIR}${PREFIX}/share/applications
160 ${INSTALL_DATA} ${WRKDIR}/firefox.desktop \
161 ${STAGEDIR}${PREFIX}/share/applications/
162 ${LN} -sf ${PREFIX}/lib/firefox/browser/chrome/icons/default/default48.png \
163 ${STAGEDIR}${PREFIX}/share/pixmaps/firefox.png
166 (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
167 (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
170 ${ECHO_CMD} export MOZ_JEMALLOC4=1 >> ${WRKSRC}/.mozconfig
171 # API keys from www/chromium
172 # http://www.chromium.org/developers/how-tos/api-keys
173 # Note: these are for FreeBSD use ONLY. For another distribution,
174 # please obtain its key instead.
175 ${ECHO_CMD} export MOZ_GOOGLE_API_KEY=AIzaSyBsp9n41JLW8jCokwn7vhoaMejDFRd1mp8 \
176 >> ${WRKSRC}/.mozconfig
178 [FILE:396:descriptions/desc.single]
179 Mozilla Firefox 52 is a fast, secure and easy to use web browser. It
180 offers many advantages over other web browsers. This award-winning, open
181 source web browser is packed with advanced security features designed to
182 help you stay safe, and in control, online.
184 This is a legacy version with lots of active vulnerabilities.
185 It is the last Firefox that does not require a rust compiler to build.
189 5cc68c1a7486cfbbf02aec0e9da9f87b55e7bfc68c7d5139bc1e578441aaf19f 213945524 firefox-52.7.3esr.source.tar.xz
192 [FILE:896:manifests/plist.single]
214 lib/firefox/browser/chrome/icons/default/
218 lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
219 lib/firefox/browser/features/
220 aushelper@mozilla.org.xpi
221 e10srollout@mozilla.org.xpi
222 firefox@getpocket.com.xpi
223 webcompat@mozilla.org.xpi
224 lib/firefox/browser/icons/mozicon128.png
225 lib/firefox/defaults/pref/channel-prefs.js
226 lib/firefox/dictionaries/
229 lib/firefox/gmp-clearkey/0.1/
232 lib/firefox/gtk2/libmozgtk.so
233 share/applications/firefox.desktop
234 share/pixmaps/firefox.png
237 [FILE:445:patches/patch-browser-app-nsBrowserApp.cpp]
238 --- browser/app/nsBrowserApp.cpp.orig 2016-09-19 16:19:28 UTC
239 +++ browser/app/nsBrowserApp.cpp
240 @@ -324,6 +324,9 @@ int main(int argc, char* argv[], char* e
242 mozilla::TimeStamp start = mozilla::TimeStamp::Now();
244 + setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
245 + setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
247 #ifdef HAS_DLL_BLOCKLIST
248 DllBlocklist_Initialize();
252 [FILE:35310:patches/patch-bug1021761]
253 diff --git build/moz.configure/old.configure build/moz.configure/old.configure
254 index b95dd2b..4cbefd5 100644
255 --- build/moz.configure/old.configure
256 +++ build/moz.configure/old.configure
257 @@ -305,6 +305,7 @@ def old_configure_options(*options):
258 '--with-nspr-prefix',
259 '--with-nss-exec-prefix',
265 diff --git old-configure.in configure.in
266 index 48e60c0..ec08417 100644
269 @@ -5591,6 +5591,67 @@ fi
270 AC_SUBST(MOZ_WEBM_ENCODER)
272 dnl ==================================
273 +dnl = Check OSS availability
274 +dnl ==================================
276 +dnl If using Linux, Solaris or BSDs, ensure that OSS is available
277 +case "$OS_TARGET" in
278 +Linux|SunOS|DragonFly|FreeBSD|NetBSD|GNU/kFreeBSD)
283 +MOZ_ARG_WITH_STRING(oss,
284 +[ --with-oss[=PFX] Enable OpenSoundSystem support [installed at prefix PFX]],
285 + OSSPREFIX=$withval)
287 +if test -n "$OSSPREFIX"; then
288 + if test "$OSSPREFIX" != "no"; then
295 +_SAVE_CFLAGS=$CFLAGS
297 +if test -n "$MOZ_OSS"; then
298 + dnl Prefer 4Front implementation
299 + AC_MSG_CHECKING([MOZ_OSS_CFLAGS])
300 + if test "$OSSPREFIX" != "yes"; then
301 + oss_conf=${OSSPREFIX%/usr}/etc/oss.conf
302 + if test -f "$oss_conf"; then
305 + OSSLIBDIR=$OSSPREFIX/lib/oss
307 + if test -d "$OSSLIBDIR"; then
308 + MOZ_OSS_CFLAGS="$MOZ_OSS_CFLAGS -I$OSSLIBDIR/include"
311 + AC_MSG_RESULT([$MOZ_OSS_CFLAGS])
313 + CFLAGS="$CFLAGS $MOZ_OSS_CFLAGS"
314 + MOZ_CHECK_HEADERS(sys/soundcard.h soundcard.h)
316 + if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
317 + "$ac_cv_header_soundcard_h" != "yes"; then
318 + AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET. Disable with --without-oss.])
321 + dnl Assume NetBSD implementation over SunAudio
322 + AC_CHECK_LIB(ossaudio, _oss_ioctl,
323 + [AC_DEFINE_UNQUOTED(CUBEB_OSS_DEFAULT_OUTPUT, "/dev/sound")
324 + MOZ_OSS_LIBS="$MOZ_OSS_LIBS -lossaudio"])
326 +CFLAGS=$_SAVE_CFLAGS
330 +AC_SUBST_LIST(MOZ_OSS_CFLAGS)
331 +AC_SUBST_LIST(MOZ_OSS_LIBS)
333 +dnl ==================================
334 dnl = Check alsa availability on Linux
335 dnl ==================================
337 diff --git media/libcubeb/AUTHORS media/libcubeb/AUTHORS
338 index b441e8a..950d9e5 100644
339 --- media/libcubeb/AUTHORS
340 +++ media/libcubeb/AUTHORS
341 @@ -4,3 +4,4 @@ Michael Wu <mwu@mozilla.com>
342 Paul Adenot <paul@paul.cx>
343 David Richards <drichards@mozilla.com>
344 Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
345 +Evgeniy Vodolazskiy <waterlaz@gmail.com>
346 diff --git media/libcubeb/src/cubeb.c media/libcubeb/src/cubeb.c
347 index 9c3adcc..45d765b 100644
348 --- media/libcubeb/src/cubeb.c
349 +++ media/libcubeb/src/cubeb.c
350 @@ -54,6 +54,9 @@ int opensl_init(cubeb ** context, char const * context_name);
351 #if defined(USE_AUDIOTRACK)
352 int audiotrack_init(cubeb ** context, char const * context_name);
354 +#if defined(USE_OSS)
355 +int oss_init(cubeb ** context, char const * context_name);
359 validate_stream_params(cubeb_stream_params stream_params)
360 @@ -120,6 +123,9 @@ cubeb_init(cubeb ** context, char const * context_name)
361 #if defined(USE_AUDIOTRACK)
364 +#if defined(USE_OSS)
370 diff --git media/libcubeb/src/cubeb_alsa.c media/libcubeb/src/cubeb_alsa.c
371 index a962553..1f780f4 100644
372 --- media/libcubeb/src/cubeb_alsa.c
373 +++ media/libcubeb/src/cubeb_alsa.c
375 #include <sys/time.h>
381 #include <alsa/asoundlib.h>
384 #define ALSA_PA_PLUGIN "ALSA <-> PulseAudio PCM I/O Plugin"
386 +#ifdef DISABLE_LIBASOUND_DLOPEN
389 +#define WRAP(x) cubeb_##x
390 +#define MAKE_TYPEDEF(x) static typeof(x) * cubeb_##x
391 +MAKE_TYPEDEF(snd_config);
392 +MAKE_TYPEDEF(snd_config_add);
393 +MAKE_TYPEDEF(snd_config_copy);
394 +MAKE_TYPEDEF(snd_config_delete);
395 +MAKE_TYPEDEF(snd_config_get_id);
396 +MAKE_TYPEDEF(snd_config_get_string);
397 +MAKE_TYPEDEF(snd_config_imake_integer);
398 +MAKE_TYPEDEF(snd_config_search);
399 +MAKE_TYPEDEF(snd_config_search_definition);
400 +MAKE_TYPEDEF(snd_lib_error_set_handler);
401 +MAKE_TYPEDEF(snd_pcm_avail_update);
402 +MAKE_TYPEDEF(snd_pcm_close);
403 +MAKE_TYPEDEF(snd_pcm_delay);
404 +MAKE_TYPEDEF(snd_pcm_drain);
405 +MAKE_TYPEDEF(snd_pcm_frames_to_bytes);
406 +MAKE_TYPEDEF(snd_pcm_get_params);
407 +/* snd_pcm_hw_params_alloca is actually a macro */
408 +/* MAKE_TYPEDEF(snd_pcm_hw_params_alloca); */
409 +MAKE_TYPEDEF(snd_pcm_hw_params_sizeof);
410 +#define snd_pcm_hw_params_sizeof cubeb_snd_pcm_hw_params_sizeof
411 +MAKE_TYPEDEF(snd_pcm_hw_params_any);
412 +MAKE_TYPEDEF(snd_pcm_hw_params_get_channels_max);
413 +MAKE_TYPEDEF(snd_pcm_hw_params_get_rate);
414 +MAKE_TYPEDEF(snd_pcm_hw_params_set_rate_near);
415 +MAKE_TYPEDEF(snd_pcm_nonblock);
416 +MAKE_TYPEDEF(snd_pcm_open);
417 +MAKE_TYPEDEF(snd_pcm_open_lconf);
418 +MAKE_TYPEDEF(snd_pcm_pause);
419 +MAKE_TYPEDEF(snd_pcm_poll_descriptors);
420 +MAKE_TYPEDEF(snd_pcm_poll_descriptors_count);
421 +MAKE_TYPEDEF(snd_pcm_poll_descriptors_revents);
422 +MAKE_TYPEDEF(snd_pcm_recover);
423 +MAKE_TYPEDEF(snd_pcm_set_params);
424 +MAKE_TYPEDEF(snd_pcm_state);
425 +MAKE_TYPEDEF(snd_pcm_writei);
430 /* ALSA is not thread-safe. snd_pcm_t instances are individually protected
431 by the owning cubeb_stream's mutex. snd_pcm_t creation and destruction
432 is not thread-safe until ALSA 1.0.24 (see alsa-lib.git commit 91c9c8f1),
433 @@ -64,6 +109,8 @@ struct cubeb {
434 workaround is not required. */
435 snd_config_t * local_config;
442 @@ -260,10 +307,10 @@ alsa_refill_stream(cubeb_stream * stm)
444 pthread_mutex_lock(&stm->mutex);
446 - avail = snd_pcm_avail_update(stm->pcm);
447 + avail = WRAP(snd_pcm_avail_update)(stm->pcm);
449 - snd_pcm_recover(stm->pcm, avail, 1);
450 - avail = snd_pcm_avail_update(stm->pcm);
451 + WRAP(snd_pcm_recover)(stm->pcm, avail, 1);
452 + avail = WRAP(snd_pcm_avail_update)(stm->pcm);
455 /* Failed to recover from an xrun, this stream must be broken. */
456 @@ -286,7 +333,7 @@ alsa_refill_stream(cubeb_stream * stm)
460 - p = calloc(1, snd_pcm_frames_to_bytes(stm->pcm, avail));
461 + p = calloc(1, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, avail));
464 pthread_mutex_unlock(&stm->mutex);
465 @@ -312,10 +359,10 @@ alsa_refill_stream(cubeb_stream * stm)
469 - wrote = snd_pcm_writei(stm->pcm, p, got);
470 + wrote = WRAP(snd_pcm_writei)(stm->pcm, p, got);
472 - snd_pcm_recover(stm->pcm, wrote, 1);
473 - wrote = snd_pcm_writei(stm->pcm, p, got);
474 + WRAP(snd_pcm_recover)(stm->pcm, wrote, 1);
475 + wrote = WRAP(snd_pcm_writei)(stm->pcm, p, got);
477 assert(wrote >= 0 && wrote == got);
478 stm->write_position += wrote;
479 @@ -342,7 +389,7 @@ alsa_refill_stream(cubeb_stream * stm)
481 /* Fill the remaining buffer with silence to guarantee one full period
483 - snd_pcm_writei(stm->pcm, (char *) p + got, avail - got);
484 + WRAP(snd_pcm_writei)(stm->pcm, (char *) p + got, avail - got);
486 set_timeout(&stm->drain_timeout, buffer_time * 1000);
488 @@ -453,26 +500,26 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
492 - r = snd_config_search(root_pcm, "slave", &slave_pcm);
493 + r = WRAP(snd_config_search)(root_pcm, "slave", &slave_pcm);
498 - r = snd_config_get_string(slave_pcm, &string);
499 + r = WRAP(snd_config_get_string)(slave_pcm, &string);
501 - r = snd_config_search_definition(lconf, "pcm_slave", string, &slave_def);
502 + r = WRAP(snd_config_search_definition)(lconf, "pcm_slave", string, &slave_def);
509 - r = snd_config_search(slave_def ? slave_def : slave_pcm, "pcm", &pcm);
510 + r = WRAP(snd_config_search)(slave_def ? slave_def : slave_pcm, "pcm", &pcm);
515 - r = snd_config_get_string(slave_def ? slave_def : slave_pcm, &string);
516 + r = WRAP(snd_config_get_string)(slave_def ? slave_def : slave_pcm, &string);
520 @@ -481,7 +528,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
521 if (r < 0 || r > (int) sizeof(node_name)) {
524 - r = snd_config_search(lconf, node_name, &pcm);
525 + r = WRAP(snd_config_search)(lconf, node_name, &pcm);
529 @@ -490,7 +537,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
533 - snd_config_delete(slave_def);
534 + WRAP(snd_config_delete)(slave_def);
538 @@ -513,22 +560,22 @@ init_local_config_with_workaround(char const * pcm_name)
542 - if (snd_config == NULL) {
543 + if (*WRAP(snd_config) == NULL) {
547 - r = snd_config_copy(&lconf, snd_config);
548 + r = WRAP(snd_config_copy)(&lconf, *WRAP(snd_config));
554 - r = snd_config_search_definition(lconf, "pcm", pcm_name, &pcm_node);
555 + r = WRAP(snd_config_search_definition)(lconf, "pcm", pcm_name, &pcm_node);
560 - r = snd_config_get_id(pcm_node, &string);
561 + r = WRAP(snd_config_get_id)(pcm_node, &string);
565 @@ -537,7 +584,7 @@ init_local_config_with_workaround(char const * pcm_name)
566 if (r < 0 || r > (int) sizeof(node_name)) {
569 - r = snd_config_search(lconf, node_name, &pcm_node);
570 + r = WRAP(snd_config_search)(lconf, node_name, &pcm_node);
574 @@ -548,12 +595,12 @@ init_local_config_with_workaround(char const * pcm_name)
577 /* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */
578 - r = snd_config_search(pcm_node, "type", &node);
579 + r = WRAP(snd_config_search)(pcm_node, "type", &node);
584 - r = snd_config_get_string(node, &string);
585 + r = WRAP(snd_config_get_string)(node, &string);
589 @@ -564,18 +611,18 @@ init_local_config_with_workaround(char const * pcm_name)
591 /* Don't clobber an explicit existing handle_underrun value, set it only
592 if it doesn't already exist. */
593 - r = snd_config_search(pcm_node, "handle_underrun", &node);
594 + r = WRAP(snd_config_search)(pcm_node, "handle_underrun", &node);
599 /* Disable pcm_pulse's asynchronous underrun handling. */
600 - r = snd_config_imake_integer(&node, "handle_underrun", 0);
601 + r = WRAP(snd_config_imake_integer)(&node, "handle_underrun", 0);
606 - r = snd_config_add(pcm_node, node);
607 + r = WRAP(snd_config_add)(pcm_node, node);
611 @@ -583,7 +630,7 @@ init_local_config_with_workaround(char const * pcm_name)
615 - snd_config_delete(lconf);
616 + WRAP(snd_config_delete)(lconf);
620 @@ -595,9 +642,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, snd_pcm_stream_t stream, snd_config_t * l
622 pthread_mutex_lock(&cubeb_alsa_mutex);
624 - r = snd_pcm_open_lconf(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK, local_config);
625 + r = WRAP(snd_pcm_open_lconf)(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK, local_config);
627 - r = snd_pcm_open(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK);
628 + r = WRAP(snd_pcm_open)(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK);
630 pthread_mutex_unlock(&cubeb_alsa_mutex);
632 @@ -610,7 +657,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
635 pthread_mutex_lock(&cubeb_alsa_mutex);
636 - r = snd_pcm_close(pcm);
637 + r = WRAP(snd_pcm_close)(pcm);
638 pthread_mutex_unlock(&cubeb_alsa_mutex);
641 @@ -667,12 +714,65 @@ alsa_init(cubeb ** context, char const * context_name)
645 + void * libasound = NULL;
647 +#ifndef DISABLE_LIBASOUND_DLOPEN
648 + libasound = dlopen("libasound.so", RTLD_LAZY);
650 + return CUBEB_ERROR;
653 +#define LOAD(x) do { \
654 + cubeb_##x = dlsym(libasound, #x); \
655 + if (!cubeb_##x) { \
656 + dlclose(libasound); \
657 + return CUBEB_ERROR; \
662 + LOAD(snd_config_add);
663 + LOAD(snd_config_copy);
664 + LOAD(snd_config_delete);
665 + LOAD(snd_config_get_id);
666 + LOAD(snd_config_get_string);
667 + LOAD(snd_config_imake_integer);
668 + LOAD(snd_config_search);
669 + LOAD(snd_config_search_definition);
670 + LOAD(snd_lib_error_set_handler);
671 + LOAD(snd_pcm_avail_update);
672 + LOAD(snd_pcm_close);
673 + LOAD(snd_pcm_delay);
674 + LOAD(snd_pcm_drain);
675 + LOAD(snd_pcm_frames_to_bytes);
676 + LOAD(snd_pcm_get_params);
677 + /* snd_pcm_hw_params_alloca is actually a macro */
678 + /* LOAD(snd_pcm_hw_params_alloca); */
679 + LOAD(snd_pcm_hw_params_sizeof);
680 + LOAD(snd_pcm_hw_params_any);
681 + LOAD(snd_pcm_hw_params_get_channels_max);
682 + LOAD(snd_pcm_hw_params_get_rate);
683 + LOAD(snd_pcm_hw_params_set_rate_near);
684 + LOAD(snd_pcm_nonblock);
685 + LOAD(snd_pcm_open);
686 + LOAD(snd_pcm_open_lconf);
687 + LOAD(snd_pcm_pause);
688 + LOAD(snd_pcm_poll_descriptors);
689 + LOAD(snd_pcm_poll_descriptors_count);
690 + LOAD(snd_pcm_poll_descriptors_revents);
691 + LOAD(snd_pcm_recover);
692 + LOAD(snd_pcm_set_params);
693 + LOAD(snd_pcm_state);
694 + LOAD(snd_pcm_writei);
701 pthread_mutex_lock(&cubeb_alsa_mutex);
702 if (!cubeb_alsa_error_handler_set) {
703 - snd_lib_error_set_handler(silent_error_handler);
704 + WRAP(snd_lib_error_set_handler)(silent_error_handler);
705 cubeb_alsa_error_handler_set = 1;
707 pthread_mutex_unlock(&cubeb_alsa_mutex);
708 @@ -680,6 +780,8 @@ alsa_init(cubeb ** context, char const * context_name)
709 ctx = calloc(1, sizeof(*ctx));
712 + ctx->libasound = libasound;
714 ctx->ops = &alsa_ops;
716 r = pthread_mutex_init(&ctx->mutex, NULL);
717 @@ -729,7 +831,7 @@ alsa_init(cubeb ** context, char const * context_name)
718 config fails with EINVAL, the PA PCM is too old for this workaround. */
720 pthread_mutex_lock(&cubeb_alsa_mutex);
721 - snd_config_delete(ctx->local_config);
722 + WRAP(snd_config_delete)(ctx->local_config);
723 pthread_mutex_unlock(&cubeb_alsa_mutex);
724 ctx->local_config = NULL;
726 @@ -768,9 +870,13 @@ alsa_destroy(cubeb * ctx)
727 pthread_mutex_destroy(&ctx->mutex);
730 + if (ctx->libasound) {
731 + dlclose(ctx->libasound);
734 if (ctx->local_config) {
735 pthread_mutex_lock(&cubeb_alsa_mutex);
736 - snd_config_delete(ctx->local_config);
737 + WRAP(snd_config_delete)(ctx->local_config);
738 pthread_mutex_unlock(&cubeb_alsa_mutex);
741 @@ -838,7 +944,7 @@ alsa_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_name,
745 - r = snd_pcm_nonblock(stm->pcm, 1);
746 + r = WRAP(snd_pcm_nonblock)(stm->pcm, 1);
749 latency_us = latency_frames * 1e6 / stm->params.rate;
750 @@ -855,7 +961,7 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
751 latency_us = latency_us < min_latency ? min_latency: latency_us;
754 - r = snd_pcm_set_params(stm->pcm, format, SND_PCM_ACCESS_RW_INTERLEAVED,
755 + r = WRAP(snd_pcm_set_params)(stm->pcm, format, SND_PCM_ACCESS_RW_INTERLEAVED,
756 stm->params.channels, stm->params.rate, 1,
759 @@ -867,15 +973,15 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
760 return CUBEB_ERROR_INVALID_FORMAT;
763 - r = snd_pcm_get_params(stm->pcm, &stm->buffer_size, &period_size);
764 + r = WRAP(snd_pcm_get_params)(stm->pcm, &stm->buffer_size, &period_size);
767 - stm->nfds = snd_pcm_poll_descriptors_count(stm->pcm);
768 + stm->nfds = WRAP(snd_pcm_poll_descriptors_count)(stm->pcm);
769 assert(stm->nfds > 0);
771 stm->saved_fds = calloc(stm->nfds, sizeof(struct pollfd));
772 assert(stm->saved_fds);
773 - r = snd_pcm_poll_descriptors(stm->pcm, stm->saved_fds, stm->nfds);
774 + r = WRAP(snd_pcm_poll_descriptors)(stm->pcm, stm->saved_fds, stm->nfds);
775 assert((nfds_t) r == stm->nfds);
777 r = pthread_cond_init(&stm->cond, NULL);
778 @@ -895,7 +1001,7 @@ alsa_stream_destroy(cubeb_stream * stm)
779 pthread_mutex_lock(&stm->mutex);
781 if (stm->state == DRAINING) {
782 - snd_pcm_drain(stm->pcm);
783 + WRAP(snd_pcm_drain)(stm->pcm);
785 alsa_locked_pcm_close(stm->pcm);
787 @@ -938,12 +1044,12 @@ alsa_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
791 - r = snd_pcm_hw_params_any(stm->pcm, hw_params);
792 + r = WRAP(snd_pcm_hw_params_any)(stm->pcm, hw_params);
797 - r = snd_pcm_hw_params_get_channels_max(hw_params, max_channels);
798 + r = WRAP(snd_pcm_hw_params_get_channels_max)(hw_params, max_channels);
802 @@ -969,34 +1075,34 @@ alsa_get_preferred_sample_rate(cubeb * c
804 /* get a pcm, disabling resampling, so we get a rate the
805 * hardware/dmix/pulse/etc. supports. */
806 - r = snd_pcm_open(&pcm, CUBEB_ALSA_PCM_NAME, SND_PCM_STREAM_PLAYBACK, SND_PCM_NO_AUTO_RESAMPLE);
807 + r = WRAP(snd_pcm_open)(&pcm, CUBEB_ALSA_PCM_NAME, SND_PCM_STREAM_PLAYBACK, SND_PCM_NO_AUTO_RESAMPLE);
812 - r = snd_pcm_hw_params_any(pcm, hw_params);
813 + r = WRAP(snd_pcm_hw_params_any)(pcm, hw_params);
815 - snd_pcm_close(pcm);
816 + WRAP(snd_pcm_close)(pcm);
820 - r = snd_pcm_hw_params_get_rate(hw_params, rate, &dir);
821 + r = WRAP(snd_pcm_hw_params_get_rate)(hw_params, rate, &dir);
823 /* There is a default rate: use it. */
824 - snd_pcm_close(pcm);
825 + WRAP(snd_pcm_close)(pcm);
829 /* Use a common rate, alsa may adjust it based on hw/etc. capabilities. */
832 - r = snd_pcm_hw_params_set_rate_near(pcm, hw_params, rate, NULL);
833 + r = WRAP(snd_pcm_hw_params_set_rate_near)(pcm, hw_params, rate, NULL);
835 - snd_pcm_close(pcm);
836 + WRAP(snd_pcm_close)(pcm);
840 - snd_pcm_close(pcm);
841 + WRAP(snd_pcm_close)(pcm);
845 @@ -1013,7 +1119,7 @@ alsa_stream_start(cubeb_stream * stm)
848 pthread_mutex_lock(&stm->mutex);
849 - snd_pcm_pause(stm->pcm, 0);
850 + WRAP(snd_pcm_pause)(stm->pcm, 0);
851 gettimeofday(&stm->last_activity, NULL);
852 pthread_mutex_unlock(&stm->mutex);
854 @@ -1047,7 +1153,7 @@ alsa_stream_stop(cubeb_stream * stm)
855 pthread_mutex_unlock(&ctx->mutex);
857 pthread_mutex_lock(&stm->mutex);
858 - snd_pcm_pause(stm->pcm, 1);
859 + WRAP(snd_pcm_pause)(stm->pcm, 1);
860 pthread_mutex_unlock(&stm->mutex);
863 @@ -1063,8 +1169,8 @@ alsa_stream_get_position(cubeb_stream * stm, uint64_t * position)
864 pthread_mutex_lock(&stm->mutex);
867 - if (snd_pcm_state(stm->pcm) != SND_PCM_STATE_RUNNING ||
868 - snd_pcm_delay(stm->pcm, &delay) != 0) {
869 + if (WRAP(snd_pcm_state)(stm->pcm) != SND_PCM_STATE_RUNNING ||
870 + WRAP(snd_pcm_delay)(stm->pcm, &delay) != 0) {
871 *position = stm->last_position;
872 pthread_mutex_unlock(&stm->mutex);
874 @@ -1089,7 +1195,7 @@ alsa_stream_get_latency(cubeb_stream * stm, uint32_t * latency)
875 snd_pcm_sframes_t delay;
876 /* This function returns the delay in frames until a frame written using
877 snd_pcm_writei is sent to the DAC. The DAC delay should be < 1ms anyways. */
878 - if (snd_pcm_delay(stm->pcm, &delay)) {
879 + if (WRAP(snd_pcm_delay)(stm->pcm, &delay)) {
883 diff --git media/libcubeb/src/cubeb_oss.c media/libcubeb/src/cubeb_oss.c
885 index 0000000..5e38e27
887 +++ media/libcubeb/src/cubeb_oss.c
890 + * Copyright © 2014 Mozilla Foundation
892 + * This program is made available under an ISC-style license. See the
893 + * accompanying file LICENSE for details.
895 +#if defined(HAVE_SYS_SOUNDCARD_H)
896 +#include <sys/soundcard.h>
898 +#include <soundcard.h>
902 +#include <sys/types.h>
903 +#include <sys/stat.h>
905 +#include <sys/ioctl.h>
907 +#include <pthread.h>
911 +#include "cubeb/cubeb.h"
912 +#include "cubeb-internal.h"
914 +#ifndef CUBEB_OSS_DEFAULT_OUTPUT
915 +#define CUBEB_OSS_DEFAULT_OUTPUT "/dev/dsp"
918 +#define OSS_BUFFER_SIZE 1024
921 + struct cubeb_ops const * ops;
924 +struct cubeb_stream {
927 + cubeb_data_callback data_callback;
928 + cubeb_state_callback state_callback;
933 + pthread_mutex_t state_mutex;
934 + pthread_cond_t state_cond;
940 + /* These two vars are needed to support old versions of OSS */
941 + unsigned int position_bytes;
942 + unsigned int last_position_bytes;
944 + uint64_t written_frags; /* The number of fragments written to /dev/dsp */
945 + uint64_t missed_frags; /* fragments output with stopped stream */
947 + cubeb_stream_params params;
952 +static struct cubeb_ops const oss_ops;
954 +int oss_init(cubeb ** context, char const * context_name)
956 + cubeb* ctx = (cubeb*)malloc(sizeof(cubeb));
957 + ctx->ops = &oss_ops;
962 +static void oss_destroy(cubeb *ctx)
967 +static char const * oss_get_backend_id(cubeb * context)
969 + static char oss_name[] = "oss";
973 +static int oss_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
975 + *max_channels = 2; /* Let's support only stereo for now */
979 +static int oss_get_min_latency(cubeb * context, cubeb_stream_params params,
980 + uint32_t * latency_ms)
982 + /* 40ms is a big enough number to work ok */
987 +static int oss_get_preferred_sample_rate(cubeb *context, uint32_t * rate)
989 + /* 48000 seems a prefered choice for most audio devices
990 + * and a good choice for OSS */
995 +static void run_state_callback(cubeb_stream *stream, cubeb_state state)
997 + if (stream->state_callback) {
998 + stream->state_callback(stream, stream->user_ptr, state);
1002 +static long run_data_callback(cubeb_stream *stream, void *buffer, long nframes)
1005 + pthread_mutex_lock(&stream->state_mutex);
1006 + if (stream->data_callback && stream->running && !stream->stopped) {
1007 + pthread_mutex_unlock(&stream->state_mutex);
1008 + got = stream->data_callback(stream, stream->user_ptr, NULL, buffer, nframes);
1010 + pthread_mutex_unlock(&stream->state_mutex);
1015 +static void apply_volume_int(int16_t* buffer, unsigned int n,
1016 + float volume, float panning)
1018 + float left = volume;
1019 + float right = volume;
1023 + right *= (1+panning);
1025 + left *= (1-panning);
1027 + pan[0] = 128.0*left;
1028 + pan[1] = 128.0*right;
1029 + for(i=0; i<n; i++){
1030 + buffer[i] = ((int)buffer[i])*pan[i%2]/128;
1034 +static void apply_volume_float(float* buffer, unsigned int n,
1035 + float volume, float panning)
1037 + float left = volume;
1038 + float right = volume;
1042 + right *= (1+panning);
1044 + left *= (1-panning);
1048 + for(i=0; i<n; i++){
1049 + buffer[i] = buffer[i]*pan[i%2];
1054 +static void *writer(void *stm)
1056 + cubeb_stream* stream = (cubeb_stream*)stm;
1057 + int16_t buffer[OSS_BUFFER_SIZE];
1058 + float f_buffer[OSS_BUFFER_SIZE];
1061 + while (stream->running) {
1062 + pthread_mutex_lock(&stream->state_mutex);
1063 + if (stream->stopped) {
1064 + pthread_mutex_unlock(&stream->state_mutex);
1065 + run_state_callback(stream, CUBEB_STATE_STOPPED);
1066 + pthread_mutex_lock(&stream->state_mutex);
1067 + while (stream->stopped) {
1068 + pthread_cond_wait(&stream->state_cond, &stream->state_mutex);
1070 + pthread_mutex_unlock(&stream->state_mutex);
1071 + run_state_callback(stream, CUBEB_STATE_STARTED);
1074 + pthread_mutex_unlock(&stream->state_mutex);
1075 + if (stream->floating) {
1076 + got = run_data_callback(stream, f_buffer,
1077 + OSS_BUFFER_SIZE/stream->params.channels);
1078 + apply_volume_float(f_buffer, got*stream->params.channels,
1079 + stream->volume, stream->panning);
1080 + for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
1081 + /* Clipping is prefered to overflow */
1082 + if(f_buffer[i]>=1.0){
1085 + if(f_buffer[i]<=-1.0){
1088 + /* One might think that multipling by 32767.0 is logical but results in clipping */
1089 + buffer[i] = f_buffer[i]*32767.0;
1092 + got = run_data_callback(stream, buffer,
1093 + OSS_BUFFER_SIZE/stream->params.channels);
1094 + apply_volume_int(buffer, got*stream->params.channels,
1095 + stream->volume, stream->panning);
1098 + run_state_callback(stream, CUBEB_STATE_ERROR);
1102 + run_state_callback(stream, CUBEB_STATE_DRAINED);
1106 + size_t s = got*stream->params.channels*sizeof(int16_t);
1108 + ssize_t n = write(stream->fd, ((char*)buffer) + i, s - i);
1110 + run_state_callback(stream, CUBEB_STATE_ERROR);
1115 + stream->written_frags+=got;
1121 +static void oss_try_set_latency(cubeb_stream* stream, unsigned int latency)
1123 + unsigned int latency_bytes, n_frag;
1125 + /* fragment size of 1024 is a good choice with good chances to be accepted */
1126 + unsigned int frag_size=1024;
1127 + unsigned int frag_log=10; /* 2^frag_log = frag_size */
1129 + latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;
1130 + n_frag = latency_bytes>>frag_log;
1131 + frag = (n_frag<<16) | frag_log;
1132 + /* Even if this fails we wish to continue, not checking for errors */
1133 + ioctl(stream->fd, SNDCTL_DSP_SETFRAGMENT, &frag);
1136 +static int oss_stream_init(cubeb * context, cubeb_stream ** stm,
1137 + char const * stream_name,
1138 + cubeb_devid input_device,
1139 + cubeb_stream_params * input_stream_params,
1140 + cubeb_devid output_device,
1141 + cubeb_stream_params * output_stream_params,
1142 + unsigned int latency,
1143 + cubeb_data_callback data_callback,
1144 + cubeb_state_callback state_callback, void * user_ptr)
1146 + cubeb_stream* stream = (cubeb_stream*)malloc(sizeof(cubeb_stream));
1147 + stream->context = context;
1148 + stream->data_callback = data_callback;
1149 + stream->state_callback = state_callback;
1150 + stream->user_ptr = user_ptr;
1152 + assert(!input_stream_params && "not supported.");
1153 + if (input_device || output_device) {
1154 + /* Device selection not yet implemented. */
1155 + return CUBEB_ERROR_DEVICE_UNAVAILABLE;
1158 + if ((stream->fd = open(CUBEB_OSS_DEFAULT_OUTPUT, O_WRONLY)) == -1) {
1160 + return CUBEB_ERROR;
1162 +#define SET(what, to) do { unsigned int i = to; \
1163 + int j = ioctl(stream->fd, what, &i); \
1164 + if (j == -1 || i != to) { \
1165 + close(stream->fd); \
1167 + return CUBEB_ERROR_INVALID_FORMAT; } } while (0)
1169 + stream->params = *output_stream_params;
1170 + stream->volume = 1.0;
1171 + stream->panning = 0.0;
1173 + oss_try_set_latency(stream, latency);
1175 + stream->floating = 0;
1176 + SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
1177 + SET(SNDCTL_DSP_SPEED, stream->params.rate);
1178 + switch (stream->params.format) {
1179 + case CUBEB_SAMPLE_S16LE:
1180 + SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
1182 + case CUBEB_SAMPLE_S16BE:
1183 + SET(SNDCTL_DSP_SETFMT, AFMT_S16_BE);
1185 + case CUBEB_SAMPLE_FLOAT32LE:
1186 + SET(SNDCTL_DSP_SETFMT, AFMT_S16_NE);
1187 + stream->floating = 1;
1190 + close(stream->fd);
1192 + return CUBEB_ERROR;
1196 + pthread_mutex_init(&stream->state_mutex, NULL);
1197 + pthread_cond_init(&stream->state_cond, NULL);
1199 + stream->running = 1;
1200 + stream->stopped = 1;
1201 + stream->position_bytes = 0;
1202 + stream->last_position_bytes = 0;
1203 + stream->written_frags = 0;
1204 + stream->missed_frags = 0;
1206 + pthread_create(&stream->th, NULL, writer, (void*)stream);
1213 +static void oss_stream_destroy(cubeb_stream * stream)
1215 + pthread_mutex_lock(&stream->state_mutex);
1217 + stream->running = 0;
1218 + stream->stopped = 0;
1219 + pthread_cond_signal(&stream->state_cond);
1221 + pthread_mutex_unlock(&stream->state_mutex);
1223 + pthread_join(stream->th, NULL);
1225 + pthread_mutex_destroy(&stream->state_mutex);
1226 + pthread_cond_destroy(&stream->state_cond);
1227 + close(stream->fd);
1231 +static int oss_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
1233 + if (ioctl(stream->fd, SNDCTL_DSP_GETODELAY, latency)==-1) {
1234 + return CUBEB_ERROR;
1236 + /* Convert latency from bytes to frames */
1237 + *latency /= stream->params.channels*sizeof(int16_t);
1242 +static int oss_stream_current_optr(cubeb_stream * stream, uint64_t * position)
1245 + /* Unfortunately, this ioctl is only available in OSS 4.x */
1246 +#ifdef SNDCTL_DSP_CURRENT_OPTR
1247 + oss_count_t count;
1248 + if (ioctl(stream->fd, SNDCTL_DSP_CURRENT_OPTR, &count) != -1) {
1249 + *position = count.samples;// + count.fifo_samples;
1253 + /* Fall back to this ioctl in case the previous one fails */
1254 + if (ioctl(stream->fd, SNDCTL_DSP_GETOPTR, &ci) == -1) {
1255 + return CUBEB_ERROR;
1257 + /* ci.bytes is only 32 bit and will start to wrap after arithmetic overflow */
1258 + stream->position_bytes += ci.bytes - stream->last_position_bytes;
1259 + stream->last_position_bytes = ci.bytes;
1260 + *position = stream->position_bytes/stream->params.channels/sizeof(int16_t);
1264 +static int oss_stream_get_position(cubeb_stream * stream, uint64_t * position)
1266 + if ( oss_stream_current_optr(stream, position) == CUBEB_OK ){
1267 + *position -= stream->missed_frags;
1270 + /* If no correct method to get position works we resort to this */
1271 + *position = stream->written_frags;
1276 +static int oss_stream_start(cubeb_stream * stream)
1278 + pthread_mutex_lock(&stream->state_mutex);
1279 + if (stream->stopped) {
1281 + oss_stream_current_optr(stream, &ptr);
1282 + stream->missed_frags = ptr - stream->written_frags;
1283 + stream->stopped = 0;
1284 + pthread_cond_signal(&stream->state_cond);
1286 + pthread_mutex_unlock(&stream->state_mutex);
1290 +static int oss_stream_stop(cubeb_stream * stream)
1292 + pthread_mutex_lock(&stream->state_mutex);
1293 + stream->stopped = 1;
1294 + pthread_mutex_unlock(&stream->state_mutex);
1298 +int oss_stream_set_panning(cubeb_stream * stream, float panning)
1300 + if (stream->params.channels == 2) {
1301 + stream->panning=panning;
1306 +int oss_stream_set_volume(cubeb_stream * stream, float volume)
1308 + stream->volume=volume;
1312 +static struct cubeb_ops const oss_ops = {
1314 + .get_backend_id = oss_get_backend_id,
1315 + .get_max_channel_count = oss_get_max_channel_count,
1316 + .get_min_latency = oss_get_min_latency,
1317 + .get_preferred_sample_rate = oss_get_preferred_sample_rate,
1318 + .destroy = oss_destroy,
1319 + .stream_init = oss_stream_init,
1320 + .stream_destroy = oss_stream_destroy,
1321 + .stream_start = oss_stream_start,
1322 + .stream_stop = oss_stream_stop,
1323 + .stream_get_position = oss_stream_get_position,
1324 + .stream_get_latency = oss_stream_get_latency,
1325 + .stream_set_volume = oss_stream_set_volume,
1326 + .stream_set_panning = oss_stream_set_panning,
1327 + .stream_get_current_device = NULL,
1328 + .stream_device_destroy = NULL,
1329 + .stream_register_device_changed_callback = NULL
1331 diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build
1332 index 8b7a0dd..31212ce 100644
1333 --- media/libcubeb/src/moz.build
1334 +++ media/libcubeb/src/moz.build
1335 @@ -17,6 +17,12 @@ if CONFIG['MOZ_ALSA']:
1337 DEFINES['USE_ALSA'] = True
1339 +if CONFIG['MOZ_OSS']:
1343 + DEFINES['USE_OSS'] = True
1345 if CONFIG['MOZ_PULSEAUDIO']:
1348 @@ -75,5 +81,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
1350 FAIL_ON_WARNINGS = True
1352 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
1353 CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
1354 CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
1356 diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
1357 index 1b17c7b..48b56c2 100644
1358 --- media/libcubeb/tests/moz.build
1359 +++ media/libcubeb/tests/moz.build
1360 @@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
1364 - OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
1365 OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
1367 if CONFIG['GNU_CXX']:
1368 diff --git media/libcubeb/update.sh media/libcubeb/update.sh
1369 index a96badd..2f9585e 100755
1370 --- media/libcubeb/update.sh
1371 +++ media/libcubeb/update.sh
1372 @@ -16,6 +16,7 @@ cp $1/src/cubeb_audiounit.cpp src
1373 cp $1/src/cubeb_osx_run_loop.h src
1374 cp $1/src/cubeb_jack.cpp src
1375 cp $1/src/cubeb_opensl.c src
1376 +cp $1/src/cubeb_oss.c src
1377 cp $1/src/cubeb_panner.cpp src
1378 cp $1/src/cubeb_panner.h src
1379 cp $1/src/cubeb_pulse.c src
1380 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
1381 index 991f03f..3d99eb5 100644
1382 --- media/webrtc/signaling/test/common.build
1383 +++ media/webrtc/signaling/test/common.build
1384 @@ -102,8 +102,8 @@ USE_LIBS += ['mozglue']
1385 OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
1386 OS_LIBS += CONFIG['REALTIME_LIBS']
1388 -if CONFIG['MOZ_ALSA']:
1389 - OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
1390 +if CONFIG['MOZ_OSS']:
1391 + OS_LIBS += CONFIG['MOZ_OSS_LIBS']
1393 if CONFIG['MOZ_SYSTEM_JPEG']:
1394 OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
1395 diff --git toolkit/library/moz.build toolkit/library/moz.build
1396 index e191f13..4fb268a 100644
1397 --- toolkit/library/moz.build
1398 +++ toolkit/library/moz.build
1399 @@ -234,8 +234,8 @@ if CONFIG['MOZ_SYSTEM_LIBVPX']:
1400 if not CONFIG['MOZ_TREE_PIXMAN']:
1401 OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
1403 -if CONFIG['MOZ_ALSA']:
1404 - OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
1405 +if CONFIG['MOZ_OSS']:
1406 + OS_LIBS += CONFIG['MOZ_OSS_LIBS']
1408 if CONFIG['HAVE_CLOCK_MONOTONIC']:
1409 OS_LIBS += CONFIG['REALTIME_LIBS']
1412 [FILE:1562:patches/patch-bug1186967]
1414 Author: Martin Stransky <stransky@redhat.com>
1415 Date: Tue Oct 17 09:50:18 2017 +0200
1417 Bug 1186967 - ignore double-click on WM without _NET_WM_MOVERESIZE support, r=jhorak
1419 MozReview-Commit-ID: 2Vs6i5leero
1422 extra : rebase_source : d8f2bbaf9ef9b2025478f029a68ee7e87e07de79
1424 widget/gtk/nsWindow.cpp | 16 ++++++++++++++++
1425 1 file changed, 16 insertions(+)
1427 diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp
1428 index eb2f0e5e95cd..955327297ac9 100644
1429 --- widget/gtk/nsWindow.cpp
1430 +++ widget/gtk/nsWindow.cpp
1431 @@ -6444,6 +6444,22 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent,
1435 + if (mIsX11Display) {
1436 + // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
1437 + // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
1438 + // See _should_perform_ewmh_drag() at gdkwindow-x11.c
1439 + GdkScreen* screen = gdk_window_get_screen(gdk_window);
1440 + GdkAtom atom = gdk_atom_intern("_NET_WM_MOVERESIZE", FALSE);
1441 + if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
1442 + static unsigned int lastTimeStamp = 0;
1443 + if (lastTimeStamp != aMouseEvent->mTime) {
1444 + lastTimeStamp = aMouseEvent->mTime;
1451 // FIXME: It would be nice to have the widget position at the time
1452 // of the event, but it's relatively unlikely that the widget has
1453 // moved since the mousedown. (On the other hand, it's quite likely
1456 [FILE:2805:patches/patch-bug1288587]
1457 diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
1458 index 855214a..1e91d51 100644
1459 --- build/moz.configure/init.configure
1460 +++ build/moz.configure/init.configure
1461 @@ -165,16 +165,17 @@ option(env='PYTHON', nargs=1, help='Python interpreter')
1462 # ==============================================================
1463 @depends('PYTHON', check_build_environment, mozconfig, '--help')
1466 @imports('subprocess')
1467 @imports(_from='mozbuild.configure.util', _import='LineIO')
1468 @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
1469 @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
1470 +@imports(_from='__builtin__', _import='KeyError')
1471 @imports('distutils.sysconfig')
1472 def virtualenv_python(env_python, build_env, mozconfig, help):
1476 python = env_python[0] if env_python else None
1478 # Ideally we'd rely on the mozconfig injection from mozconfig_options,
1479 @@ -184,16 +185,22 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
1480 if 'PYTHON' in mozconfig['env']['added']:
1481 python = mozconfig['env']['added']['PYTHON']
1482 elif 'PYTHON' in mozconfig['env']['modified']:
1483 python = mozconfig['env']['modified']['PYTHON'][1]
1484 elif 'PYTHON' in mozconfig['vars']['added']:
1485 python = mozconfig['vars']['added']['PYTHON']
1486 elif 'PYTHON' in mozconfig['vars']['modified']:
1487 python = mozconfig['vars']['modified']['PYTHON'][1]
1488 + for i in ('env', 'vars'):
1489 + for j in ('added', 'modified'):
1491 + del mozconfig[i][j]['PYTHON']
1495 with LineIO(lambda l: log.error(l)) as out:
1496 verify_python_version(out)
1497 topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
1498 if topobjdir.endswith('/js/src'):
1499 topobjdir = topobjdir[:-7]
1501 with LineIO(lambda l: log.info(l)) as out:
1502 @@ -219,17 +226,20 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
1503 log.info('Creating Python environment')
1504 manager.build(python)
1506 python = normsep(manager.python_path)
1508 if python != normsep(sys.executable):
1509 log.info('Reexecuting in the virtualenv')
1511 - del os.environ['PYTHON']
1513 + del os.environ['PYTHON']
1516 # One would prefer to use os.execl, but that's completely borked on
1518 sys.exit(subprocess.call([python] + sys.argv))
1520 # We are now in the virtualenv
1521 if not distutils.sysconfig.get_python_lib():
1522 die('Could not determine python site packages directory')
1526 [FILE:1390:patches/patch-bug1321877]
1528 Author: <tharvik@gmail.com>
1529 Date: Thu Dec 8 18:20:12 2016 -0600
1531 Bug 1321877. Fix compiler warnings in Downscaler.h when skia is not enabled. r=tnikkel
1533 image/Downscaler.h | 11 +++++++----
1534 1 file changed, 7 insertions(+), 4 deletions(-)
1536 diff --git image/Downscaler.h image/Downscaler.h
1537 index 21179a38f200..0bdef0eaa646 100644
1538 --- image/Downscaler.h
1539 +++ image/Downscaler.h
1540 @@ -154,14 +154,14 @@ private:
1544 - explicit Downscaler(const nsIntSize&)
1545 + explicit Downscaler(const nsIntSize&) : mScale(1.0, 1.0)
1547 MOZ_RELEASE_ASSERT(false, "Skia is not enabled");
1550 - const nsIntSize& OriginalSize() const { return nsIntSize(); }
1551 - const nsIntSize& TargetSize() const { return nsIntSize(); }
1552 - const gfxSize& Scale() const { return gfxSize(1.0, 1.0); }
1553 + const nsIntSize& OriginalSize() const { return mSize; }
1554 + const nsIntSize& TargetSize() const { return mSize; }
1555 + const gfxSize& Scale() const { return mScale; }
1557 nsresult BeginFrame(const nsIntSize&, const Maybe<nsIntRect>&, uint8_t*, bool, bool = false)
1559 @@ -177,6 +177,9 @@ public:
1560 DownscalerInvalidRect TakeInvalidRect() { return DownscalerInvalidRect(); }
1561 void ResetForNextProgressivePass() { }
1562 const nsIntSize FrameSize() const { return nsIntSize(0, 0); }
1568 #endif // MOZ_ENABLE_SKIA
1571 [FILE:2359:patches/patch-bug1338655]
1573 Author: Ralph Giles <giles@mozilla.com>
1574 Date: Fri Feb 10 12:58:18 2017 -0800
1576 Bug 1338655 - Don't try to build mp4parse bindings. r=froydnj
1578 We use the cheddar crate to generate a C header file
1579 for our mp4parse_capi wrapper crate. Currently we
1580 do this at code check-in time via update-rust.sh.
1582 Cargo 0.18 and later will try to execute a build.rs
1583 file in the crate source tree regardless of whether
1584 it's specified in Cargo.toml so patching out that
1585 line just results in 'crate cheddar not found'.
1587 This change restores the old behaviour by substituting
1588 a 'build = false' line instead.
1590 We do have syntex vendored, but we don't currently build
1591 it by default, so I prefer this solution to just vendoring
1592 cheddar and generating the header at build time. The syntex
1593 crate is quite large and adds significantly to our compile
1596 MozReview-Commit-ID: InJRRODWAdP
1599 extra : rebase_source : 29378fcbc86015ce6cc22dc66d38a43ddbac204e
1601 media/libstagefright/binding/mp4parse-cargo.patch | 5 +++--
1602 media/libstagefright/binding/mp4parse_capi/Cargo.toml | 2 ++
1603 2 files changed, 5 insertions(+), 2 deletions(-)
1605 diff --git media/libstagefright/binding/mp4parse-cargo.patch media/libstagefright/binding/mp4parse-cargo.patch
1606 index 1dd13d20472a..bfa0ab74b424 100644
1607 --- media/libstagefright/binding/mp4parse-cargo.patch
1608 +++ media/libstagefright/binding/mp4parse-cargo.patch
1609 @@ -25,12 +25,13 @@ diff --git a/media/libstagefright/binding/mp4parse_cap
1610 index aeeebc65..5c0836a 100644
1611 --- a/media/libstagefright/binding/mp4parse_capi/Cargo.toml
1612 +++ b/media/libstagefright/binding/mp4parse_capi/Cargo.toml
1613 -@@ -18,17 +18,9 @@ exclude = [
1614 +@@ -18,17 +18,11 @@ exclude = [
1623 "mp4parse" = {version = "0.6.0", path = "../mp4parse"}
1625 diff --git media/libstagefright/binding/mp4parse_capi/Cargo.toml media/libstagefright/binding/mp4parse_capi/Cargo.toml
1626 index aee7ee947151..d7e3f55119d3 100644
1627 --- media/libstagefright/binding/mp4parse_capi/Cargo.toml
1628 +++ media/libstagefright/binding/mp4parse_capi/Cargo.toml
1629 @@ -18,6 +18,8 @@ exclude = [
1637 "mp4parse" = {version = "0.6.0", path = "../mp4parse"}
1640 [FILE:1238:patches/patch-bug1380706]
1642 Author: Kai Engert <kaie@kuix.de>
1643 Date: Fri Jul 14 15:31:30 2017 +0200
1645 Bug 1380706, PSM should depend on mozStorage, as a workaround for a sqlite3_config race, r=keeler
1647 security/manager/ssl/nsNSSComponent.cpp | 9 +++++++++
1648 1 file changed, 9 insertions(+)
1650 diff --git security/manager/ssl/nsNSSComponent.cpp security/manager/ssl/nsNSSComponent.cpp
1651 index f51f8af47d51..a82c1ed61fba 100644
1652 --- security/manager/ssl/nsNSSComponent.cpp
1653 +++ security/manager/ssl/nsNSSComponent.cpp
1655 #include "SharedSSLState.h"
1658 +#include "mozStorageCID.h"
1659 #include "mozilla/ArrayUtils.h"
1660 #include "mozilla/Assertions.h"
1661 #include "mozilla/Casting.h"
1662 @@ -2032,6 +2033,14 @@ nsNSSComponent::Init()
1663 return NS_ERROR_NOT_AVAILABLE;
1666 + // To avoid a sqlite3_config race in NSS init, as a workaround for
1667 + // bug 730495, we require the storage service to get initialized first.
1668 + nsCOMPtr<nsISupports> storageService =
1669 + do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
1670 + if (!storageService) {
1671 + return NS_ERROR_NOT_AVAILABLE;
1674 MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n"));
1676 nsresult rv = InitializePIPNSSBundle();
1679 [FILE:341:patches/patch-bug1386957]
1680 https://github.com/kinetiknz/cubeb/commit/16f9ccc064f2
1682 --- media/libcubeb/src/cubeb_jack.cpp.orig 2017-07-07 05:37:16 UTC
1683 +++ media/libcubeb/src/cubeb_jack.cpp
1686 #define _DEFAULT_SOURCE
1688 +#ifndef __FreeBSD__
1689 #define _POSIX_SOURCE
1691 #include <algorithm>
1696 [FILE:2435:patches/patch-bug1412558]
1697 diff --git dom/media/flac/FlacDecoder.cpp dom/media/flac/FlacDecoder.cpp
1698 index 53fc3c9937f7..b23771ab80fa 100644
1699 --- dom/media/flac/FlacDecoder.cpp
1700 +++ dom/media/flac/FlacDecoder.cpp
1702 #include "FlacDecoder.h"
1703 #include "MediaContainerType.h"
1704 #include "MediaPrefs.h"
1705 +#include "PDMFactory.h"
1709 @@ -15,6 +16,10 @@ FlacDecoder::IsEnabled()
1712 return MediaPrefs::FlacEnabled();
1713 +#elif defined(MOZ_FFMPEG)
1714 + RefPtr<PDMFactory> platform = new PDMFactory();
1715 + return MediaPrefs::FlacEnabled() && platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/flac"),
1716 + /* DecoderDoctorDiagnostics* */ nullptr);
1718 // Until bug 1295886 is fixed.
1720 diff --git media/ffvpx/README_MOZILLA media/ffvpx/README_MOZILLA
1721 index 5d3a6037efe0..43144b726a92 100644
1722 --- media/ffvpx/README_MOZILLA
1723 +++ media/ffvpx/README_MOZILLA
1724 @@ -17,14 +17,6 @@ configuration files were generated as follow using the configure script:
1726 replace: /HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d
1729 -add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
1732 -add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
1733 -replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0/ and s/HAVE_MEMALIGN 1/HAVE_MEMALIGN 0/ and s/HAVE_POSIX_MEMALIGN 1/HAVE_POSIX_MEMALIGN 0/
1736 config_unix64.h/config_unix64.asm:
1737 replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
1739 diff --git media/ffvpx/config.h media/ffvpx/config.h
1740 index dab01e05cd65..26ebe529bd98 100644
1741 --- media/ffvpx/config.h
1742 +++ media/ffvpx/config.h
1744 #define HAVE_LIBC_MSVCRT 0
1746 #elif defined(XP_DARWIN)
1747 -#if defined(HAVE_64BIT_BUILD)
1748 #include "config_darwin64.h"
1750 -#include "config_darwin32.h"
1752 #elif defined(XP_UNIX)
1753 -#if defined(HAVE_64BIT_BUILD)
1754 #include "config_unix64.h"
1756 -#include "config_unix32.h"
1759 #include "config_common.h"
1760 #endif // MOZ_FFVPX_CONFIG_H
1761 diff --git old-configure.in old-configure.in
1762 index b8ce71278548..410be683c2f6 100644
1763 --- old-configure.in
1764 +++ old-configure.in
1765 @@ -3279,11 +3279,11 @@ dnl = FFmpeg's ffvpx configuration
1766 dnl ========================================================
1769 -case "$CPU_ARCH" in
1771 +case "$OS_ARCH:$CPU_ARCH" in
1782 [FILE:3265:patches/patch-bug1414440]
1783 Always build libyuv x86 optimizations with Clang.
1785 diff --git media/libyuv/include/libyuv/compare_row.h media/libyuv/include/libyuv/compare_row.h
1786 index 38a957b2ce33..59ec4b30c238 100644
1787 --- media/libyuv/include/libyuv/compare_row.h
1788 +++ media/libyuv/include/libyuv/compare_row.h
1789 @@ -19,7 +19,7 @@ extern "C" {
1792 #if defined(__pnacl__) || defined(__CLR_VER) || \
1793 - (defined(__i386__) && !defined(__SSE2__))
1794 + (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
1795 #define LIBYUV_DISABLE_X86
1797 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
1798 diff --git media/libyuv/include/libyuv/planar_functions.h media/libyuv/include/libyuv/planar_functions.h
1799 index 881b0c5c6473..491c022bfe8f 100644
1800 --- media/libyuv/include/libyuv/planar_functions.h
1801 +++ media/libyuv/include/libyuv/planar_functions.h
1802 @@ -450,7 +450,7 @@ int I420Interpolate(const uint8* src0_y, int src0_stride_y,
1803 int width, int height, int interpolation);
1805 #if defined(__pnacl__) || defined(__CLR_VER) || \
1806 - (defined(__i386__) && !defined(__SSE2__))
1807 + (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
1808 #define LIBYUV_DISABLE_X86
1810 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
1811 diff --git media/libyuv/include/libyuv/rotate_row.h media/libyuv/include/libyuv/rotate_row.h
1812 index ebc487f9abf4..59fbd10b573c 100644
1813 --- media/libyuv/include/libyuv/rotate_row.h
1814 +++ media/libyuv/include/libyuv/rotate_row.h
1815 @@ -19,7 +19,7 @@ extern "C" {
1818 #if defined(__pnacl__) || defined(__CLR_VER) || \
1819 - (defined(__i386__) && !defined(__SSE2__))
1820 + (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
1821 #define LIBYUV_DISABLE_X86
1823 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
1824 diff --git media/libyuv/include/libyuv/row.h media/libyuv/include/libyuv/row.h
1825 index 069d73bd3f2e..3616ecd81c3d 100644
1826 --- media/libyuv/include/libyuv/row.h
1827 +++ media/libyuv/include/libyuv/row.h
1828 @@ -38,7 +38,7 @@ extern "C" {
1831 #if defined(__pnacl__) || defined(__CLR_VER) || \
1832 - (defined(__i386__) && !defined(__SSE2__))
1833 + (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
1834 #define LIBYUV_DISABLE_X86
1836 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
1837 diff --git media/libyuv/include/libyuv/scale_row.h media/libyuv/include/libyuv/scale_row.h
1838 index df699e6c2282..242f025b1e6e 100644
1839 --- media/libyuv/include/libyuv/scale_row.h
1840 +++ media/libyuv/include/libyuv/scale_row.h
1841 @@ -20,7 +20,7 @@ extern "C" {
1844 #if defined(__pnacl__) || defined(__CLR_VER) || \
1845 - (defined(__i386__) && !defined(__SSE2__))
1846 + (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
1847 #define LIBYUV_DISABLE_X86
1849 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
1850 diff --git media/libyuv/linux.mk media/libyuv/linux.mk
1851 index ee5a3a70705a..c1a45173c9ab 100644
1852 --- media/libyuv/linux.mk
1853 +++ media/libyuv/linux.mk
1854 @@ -78,4 +78,4 @@ cpuid: util/cpuid.c libyuv.a
1855 $(CC) $(CFLAGS) -o $@ util/cpuid.c libyuv.a
1858 - /bin/rm -f source/*.o *.ii *.s libyuv.a convert cpuid psnr
1859 + /bin/rm -f source/*.o *.ii *.s libyuv.a yuvconvert cpuid psnr
1862 [FILE:445:patches/patch-bug702179]
1863 --- js/src/moz.build.orig 2015-12-16 12:32:04.574425000 +0100
1864 +++ js/src/moz.build 2015-12-16 12:32:09.032032000 +0100
1865 @@ -671,10 +671,6 @@ CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
1866 CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
1867 LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
1869 -NO_EXPAND_LIBS = True
1871 -DIST_INSTALL = True
1873 # Prepare self-hosted JS code for embedding
1874 GENERATED_FILES += ['selfhosted.out.h']
1875 selfhosted = GENERATED_FILES['selfhosted.out.h']
1878 [FILE:6039:patches/patch-bug826985]
1880 Author: Henrik Gulbrandsen <henrik@gulbra.net>
1881 Date: Fri Jan 4 13:49:22 2013 +0100
1883 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux.
1885 config/system-headers | 1 +
1886 old-configure.in | 7 +++++++
1887 media/webrtc/signaling/test/Makefile.in | 1 +
1888 .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++
1889 .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++-
1890 .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++
1891 toolkit/library/Makefile.in | 1 +
1892 6 files changed, 52 insertions(+), 1 deletion(-)
1894 diff --git config/system-headers config/system-headers
1895 index 55e4cd1..76567b3 100644
1896 --- config/system-headers
1897 +++ config/system-headers
1898 @@ -624,6 +624,7 @@ libgnome/libgnome.h
1899 libgnomeui/gnome-icon-lookup.h
1900 libgnomeui/gnome-icon-theme.h
1901 libgnomeui/gnome-ui-init.h
1906 diff --git old-configure.in configure.in
1907 index 55e4cd1..76567b3 100644
1908 --- old-configure.in
1909 +++ old-configure.in
1910 @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then
1912 MOZ_VP8_ERROR_CONCEALMENT=1
1914 + dnl with libv4l2 we can support more cameras
1915 + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
1917 dnl enable once Signaling lands
1918 MOZ_WEBRTC_SIGNALING=1
1919 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
1920 diff --git build/gyp.mozbuild build/gyp.mozbuild
1921 index b483cd1..f1dd1f0 100644
1922 --- build/gyp.mozbuild
1923 +++ build/gyp.mozbuild
1924 @@ -11,6 +11,7 @@ gyp_vars = {
1925 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0,
1926 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0,
1927 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0,
1928 + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0,
1929 # basic stuff for everything
1930 'include_internal_video_render': 0,
1931 'clang_use_chrome_plugins': 0,
1932 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
1933 index b483cd1..f1dd1f0 100644
1934 --- media/webrtc/signaling/test/common.build
1935 +++ media/webrtc/signaling/test/common.build
1936 @@ -99,6 +99,7 @@ if CONFIG['JS_SHARED_LIBRARY']:
1938 USE_LIBS += ['mozglue']
1940 +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS']
1941 OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
1942 OS_LIBS += CONFIG['REALTIME_LIBS']
1944 diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
1945 index 239a292..bab496c 100644
1946 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
1947 +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
1950 #include <linux/videodev2.h>
1952 +#ifdef HAVE_LIBV4L2
1953 +#include <libv4l2.h>
1956 #include "webrtc/system_wrappers/interface/ref_count.h"
1957 #include "webrtc/system_wrappers/interface/trace.h"
1959 #define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
1962 +#ifdef HAVE_LIBV4L2
1963 +#define open v4l2_open
1964 +#define close v4l2_close
1965 +#define dup v4l2_dup
1966 +#define ioctl v4l2_ioctl
1967 +#define mmap v4l2_mmap
1968 +#define munmap v4l2_munmap
1973 namespace videocapturemodule
1974 @@ -274,6 +286,11 @@ int32_t DeviceInfoLinux::GetDeviceName(
1975 memset(deviceNameUTF8, 0, deviceNameLength);
1976 memcpy(cameraName, cap.card, sizeof(cap.card));
1978 + if (cameraName[0] == '\0')
1980 + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
1983 if (deviceNameLength >= strlen(cameraName))
1985 memcpy(deviceNameUTF8, cameraName, strlen(cameraName));
1986 diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
1987 index 12df1b3..e9863ba 100644
1988 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
1989 +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
1992 #include <linux/videodev2.h>
1994 +#ifdef HAVE_LIBV4L2
1995 +#include <libv4l2.h>
2001 #include "critical_section_wrapper.h"
2002 #include "video_capture_linux.h"
2004 +#ifdef HAVE_LIBV4L2
2005 +#define open v4l2_open
2006 +#define close v4l2_close
2007 +#define dup v4l2_dup
2008 +#define ioctl v4l2_ioctl
2009 +#define mmap v4l2_mmap
2010 +#define munmap v4l2_munmap
2015 namespace videocapturemodule
2016 diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
2017 index d46b5aa..e452223 100644
2018 --- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
2019 +++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
2021 # be found in the AUTHORS file in the root of the source tree.
2025 + 'use_libv4l2%': 0,
2029 'target_name': 'video_capture_module',
2031 'linux/video_capture_linux.cc',
2032 'linux/video_capture_linux.h',
2035 + ['use_libv4l2==1', {
2039 + 'cflags_mozilla': [
2040 + '$(MOZ_LIBV4L2_CFLAGS)',
2050 diff --git toolkit/library/moz.build toolkit/library/moz.build
2051 index 9c16ffa..1db3794 100644
2052 --- toolkit/library/moz.build
2053 +++ toolkit/library/moz.build
2054 @@ -163,6 +163,7 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONF
2057 OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
2058 +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS']
2059 OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
2060 OS_LIBS += CONFIG['MOZ_APP_EXTRA_LIBS']
2064 [FILE:9436:patches/patch-bug847568]
2065 # Allow building against system-wide graphite2/harfbuzz.
2067 diff --git config/Makefile.in config/Makefile.in
2068 index e2e11dc0e27e..a6206bb0ff30 100644
2069 --- config/Makefile.in
2070 +++ config/Makefile.in
2071 @@ -41,6 +41,8 @@ export:: $(export-preqs)
2072 $(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \
2073 -DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \
2074 -DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \
2075 + -DMOZ_SYSTEM_GRAPHITE2=$(MOZ_SYSTEM_GRAPHITE2) \
2076 + -DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \
2077 -DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \
2078 -DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \
2079 -DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \
2080 diff --git config/system-headers config/system-headers
2081 index a0c53c651a3e..5ee7f71f9634 100644
2082 --- config/system-headers
2083 +++ config/system-headers
2084 @@ -1269,6 +1269,15 @@ libsn/sn-launcher.h
2088 +#if MOZ_SYSTEM_GRAPHITE2==1
2090 +graphite2/Segment.h
2092 +#if MOZ_SYSTEM_HARFBUZZ==1
2097 #if MOZ_SYSTEM_HUNSPELL==1
2100 diff --git dom/base/moz.build dom/base/moz.build
2101 index 8e19020315ae..2fcdbb6f7b42 100644
2102 --- dom/base/moz.build
2103 +++ dom/base/moz.build
2104 @@ -464,6 +464,9 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
2105 if CONFIG['MOZ_X11']:
2106 CXXFLAGS += CONFIG['TK_CFLAGS']
2108 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2109 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2111 GENERATED_FILES += [
2112 'PropertyUseCounterMap.inc',
2114 diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
2115 index faaab1b17971..04eff5f09882 100644
2116 --- gfx/graphite2/moz-gr-update.sh
2117 +++ gfx/graphite2/moz-gr-update.sh
2121 # Script used to update the Graphite2 library in the mozilla source tree
2122 +# and bump version for --with-system-graphite2
2124 # This script lives in gfx/graphite2, along with the library source,
2125 # but must be run from the top level of the mozilla-central tree.
2126 @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
2127 #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
2128 #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
2130 +# chase version for --with-system-graphite2
2131 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
2132 + if /GR2_VERSION_REQUIRE/" old-configure.in
2134 # summarize what's been touched
2135 echo Updated to $RELEASE.
2136 echo Here is what changed in the gfx/graphite2 directory:
2139 -hg stat gfx/graphite2
2140 +hg stat old-configure.in gfx/graphite2
2143 echo If gfx/graphite2/src/files.mk has changed, please make corresponding
2144 diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
2145 index 22c76a7df020..a01490bd49ee 100644
2146 --- gfx/harfbuzz/README-mozilla
2147 +++ gfx/harfbuzz/README-mozilla
2148 @@ -19,3 +19,8 @@ the mozilla tree.
2150 If the collection of source files changes, manual updates to moz.build may be
2151 needed, as we don't use the upstream makefiles.
2153 +The in-tree copy may be omitted during build by --with-system-harfbuzz.
2154 +Make sure to keep pkg-config version check within toolkit/moz.configure in sync
2155 +with checkout version or increment latest tag by one if it's not based
2156 +on upstream release.
2157 diff --git gfx/moz.build gfx/moz.build
2158 index 771f652e837a..3b358d84e384 100644
2161 @@ -10,6 +10,12 @@ with Files('**'):
2162 if CONFIG['MOZ_TREE_CAIRO']:
2165 +if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
2166 + DIRS += ['graphite2/src' ]
2168 +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2169 + DIRS += ['harfbuzz/src']
2174 @@ -18,8 +24,6 @@ DIRS += [
2183 diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
2184 index e06ae3457a47..93faa61594a3 100755
2185 --- gfx/skia/generate_mozbuild.py
2186 +++ gfx/skia/generate_mozbuild.py
2187 @@ -143,6 +143,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
2188 '-Wno-unused-private-field',
2191 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2192 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2194 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
2195 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
2196 CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
2197 diff --git gfx/skia/moz.build gfx/skia/moz.build
2198 index 2118677ca3a8..e4978b413784 100644
2199 --- gfx/skia/moz.build
2200 +++ gfx/skia/moz.build
2201 @@ -753,6 +753,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
2202 '-Wno-unused-private-field',
2205 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2206 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2208 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
2209 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
2210 CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
2211 diff --git gfx/thebes/moz.build gfx/thebes/moz.build
2212 index dee9b7bfa2cb..bd801f3a468e 100644
2213 --- gfx/thebes/moz.build
2214 +++ gfx/thebes/moz.build
2215 @@ -273,7 +273,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
2217 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
2219 -DEFINES['GRAPHITE2_STATIC'] = True
2220 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
2221 + CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
2223 + DEFINES['GRAPHITE2_STATIC'] = True
2225 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2226 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2228 if CONFIG['CLANG_CXX']:
2229 # Suppress warnings from Skia header files.
2230 diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
2231 index cb1233c56d7e..06fb1f9f174b 100644
2232 --- intl/unicharutil/util/moz.build
2233 +++ intl/unicharutil/util/moz.build
2234 @@ -40,4 +40,7 @@ if CONFIG['_MSC_VER']:
2235 if CONFIG['ENABLE_INTL_API']:
2238 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2239 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2242 diff --git netwerk/dns/moz.build netwerk/dns/moz.build
2243 index 79c26e3e7001..c4d93bc5f7dc 100644
2244 --- netwerk/dns/moz.build
2245 +++ netwerk/dns/moz.build
2246 @@ -69,6 +69,9 @@ LOCAL_INCLUDES += [
2250 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2251 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
2253 if CONFIG['ENABLE_INTL_API']:
2254 DEFINES['IDNA2008'] = True
2256 diff --git old-configure.in old-configure.in
2257 index 95a58b634593..b614eef85c89 100644
2258 --- old-configure.in
2259 +++ old-configure.in
2260 @@ -4888,6 +4888,27 @@ dnl ========================================================
2261 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2263 dnl ========================================================
2264 +dnl Check for graphite2
2265 +dnl ========================================================
2266 +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
2267 + dnl graphite2.pc has bogus version, check manually
2268 + _SAVE_CFLAGS=$CFLAGS
2269 + CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
2270 + AC_TRY_COMPILE([ #include <graphite2/Font.h>
2271 + #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
2272 + ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
2273 + * 100 + GR2_VERSION_BUGFIX >= \
2274 + (major) * 10000 + (minor) * 100 + (bugfix) )
2276 + #if !GR2_VERSION_REQUIRE(1,3,8)
2277 + #error "Insufficient graphite2 version."
2280 + [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
2281 + CFLAGS=$_SAVE_CFLAGS
2284 +dnl ========================================================
2285 dnl Check for pixman and cairo
2286 dnl ========================================================
2288 diff --git toolkit/library/moz.build toolkit/library/moz.build
2289 index 24f940e1ed7e..079a575adec3 100644
2290 --- toolkit/library/moz.build
2291 +++ toolkit/library/moz.build
2292 @@ -228,6 +228,12 @@ if CONFIG['MOZ_SYSTEM_JPEG']:
2293 if CONFIG['MOZ_SYSTEM_PNG']:
2294 OS_LIBS += CONFIG['MOZ_PNG_LIBS']
2296 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
2297 + OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
2299 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
2300 + OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
2302 if CONFIG['MOZ_SYSTEM_HUNSPELL']:
2303 OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
2305 diff --git toolkit/moz.configure toolkit/moz.configure
2306 index 9297e4d6f501..d8e273887e4b 100644
2307 --- toolkit/moz.configure
2308 +++ toolkit/moz.configure
2309 @@ -343,6 +343,26 @@ add_old_configure_assignment('FT2_LIBS',
2310 add_old_configure_assignment('FT2_CFLAGS',
2311 delayed_getattr(ft2_info, 'cflags'))
2314 +# ==============================================================
2315 +option('--with-system-graphite2',
2316 + help="Use system graphite2 (located with pkgconfig)")
2318 +system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
2319 + when='--with-system-graphite2')
2321 +set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
2324 +# ==============================================================
2325 +option('--with-system-harfbuzz',
2326 + help="Use system harfbuzz (located with pkgconfig)")
2328 +system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.4.1',
2329 + when='--with-system-harfbuzz')
2331 +set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
2333 # Apple platform decoder support
2334 # ==============================================================
2338 [FILE:2582:patches/patch-bug981348]
2339 diff --git dom/system/OSFileConstants.cpp dom/system/OSFileConstants.cpp
2340 index 88bba9baa401..99f240952dfe 100644
2341 --- dom/system/OSFileConstants.cpp
2342 +++ dom/system/OSFileConstants.cpp
2346 #include "sys/stat.h"
2347 -#if defined(ANDROID)
2348 +#if defined(XP_LINUX)
2349 #include <sys/vfs.h>
2350 #define statvfs statfs
2351 +#define f_frsize f_bsize
2353 #include "sys/statvfs.h"
2354 +#endif // defined(XP_LINUX)
2355 +#if !defined(ANDROID)
2356 #include "sys/wait.h"
2358 -#endif // defined(ANDROID)
2359 +#endif // !defined(ANDROID)
2360 #endif // defined(XP_UNIX)
2362 #if defined(XP_LINUX)
2363 @@ -699,7 +702,7 @@ static const dom::ConstantSpec gLibcProperties[] =
2365 { "OSFILE_SIZEOF_STATVFS", JS::Int32Value(sizeof (struct statvfs)) },
2367 - { "OSFILE_OFFSETOF_STATVFS_F_BSIZE", JS::Int32Value(offsetof (struct statvfs, f_bsize)) },
2368 + { "OSFILE_OFFSETOF_STATVFS_F_FRSIZE", JS::Int32Value(offsetof (struct statvfs, f_frsize)) },
2369 { "OSFILE_OFFSETOF_STATVFS_F_BAVAIL", JS::Int32Value(offsetof (struct statvfs, f_bavail)) },
2371 #endif // defined(XP_UNIX)
2372 diff --git toolkit/components/osfile/modules/osfile_unix_back.jsm toolkit/components/osfile/modules/osfile_unix_back.jsm
2373 index a028dda7d5ec..f5c632e3d7e5 100644
2374 --- toolkit/components/osfile/modules/osfile_unix_back.jsm
2375 +++ toolkit/components/osfile/modules/osfile_unix_back.jsm
2377 let statvfs = new SharedAll.HollowStructure("statvfs",
2378 Const.OSFILE_SIZEOF_STATVFS);
2380 - statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BSIZE,
2381 - "f_bsize", Type.unsigned_long.implementation);
2382 + statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_FRSIZE,
2383 + "f_frsize", Type.unsigned_long.implementation);
2384 statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BAVAIL,
2385 "f_bavail", Type.fsblkcnt_t.implementation);
2387 diff --git toolkit/components/osfile/modules/osfile_unix_front.jsm toolkit/components/osfile/modules/osfile_unix_front.jsm
2388 index bd60d4d8419c..a8cd6b546b0e 100644
2389 --- toolkit/components/osfile/modules/osfile_unix_front.jsm
2390 +++ toolkit/components/osfile/modules/osfile_unix_front.jsm
2392 throw_on_negative("statvfs", (UnixFile.statvfs || UnixFile.statfs)(sourcePath, fileSystemInfoPtr));
2394 let bytes = new Type.uint64_t.implementation(
2395 - fileSystemInfo.f_bsize * fileSystemInfo.f_bavail);
2396 + fileSystemInfo.f_frsize * fileSystemInfo.f_bavail);
2402 [FILE:610:patches/patch-bug991253]
2403 --- extensions/spellcheck/hunspell/glue/mozHunspell.cpp~
2404 +++ extensions/spellcheck/hunspell/glue/mozHunspell.cpp
2405 @@ -392,6 +392,14 @@ mozHunspell::LoadDictionaryList(bool aNo
2409 + // load system hunspell dictionaries
2410 + nsCOMPtr<nsIFile> hunDir;
2411 + NS_NewNativeLocalFile(NS_LITERAL_CSTRING("%%LOCALBASE%%/share/hunspell"),
2412 + true, getter_AddRefs(hunDir));
2414 + LoadDictionariesFromDir(hunDir);
2417 // find dictionaries from extensions requiring restart
2418 nsCOMPtr<nsISimpleEnumerator> dictDirs;
2419 rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST,
2422 [FILE:581:patches/patch-build-pgo-profileserver.py]
2423 --- build/pgo/profileserver.py.orig 2011-02-24 21:49:47.000000000 +0100
2424 +++ build/pgo/profileserver.py 2011-02-24 21:50:30.000000000 +0100
2425 @@ -59,7 +59,7 @@ if __name__ == '__main__':
2426 env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
2427 print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
2429 - cmdargs = ["http://localhost:%d/index.html" % PORT]
2430 + cmdargs = ["http://127.0.0.1:%d/index.html" % PORT]
2431 runner = FirefoxRunner(profile=profile,
2432 binary=build.get_binary_path(where="staged-package"),
2436 [FILE:714:patches/patch-config-baseconfig.mk]
2437 --- config/baseconfig.mk~
2438 +++ config/baseconfig.mk
2440 # directly in python/mozbuild/mozbuild/base.py for gmake validation.
2441 # We thus use INCLUDED_AUTOCONF_MK to enable/disable some parts depending
2442 # whether a normal build is happening or whether the check is running.
2443 -includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
2444 -idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
2445 -installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
2446 -sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
2447 +includedir := $(includedir)/%%MOZILLA%%
2448 +idldir = $(datadir)/idl/%%MOZILLA%%
2449 +installdir = $(libdir)/%%MOZILLA%%
2450 +sdkdir = $(libdir)/%%MOZILLA%%
2456 [FILE:886:patches/patch-env-api-keys]
2457 # Accept API keys from environment like before bug 1294585
2459 --- build/moz.configure/keyfiles.configure
2460 +++ build/moz.configure/keyfiles.configure
2461 @@ -18,6 +18,7 @@ def keyfile(desc, help=None, callback=lambda x: x):
2462 @checking('for the %s key' % desc, lambda x: x and x is not no_key)
2463 @imports(_from='__builtin__', _import='open')
2464 @imports(_from='__builtin__', _import='IOError')
2465 + @imports(_from='os', _import='environ')
2469 @@ -28,7 +29,7 @@ def keyfile(desc, help=None, callback=lambda x: x):
2470 raise FatalCheckError("'%s' is empty." % value[0])
2471 except IOError as e:
2472 raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
2474 + return environ.get('MOZ_%s_KEY' % desc.upper().replace(' ', '_')) or no_key
2480 [FILE:21645:patches/patch-ijg-libjpeg]
2481 # Partially revert bug 791305 to allow building with system IJG jpeg library
2483 diff --git old-configure.in configure.in
2484 index f0aeb5d..1c01010 100644
2485 --- old-configure.in
2486 +++ old-configure.in
2487 @@ -4027,11 +4027,7 @@ if test "$MOZ_SYSTEM_JPEG" = 1; then
2488 #include <jpeglib.h> ],
2489 [ #if JPEG_LIB_VERSION < $MOZJPEG
2490 #error "Insufficient JPEG library version ($MOZJPEG required)."
2492 - #ifndef JCS_EXTENSIONS
2493 - #error "libjpeg-turbo JCS_EXTENSIONS required"
2498 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
2500 diff --git image/decoders/nsJPEGDecoder.cpp image/decoders/nsJPEGDecoder.cpp
2501 index 8fa8200..1d2a259 100644
2502 --- image/decoders/nsJPEGDecoder.cpp
2503 +++ image/decoders/nsJPEGDecoder.cpp
2507 #include "iccjpeg.h"
2510 +#ifdef JCS_EXTENSIONS
2512 #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
2514 #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
2517 +/* Colorspace conversion (copied from jpegint.h) */
2518 +struct jpeg_color_deconverter {
2519 + JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
2520 + JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
2521 + JSAMPIMAGE input_buf, JDIMENSION input_row,
2522 + JSAMPARRAY output_buf, int num_rows));
2526 +ycc_rgb_convert_argb (j_decompress_ptr cinfo,
2527 + JSAMPIMAGE input_buf, JDIMENSION input_row,
2528 + JSAMPARRAY output_buf, int num_rows);
2532 static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
2534 @@ -367,6 +382,7 @@ nsJPEGDecoder::WriteInternal(const char*
2538 +#ifdef JCS_EXTENSIONS
2539 // if we're not color managing we can decode directly to
2540 // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
2541 if (mCMSMode != eCMSMode_All) {
2542 @@ -375,6 +391,9 @@ nsJPEGDecoder::WriteInternal(const char*
2544 mInfo.out_color_space = JCS_RGB;
2547 + mInfo.out_color_space = JCS_RGB;
2552 @@ -448,6 +467,16 @@ nsJPEGDecoder::WriteInternal(const char*
2553 return; // I/O suspension
2556 +#ifndef JCS_EXTENSIONS
2557 + /* Force to use our YCbCr to Packed RGB converter when possible */
2558 + if (!mTransform && (mCMSMode != eCMSMode_All) &&
2559 + mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
2560 + /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
2561 + mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
2562 + mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
2566 // If this is a progressive JPEG ...
2567 mState = mInfo.buffered_image ?
2568 JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
2569 @@ -605,7 +633,11 @@ nsJPEGDecoder::OutputScanlines(bool* sus
2570 uint32_t* imageRow = ((uint32_t*)mImageData) +
2571 (mInfo.output_scanline * mInfo.output_width);
2573 +#ifdef JCS_EXTENSIONS
2574 if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
2576 + if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
2578 // Special case: scanline will be directly converted into packed ARGB
2579 if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
2580 *suspend = true; // suspend
2581 @@ -920,6 +952,282 @@ term_source (j_decompress_ptr jd)
2582 } // namespace mozilla
2585 +#ifndef JCS_EXTENSIONS
2586 +/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
2589 + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
2590 + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
2591 + * The conversion equations to be implemented are therefore
2592 + * R = Y + 1.40200 * Cr
2593 + * G = Y - 0.34414 * Cb - 0.71414 * Cr
2594 + * B = Y + 1.77200 * Cb
2595 + * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
2596 + * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
2598 + * To avoid floating-point arithmetic, we represent the fractional constants
2599 + * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
2600 + * the products by 2^16, with appropriate rounding, to get the correct answer.
2601 + * Notice that Y, being an integral input, does not contribute any fraction
2602 + * so it need not participate in the rounding.
2604 + * For even more speed, we avoid doing any multiplications in the inner loop
2605 + * by precalculating the constants times Cb and Cr for all possible values.
2606 + * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
2607 + * for 12-bit samples it is still acceptable. It's not very reasonable for
2608 + * 16-bit samples, but if you want lossless storage you shouldn't be changing
2609 + * colorspace anyway.
2610 + * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
2611 + * values for the G calculation are left scaled up, since we must add them
2612 + * together before rounding.
2615 +#define SCALEBITS 16 /* speediest right-shift on some machines */
2617 +/* Use static tables for color processing. */
2618 +/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
2620 +const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
2621 + -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
2622 + -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
2623 + -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
2624 + -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
2625 + -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
2626 + -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
2627 + -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
2628 + -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
2629 + -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
2630 + -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
2631 + -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
2632 + -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
2633 + -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
2634 + -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
2635 + -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
2636 + -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
2637 + -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
2638 + -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
2639 + -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
2640 + -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
2641 + -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
2642 + -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
2643 + 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
2644 + 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
2645 + 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
2646 + 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
2647 + 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
2648 + 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
2649 + 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
2650 + 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
2651 + 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
2652 + 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
2653 + 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
2654 + 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
2655 + 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
2656 + 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
2657 + 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
2658 + 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
2659 + 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
2660 + 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
2661 + 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
2662 + 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
2663 + 0xae, 0xaf, 0xb1, 0xb2,
2666 +const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
2667 + -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
2668 + -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
2669 + -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
2670 + -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
2671 + -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
2672 + -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
2673 + -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
2674 + -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
2675 + -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
2676 + -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
2677 + -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
2678 + -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
2679 + -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
2680 + -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
2681 + -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
2682 + -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
2683 + -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
2684 + -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
2685 + -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
2686 + -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
2687 + -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
2688 + -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
2689 + 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
2690 + 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
2691 + 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
2692 + 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
2693 + 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
2694 + 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
2695 + 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
2696 + 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
2697 + 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
2698 + 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
2699 + 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
2700 + 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
2701 + 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
2702 + 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
2703 + 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
2704 + 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
2705 + 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
2706 + 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
2707 + 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
2708 + 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
2709 + 0xdc, 0xde, 0xdf, 0xe1,
2712 +const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
2713 + 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
2714 + 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
2715 + 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
2716 + 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
2717 + 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
2718 + 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
2719 + 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
2720 + 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
2721 + 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
2722 + 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
2723 + 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
2724 + 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
2725 + 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
2726 + 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
2727 + 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
2728 + 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
2729 + 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
2730 + 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
2731 + 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
2732 + 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
2733 + 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
2734 + 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
2735 + -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
2736 + -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
2737 + -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
2738 + -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
2739 + -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
2740 + -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
2741 + -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
2742 + -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
2743 + -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
2744 + -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
2745 + -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
2746 + -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
2747 + -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
2748 + -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
2749 + -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
2750 + -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
2751 + -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
2752 + -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
2753 + -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
2754 + -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
2755 + -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
2758 +const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
2759 + 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
2760 + 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
2761 + 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
2762 + 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
2763 + 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
2764 + 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
2765 + 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
2766 + 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
2767 + 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
2768 + 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
2769 + 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
2770 + 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
2771 + 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
2772 + 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
2773 + 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
2774 + 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
2775 + 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
2776 + 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
2777 + 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
2778 + 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
2779 + 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
2780 + 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
2781 + -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
2782 + -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
2783 + -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
2784 + -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
2785 + -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
2786 + -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
2787 + -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
2788 + -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
2789 + -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
2790 + -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
2791 + -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
2792 + -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
2793 + -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
2794 + -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
2795 + -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
2796 + -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
2797 + -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
2798 + -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
2799 + -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
2800 + -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
2801 + -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
2805 +/* We assume that right shift corresponds to signed division by 2 with
2806 + * rounding towards minus infinity. This is correct for typical "arithmetic
2807 + * shift" instructions that shift in copies of the sign bit. But some
2808 + * C compilers implement >> with an unsigned shift. For these machines you
2809 + * must define RIGHT_SHIFT_IS_UNSIGNED.
2810 + * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
2811 + * It is only applied with constant shift counts. SHIFT_TEMPS must be
2812 + * included in the variables of any routine using RIGHT_SHIFT.
2815 +#ifdef RIGHT_SHIFT_IS_UNSIGNED
2816 +#define SHIFT_TEMPS INT32 shift_temp;
2817 +#define RIGHT_SHIFT(x,shft) \
2818 + ((shift_temp = (x)) < 0 ? \
2819 + (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
2820 + (shift_temp >> (shft)))
2822 +#define SHIFT_TEMPS
2823 +#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
2828 +ycc_rgb_convert_argb (j_decompress_ptr cinfo,
2829 + JSAMPIMAGE input_buf, JDIMENSION input_row,
2830 + JSAMPARRAY output_buf, int num_rows)
2832 + JDIMENSION num_cols = cinfo->output_width;
2833 + JSAMPLE * range_limit = cinfo->sample_range_limit;
2837 + /* This is used if we don't have SSE2 */
2839 + while (--num_rows >= 0) {
2840 + JSAMPROW inptr0 = input_buf[0][input_row];
2841 + JSAMPROW inptr1 = input_buf[1][input_row];
2842 + JSAMPROW inptr2 = input_buf[2][input_row];
2844 + uint32_t *outptr = (uint32_t *) *output_buf++;
2845 + for (JDIMENSION col = 0; col < num_cols; col++) {
2846 + int y = GETJSAMPLE(inptr0[col]);
2847 + int cb = GETJSAMPLE(inptr1[col]);
2848 + int cr = GETJSAMPLE(inptr2[col]);
2849 + JSAMPLE * range_limit_y = range_limit + y;
2850 + /* Range-limiting is essential due to noise introduced by DCT losses. */
2851 + outptr[col] = 0xFF000000 |
2852 + ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
2853 + ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
2854 + ( range_limit_y[Cb_b_tab[cb]] );
2861 ///*************** Inverted CMYK -> RGB conversion *************************
2862 /// Input is (Inverted) CMYK stored as 4 bytes per pixel.
2863 /// Output is RGB stored as 3 bytes per pixel.
2866 [FILE:536:patches/patch-sample-type]
2867 # Let ports handle default sample type
2869 --- old-configure.in~
2870 +++ old-configure.in
2871 @@ -5144,7 +5144,7 @@ dnl Use integers over floats for audio o
2872 dnl (regarless of the CPU architecture, because audio
2873 dnl backends for those platforms don't support floats. We also
2874 dnl use integers on ARM with other OS, because it's more efficient.
2875 -if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2876 +if test -n "$MOZ_INTEGER_SAMPLES"; then
2877 MOZ_SAMPLE_TYPE_S16=1
2878 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2879 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2882 [FILE:675:patches/patch-toolkit_mozapps_installer_packager_mk]
2883 $OpenBSD: patch-toolkit_mozapps_installer_packager_mk,v 1.11 2012/06/11 15:29:56 landry Exp $
2884 install headers/idl/sdk libs only if xulrunner
2885 --- toolkit/mozapps/installer/packager.mk.orig Fri Jun 1 14:04:20 2012
2886 +++ toolkit/mozapps/installer/packager.mk Tue Jun 5 07:55:51 2012
2887 @@ -127,7 +127,7 @@ endif
2888 $(NSINSTALL) -D $(DESTDIR)$(bindir)
2889 $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
2890 ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
2891 -ifdef INSTALL_SDK # Here comes the hard part
2892 +ifeq ($(MOZ_APP_NAME),xulrunner)
2893 $(NSINSTALL) -D $(DESTDIR)$(includedir)
2894 (cd $(DIST)/include && tar $(TAR_CREATE_FLAGS) - .) | \
2895 (cd $(DESTDIR)$(includedir) && tar -xf -)
2898 [FILE:16913:patches/patch-z-bug517422]
2899 # Allow more config/external/ libs built against system-wide version.
2901 diff --git build/moz.configure/old.configure build/moz.configure/old.configure
2902 index d0fe7accffe6..c46bdd023225 100644
2903 --- build/moz.configure/old.configure
2904 +++ build/moz.configure/old.configure
2905 @@ -288,7 +288,12 @@ def old_configure_options(*options):
2906 '--with-system-libvpx',
2907 '--with-system-nspr',
2908 '--with-system-nss',
2909 + '--with-system-ogg',
2910 '--with-system-png',
2911 + '--with-system-soundtouch',
2912 + '--with-system-theora',
2913 + '--with-system-tremor',
2914 + '--with-system-vorbis',
2915 '--with-system-zlib',
2917 '--with-thumb-interwork',
2918 diff --git config/Makefile.in config/Makefile.in
2919 index a6206bb0ff30..f20987c61754 100644
2920 --- config/Makefile.in
2921 +++ config/Makefile.in
2922 @@ -51,6 +51,11 @@ export:: $(export-preqs)
2923 -DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \
2924 -DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \
2925 -DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \
2926 + -DMOZ_SYSTEM_OGG=$(MOZ_SYSTEM_OGG) \
2927 + -DMOZ_SYSTEM_THEORA=$(MOZ_SYSTEM_THEORA) \
2928 + -DMOZ_SYSTEM_VORBIS=$(MOZ_SYSTEM_VORBIS) \
2929 + -DMOZ_SYSTEM_TREMOR=$(MOZ_SYSTEM_TREMOR) \
2930 + -DMOZ_SYSTEM_SOUNDTOUCH=$(MOZ_SYSTEM_SOUNDTOUCH) \
2931 $(srcdir)/system-headers $(srcdir)/stl-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
2932 $(INSTALL) system_wrappers $(DIST)
2934 diff --git config/external/moz.build config/external/moz.build
2935 index 029ff8504795..2c3a40caa1ba 100644
2936 --- config/external/moz.build
2937 +++ config/external/moz.build
2938 @@ -21,12 +21,21 @@ if CONFIG['MOZ_UPDATER']:
2939 external_dirs += ['modules/brotli']
2940 external_dirs += ['modules/woff2']
2942 -if CONFIG['MOZ_VORBIS']:
2943 +if not CONFIG['MOZ_SYSTEM_OGG']:
2944 + external_dirs += ['media/libogg']
2946 +if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
2947 external_dirs += ['media/libvorbis']
2949 -if CONFIG['MOZ_TREMOR']:
2950 +if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
2951 external_dirs += ['media/libtremor']
2953 +if not CONFIG['MOZ_SYSTEM_THEORA']:
2954 + external_dirs += ['media/libtheora']
2956 +if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
2957 + external_dirs += ['media/libsoundtouch']
2959 if CONFIG['MOZ_WEBM_ENCODER']:
2960 external_dirs += ['media/libmkv']
2962 @@ -52,12 +61,9 @@ external_dirs += [
2968 - 'media/libtheora',
2969 'media/libspeex_resampler',
2970 'media/libstagefright',
2971 - 'media/libsoundtouch',
2975 diff --git config/system-headers config/system-headers
2976 index 5ee7f71f9634..13178ac3b3ab 100644
2977 --- config/system-headers
2978 +++ config/system-headers
2979 @@ -1348,3 +1348,17 @@ unicode/utypes.h
2983 +#if MOZ_SYSTEM_OGG==1
2987 +#if MOZ_SYSTEM_THEORA==1
2990 +#if MOZ_SYSTEM_VORBIS==1
2994 +#if MOZ_SYSTEM_TREMOR==1
2995 +tremor/ivorbiscodec.h
2997 diff --git dom/media/AudioStream.cpp dom/media/AudioStream.cpp
2998 index 93ecda4319af..ff674c64ea07 100644
2999 --- dom/media/AudioStream.cpp
3000 +++ dom/media/AudioStream.cpp
3001 @@ -115,7 +115,9 @@ AudioStream::AudioStream(DataSource& aSource)
3002 : mMonitor("AudioStream")
3005 +#ifndef MOZ_SYSTEM_SOUNDTOUCH
3006 , mTimeStretcher(nullptr)
3008 , mDumpFile(nullptr)
3009 , mState(INITIALIZED)
3010 , mDataSource(aSource)
3011 @@ -130,9 +132,11 @@ AudioStream::~AudioStream()
3015 +#ifndef MOZ_SYSTEM_SOUNDTOUCH
3016 if (mTimeStretcher) {
3017 soundtouch::destroySoundTouchObj(mTimeStretcher);
3023 @@ -151,7 +155,11 @@ nsresult AudioStream::EnsureTimeStretcherInitializedUnlocked()
3025 mMonitor.AssertCurrentThreadOwns();
3026 if (!mTimeStretcher) {
3027 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
3028 + mTimeStretcher = new soundtouch::SoundTouch();
3030 mTimeStretcher = soundtouch::createSoundTouchObj();
3032 mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
3033 mTimeStretcher->setChannels(mOutChannels);
3034 mTimeStretcher->setPitch(1.0);
3035 diff --git dom/media/AudioStream.h dom/media/AudioStream.h
3036 index 7dc1f60f95cc..67d402a4117f 100644
3037 --- dom/media/AudioStream.h
3038 +++ dom/media/AudioStream.h
3040 #include "mozilla/TimeStamp.h"
3041 #include "mozilla/UniquePtr.h"
3042 #include "CubebUtils.h"
3043 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
3044 +#include "soundtouch/SoundTouch.h"
3046 #include "soundtouch/SoundTouchFactory.h"
3051 @@ -287,7 +291,11 @@ private:
3053 uint32_t mOutChannels;
3054 AudioClock mAudioClock;
3055 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
3056 + nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
3058 soundtouch::SoundTouch* mTimeStretcher;
3061 // Output file for dumping audio
3063 diff --git dom/media/moz.build dom/media/moz.build
3064 index 86b051c58d33..fb6186dce78b 100644
3065 --- dom/media/moz.build
3066 +++ dom/media/moz.build
3067 @@ -308,6 +308,21 @@ if CONFIG['MOZ_WEBRTC']:
3069 DEFINES['MOZILLA_INTERNAL_API'] = True
3071 +if CONFIG['MOZ_SYSTEM_OGG']:
3072 + CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
3074 +if CONFIG['MOZ_SYSTEM_THEORA']:
3075 + CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
3077 +if CONFIG['MOZ_SYSTEM_VORBIS']:
3078 + CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
3080 +if CONFIG['MOZ_SYSTEM_TREMOR']:
3081 + CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
3083 +if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
3084 + CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
3086 if CONFIG['OS_TARGET'] == 'WINNT':
3087 DEFINES['WEBRTC_WIN'] = True
3089 diff --git dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
3090 index 078f6ea5ef60..c600db067539 100644
3091 --- dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
3092 +++ dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
3097 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
3098 +#include "nsXPCOMPrivate.h" // for XUL_DLL
3100 // We use a known symbol located in lgpllibs to determine its location.
3101 // soundtouch happens to be always included in lgpllibs
3102 #include "soundtouch/SoundTouch.h"
3107 @@ -50,6 +54,12 @@ FFVPXRuntimeLinker::Init()
3109 sLinkStatus = LinkStatus_FAILED;
3111 +#ifdef MOZ_SYSTEM_SOUNDTOUCH
3112 + // We retrieve the path of the XUL library as this is where mozavcodec and
3113 + // mozavutil libs are located.
3115 + PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
3117 // We retrieve the path of the lgpllibs library as this is where mozavcodec
3118 // and mozavutil libs are located.
3119 char* lgpllibsname = PR_GetLibraryName(nullptr, "lgpllibs");
3120 @@ -60,6 +70,7 @@ FFVPXRuntimeLinker::Init()
3121 PR_GetLibraryFilePathname(lgpllibsname,
3122 (PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
3123 PR_FreeLibraryName(lgpllibsname);
3128 diff --git media/libogg/README_MOZILLA media/libogg/README_MOZILLA
3129 index 6213fdc7770c..ada799916a17 100644
3130 --- media/libogg/README_MOZILLA
3131 +++ media/libogg/README_MOZILLA
3132 @@ -6,3 +6,6 @@ package downloaded from xiph.org and copied using the update.sh script.
3133 The int-types.patch address a bug that config_types.h generated from
3134 Linux platform can't be used on OpenSolaris directly see Mozilla bug
3137 +The in-tree copy may be omitted during build by --with-system-ogg.
3138 +Keep version in old-configure.in in sync on updates.
3139 diff --git media/libsoundtouch/README_MOZILLA media/libsoundtouch/README_MOZILLA
3140 index dc0dbe8f6886..ea73b55e3e39 100644
3141 --- media/libsoundtouch/README_MOZILLA
3142 +++ media/libsoundtouch/README_MOZILLA
3143 @@ -6,3 +6,5 @@ The whole library is not used, only the relevant files are imported in the tree,
3144 using the script `update.sh`. Some changes have been made to the files, using
3145 the patch `moz-libsoundtouch.patch`. We also use a custom soundtouch_config.h.
3147 +The in-tree copy may be omitted during build by --with-system-soundtouch.
3148 +Keep version in old-configure.in in sync on updates.
3149 diff --git media/libsoundtouch/src/soundtouch_perms.h media/libsoundtouch/src/soundtouch_perms.h
3150 index 0af2fe618311..10973564e7a4 100644
3151 --- media/libsoundtouch/src/soundtouch_perms.h
3152 +++ media/libsoundtouch/src/soundtouch_perms.h
3155 #pragma GCC visibility push(default)
3156 #include "SoundTouch.h"
3157 +#ifndef MOZ_SYSTEM_SOUNDTOUCH
3158 #include "SoundTouchFactory.h"
3160 #pragma GCC visibility pop
3162 #endif // MOZILLA_SOUNDTOUCH_PERMS_H
3163 diff --git media/libtheora/README_MOZILLA media/libtheora/README_MOZILLA
3164 index d48dbfa6f63d..6f30f250220e 100644
3165 --- media/libtheora/README_MOZILLA
3166 +++ media/libtheora/README_MOZILLA
3167 @@ -3,3 +3,6 @@ using the update.sh script. The changes made were those applied by update.sh,
3168 the addition/update of Makefile.in files for the Mozilla build system.
3170 The subversion revision used was r17578.
3172 +The in-tree copy may be omitted during build by --with-system-theora.
3173 +Keep version in old-configure.in in sync on updates.
3174 diff --git media/libtheora/moz.build media/libtheora/moz.build
3175 index c7f85eebff95..aae7b814adb5 100644
3176 --- media/libtheora/moz.build
3177 +++ media/libtheora/moz.build
3178 @@ -21,6 +21,9 @@ FINAL_LIBRARY = 'gkmedias'
3179 # The encoder is currently not included.
3180 DEFINES['THEORA_DISABLE_ENCODE'] = True
3182 +if CONFIG['MOZ_SYSTEM_OGG']:
3183 + CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
3185 # Suppress warnings in third-party code.
3186 if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
3187 CFLAGS += ['-Wno-type-limits']
3188 diff --git media/libtremor/README_MOZILLA media/libtremor/README_MOZILLA
3189 index ee67b53a05c5..81c971773d55 100644
3190 --- media/libtremor/README_MOZILLA
3191 +++ media/libtremor/README_MOZILLA
3192 @@ -5,3 +5,6 @@ Makefile.in files for the Mozilla build system.
3194 The upstream release used was http://svn.xiph.org/trunk/Tremor/
3195 The subversion revision used was r17547.
3197 +The in-tree copy may be omitted during build by --with-system-tremor.
3198 +Keep version in old-configure.in in sync on updates.
3199 diff --git media/libtremor/moz.build media/libtremor/moz.build
3200 index 83afc8e37c64..71ef159da3d7 100644
3201 --- media/libtremor/moz.build
3202 +++ media/libtremor/moz.build
3203 @@ -9,3 +9,5 @@ with Files('*'):
3205 DIRS += ['include/tremor', 'lib']
3207 +if CONFIG['MOZ_SYSTEM_OGG']:
3208 + CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
3209 diff --git media/libvorbis/README_MOZILLA media/libvorbis/README_MOZILLA
3210 index 1211ac074b33..eb31084aed25 100644
3211 --- media/libvorbis/README_MOZILLA
3212 +++ media/libvorbis/README_MOZILLA
3213 @@ -8,3 +8,6 @@ https://svn.xiph.org/tags/vorbis/libvorbis-1.3.5@19464
3215 Some files are renamed during the copy to prevent clashes with object
3216 file names with other Mozilla libraries.
3218 +The in-tree copy may be omitted during build by --with-system-vorbis.
3219 +Keep version in old-configure.in in sync on updates.
3220 diff --git media/libvorbis/moz.build media/libvorbis/moz.build
3221 index adf393782cc9..923b76231107 100644
3222 --- media/libvorbis/moz.build
3223 +++ media/libvorbis/moz.build
3224 @@ -56,3 +56,6 @@ FINAL_LIBRARY = 'gkmedias'
3225 # Suppress warnings in third-party code.
3226 if CONFIG['GNU_CC']:
3227 CFLAGS += ['-Wno-uninitialized']
3229 +if CONFIG['MOZ_SYSTEM_OGG']:
3230 + CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
3231 diff --git old-configure.in old-configure.in
3232 index b614eef85c89..85f9099dba4d 100644
3233 --- old-configure.in
3234 +++ old-configure.in
3235 @@ -2941,6 +2941,111 @@ if test -n "$MOZ_OMX_PLUGIN"; then
3239 +dnl ========================================================
3240 +dnl Check for libogg
3241 +dnl ========================================================
3243 +MOZ_ARG_WITH_BOOL(system-ogg,
3244 +[ --with-system-ogg Use system libogg (located with pkgconfig)],
3248 +if test -n "$MOZ_SYSTEM_OGG"; then
3249 + PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.0)
3252 + LIBS="$LIBS $MOZ_OGG_LIBS"
3253 + AC_CHECK_FUNC(ogg_set_mem_functions, [],
3254 + [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
3258 +AC_SUBST(MOZ_SYSTEM_OGG)
3260 +dnl ========================================================
3261 +dnl Check for libvorbis
3262 +dnl ========================================================
3264 +MOZ_ARG_WITH_BOOL(system-vorbis,
3265 +[ --with-system-vorbis Use system libvorbis (located with pkgconfig)],
3266 +MOZ_SYSTEM_VORBIS=1,
3267 +MOZ_SYSTEM_VORBIS=)
3269 +if test -n "$MOZ_SYSTEM_VORBIS"; then
3270 + PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.5)
3273 +AC_SUBST(MOZ_SYSTEM_VORBIS)
3275 +dnl ========================================================
3276 +dnl Check for integer-only libvorbis aka tremor
3277 +dnl ========================================================
3279 +MOZ_ARG_WITH_BOOL(system-tremor,
3280 +[ --with-system-tremor Use system libtremor (located with pkgconfig)],
3281 +MOZ_SYSTEM_TREMOR=1,
3282 +MOZ_SYSTEM_TREMOR=)
3284 +if test -n "$MOZ_SYSTEM_TREMOR"; then
3285 + PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
3288 +AC_SUBST(MOZ_SYSTEM_TREMOR)
3290 +dnl ========================================================
3291 +dnl Check for libtheora
3292 +dnl ========================================================
3294 +MOZ_ARG_WITH_BOOL(system-theora,
3295 +[ --with-system-theora Use system libtheora (located with pkgconfig)],
3296 +MOZ_SYSTEM_THEORA=1,
3297 +MOZ_SYSTEM_THEORA=)
3299 +if test -n "$MOZ_SYSTEM_THEORA"; then
3300 + PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
3303 +AC_SUBST(MOZ_SYSTEM_THEORA)
3305 +dnl ========================================================
3306 +dnl Check for libSoundTouch
3307 +dnl ========================================================
3309 +MOZ_ARG_WITH_BOOL(system-soundtouch,
3310 +[ --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
3311 +MOZ_SYSTEM_SOUNDTOUCH=1,
3312 +MOZ_SYSTEM_SOUNDTOUCH=)
3314 +if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
3315 + PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
3319 + _SAVE_CXXFLAGS=$CXXFLAGS
3320 + CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
3321 + AC_CACHE_CHECK(for soundtouch sample type,
3322 + ac_cv_soundtouch_sample_type,
3323 + [AC_TRY_COMPILE([#include <SoundTouch.h>
3324 + #ifndef SOUNDTOUCH_INTEGER_SAMPLES
3325 + #error soundtouch expects float samples
3328 + [ac_cv_soundtouch_sample_type=short],
3329 + [ac_cv_soundtouch_sample_type=float])])
3330 + CXXFLAGS=$_SAVE_CXXFLAGS
3333 + if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
3334 + -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
3335 + 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.])
3339 +if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
3340 + AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
3342 +AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
3344 dnl system libvpx Support
3345 dnl ========================================================
3346 MOZ_ARG_WITH_BOOL(system-libvpx,
3347 diff --git toolkit/library/moz.build toolkit/library/moz.build
3348 index 079a575adec3..514d901195de 100644
3349 --- toolkit/library/moz.build
3350 +++ toolkit/library/moz.build
3351 @@ -237,6 +237,21 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
3352 if CONFIG['MOZ_SYSTEM_HUNSPELL']:
3353 OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
3355 +if CONFIG['MOZ_SYSTEM_OGG']:
3356 + OS_LIBS += CONFIG['MOZ_OGG_LIBS']
3358 +if CONFIG['MOZ_SYSTEM_THEORA']:
3359 + OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
3361 +if CONFIG['MOZ_SYSTEM_VORBIS']:
3362 + OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
3364 +if CONFIG['MOZ_SYSTEM_TREMOR']:
3365 + OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
3367 +if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
3368 + OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
3370 if CONFIG['MOZ_SYSTEM_LIBEVENT']:
3371 OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
3373 diff --git xpcom/build/XPCOMInit.cpp xpcom/build/XPCOMInit.cpp
3374 index c083ab4bc4f3..62b917043a2c 100644
3375 --- xpcom/build/XPCOMInit.cpp
3376 +++ xpcom/build/XPCOMInit.cpp
3377 @@ -154,7 +154,9 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
3379 #include "mozilla/ipc/GeckoChildProcessHost.h"
3381 +#ifndef MOZ_OGG_NO_MEM_REPORTING
3382 #include "ogg/ogg.h"
3384 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
3385 #if defined(HAVE_STDINT_H)
3386 // mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
3387 @@ -664,11 +666,13 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
3389 mozilla::SetICUMemoryFunctions();
3391 +#ifndef MOZ_OGG_NO_MEM_REPORTING
3392 // Do the same for libogg.
3393 ogg_set_mem_functions(OggReporter::CountingMalloc,
3394 OggReporter::CountingCalloc,
3395 OggReporter::CountingRealloc,
3396 OggReporter::CountingFree);
3399 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
3403 [FILE:6900:files/firefox.desktop.in]
3406 Name=@MOZILLA_NAME@ Web Browser
3409 Name[az]=@MOZILLA_NAME@ Veb Səyyahı
3411 Name[bg]=Интернет браузър @MOZILLA_NAME@
3413 Name[bs]=@MOZILLA_NAME@ web preglednik
3414 Name[ca]=Navegador web @MOZILLA_NAME@
3415 Name[cs]=Prohlížeč WWW @MOZILLA_NAME@
3416 Name[cy]=Y Porwr Gwe @MOZILLA_NAME@
3417 Name[da]=@MOZILLA_NAME@ - internetsurfning
3418 Name[de]=@MOZILLA_NAME@ Webbrowser
3419 Name[el]=Περιηγητής Διαδικτύου @MOZILLA_NAME@
3420 Name[en_CA]=@MOZILLA_NAME@ Web Browser
3421 Name[en_GB]=@MOZILLA_NAME@ Web Browser
3422 Name[es]=Navegador Web @MOZILLA_NAME@
3423 Name[et]=@MOZILLA_NAME@ veebibrauser
3424 Name[eu]=@MOZILLA_NAME@ web arakatzailea
3425 Name[fi]=@MOZILLA_NAME@, WWW-selain
3426 Name[fr]=Navigateur Web @MOZILLA_NAME@
3427 Name[ga]=Brabhsálaí Lín @MOZILLA_NAME@
3428 Name[gu]=એપીફની વૅબ બ્રાઉઝર
3429 Name[he]=דפדפן @MOZILLA_NAME@
3431 Name[hr]=@MOZILLA_NAME@ Web preglednik
3432 Name[hu]=@MOZILLA_NAME@ webböngésző
3433 Name[id]=Web Browser @MOZILLA_NAME@
3434 Name[it]=Browser web @MOZILLA_NAME@
3435 Name[ja]=@MOZILLA_NAME@ ウェブ・ブラウザ
3436 Name[ko]=@MOZILLA_NAME@ 웹 브라우저
3437 Name[li]=@MOZILLA_NAME@ Web Browser
3438 Name[lt]=@MOZILLA_NAME@ web naršyklė
3439 Name[mk]=@MOZILLA_NAME@ веб прелистувач
3440 Name[ml]=എപ്പിഫാനി വെബ്ബ് ബ്രൌസര്
3441 Name[mn]=@MOZILLA_NAME@ веб хөтөч
3442 Name[ms]=Pelungsur Web @MOZILLA_NAME@
3443 Name[nb]=@MOZILLA_NAME@ nettleser
3444 Name[nl]=@MOZILLA_NAME@ Webbrowser
3445 Name[nn]=@MOZILLA_NAME@ nettlesar
3446 Name[no]=@MOZILLA_NAME@ nettleser
3447 Name[pa]=ਏਪੀਫਾਨੀ ਵੈੱਬ ਬਰਾਊਜ਼ਰ
3448 Name[pl]=Przeglądarka WWW @MOZILLA_NAME@
3449 Name[pt]=Navegador Web @MOZILLA_NAME@
3450 Name[pt_BR]=Navegador Web @MOZILLA_NAME@
3451 Name[ro]=Navigatorul @MOZILLA_NAME@
3452 Name[ru]=Веб-браузер @MOZILLA_NAME@
3454 Name[sl]=Spletni brskalnik @MOZILLA_NAME@
3455 Name[sq]=@MOZILLA_NAME@ - Shfletuesi Web
3457 Name[sr@Latn]=Veb čitač Spoznaja
3458 Name[sv]=Webbläsaren @MOZILLA_NAME@
3459 Name[ta]=எபிபனி வலை உலாவி
3460 Name[tk]=@MOZILLA_NAME@ Web Ahtarçisi
3461 Name[tr]=@MOZILLA_NAME@ Web Tarayıcı
3462 Name[uk]=Переглядач web @MOZILLA_NAME@
3463 Name[vi]=Trình Duyệt Web @MOZILLA_NAME@
3464 Name[wa]=Betchteu waibe epiphany
3465 Name[zh_CN]=@MOZILLA_NAME@ Web 浏览器
3466 Name[zh_TW]=@MOZILLA_NAME@ 網頁瀏覽器
3467 GenericName=Web Browser
3468 GenericName[ar]=متصفّح الانترنت
3469 GenericName[az]=Veb Səyyahı
3470 GenericName[be]=Вандроўнік па павуціньню
3471 GenericName[bg]=Браузър
3472 GenericName[bn]=ওয়েব ব্রাউজার
3473 GenericName[bs]=Web preglednik
3474 GenericName[ca]=Navegador web
3475 GenericName[cs]=Prohlížeč WWW
3476 GenericName[cy]=Porwr Gwe
3477 GenericName[da]=Internetsurfning
3478 GenericName[de]=Webbrowser
3479 GenericName[el]=Περιηγητής Ιστοσελίδων
3480 GenericName[en_CA]=Web Browser
3481 GenericName[en_GB]=Web Browser
3482 GenericName[es]=Navegador web
3483 GenericName[et]=Veebilehitseja
3484 GenericName[eu]=Web arakatzailea
3485 GenericName[fi]=WWW-selain
3486 GenericName[fr]=Navigateur Web @MOZILLA_NAME@
3487 GenericName[ga]=Brabhsálaí Lín
3488 GenericName[gu]=વેબ બ્રાઉઝર
3489 GenericName[he]=דפדפן אינטרנט
3490 GenericName[hi]=वेब ब्राउज़र
3491 GenericName[hr]=Web preglednik
3492 GenericName[hu]=Webböngésző
3493 GenericName[id]=Browser Web
3494 GenericName[it]=Browser web
3495 GenericName[ja]=GNOME ウェブ・ブラウザ
3496 GenericName[ko]=웹 브라우저
3497 GenericName[li]=Wèb Browser
3498 GenericName[lt]=Web naršyklė
3499 GenericName[mk]=Веб прелистувач
3500 GenericName[mn]=Веб хөтөч
3501 GenericName[ms]=Pelungsur Web
3502 GenericName[nb]=Nettleser
3503 GenericName[nl]=Web-browser
3504 GenericName[nn]=Nettlesar
3505 GenericName[no]=Nettleser
3506 GenericName[pa]=ਵੈਬ ਬਰਾਊਜ਼
3507 GenericName[pl]=Przeglądarka WWW
3508 GenericName[pt]=Navegador Web
3509 GenericName[pt_BR]=Navegador Web
3510 GenericName[ro]=Navigator Internet
3511 GenericName[ru]=Веб-браузер
3512 GenericName[sk]=WWW prehliadač
3513 GenericName[sl]=Spletni brskalnik
3514 GenericName[sq]=Shfletuesi Web
3515 GenericName[sr]=Веб читач
3516 GenericName[sr@Latn]=Veb čitač
3517 GenericName[sv]=Webbläsare
3518 GenericName[ta]=வலை உலாவி
3519 GenericName[th]=เว็บบราวเซอร์
3520 GenericName[tk]=Web Ahtarçysy
3521 GenericName[tr]=Web Tarayıcı
3522 GenericName[uk]=Переглядач web-сторінок
3523 GenericName[vi]=Trình duyệt Web
3524 GenericName[wa]=Betchteu waibe
3525 GenericName[zh_CN]=Web 浏览器
3526 GenericName[zh_TW]=網頁瀏覽器
3527 Comment=Browse the web
3528 Comment[ar]=تصفح الانترنت
3529 Comment[az]=Vebi gəzin
3530 Comment[be]=Вандраваць па павуціньню
3531 Comment[bg]=Сърфиране в интернет
3532 Comment[bn]=ওয়েব ব্রাউজ করুন
3533 Comment[bs]=Pregledaj na internetu
3534 Comment[ca]=Navegueu per la web
3535 Comment[cs]=Prohlížet WWW
3536 Comment[cy]=Pori'r we
3537 Comment[da]=Surf på internettet
3538 Comment[de]=Im Web surfen
3539 Comment[el]=Περιήγηση στον παγκόσμιο ιστό
3540 Comment[en_CA]=Browse the web
3541 Comment[en_GB]=Browse the web
3542 Comment[es]=Navegar por la web
3543 Comment[et]=Sirvi veebi
3544 Comment[eu]=Arakatu web-a
3545 Comment[fi]=Selaa WWW:tä
3546 Comment[fr]=Naviguer sur Internet
3547 Comment[ga]=Brabhsáil an Líon
3548 Comment[gu]=વેબમાં શોધો
3549 Comment[he]=גלוש ברשת
3550 Comment[hi]=वेब ब्राउज़ करें
3551 Comment[hr]=Pregledaj Web
3552 Comment[hu]=A világháló böngészése
3553 Comment[id]=Jelajah web
3554 Comment[it]=Esplora il web
3555 Comment[ja]=ウェブを閲覧します
3556 Comment[ko]=웹을 돌아 다닙니다
3557 Comment[li]=Blajere op internet
3558 Comment[lt]=Naršyti internete
3559 Comment[mk]=Прелистувајте на веб
3560 Comment[ml]=വലക്കെട്ട് തിരയുക
3561 Comment[mn]=Веб броузе хийх
3562 Comment[ms]=Layari web
3563 Comment[nb]=Surf på nettet
3564 Comment[nl]=Websurfen
3565 Comment[nn]=Surf på nettet
3566 Comment[no]=Surf på nettet
3567 Comment[pa]=ਵੈਬ ਬਰਾਊਜ਼
3568 Comment[pl]=Przeglądanie stron WWW
3569 Comment[pt]=Navegar na web
3570 Comment[pt_BR]=Navegar na web
3571 Comment[ro]=Navigare Internet
3572 Comment[ru]=Веб-браузер
3573 Comment[sk]=Prehliadať internet
3574 Comment[sl]=Brskaj po spletu
3575 Comment[sq]=Eksploro web-in
3576 Comment[sr]=Прегледај веб
3577 Comment[sr@Latn]=Pregledaj veb
3578 Comment[sv]=Surfa på nätet
3579 Comment[ta]=வலையில் உலாவு
3580 Comment[th]=ใช้งานเว็บบราวเซอร์ @MOZILLA_NAME@
3581 Comment[tk]=Webi Ahtar
3582 Comment[tr]=Web'e Gözat
3583 Comment[uk]=Програма перегляду web-сторінок
3584 Comment[vi]=Duyệt web
3585 Comment[wa]=Naivyî avå les waibes
3586 Comment[zh_CN]=浏览 Web
3593 Categories=Network;WebBrowser;
3594 MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
3597 [FILE:762:files/pkg-deinstall-single.in]
3600 # $MCom: ports/www/mozilla/pkg-deinstall.in,v 1.25 2008/07/26 19:07:07 ahze Exp $
3602 # Date created: Mon Nov 29, 2003
3603 # Whom: Thierry Thomas (<thierry@pompo.net>)
3604 # Fix the chrome registry.
3609 [ "x$1" = "x" ] && exit 1
3610 [ "x$2" != "xDEINSTALL" ] && exit 0
3614 rm -rf ${MOZDIR}/chrome/overlayinfo
3615 rm -f ${MOZDIR}/chrome/*.rdf
3616 rm -f ${MOZDIR}/component.reg
3617 rm -f ${MOZDIR}/components/*.dat
3618 rm -f ${MOZDIR}/components.ini
3619 rm -f ${MOZDIR}/defaults.ini
3620 rm -f ${MOZDIR}/chrome/app-chrome.manifest
3621 rm -rf ${MOZDIR}/updates
3622 find %%MOZDIR%%/plugins/ -depth 1 -type l -delete > /dev/null 2>&1
3623 find %%MOZDIR%%/extensions/ -depth 1 -type l -delete > /dev/null 2>&1
3624 rmdir ${MOZDIR}/chrome
3630 [FILE:914:files/pkg-install-single.in]
3633 # $MCom: ports/www/mozilla/pkg-install.in,v 1.26 2008/08/04 16:58:03 mezz Exp $
3635 # Date created: Mon Nov 29, 2003
3636 # Whom: Thierry Thomas (<thierry@pompo.net>)
3637 # Fix the chrome registry.
3642 [ "x$1" = "x" ] && exit 1
3643 [ "x$2" != "xPOST-INSTALL" ] && exit 0
3646 MOZBIN=${MOZDIR}/%%MOZILLA_BIN%%
3647 REGXPCOM=${MOZDIR}/regxpcom
3648 REGCHROME=${MOZDIR}/regchrome
3650 rm -rf ${MOZDIR}/chrome/overlayinfo
3651 rm -f ${MOZDIR}/chrome/*.rdf
3652 mkdir -p ${MOZDIR}/chrome/overlayinfo
3653 rm -f ${MOZDIR}/component.reg
3655 cd ${MOZDIR} || exit 1
3656 if [ -f ${REGXPCOM} ]; then
3657 ./run-mozilla.sh ${REGXPCOM} || true
3659 if [ -f ${REGCHROME} ]; then
3660 ./run-mozilla.sh ${REGCHROME} || true
3662 if [ -f ${MOZBIN} -a "${1%-*}" = "nvu" ]; then
3663 ./run-mozilla.sh ${MOZBIN} -register > /dev/null 2>&1
3665 cp -R %%LOCALBASE%%/lib/xpi/symlinks/%%MOZILLA%%/ %%MOZDIR%%/extensions/ > /dev/null 2>&1
3670 [FILE:1280:files/pkg-message-single]
3671 ======================================================================
3673 Some features available on other platforms are not implemented:
3674 - Native audio (OSS backend is incomplete, doesn't support WebRTC)
3675 - Encrypted Media Extensions (requires Widevine CDM binary)
3676 - Process sandboxing (requires Capsicum backend)
3677 - Reduced memory usage (requires mozjemalloc)
3678 - Performance profiling (requires GeckoProfiler)
3679 - Gamepad API (requires libusbhid backend)
3681 ======================================================================
3683 To select non-default audio backend open about:config page and create
3684 media.cubeb.backend preference. Supported values are: alsa, jack,
3685 pulse, oss, sndio. Currently used backend can be inspected on
3688 ======================================================================
3690 smb:// issues (Gvfs/GIO option):
3691 Network group, machine, and share browsing does not work correctly.
3693 sftp:// (Gvfs/GIO option):
3694 Only sftp access using public key authentication works. To easily
3695 setup public key authentication to "remote_host":
3698 cat ~/.ssh/id_rsa.pub | ssh remote_host "cat >> .ssh/authorized_keys"
3700 The SSH server on remote_host must allow pub key authentication.
3702 ======================================================================
3705 [FILE:539:dragonfly/patch-build_moz.configure_memory.configure]
3706 --- build/moz.configure/memory.configure.orig 2016-09-05 20:12:51 UTC
3707 +++ build/moz.configure/memory.configure
3708 @@ -66,7 +66,7 @@ def jemalloc_os_define(jemalloc, jemallo
3709 return 'MOZ_MEMORY_LINUX'
3710 if target.kernel == 'Darwin':
3711 return 'MOZ_MEMORY_DARWIN'
3712 - if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD'):
3713 + if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD','DragonFly'):
3714 return 'MOZ_MEMORY_BSD'
3715 die('--enable-jemalloc is not supported on %s', target.kernel)
3719 [FILE:390:dragonfly/patch-ipc_chromium_src_base_platform__thread__posix.cc]
3720 --- ipc/chromium/src/base/platform_thread_posix.cc.orig 2016-09-05 23:12:53.000000000 +0300
3721 +++ ipc/chromium/src/base/platform_thread_posix.cc
3723 #elif defined(OS_LINUX)
3724 #include <sys/syscall.h>
3725 #include <sys/prctl.h>
3726 +#elif defined(OS_DRAGONFLY)
3727 +#include <sys/param.h>
3728 +#if __DragonFly_version >= 400709
3729 +#include <sys/lwp.h>
3733 #if !defined(OS_MACOSX)
3736 [FILE:510:dragonfly/patch-js_src_jsnativestack.cpp]
3737 --- js/src/jsnativestack.cpp.orig 2016-05-12 17:13:19 UTC
3738 +++ js/src/jsnativestack.cpp
3739 @@ -102,7 +102,8 @@ js::GetNativeStackBaseImpl()
3740 pthread_attr_init(&sattr);
3741 # if defined(__OpenBSD__)
3743 -# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD)
3744 +# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD) \
3745 + || defined(__DragonFly__)
3746 /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */
3747 pthread_attr_get_np(thread, &sattr);
3751 [FILE:579:dragonfly/patch-js_src_old-configure.in]
3752 --- js/src/old-configure.in.orig 2016-09-05 20:12:56 UTC
3753 +++ js/src/old-configure.in
3754 @@ -1305,7 +1305,7 @@ dnl Checks for header files.
3755 dnl ========================================================
3757 case "$target_os" in
3759 +freebsd*|dragonfly*)
3760 # for stuff like -lXshm
3761 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3763 @@ -1448,7 +1448,7 @@ then
3768 + *-*-freebsd*|*-*-dragonfly*)
3769 AC_DEFINE(_REENTRANT)
3770 AC_DEFINE(_THREAD_SAFE)
3771 dnl -pthread links in -lpthread, so don't specify it explicitly.
3774 [FILE:285:dragonfly/patch-media_libcubeb_src_cubeb__jack.cpp]
3775 --- media/libcubeb/src/cubeb_jack.cpp.orig 2017-10-06 17:40:00 UTC
3776 +++ media/libcubeb/src/cubeb_jack.cpp
3779 #define _DEFAULT_SOURCE
3781 -#ifndef __FreeBSD__
3782 -#define _POSIX_SOURCE
3784 #include <algorithm>
3789 [FILE:393:dragonfly/patch-media_webrtc_trunk_webrtc_base_thread__checker__impl.cc]
3790 --- media/webrtc/trunk/webrtc/base/thread_checker_impl.cc.orig 2016-05-12 20:13:19.000000000 +0300
3791 +++ media/webrtc/trunk/webrtc/base/thread_checker_impl.cc
3794 #elif defined(__FreeBSD__)
3795 #include <pthread_np.h>
3796 +#elif defined(__DragonFly__)
3797 +#include <sys/param.h>
3798 +#if __DragonFly_version >= 400709
3799 +#include <sys/lwp.h>