From 0522b39143f8a52f9f8a9edaa91f7335a4c889f0 Mon Sep 17 00:00:00 2001 From: Some One Else Date: Tue, 11 Apr 2017 14:17:57 +0000 Subject: [PATCH] www/firefox: update to 55.0 Changes: https://www.mozilla.org/firefox/55.0/releasenotes/ PR: 219963 Tested by: ? Security: 555b244e-6b20-4546-851f-d8eb7d6c1ffa MFH: 2017Q3 --- Mk/Uses/gecko.mk | 4 +- www/firefox/Makefile | 11 +- www/firefox/distinfo | 6 +- www/firefox/files/patch-bug1021761 | 40 +- www/firefox/files/patch-bug1371927 | 124 +++++ www/firefox/files/patch-bug702179 | 17 +- www/firefox/files/patch-bug826985 | 12 - www/firefox/files/patch-bug847568 | 2 +- www/firefox/files/patch-bug981348 | 61 --- ...ch-python_futures_concurrent_futures_process.py | 15 - www/firefox/files/patch-rust-option | 569 +++++++++++++++++++-- ...ty_python_futures_concurrent_futures_process.py | 15 + 12 files changed, 697 insertions(+), 179 deletions(-) create mode 100644 www/firefox/files/patch-bug1371927 delete mode 100644 www/firefox/files/patch-bug981348 delete mode 100644 www/firefox/files/patch-python_futures_concurrent_futures_process.py create mode 100644 www/firefox/files/patch-third__party_python_futures_concurrent_futures_process.py diff --git a/Mk/Uses/gecko.mk b/Mk/Uses/gecko.mk index c895b04979de..0fbc2d3e4bf2 100644 --- a/Mk/Uses/gecko.mk +++ b/Mk/Uses/gecko.mk @@ -37,12 +37,12 @@ RUN_DEPENDS+= libxul>=45:www/libxul .elif ${gecko_ARGS:Mfirefox} _GECKO_DEFAULT_VERSION= 52 -_GECKO_VERSIONS= 52 54 +_GECKO_VERSIONS= 52 55 _GECKO_TYPE= firefox # Dependence lines for different Firefox versions 52_DEPENDS= ${LOCALBASE}/lib/firefox/firefox:www/firefox-esr -54_DEPENDS= ${LOCALBASE}/lib/firefox/firefox:www/firefox +55_DEPENDS= ${LOCALBASE}/lib/firefox/firefox:www/firefox .if exists(${LOCALBASE}/bin/firefox) _GECKO_INSTALLED_VER!= ${LOCALBASE}/bin/firefox --version 2>/dev/null diff --git a/www/firefox/Makefile b/www/firefox/Makefile index b21e7921eb0f..c8f678e41505 100644 --- a/www/firefox/Makefile +++ b/www/firefox/Makefile @@ -2,25 +2,25 @@ # $FreeBSD$ PORTNAME= firefox -DISTVERSION= 54.0 +DISTVERSION= 55.0b1 DISTVERSIONSUFFIX=.source PORTEPOCH= 1 CATEGORIES= www ipv6 MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \ - MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build3/source + MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build4/source MAINTAINER= gecko@FreeBSD.org COMMENT= Web browser based on the browser portion of Mozilla BUILD_DEPENDS= nspr>=4.14:devel/nspr \ - nss>=3.30.2:security/nss \ + nss>=3.31:security/nss \ libevent>=2.0.22:devel/libevent \ - harfbuzz>=1.4.3:print/harfbuzz \ + harfbuzz>=1.4.6:print/harfbuzz \ graphite2>=1.3.10:graphics/graphite2 \ png>=1.6.28:graphics/png \ libvorbis>=1.3.5,3:audio/libvorbis \ libvpx>=1.5.0:multimedia/libvpx \ - sqlite3>=3.17.0:databases/sqlite3 \ + sqlite3>=3.19.2:databases/sqlite3 \ ${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3 \ v4l_compat>0:multimedia/v4l_compat \ autoconf-2.13:devel/autoconf213 \ @@ -46,6 +46,7 @@ MOZ_OPTIONS= --enable-application=browser \ OPTIONS_DEFINE= RUST OPTIONS_DEFAULT= BUNDLED_CAIRO +OPTIONS_EXCLUDE= GNOMEUI # XXX lang/rust and devel/cargo currently build only on these platforms OPTIONS_DEFAULT_amd64= RUST OPTIONS_DEFAULT_i386= RUST diff --git a/www/firefox/distinfo b/www/firefox/distinfo index d46cc9b64188..0e3543df5d61 100644 --- a/www/firefox/distinfo +++ b/www/firefox/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1496961575 -SHA256 (firefox-54.0.source.tar.xz) = 08a9ff6870d904a2af1d03c17c6c44f67413608efb66bb280894d7b92c336a77 -SIZE (firefox-54.0.source.tar.xz) = 229178564 +TIMESTAMP = 1497363179 +SHA256 (firefox-55.0b1.source.tar.xz) = 5424250111c6a1124325ba88481d28f37a90c771e66bb7bf3c05f7a0bd7a4d04 +SIZE (firefox-55.0b1.source.tar.xz) = 236308400 diff --git a/www/firefox/files/patch-bug1021761 b/www/firefox/files/patch-bug1021761 index e59fce618f00..f0764a8c4b22 100644 --- a/www/firefox/files/patch-bug1021761 +++ b/www/firefox/files/patch-bug1021761 @@ -122,7 +122,18 @@ index 57bcb4c13652..68be024f4a68 100644 static int validate_stream_params(cubeb_stream_params * input_stream_params, -@@ -138,6 +141,9 @@ cubeb_init(cubeb ** context, char const * context_name) +@@ -155,6 +158,10 @@ cubeb_init(cubeb ** context, char const * context_name, char const * backend_nam + #if defined(USE_KAI) + init_oneshot = kai_init; + #endif ++ } else if (!strcmp(backend_name, "oss")) { ++#if defined(USE_OSS) ++ init_oneshot = oss_init; ++#endif + } else { + /* Already set */ + } +@@ -196,6 +203,9 @@ cubeb_init(cubeb ** context, char const * context_name, char const * backend_nam #if defined(USE_KAI) kai_init, #endif @@ -246,7 +257,7 @@ index 05ad27fef53b..3ea78e994f59 100644 + char * buftail = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes); /* Correct read size to the other stream available frames */ - if (stm->other_stream && got > stm->other_stream->bufframes) { + if (stm->other_stream && got > (snd_pcm_sframes_t) stm->other_stream->bufframes) { @@ -372,8 +421,8 @@ alsa_process_stream(cubeb_stream * stm) long drain_frames = avail - stm->bufframes; double drain_time = (double) drain_frames / stm->params.rate; @@ -579,7 +590,7 @@ index 05ad27fef53b..3ea78e994f59 100644 + r = WRAP(snd_pcm_poll_descriptors)(stm->pcm, stm->saved_fds, stm->nfds); assert((nfds_t) r == stm->nfds); - r = pthread_cond_init(&stm->cond, NULL); + if (alsa_register_stream(ctx, stm) != 0) { @@ -1048,7 +1156,7 @@ alsa_stream_destroy(cubeb_stream * stm) pthread_mutex_lock(&stm->mutex); if (stm->pcm) { @@ -1182,29 +1193,14 @@ diff --git media/libcubeb/update.sh media/libcubeb/update.sh index b139b8f497fd..d1f8a223c6d8 100755 --- media/libcubeb/update.sh +++ media/libcubeb/update.sh -@@ -17,6 +17,7 @@ cp $1/src/cubeb_audiounit.cpp src - cp $1/src/cubeb_osx_run_loop.h src - cp $1/src/cubeb_jack.cpp src +@@ -20,6 +20,7 @@ cp $1/src/cubeb_log.h src + cp $1/src/cubeb_mixer.cpp src + cp $1/src/cubeb_mixer.h src cp $1/src/cubeb_opensl.c src +cp $1/src/cubeb_oss.c src - cp $1/src/cubeb_array_queue.h src + cp $1/src/cubeb_osx_run_loop.h src cp $1/src/cubeb_panner.cpp src cp $1/src/cubeb_panner.h src -diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build -index 3e5450f5d63a..dd45427f655a 100644 ---- media/webrtc/signaling/test/common.build -+++ media/webrtc/signaling/test/common.build -@@ -99,8 +99,8 @@ USE_LIBS += ['mozglue'] - OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] - OS_LIBS += CONFIG['REALTIME_LIBS'] - --if CONFIG['MOZ_ALSA']: -- OS_LIBS += CONFIG['MOZ_ALSA_LIBS'] -+if CONFIG['MOZ_OSS']: -+ OS_LIBS += CONFIG['MOZ_OSS_LIBS'] - - if CONFIG['MOZ_SYSTEM_JPEG']: - OS_LIBS += CONFIG['MOZ_JPEG_LIBS'] diff --git toolkit/library/moz.build toolkit/library/moz.build index a61c689c83c3..7764df6f8a6b 100644 --- toolkit/library/moz.build diff --git a/www/firefox/files/patch-bug1371927 b/www/firefox/files/patch-bug1371927 new file mode 100644 index 000000000000..99cdde035bf9 --- /dev/null +++ b/www/firefox/files/patch-bug1371927 @@ -0,0 +1,124 @@ +commit 40744bcfbf86 +Author: Iaroslav (yarik) Sheptykin +Date: Sat Jun 10 19:59:16 2017 +0200 + + Bug 1371927: Build KeyedStackCapture only if profiler enabled. r=gfritzsche + + MozReview-Commit-ID: 9IoVY2K5hXc +--- + toolkit/components/telemetry/HangReports.cpp | 6 +++--- + toolkit/components/telemetry/KeyedStackCapturer.cpp | 3 --- + toolkit/components/telemetry/KeyedStackCapturer.h | 4 ---- + toolkit/components/telemetry/Telemetry.cpp | 5 ++++- + toolkit/components/telemetry/moz.build | 7 ++++++- + 5 files changed, 13 insertions(+), 12 deletions(-) + +diff --git toolkit/components/telemetry/HangReports.cpp toolkit/components/telemetry/HangReports.cpp +index a093405fe7a9..da9e117b2524 100644 +--- toolkit/components/telemetry/HangReports.cpp ++++ toolkit/components/telemetry/HangReports.cpp +@@ -11,9 +11,6 @@ namespace Telemetry { + + using namespace HangMonitor; + +-/** The maximum number of stacks that we're keeping for hang reports. */ +-const size_t kMaxHangStacksKept = 50; +- + // This utility function generates a string key that is used to index the annotations + // in a hash map from |HangReports::AddHang|. + nsresult +@@ -36,6 +33,9 @@ ComputeAnnotationsKey(const HangAnnotationsPtr& aAnnotations, nsAString& aKeyOut + } + + #if defined(MOZ_GECKO_PROFILER) ++/** The maximum number of stacks that we're keeping for hang reports. */ ++const size_t kMaxHangStacksKept = 50; ++ + void + HangReports::AddHang(const Telemetry::ProcessedStack& aStack, + uint32_t aDuration, +diff --git toolkit/components/telemetry/KeyedStackCapturer.cpp toolkit/components/telemetry/KeyedStackCapturer.cpp +index 25479485fcd9..6b6431a44978 100644 +--- toolkit/components/telemetry/KeyedStackCapturer.cpp ++++ toolkit/components/telemetry/KeyedStackCapturer.cpp +@@ -12,8 +12,6 @@ + + namespace { + +-#if defined(MOZ_GECKO_PROFILER) +- + /** Defines the size of the keyed stack dictionary. */ + const uint8_t kMaxKeyLength = 50; + +@@ -161,7 +159,6 @@ KeyedStackCapturer::Clear() + mStackInfos.Clear(); + mStacks.Clear(); + } +-#endif + + } // namespace Telemetry + } // namespace mozilla +diff --git toolkit/components/telemetry/KeyedStackCapturer.h toolkit/components/telemetry/KeyedStackCapturer.h +index 77f17a613948..f554787b5934 100644 +--- toolkit/components/telemetry/KeyedStackCapturer.h ++++ toolkit/components/telemetry/KeyedStackCapturer.h +@@ -6,8 +6,6 @@ + #ifndef KeyedStackCapturer_h__ + #define KeyedStackCapturer_h__ + +-#ifdef MOZ_GECKO_PROFILER +- + #include "Telemetry.h" + #include "nsString.h" + #include "nsClassHashtable.h" +@@ -74,6 +72,4 @@ private: + } // namespace Telemetry + } // namespace mozilla + +-#endif // MOZ_GECKO_PROFILER +- + #endif // KeyedStackCapturer_h__ +diff --git toolkit/components/telemetry/Telemetry.cpp toolkit/components/telemetry/Telemetry.cpp +index 4864f400a21a..a81975873d02 100644 +--- toolkit/components/telemetry/Telemetry.cpp ++++ toolkit/components/telemetry/Telemetry.cpp +@@ -99,10 +99,13 @@ using Telemetry::Common::AutoHashtable; + using mozilla::dom::Promise; + using mozilla::dom::AutoJSAPI; + using mozilla::Telemetry::HangReports; +-using mozilla::Telemetry::KeyedStackCapturer; + using mozilla::Telemetry::CombinedStacks; + using mozilla::Telemetry::ComputeAnnotationsKey; + ++#if defined(MOZ_GECKO_PROFILER) ++using mozilla::Telemetry::KeyedStackCapturer; ++#endif ++ + /** + * IOInterposeObserver recording statistics of main-thread I/O during execution, + * aimed at consumption by TelemetryImpl +diff --git toolkit/components/telemetry/moz.build toolkit/components/telemetry/moz.build +index c8d5b177d205..30c8914c4055 100644 +--- toolkit/components/telemetry/moz.build ++++ toolkit/components/telemetry/moz.build +@@ -57,7 +57,6 @@ SOURCES += [ + 'HangReports.cpp', + 'ipc/TelemetryIPC.cpp', + 'ipc/TelemetryIPCAccumulator.cpp', +- 'KeyedStackCapturer.cpp', + 'Telemetry.cpp', + 'TelemetryCommon.cpp', + 'TelemetryEvent.cpp', +@@ -66,6 +65,12 @@ SOURCES += [ + 'WebrtcTelemetry.cpp', + ] + ++# KeyedStackCapturer entirely relies on profiler to be enabled. ++if CONFIG['MOZ_GECKO_PROFILER']: ++ SOURCES += [ ++ 'KeyedStackCapturer.cpp' ++ ] ++ + EXTRA_COMPONENTS += [ + 'TelemetryStartup.js', + 'TelemetryStartup.manifest' diff --git a/www/firefox/files/patch-bug702179 b/www/firefox/files/patch-bug702179 index bb642382dfd8..0c998526736e 100644 --- a/www/firefox/files/patch-bug702179 +++ b/www/firefox/files/patch-bug702179 @@ -1,13 +1,12 @@ ---- js/src/moz.build.orig 2015-12-16 12:32:04.574425000 +0100 -+++ js/src/moz.build 2015-12-16 12:32:09.032032000 +0100 -@@ -671,10 +671,6 @@ CFLAGS += CONFIG['MOZ_ICU_CFLAGS'] - CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS'] - LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES'] +Don't build static JS lib to make sure DTrace probes are picked up. + +--- js/src/build/moz.build.orig 2017-04-16 18:00:50 UTC ++++ js/src/build/moz.build +@@ -71,7 +71,3 @@ if CONFIG['OS_ARCH'] == 'SunOS': + ] + OS_LIBS += CONFIG['REALTIME_LIBS'] +- -NO_EXPAND_LIBS = True - -DIST_INSTALL = True -- - # Prepare self-hosted JS code for embedding - GENERATED_FILES += ['selfhosted.out.h'] - selfhosted = GENERATED_FILES['selfhosted.out.h'] diff --git a/www/firefox/files/patch-bug826985 b/www/firefox/files/patch-bug826985 index 1f21f8f960cd..8e23b9382748 100644 --- a/www/firefox/files/patch-bug826985 +++ b/www/firefox/files/patch-bug826985 @@ -51,18 +51,6 @@ index b483cd1..f1dd1f0 100644 # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, -diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build -index b483cd1..f1dd1f0 100644 ---- media/webrtc/signaling/test/common.build -+++ media/webrtc/signaling/test/common.build -@@ -99,6 +99,7 @@ if CONFIG['JS_SHARED_LIBRARY']: - - USE_LIBS += ['mozglue'] - -+OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS'] - OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] - OS_LIBS += CONFIG['REALTIME_LIBS'] - 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 index 239a292..bab496c 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc diff --git a/www/firefox/files/patch-bug847568 b/www/firefox/files/patch-bug847568 index 9ef2dbadd362..0deb5a504f56 100644 --- a/www/firefox/files/patch-bug847568 +++ b/www/firefox/files/patch-bug847568 @@ -261,7 +261,7 @@ index 9297e4d6f501..d8e273887e4b 100644 +option('--with-system-harfbuzz', + help="Use system harfbuzz (located with pkgconfig)") + -+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.4.3', ++system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.4.6', + when='--with-system-harfbuzz') + +set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True)) diff --git a/www/firefox/files/patch-bug981348 b/www/firefox/files/patch-bug981348 deleted file mode 100644 index 0c2ffea1ef7b..000000000000 --- a/www/firefox/files/patch-bug981348 +++ /dev/null @@ -1,61 +0,0 @@ -diff --git dom/system/OSFileConstants.cpp dom/system/OSFileConstants.cpp -index 88bba9baa401..99f240952dfe 100644 ---- dom/system/OSFileConstants.cpp -+++ dom/system/OSFileConstants.cpp -@@ -16,14 +16,17 @@ - #include "dirent.h" - #include "poll.h" - #include "sys/stat.h" --#if defined(ANDROID) -+#if defined(XP_LINUX) - #include - #define statvfs statfs -+#define f_frsize f_bsize - #else - #include "sys/statvfs.h" -+#endif // defined(XP_LINUX) -+#if !defined(ANDROID) - #include "sys/wait.h" - #include --#endif // defined(ANDROID) -+#endif // !defined(ANDROID) - #endif // defined(XP_UNIX) - - #if defined(XP_LINUX) -@@ -699,7 +702,7 @@ static const dom::ConstantSpec gLibcProperties[] = - - { "OSFILE_SIZEOF_STATVFS", JS::Int32Value(sizeof (struct statvfs)) }, - -- { "OSFILE_OFFSETOF_STATVFS_F_BSIZE", JS::Int32Value(offsetof (struct statvfs, f_bsize)) }, -+ { "OSFILE_OFFSETOF_STATVFS_F_FRSIZE", JS::Int32Value(offsetof (struct statvfs, f_frsize)) }, - { "OSFILE_OFFSETOF_STATVFS_F_BAVAIL", JS::Int32Value(offsetof (struct statvfs, f_bavail)) }, - - #endif // defined(XP_UNIX) -diff --git toolkit/components/osfile/modules/osfile_unix_back.jsm toolkit/components/osfile/modules/osfile_unix_back.jsm -index a028dda7d5ec..f5c632e3d7e5 100644 ---- toolkit/components/osfile/modules/osfile_unix_back.jsm -+++ toolkit/components/osfile/modules/osfile_unix_back.jsm -@@ -228,8 +228,8 @@ - let statvfs = new SharedAll.HollowStructure("statvfs", - Const.OSFILE_SIZEOF_STATVFS); - -- statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BSIZE, -- "f_bsize", Type.unsigned_long.implementation); -+ statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_FRSIZE, -+ "f_frsize", Type.unsigned_long.implementation); - statvfs.add_field_at(Const.OSFILE_OFFSETOF_STATVFS_F_BAVAIL, - "f_bavail", Type.fsblkcnt_t.implementation); - -diff --git toolkit/components/osfile/modules/osfile_unix_front.jsm toolkit/components/osfile/modules/osfile_unix_front.jsm -index bd60d4d8419c..a8cd6b546b0e 100644 ---- toolkit/components/osfile/modules/osfile_unix_front.jsm -+++ toolkit/components/osfile/modules/osfile_unix_front.jsm -@@ -399,7 +399,7 @@ - throw_on_negative("statvfs", (UnixFile.statvfs || UnixFile.statfs)(sourcePath, fileSystemInfoPtr)); - - let bytes = new Type.uint64_t.implementation( -- fileSystemInfo.f_bsize * fileSystemInfo.f_bavail); -+ fileSystemInfo.f_frsize * fileSystemInfo.f_bavail); - - return bytes.value; - }; diff --git a/www/firefox/files/patch-python_futures_concurrent_futures_process.py b/www/firefox/files/patch-python_futures_concurrent_futures_process.py deleted file mode 100644 index 5327af944b8b..000000000000 --- a/www/firefox/files/patch-python_futures_concurrent_futures_process.py +++ /dev/null @@ -1,15 +0,0 @@ ---- python/futures/concurrent/futures/process.py.orig 2017-04-11 04:15:19 UTC -+++ python/futures/concurrent/futures/process.py -@@ -247,7 +247,11 @@ def _check_system_limits(): - _system_limits_checked = True - try: - import os -- nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") -+ if sys.platform.startswith('freebsd'): -+ # sem(4) confuses sysconf(3) on FreeBSD < 11.1 -+ nsems_max = -1 -+ else: -+ nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") - except (AttributeError, ValueError): - # sysconf not available or setting not available - return diff --git a/www/firefox/files/patch-rust-option b/www/firefox/files/patch-rust-option index 57da0de6038e..e60e11b111ee 100644 --- a/www/firefox/files/patch-rust-option +++ b/www/firefox/files/patch-rust-option @@ -1,4 +1,4 @@ -Revert bug 1284816 and bug 1341967 to postpone bustage on non-x86 archs. +Revert bug 1284816, bug 1341967, bug 1336153 to postpone bustage on non-x86 archs. diff --git browser/confvars.sh browser/confvars.sh index d8dcd99c2757..740d9d3e5fcf 100755 @@ -56,11 +56,58 @@ index 267d989f1597..f709820e60ae 100644 if not rustc_info: die(dedent('''\ Rust compiler not found. +@@ -97,6 +110,9 @@ def rust_compiler(rustc_info, cargo_info): + + return True + ++set_define('MOZ_RUST', rust_compiler) ++set_config('MOZ_RUST', rust_compiler) ++ + @template + def rust_triple_alias(host_or_target): + """Template defining the alias used for rustc's --target flag. +@@ -227,7 +243,8 @@ set_config('RUST_HOST_TARGET', rust_host_triple) + + @depends(rust_target_triple) + def rust_target_env_name(triple): +- return triple.upper().replace('-','_') ++ if triple: ++ return triple.upper().replace('-','_') + + # We need this to form various Cargo environment variables, as there is no + # uppercase function in make, and we don't want to shell out just for +@@ -235,5 +252,6 @@ def rust_target_env_name(triple): + set_config('RUST_TARGET_ENV_NAME', rust_target_env_name) + + # Until we remove all the other Rust checks in old-configure. ++add_old_configure_assignment('MOZ_RUST', rust_compiler) + add_old_configure_assignment('RUSTC', rustc) + add_old_configure_assignment('RUST_TARGET', rust_target_triple) +diff --git config/rules.mk config/rules.mk +index 94cc5556e3d0..7b143ebc5146 100644 +--- config/rules.mk ++++ config/rules.mk +@@ -900,6 +900,7 @@ endif + + $(foreach file,$(DUMP_SYMS_TARGETS),$(eval $(call syms_template,$(file),$(file)_syms.track))) + ++ifdef MOZ_RUST + cargo_host_flag := --target=$(RUST_HOST_TARGET) + cargo_target_flag := --target=$(RUST_TARGET) + +@@ -1055,6 +1056,7 @@ force-cargo-host-program-build: + + $(HOST_RUST_PROGRAMS): force-cargo-host-program-build + endif # HOST_RUST_PROGRAMS ++endif # MOZ_RUST + + $(SOBJS): + $(REPORT_BUILD) diff --git dom/media/MediaPrefs.h dom/media/MediaPrefs.h index 4dcc659222a4..559334d89fd1 100644 --- dom/media/MediaPrefs.h +++ dom/media/MediaPrefs.h -@@ -165,7 +165,7 @@ private: +@@ -183,7 +183,7 @@ private: DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false); DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true); @@ -69,6 +116,42 @@ index 4dcc659222a4..559334d89fd1 100644 DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false); #endif +diff --git dom/media/gtest/moz.build dom/media/gtest/moz.build +index c66ac4a9437f..e2203c0a4321 100644 +--- dom/media/gtest/moz.build ++++ dom/media/gtest/moz.build +@@ -22,7 +22,6 @@ UNIFIED_SOURCES += [ + 'TestMozPromise.cpp', + 'TestMP3Demuxer.cpp', + 'TestMP4Demuxer.cpp', +- 'TestRust.cpp', + 'TestTrackEncoder.cpp', + 'TestVideoSegment.cpp', + 'TestVideoUtils.cpp', +@@ -36,6 +35,9 @@ if CONFIG['MOZ_WEBM_ENCODER']: + 'TestWebMWriter.cpp', + ] + ++if CONFIG['MOZ_RUST']: ++ UNIFIED_SOURCES += ['TestRust.cpp',] ++ + TEST_HARNESS_FILES.gtest += [ + '../test/gizmo-frag.mp4', + '../test/gizmo.mp4', +diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build +index c65b53b80f63..8953f646e831 100644 +--- media/libcubeb/src/moz.build ++++ media/libcubeb/src/moz.build +@@ -32,7 +32,8 @@ if CONFIG['MOZ_PULSEAUDIO']: + 'cubeb_pulse.c', + ] + DEFINES['USE_PULSE'] = True +- DEFINES['USE_PULSE_RUST'] = True ++ if CONFIG['MOZ_RUST']: ++ DEFINES['USE_PULSE_RUST'] = True + + if CONFIG['MOZ_JACK']: + SOURCES += [ diff --git media/libstagefright/binding/DecoderData.cpp media/libstagefright/binding/DecoderData.cpp index 109ea329d154..a06e533b1e62 100644 --- media/libstagefright/binding/DecoderData.cpp @@ -84,16 +167,16 @@ index 109ea329d154..a06e533b1e62 100644 +#endif // MOZ_RUST_MP4PARSE using namespace stagefright; - -@@ -187,6 +189,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType) - + using mozilla::media::TimeUnit; +@@ -177,6 +179,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType) + FindData(aMetaData, kKeyAVCC, mExtraData); } +#ifdef MOZ_RUST_MP4PARSE static void UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig, const mp4parse_sinf_info& aSinf) -@@ -266,6 +269,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track, +@@ -263,6 +266,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track, mExtraData->AppendElements(video->extra_data.data, video->extra_data.length); } } @@ -105,7 +188,7 @@ diff --git media/libstagefright/binding/MP4Metadata.cpp media/libstagefright/bin index 5c3810d99a38..5d14dfd8b8a9 100644 --- media/libstagefright/binding/MP4Metadata.cpp +++ media/libstagefright/binding/MP4Metadata.cpp -@@ -19,14 +19,18 @@ +@@ -20,14 +20,18 @@ #include "mp4_demuxer/MP4Metadata.h" #include "mp4_demuxer/Stream.h" #include "MediaPrefs.h" @@ -123,8 +206,8 @@ index 5c3810d99a38..5d14dfd8b8a9 100644 +#endif // MOZ_RUST_MP4PARSE using namespace stagefright; - -@@ -101,6 +103,7 @@ private: + using mozilla::media::TimeUnit; +@@ -105,6 +109,7 @@ private: bool mCanSeek; }; @@ -132,19 +215,35 @@ index 5c3810d99a38..5d14dfd8b8a9 100644 // Wrap an mp4_demuxer::Stream to remember the read offset. class RustStreamAdaptor { -@@ -145,9 +149,11 @@ private: +@@ -151,6 +156,7 @@ private: RustStreamAdaptor mRustSource; mozilla::UniquePtr mRustParser; }; +#endif // MOZ_RUST_MP4PARSE + class IndiceWrapperStagefright : public IndiceWrapper { + public: +@@ -187,6 +193,7 @@ IndiceWrapperStagefright::GetIndice(size_t aIndex, Index::Indice& aIndice) const + return true; + } + ++#ifdef MOZ_RUST_MP4PARSE + // the owner of mIndice is rust mp4 paser, so lifetime of this class + // SHOULD NOT longer than rust parser. + class IndiceWrapperRust : public IndiceWrapper +@@ -232,9 +239,11 @@ IndiceWrapperRust::GetIndice(size_t aIndex, Index::Indice& aIndice) const + aIndice.sync = indice->sync; + return true; + } ++#endif // MOZ_RUST_MP4PARSE + MP4Metadata::MP4Metadata(Stream* aSource) : mStagefright(MakeUnique(aSource)) +#ifdef MOZ_RUST_MP4PARSE , mRust(MakeUnique(aSource)) - , mPreferRust(false) + , mPreferRust(MediaPrefs::EnableRustMP4Parser()) , mReportedAudioTrackTelemetry(false) -@@ -155,6 +161,7 @@ MP4Metadata::MP4Metadata(Stream* aSource) +@@ -242,6 +251,7 @@ MP4Metadata::MP4Metadata(Stream* aSource) #ifndef RELEASE_OR_BETA , mRustTestMode(MediaPrefs::RustTestMode()) #endif @@ -152,44 +251,46 @@ index 5c3810d99a38..5d14dfd8b8a9 100644 { } -@@ -186,6 +193,7 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const - { - uint32_t numTracks = mStagefright->GetNumberTracks(aType); +@@ -274,8 +284,11 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const + MP4Metadata::ResultAndTrackCount numTracks = + mStagefright->GetNumberTracks(aType); +#ifdef MOZ_RUST_MP4PARSE if (!mRust) { ++#endif // MOZ_RUST_MP4PARSE return numTracks; ++#ifdef MOZ_RUST_MP4PARSE } -@@ -211,10 +219,12 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const - mPreferRust = true; - return numTracksRust; - } -+#endif // MOZ_RUST_MP4PARSE - return numTracks; + MP4Metadata::ResultAndTrackCount numTracksRust = +@@ -350,8 +363,10 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const + // Same non-error numbers, just return any. + // (Choosing Rust here, in case it carries a warning, we'd want to know that.) + return numTracksRust; ++#endif // MOZ_RUST_MP4PARSE } +#ifdef MOZ_RUST_MP4PARSE bool MP4Metadata::ShouldPreferRust() const { if (!mRust) { return false; -@@ -245,6 +255,7 @@ bool MP4Metadata::ShouldPreferRust() const { +@@ -389,6 +404,7 @@ bool MP4Metadata::ShouldPreferRust() const { // Otherwise, fall back. return false; } +#endif // MOZ_RUST_MP4PARSE - mozilla::UniquePtr - MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, -@@ -253,6 +264,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, - mozilla::UniquePtr info = - mStagefright->GetTrackInfo(aType, aTrackNumber); + static const char* + GetDifferentField(const mozilla::TrackInfo& info, +@@ -443,6 +459,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, + MP4Metadata::ResultAndTrackInfo info = + mStagefright->GetTrackInfo(aType, aTrackNumber); +#ifdef MOZ_RUST_MP4PARSE if (!mRust) { return info; } -@@ -305,6 +317,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackTyp +@@ -514,6 +531,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, if (mPreferRust) { return infoRust; } @@ -197,15 +298,15 @@ index 5c3810d99a38..5d14dfd8b8a9 100644 return info; } -@@ -319,6 +334,7 @@ const CryptoFile& +@@ -528,6 +546,7 @@ MP4Metadata::ResultAndCryptoFile MP4Metadata::Crypto() const { - const CryptoFile& crypto = mStagefright->Crypto(); + MP4Metadata::ResultAndCryptoFile crypto = mStagefright->Crypto(); +#ifdef MOZ_RUST_MP4PARSE - const CryptoFile& rustCrypto = mRust->Crypto(); + MP4Metadata::ResultAndCryptoFile rustCrypto = mRust->Crypto(); #ifndef RELEASE_OR_BETA -@@ -330,6 +347,7 @@ MP4Metadata::Crypto() const +@@ -548,6 +567,7 @@ MP4Metadata::Crypto() const if (mPreferRust) { return rustCrypto; } @@ -213,17 +314,59 @@ index 5c3810d99a38..5d14dfd8b8a9 100644 return crypto; } -@@ -594,6 +612,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource) - return parser->Metadata(); +@@ -556,17 +576,22 @@ MP4Metadata::ResultAndIndice + MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) + { + FallibleTArray indiceSF; ++#ifdef MOZ_RUST_MP4PARSE + if (!mPreferRust + #ifndef RELEASE_OR_BETA + || mRustTestMode + #endif + ) { ++#endif // MOZ_RUST_MP4PARSE + MediaResult rv = mStagefright->ReadTrackIndex(indiceSF, aTrackID); + if (NS_FAILED(rv)) { + return {Move(rv), nullptr}; + } ++#ifdef MOZ_RUST_MP4PARSE + } ++#endif // MOZ_RUST_MP4PARSE + ++#ifdef MOZ_RUST_MP4PARSE + mp4parse_byte_data indiceRust = {}; + if (mPreferRust + #ifndef RELEASE_OR_BETA +@@ -592,13 +617,18 @@ MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) + } + } + #endif ++#endif // MOZ_RUST_MP4PARSE + + UniquePtr indice; ++#ifdef MOZ_RUST_MP4PARSE + if (mPreferRust) { + indice = mozilla::MakeUnique(indiceRust); + } else { ++#endif // MOZ_RUST_MP4PARSE + indice = mozilla::MakeUnique(indiceSF); ++#ifdef MOZ_RUST_MP4PARSE + } ++#endif // MOZ_RUST_MP4PARSE + + return {NS_OK, Move(indice)}; + } +@@ -856,6 +886,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource) + return {NS_OK, Move(buffer)}; } +#ifdef MOZ_RUST_MP4PARSE bool RustStreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read) { -@@ -859,5 +878,6 @@ MP4MetadataRust::Metadata(Stream* aSource) +@@ -1152,5 +1183,6 @@ MP4MetadataRust::Metadata(Stream* aSource) MOZ_ASSERT(false, "Not yet implemented"); - return nullptr; + return {NS_ERROR_NOT_IMPLEMENTED, nullptr}; } +#endif // MOZ_RUST_MP4PARSE @@ -272,7 +415,17 @@ diff --git media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h media/ index 492c9c1c1bc3..e16dbbd1155e 100644 --- media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h +++ media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h -@@ -36,6 +36,7 @@ public: +@@ -13,7 +13,9 @@ + #include "MediaInfo.h" + #include "MediaResult.h" + #include "Stream.h" ++#ifdef MOZ_RUST_MP4PARSE + #include "mp4parse.h" ++#endif // MOZ_RUST_MP4PARSE + + namespace mp4_demuxer { + +@@ -82,6 +84,7 @@ public: private: UniquePtr mStagefright; @@ -280,7 +433,7 @@ index 492c9c1c1bc3..e16dbbd1155e 100644 UniquePtr mRust; mutable bool mPreferRust; mutable bool mReportedAudioTrackTelemetry; -@@ -44,6 +45,7 @@ private: +@@ -90,6 +93,7 @@ private: mutable bool mRustTestMode; #endif bool ShouldPreferRust() const; @@ -288,6 +441,49 @@ index 492c9c1c1bc3..e16dbbd1155e 100644 }; } // namespace mp4_demuxer +diff --git media/libstagefright/gtest/moz.build media/libstagefright/gtest/moz.build +index be4d56fc93f7..66fdd365f8f3 100644 +--- media/libstagefright/gtest/moz.build ++++ media/libstagefright/gtest/moz.build +@@ -38,12 +38,13 @@ TEST_HARNESS_FILES.gtest += [ + 'test_case_1351094.mp4', + ] + +-UNIFIED_SOURCES += ['TestMP4Rust.cpp',] +-TEST_HARNESS_FILES.gtest += [ +- '../../../dom/media/test/street.mp4', +-] +-LOCAL_INCLUDES += [ +- '../binding/include', +-] ++if CONFIG['MOZ_RUST']: ++ UNIFIED_SOURCES += ['TestMP4Rust.cpp',] ++ TEST_HARNESS_FILES.gtest += [ ++ '../../../dom/media/test/street.mp4', ++ ] ++ LOCAL_INCLUDES += [ ++ '../binding/include', ++ ] + + FINAL_LIBRARY = 'xul-gtest' +diff --git media/libstagefright/moz.build media/libstagefright/moz.build +index af5d1194d621..6725a0179989 100644 +--- media/libstagefright/moz.build ++++ media/libstagefright/moz.build +@@ -83,9 +83,10 @@ SOURCES += [ + 'system/core/libutils/VectorImpl.cpp', + ] + +-EXPORTS += [ +- 'binding/include/mp4parse.h', +-] ++if CONFIG['MOZ_RUST']: ++ EXPORTS += [ ++ 'binding/include/mp4parse.h', ++ ] + + UNIFIED_SOURCES += [ + 'binding/Adts.cpp', diff --git mobile/android/confvars.sh mobile/android/confvars.sh index e79b6f5c0707..eb62763acaf7 100644 --- mobile/android/confvars.sh @@ -301,21 +497,98 @@ index e79b6f5c0707..eb62763acaf7 100644 # use custom widget for html:select MOZ_USE_NATIVE_POPUP_WINDOWS=1 +diff --git netwerk/base/moz.build netwerk/base/moz.build +index 61d022a9660e..e5ca1d77d859 100644 +--- netwerk/base/moz.build ++++ netwerk/base/moz.build +@@ -256,7 +256,7 @@ UNIFIED_SOURCES += [ + 'TLSServerSocket.cpp', + ] + +-if CONFIG['MOZ_RUST_URLPARSE']: ++if CONFIG['MOZ_RUST'] and CONFIG['MOZ_RUST_URLPARSE']: + EXPORTS.mozilla.net += [ 'RustURL.h' ] + UNIFIED_SOURCES += [ 'RustURL.cpp' ] + +diff --git netwerk/base/nsStandardURL.cpp netwerk/base/nsStandardURL.cpp +index 608b918a4ecf..20bcdeb34ab8 100644 +--- netwerk/base/nsStandardURL.cpp ++++ netwerk/base/nsStandardURL.cpp +@@ -858,6 +858,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) + if (!SegmentIs(spec, mScheme, "resource") && + !SegmentIs(spec, mScheme, "chrome")) { + nsAutoCString ipString; ++#ifdef MOZ_RUST + if (encHost.Length() > 0 && + encHost.First() == '[' && encHost.Last() == ']' && + ValidIPv6orHostname(encHost.get(), encHost.Length())) { +@@ -866,7 +867,9 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) + return rv; + } + encHost = ipString; +- } else if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { ++ } else ++#endif ++ if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { + encHost = ipString; + } + } +@@ -2112,6 +2115,7 @@ nsStandardURL::SetHost(const nsACString &input) + + if (!SegmentIs(mScheme, "resource") && !SegmentIs(mScheme, "chrome")) { + nsAutoCString ipString; ++#ifdef MOZ_RUST + if (hostBuf.Length() > 0 && + hostBuf.First() == '[' && hostBuf.Last() == ']' && + ValidIPv6orHostname(hostBuf.get(), hostBuf.Length())) { +@@ -2120,7 +2124,9 @@ nsStandardURL::SetHost(const nsACString &input) + return rv; + } + hostBuf = ipString; +- } else if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { ++ } else ++#endif ++ if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { + hostBuf = ipString; + } + } +diff --git old-configure.in old-configure.in +index 717a94fcc692..54b29d737cc1 100644 +--- old-configure.in ++++ old-configure.in +@@ -2330,9 +2330,14 @@ if test -n "$MOZ_MULET"; then + fi + + # Propagate feature switches for code written in rust from confvars.sh +-if test -n "$MOZ_RUST_URLPARSE"; then +- AC_DEFINE(MOZ_RUST_URLPARSE) +- AC_SUBST(MOZ_RUST_URLPARSE) ++if test -n "$MOZ_RUST"; then ++ if test -n "$MOZ_RUST_MP4PARSE"; then ++ AC_DEFINE(MOZ_RUST_MP4PARSE) ++ fi ++ if test -n "$MOZ_RUST_URLPARSE"; then ++ AC_DEFINE(MOZ_RUST_URLPARSE) ++ AC_SUBST(MOZ_RUST_URLPARSE) ++ fi + fi + + AC_SUBST(MOZ_PHOENIX) diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json index 061c55f6a5b6..e49dfd176952 100644 --- toolkit/components/telemetry/Histograms.json +++ toolkit/components/telemetry/Histograms.json -@@ -6996,7 +6996,8 @@ - "expires_in_version": "55", +@@ -8320,7 +8320,8 @@ + "expires_in_version": "60", "kind": "boolean", "bug_numbers": [1220885], -- "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment." -+ "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment.", +- "description": "Whether the rust mp4 demuxer successfully parsed a stream segment." ++ "description": "Whether the rust mp4 demuxer successfully parsed a stream segment.", + "cpp_guard": "MOZ_RUST_MP4PARSE" }, "MEDIA_RUST_MP4PARSE_ERROR_CODE": { - "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], -@@ -7004,21 +7005,24 @@ + "record_in_processes": ["main", "content"], +@@ -8329,7 +8330,8 @@ "kind": "enumerated", "n_values": 32, "bug_numbers": [1238420], @@ -324,8 +597,9 @@ index 061c55f6a5b6..e49dfd176952 100644 + "cpp_guard": "MOZ_RUST_MP4PARSE" }, "MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": { - "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], - "expires_in_version": "55", + "record_in_processes": ["main", "content"], +@@ -8337,7 +8339,8 @@ + "expires_in_version": "60", "kind": "boolean", "bug_numbers": [1231169], - "description": "Whether rust and stagefight mp4 parser audio track results match." @@ -333,8 +607,9 @@ index 061c55f6a5b6..e49dfd176952 100644 + "cpp_guard": "MOZ_RUST_MP4PARSE" }, "MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": { - "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"], - "expires_in_version": "55", + "record_in_processes": ["main", "content"], +@@ -8345,7 +8348,8 @@ + "expires_in_version": "60", "kind": "boolean", "bug_numbers": [1231169], - "description": "Whether rust and stagefight mp4 parser video track results match." @@ -342,4 +617,200 @@ index 061c55f6a5b6..e49dfd176952 100644 + "cpp_guard": "MOZ_RUST_MP4PARSE" }, "MEDIA_WMF_DECODE_ERROR": { - "expires_in_version": "55", + "record_in_processes": ["main", "content", "gpu"], +diff --git toolkit/library/gtest/moz.build toolkit/library/gtest/moz.build +index 69a8fb1f4893..c684f48e456e 100644 +--- toolkit/library/gtest/moz.build ++++ toolkit/library/gtest/moz.build +@@ -7,7 +7,6 @@ + FINAL_TARGET = 'dist/bin/gtest' + + USE_LIBS += [ +- 'gkrust-gtest', + 'static:xul', + # xul-gtest is an intermediate static library. It is used as FINAL_TARGET + # for gtest code. +@@ -21,6 +20,11 @@ USE_LIBS += [ + # before StaticXULComponentStart. + Libxul('xul-gtest-real') + ++if CONFIG['MOZ_RUST']: ++ USE_LIBS += [ ++ 'gkrust-gtest', ++ ] ++ + DIRS += [ + 'static', + ] +diff --git toolkit/library/moz.build toolkit/library/moz.build +index 650f6eaba980..191e90ceb09a 100644 +--- toolkit/library/moz.build ++++ toolkit/library/moz.build +@@ -63,7 +63,7 @@ def Libxul(name): + + # This option should go away in bug 1290972, but we need to wait until + # Rust 1.12 has been released. +- if CONFIG['OS_ARCH'] == 'Darwin': ++ if CONFIG['MOZ_RUST'] and CONFIG['OS_ARCH'] == 'Darwin': + LDFLAGS += ['-Wl,-no_compact_unwind'] + + Libxul('xul') +@@ -343,4 +343,5 @@ USE_LIBS += ['StaticXULComponentsEnd'] + # The above library needs to be last for C++ purposes. This library, + # however, is entirely composed of Rust code, and needs to come after + # all the C++ code so any possible C++ -> Rust calls can be resolved. +-USE_LIBS += ['gkrust'] ++if CONFIG['MOZ_RUST']: ++ USE_LIBS += ['gkrust'] +diff --git toolkit/moz.configure toolkit/moz.configure +index ac9d123224ce..e90da70f0fa5 100644 +--- toolkit/moz.configure ++++ toolkit/moz.configure +@@ -88,8 +88,7 @@ include('../js/moz.configure') + + # Rust + # ============================================================== +-include('../build/moz.configure/rust.configure', +- when='--enable-compile-environment') ++include('../build/moz.configure/rust.configure') + + + # L10N +@@ -623,13 +622,13 @@ id_and_secret_keyfile('Leanplum SDK') + option('--enable-stylo', nargs='?', choices=('build',), + help='Include Stylo in the build and/or enable it at runtime') + +-@depends('--enable-stylo') +-def stylo_config(value): ++@depends('--enable-stylo', '--enable-rust') ++def stylo_config(value, rust_enabled): + build_stylo = None + enable_stylo = None + + # The default is to not build Stylo at all. +- if value.origin == 'default': ++ if not rust_enabled or value.origin == 'default': + pass + elif value == 'build': + build_stylo = True +@@ -769,12 +768,14 @@ set_config('SERVO_TARGET_DIR', servo_target_dir) + option('--enable-webrender', nargs='?', choices=('build',), + help='Include WebRender in the build and/or enable it at runtime') + +-@depends('--enable-webrender', milestone) +-def webrender(value, milestone): ++@depends('--enable-webrender', '--enable-rust', milestone) ++def webrender(value, rust_enabled, milestone): + build_webrender = None + enable_webrender = None + +- if value.origin == 'default': ++ if not rust_enabled: ++ pass ++ elif value.origin == 'default': + # if nothing is specified, default to just building on Nightly + build_webrender = milestone.is_nightly + elif value == 'build': +diff --git toolkit/toolkit.mozbuild toolkit/toolkit.mozbuild +index b845aab48023..9215afc6dd2d 100644 +--- toolkit/toolkit.mozbuild ++++ toolkit/toolkit.mozbuild +@@ -133,16 +133,23 @@ if CONFIG['MOZ_PREF_EXTENSIONS']: + + DIRS += [ + '/devtools', +- '/toolkit/library', +- '/toolkit/library/gtest/rust', +- '/toolkit/library/rust', +- '/toolkit/library/StaticXULComponentsEnd', + '/services', + '/startupcache', + '/js/ductwork/debugger', + '/other-licenses/snappy', + ] + ++if CONFIG['MOZ_RUST']: ++ DIRS += [ ++ '/toolkit/library/gtest/rust', ++ '/toolkit/library/rust', ++ ] ++ ++DIRS += [ ++ '/toolkit/library/StaticXULComponentsEnd', ++ '/toolkit/library', ++] ++ + if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: + DIRS += ['/toolkit/system/gnome'] + +diff --git toolkit/xre/nsAppRunner.cpp toolkit/xre/nsAppRunner.cpp +index 667c2eb1b365..6fb6cf102baa 100644 +--- toolkit/xre/nsAppRunner.cpp ++++ toolkit/xre/nsAppRunner.cpp +@@ -227,11 +227,13 @@ + extern uint32_t gRestartMode; + extern void InstallSignalHandlers(const char *ProgramName); + ++#ifdef MOZ_RUST + // This workaround is fixed in Rust 1.19. For details, see bug 1358151. + // Implementation in toolkit/library/rust/shared/lib.rs + extern "C" { + void rust_init_please_remove_this_after_updating_rust_1_19(); + } ++#endif + + #define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini") + #define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches") +@@ -3122,8 +3124,10 @@ XREMain::XRE_mainInit(bool* aExitFlag) + return 1; + *aExitFlag = false; + ++#ifdef MOZ_RUST + // This workaround is fixed in Rust 1.19. For details, see bug 1358151. + rust_init_please_remove_this_after_updating_rust_1_19(); ++#endif + + atexit(UnexpectedExit); + auto expectedShutdown = mozilla::MakeScopeExit([&] { +diff --git xpcom/base/nsDebugImpl.cpp xpcom/base/nsDebugImpl.cpp +index e6bb623c258b..c49d61dce605 100644 +--- xpcom/base/nsDebugImpl.cpp ++++ xpcom/base/nsDebugImpl.cpp +@@ -148,14 +148,20 @@ nsDebugImpl::Abort(const char* aFile, int32_t aLine) + return NS_OK; + } + ++#ifdef MOZ_RUST + // From toolkit/library/rust/lib.rs + extern "C" void intentional_panic(const char* message); ++#endif + + NS_IMETHODIMP + nsDebugImpl::RustPanic(const char* aMessage) + { ++#ifdef MOZ_RUST + intentional_panic(aMessage); + return NS_OK; ++#else ++ return NS_ERROR_NOT_IMPLEMENTED; ++#endif + } + + NS_IMETHODIMP +diff --git xpcom/rust/nsstring/gtest/moz.build xpcom/rust/nsstring/gtest/moz.build +index 197411678815..5bed9e57e57d 100644 +--- xpcom/rust/nsstring/gtest/moz.build ++++ xpcom/rust/nsstring/gtest/moz.build +@@ -4,8 +4,9 @@ + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + +-UNIFIED_SOURCES += [ +- 'Test.cpp' +-] ++if CONFIG['MOZ_RUST']: ++ UNIFIED_SOURCES += [ ++ 'Test.cpp' ++ ] + + FINAL_LIBRARY = 'xul-gtest' diff --git a/www/firefox/files/patch-third__party_python_futures_concurrent_futures_process.py b/www/firefox/files/patch-third__party_python_futures_concurrent_futures_process.py new file mode 100644 index 000000000000..0f584dbca8e5 --- /dev/null +++ b/www/firefox/files/patch-third__party_python_futures_concurrent_futures_process.py @@ -0,0 +1,15 @@ +--- third_party/python/futures/concurrent/futures/process.py.orig 2017-04-11 04:15:19 UTC ++++ third_party/python/futures/concurrent/futures/process.py +@@ -247,7 +247,11 @@ def _check_system_limits(): + _system_limits_checked = True + try: + import os +- nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") ++ if sys.platform.startswith('freebsd'): ++ # sem(4) confuses sysconf(3) on FreeBSD < 11.1 ++ nsems_max = -1 ++ else: ++ nsems_max = os.sysconf("SC_SEM_NSEMS_MAX") + except (AttributeError, ValueError): + # sysconf not available or setting not available + return