Browse Source

build fixes

Frank-Rainer Grahl 1 month ago
parent
commit
9b4cc11d86
29 changed files with 1693 additions and 195 deletions
  1. 89 0
      mozilla-release/patches/1519968-66a1.patch
  2. 75 0
      mozilla-release/patches/1523143-1-67a1.patch
  3. 43 0
      mozilla-release/patches/1523143-2-67a1.patch
  4. 24 28
      mozilla-release/patches/1526062-1-67a1.patch
  5. 80 0
      mozilla-release/patches/1536486-68a1.patch
  6. 196 0
      mozilla-release/patches/1547196-68a1.patch
  7. 11 11
      mozilla-release/patches/1560700-1-70a1.patch
  8. 6 4
      mozilla-release/patches/1560700-2-70a1.patch
  9. 68 0
      mozilla-release/patches/1562389-1-70a1.patch
  10. 104 0
      mozilla-release/patches/1562389-2-70a1.patch
  11. 8 6
      mozilla-release/patches/1564216-1-70a1.patch
  12. 22 29
      mozilla-release/patches/1575135-1-70a1.patch
  13. 11 9
      mozilla-release/patches/1579189-72a1.patch
  14. 15 15
      mozilla-release/patches/1610944-74a1.patch
  15. 22 26
      mozilla-release/patches/1635764-78a1.patch
  16. 3 9
      mozilla-release/patches/1638195-PARTIAL-78a1.patch
  17. 5 9
      mozilla-release/patches/1639815-1-78a1.patch
  18. 9 9
      mozilla-release/patches/1639815-2-78a1.patch
  19. 5 5
      mozilla-release/patches/1639815-3-78a1.patch
  20. 3 3
      mozilla-release/patches/1639815-6-78a1.patch
  21. 10 11
      mozilla-release/patches/1639815-7-78a1.patch
  22. 747 0
      mozilla-release/patches/1641775-78a1.patch
  23. 107 0
      mozilla-release/patches/1641783-78a1.patch
  24. 5 5
      mozilla-release/patches/1656044-PARTIAL-81a1.patch
  25. 3 3
      mozilla-release/patches/1659575-81a1.patch
  26. 5 5
      mozilla-release/patches/1746299-97a1.patch
  27. 4 4
      mozilla-release/patches/1747754-PARTIAL-97a1.patch
  28. 4 4
      mozilla-release/patches/PPPPPPP-NSSgetentropy.patch
  29. 9 0
      mozilla-release/patches/series

+ 89 - 0
mozilla-release/patches/1519968-66a1.patch

@@ -0,0 +1,89 @@
+# HG changeset patch
+# User Andrew Halberstadt <ahalberstadt@mozilla.com>
+# Date 1547495033 0
+# Node ID 1cf230625662499e8c2d0315cfa9d7cd161e1a48
+# Parent  094f30b483c2870166dfa617bb3bf5cda93a79d3
+Bug 1519968 - [mach] Minor improvements to autocomplete docs, r=jmaher
+
+Differential Revision: https://phabricator.services.mozilla.com/D16495
+
+diff --git a/python/mach/docs/usage.rst b/python/mach/docs/usage.rst
+--- a/python/mach/docs/usage.rst
++++ b/python/mach/docs/usage.rst
+@@ -39,30 +39,50 @@ following are valid:
+     $ ./mach help try fuzzy
+     $ ./mach try -h
+     $ ./mach try fuzzy --help
+ 
+ 
+ Auto Completion
+ ---------------
+ 
+-A `bash completion`_ script is bundled with mach. To enable it with ``bash``,
+-add the following to your ``~/.bashrc``, ``~/.bash_profile`` or equivalent:
++A `bash completion`_ script is bundled with mach, it can be used with either ``bash`` or ``zsh``.
++
++Bash
++~~~~
++
++Add the following to your ``~/.bashrc``, ``~/.bash_profile`` or equivalent:
+ 
+ .. code-block:: shell
+ 
+     source <srcdir>/python/mach/bash-completion.sh
+ 
+-This script can also be used with ``zsh``. Add this to your ``~/.zshrc`` or
+-equivalent:
++.. tip::
++
++    Windows users using the default shell bundled with mozilla-build should source the completion
++    script from ``~/.bash_profile`` (it may need to be created first).
++
++Zsh
++~~~
++
++Add this to your ``~/.zshrc`` or equivalent:
+ 
+ .. code-block:: shell
+ 
+-    autoload bashcompinit
+-    bashcompinit
++    autoload -U bashcompinit && bashcompinit
++    source <srcdir>/python/mach/bash-completion.sh
++
++The ``compinit`` function also needs to be loaded, but if using a framework (like ``oh-my-zsh``),
++this will often be done for you. So if you see ``command not found: compdef``, you'll need to modify
++the above instructions to:
++
++.. code-block:: shell
++
++    autoload -U compinit && compinit
++    autoload -U bashcompinit && bashcompinit
+     source <srcdir>/python/mach/bash-completion.sh
+ 
+ Don't forget to substitute ``<srcdir>`` with the path to your checkout.
+ 
+ 
+ User Settings
+ -------------
+ 
+diff --git a/tools/lint/codespell.yml b/tools/lint/codespell.yml
+--- a/tools/lint/codespell.yml
++++ b/tools/lint/codespell.yml
+@@ -1,15 +1,16 @@
+ ---
+ codespell:
+     description: Check code for common misspellings
+     include:
+         - browser/base/content/docs/
+         - build/docs
+         - python/docs
++        - python/mach/docs/
+         - python/mozlint
+         - python/safety/
+         - testing/mozbase/docs
+         - toolkit/components/extensions/docs
+         - toolkit/crashreporter/docs
+         - tools/lint
+     # List of extensions coming from:
+     # tools/lint/{flake8,eslint}.yml

+ 75 - 0
mozilla-release/patches/1523143-1-67a1.patch

@@ -0,0 +1,75 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1548724549 0
+#      Tue Jan 29 01:15:49 2019 +0000
+# Node ID e1c6f99be2e529d7997e60e67b61ba9039cce568
+# Parent  d91edd8b39e3d6fd7f62e811d411ee02f67d30cc
+Bug 1523143 - Remove --host configure flags from autospider builds. r=chmanchester
+
+--host is autodetected and may not actually be what the currently given
+values are.
+
+Differential Revision: https://phabricator.services.mozilla.com/D17765
+
+diff --git a/js/src/devtools/automation/autospider.py b/js/src/devtools/automation/autospider.py
+--- a/js/src/devtools/automation/autospider.py
++++ b/js/src/devtools/automation/autospider.py
+@@ -251,32 +251,32 @@ elif platform.system() == 'Windows':
+         os.environ['USE_64BIT'] = '1'
+     set_vars_from_script(posixpath.join(PDIR.scripts, 'winbuildenv.sh'),
+                          ['PATH', 'INCLUDE', 'LIB', 'LIBPATH', 'CC', 'CXX',
+                           'WINDOWSSDKDIR'])
+ 
+ # Configure flags, based on word length and cross-compilation
+ if word_bits == 32:
+     if platform.system() == 'Windows':
+-        CONFIGURE_ARGS += ' --target=i686-pc-mingw32 --host=i686-pc-mingw32'
++        CONFIGURE_ARGS += ' --target=i686-pc-mingw32'
+     elif platform.system() == 'Linux':
+         if not platform.machine().startswith('arm'):
+-            CONFIGURE_ARGS += ' --target=i686-pc-linux --host=i686-pc-linux'
++            CONFIGURE_ARGS += ' --target=i686-pc-linux'
+ 
+     # Add SSE2 support for x86/x64 architectures.
+     if not platform.machine().startswith('arm'):
+         if platform.system() == 'Windows':
+             sse_flags = '-arch:SSE2'
+         else:
+             sse_flags = '-msse -msse2 -mfpmath=sse'
+         env['CCFLAGS'] = '{0} {1}'.format(env.get('CCFLAGS', ''), sse_flags)
+         env['CXXFLAGS'] = '{0} {1}'.format(env.get('CXXFLAGS', ''), sse_flags)
+ else:
+     if platform.system() == 'Windows':
+-        CONFIGURE_ARGS += ' --target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32'
++        CONFIGURE_ARGS += ' --target=x86_64-pc-mingw32'
+ 
+ if platform.system() == 'Linux':
+     CONFIGURE_ARGS += ' --enable-stdcxx-compat'
+ 
+ # Timeouts.
+ ACTIVE_PROCESSES = set()
+ 
+ 
+diff --git a/js/src/devtools/automation/variants/arm-sim b/js/src/devtools/automation/variants/arm-sim
+--- a/js/src/devtools/automation/variants/arm-sim
++++ b/js/src/devtools/automation/variants/arm-sim
+@@ -1,7 +1,7 @@
+ {
+-    "configure-args": "--enable-simulator=arm --target=i686-pc-linux --host=i686-pc-linux",
++    "configure-args": "--enable-simulator=arm --target=i686-pc-linux",
+     "optimize": true,
+     "debug": true,
+     "bits": 32,
+     "use_minidump": false
+ }
+diff --git a/js/src/devtools/automation/variants/arm-sim-osx b/js/src/devtools/automation/variants/arm-sim-osx
+--- a/js/src/devtools/automation/variants/arm-sim-osx
++++ b/js/src/devtools/automation/variants/arm-sim-osx
+@@ -1,6 +1,6 @@
+ {
+-    "configure-args": "--enable-simulator=arm --target=i686-apple-darwin10.0.0 --host=i686-apple-darwin10.0.0",
++    "configure-args": "--enable-simulator=arm --target=i686-apple-darwin10.0.0",
+     "optimize": true,
+     "debug": true,
+     "bits": 32
+ }

+ 43 - 0
mozilla-release/patches/1523143-2-67a1.patch

@@ -0,0 +1,43 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1548724516 0
+# Node ID d0c328ac350718d3fe180a0a60aa6c65a929b2a7
+# Parent  3742098776e635bc6d8af345f91b8394d41615fc
+Bug 1523143 - Reject builds where the rust compiler host does not match the build host. r=chmanchester
+
+Depends on D17765
+
+Differential Revision: https://phabricator.services.mozilla.com/D17766
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -231,16 +231,28 @@ def rust_triple_alias(host_or_target):
+         return rustc_target.alias
+ 
+     return rust_target
+ 
+ 
+ rust_target_triple = rust_triple_alias(target)
+ rust_host_triple = rust_triple_alias(host)
+ 
++
++@depends(host, rust_host_triple, rustc_info.host)
++def validate_rust_host_triple(host, rust_host, rustc_host):
++    if rust_host != rustc_host:
++        if host.alias == rust_host:
++            configure_host = host_alias
++        else:
++            configure_host = '{}/{}'.format(host.alias, rust_host)
++        die("The rust compiler host ({}) is not suitable for the configure host ({})."
++            .format(rustc_host, configure_host))
++
++
+ set_config('RUST_TARGET', rust_target_triple)
+ set_config('RUST_HOST_TARGET', rust_host_triple)
+ 
+ 
+ @depends(rust_target_triple)
+ def rust_target_env_name(triple):
+     return triple.upper().replace('-', '_')
+ 

+ 24 - 28
mozilla-release/patches/1526062-1-67a1.patch

@@ -3,7 +3,7 @@
 # Date 1549644973 0
 #      Fri Feb 08 16:56:13 2019 +0000
 # Node ID 358cf23ac4482d01d80de12482cc40c58b0b144f
-# Parent  9e8107d3b763f54a3efa5faf1f7b2a1a48d30e74
+# Parent  e8da2b7b91b07a2753edf1a3e1b642519502e1be
 Bug 1526062 - Fix miscellaneous NameErrors lingering in the python configure code. r=nalexander
 
 Differential Revision: https://phabricator.services.mozilla.com/D19109
@@ -30,7 +30,7 @@ diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/and
              '/path/to/ndk/toolchain.')
  
  
-@@ -281,21 +281,20 @@ def bindgen_cflags_defaults(toolchain_fl
+@@ -281,21 +281,20 @@ def bindgen_cflags_android(toolchain_fla
  
  @depends(host, ndk)
  @imports(_from='os.path', _import='exists')
@@ -55,32 +55,28 @@ diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/and
      if not exists(clang):
          die("Couln't find clang in LLVM toolchain at %s" % clang)
  
-diff --git a/build/moz.configure/rust.configure.1526062.later b/build/moz.configure/rust.configure.1526062.later
-new file mode 100644
---- /dev/null
-+++ b/build/moz.configure/rust.configure.1526062.later
-@@ -0,0 +1,21 @@
-+--- rust.configure
-++++ rust.configure
-+@@ -236,17 +236,17 @@ def rust_triple_alias(host_or_target):
-+ rust_target_triple = rust_triple_alias(target)
-+ rust_host_triple = rust_triple_alias(host)
-+ 
-+ 
-+ @depends(host, rust_host_triple, rustc_info.host)
-+ def validate_rust_host_triple(host, rust_host, rustc_host):
-+     if rust_host != rustc_host:
-+         if host.alias == rust_host:
-+-            configure_host = host_alias
-++            configure_host = host.alias
-+         else:
-+             configure_host = '{}/{}'.format(host.alias, rust_host)
-+         die("The rust compiler host ({}) is not suitable for the configure host ({})."
-+             .format(rustc_host, configure_host))
-+ 
-+ 
-+ set_config('RUST_TARGET', rust_target_triple)
-+ set_config('RUST_HOST_TARGET', rust_host_triple)
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -236,17 +236,17 @@ def rust_triple_alias(host_or_target):
+ rust_target_triple = rust_triple_alias(target)
+ rust_host_triple = rust_triple_alias(host)
+ 
+ 
+ @depends(host, rust_host_triple, rustc_info.host)
+ def validate_rust_host_triple(host, rust_host, rustc_host):
+     if rust_host != rustc_host:
+         if host.alias == rust_host:
+-            configure_host = host_alias
++            configure_host = host.alias
+         else:
+             configure_host = '{}/{}'.format(host.alias, rust_host)
+         die("The rust compiler host ({}) is not suitable for the configure host ({})."
+             .format(rustc_host, configure_host))
+ 
+ 
+ set_config('RUST_TARGET', rust_target_triple)
+ set_config('RUST_HOST_TARGET', rust_host_triple)
 diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure
 --- a/build/moz.configure/util.configure
 +++ b/build/moz.configure/util.configure

+ 80 - 0
mozilla-release/patches/1536486-68a1.patch

@@ -0,0 +1,80 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1555021551 0
+# Node ID c1f7767c6896d6d3e4c40b3f32244822fca0bfda
+# Parent  6873807a36e8200a7b545d63d6fbfb37316a8dad
+Bug 1536486 - Use plain cargo instead of rustup cargo on OSX. r=froydnj
+
+Differential Revision: https://phabricator.services.mozilla.com/D27040
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -7,18 +7,64 @@
+ 
+ # Rust is required by `rust_compiler` below. We allow_missing here
+ # to propagate failures to the better error message there.
+ js_option(env='RUSTC', nargs=1, help='Path to the rust compiler')
+ js_option(env='CARGO', nargs=1, help='Path to the Cargo package manager')
+ 
+ rustc = check_prog('RUSTC', ['rustc'], paths=toolchain_search_path,
+                    input='RUSTC', allow_missing=True)
+-cargo = check_prog('CARGO', ['cargo'], paths=toolchain_search_path,
+-                   input='CARGO', allow_missing=True)
++cargo = check_prog('_CARGO', ['cargo'], what='cargo',
++                   paths=toolchain_search_path, input='CARGO',
++                   allow_missing=True)
++
++
++@depends(cargo, host)
++@imports('subprocess')
++@imports(_from='__builtin__', _import='open')
++@imports('os')
++def cargo(cargo, host):
++    # The cargo executable can be either a rustup wrapper, or a real,
++    # plain, cargo. In the former case, on OSX, rustup sets
++    # DYLD_LIBRARY_PATH (at least until
++    # https://github.com/rust-lang/rustup.rs/pull/1752 is merged and shipped)
++    # and that can wreck havoc (see bug 1536486).
++    #
++    # So if we're in that situation, find the corresponding real plain
++    # cargo.
++    #
++    # To achieve that, try to run `cargo +stable`. When it's the rustup
++    # wrapper, it either prints cargo's help and exits with status 0, or print
++    # an error message (error: toolchain 'stable' is not installed) and exits
++    # with status 1. When it's plain cargo, it exits with a different error
++    # message (error: no such subcommand: `+stable`), and exits with status
++    # 101.
++    if host.os == 'OSX':
++        with open(os.devnull, 'wb') as devnull:
++            retcode = subprocess.call(
++                [cargo, '+stable'], stdout=devnull, stderr=devnull)
++        if retcode != 101:
++            # We now proceed to find the real cargo. We're not sure `rustup`
++            # is in $PATH, but we know the cargo executable location, and that
++            # it /is/ rustup, so we can pass it `rustup` as argv[0], which
++            # will make it act as rustup.
++            # Note we could avoid the `cargo +stable` call above, but there's
++            # the possibility that there's a `cargo-which` command that would
++            # not fail with running `cargo which cargo` with a real cargo.
++            out = check_cmd_output('rustup', 'which', 'cargo',
++                                   executable=cargo).rstrip()
++            # If for some reason the above failed to return something, keep the
++            # cargo we found originally.
++            if out:
++                cargo = out
++                log.info('Actually using %s', cargo)
++    return cargo
++
++
++set_config('CARGO', cargo)
+ 
+ 
+ @depends_if(rustc)
+ @checking('rustc version', lambda info: info.version)
+ def rustc_info(rustc):
+     out = check_cmd_output(rustc, '--version', '--verbose').splitlines()
+     info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:])
+     return namespace(
+

+ 196 - 0
mozilla-release/patches/1547196-68a1.patch

@@ -0,0 +1,196 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1557812599 0
+# Node ID c9f1a1db8fa2190a88c09eb624b321a07da6c3e1
+# Parent  c258b2ba6aafb8fc0cb0bb29881760270bc50951
+Bug 1547196 - remove rustup wrapper from `rustc` as well as `cargo`; r=glandium
+
+Having `rustc` be `rustup`'s wrapper for `rustc` means that we may
+silently honor `rustup`'s override mechanisms.  We noticed this first on
+OS X, where we use the "real" `cargo` but `rustup`'s `rustc` wrapper,
+and problems ensued when `cargo` thought it was using one version of
+`rustc`, but actually wound up using something different.
+
+It seems better to avoid silently interposing `rustup`'s toolchain
+override mechanisms everywhere, rather than having to special-case OS
+X.  So let's factor out a general mechanism for removing the wrappers
+`rustup` provides and use that for both `rustc` and `cargo`.  The tests
+need adjusting because we weren't triggering the unwrapping cases
+before; we don't yet test the case where we really do need to unwrap.
+That test can be left for a future patch.
+
+Differential Revision: https://phabricator.services.mozilla.com/D29531
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -5,66 +5,91 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ 
+ # Rust is required by `rust_compiler` below. We allow_missing here
+ # to propagate failures to the better error message there.
+ js_option(env='RUSTC', nargs=1, help='Path to the rust compiler')
+ js_option(env='CARGO', nargs=1, help='Path to the Cargo package manager')
+ 
+-rustc = check_prog('RUSTC', ['rustc'], paths=toolchain_search_path,
+-                   input='RUSTC', allow_missing=True)
++rustc = check_prog('_RUSTC', ['rustc'], what='rustc',
++                   paths=toolchain_search_path, input='RUSTC',
++                   allow_missing=True)
+ cargo = check_prog('_CARGO', ['cargo'], what='cargo',
+                    paths=toolchain_search_path, input='CARGO',
+                    allow_missing=True)
+ 
+ 
+-@depends(cargo, host)
+-@imports('subprocess')
+-@imports(_from='__builtin__', _import='open')
+-@imports('os')
+-def cargo(cargo, host):
+-    # The cargo executable can be either a rustup wrapper, or a real,
+-    # plain, cargo. In the former case, on OSX, rustup sets
+-    # DYLD_LIBRARY_PATH (at least until
+-    # https://github.com/rust-lang/rustup.rs/pull/1752 is merged and shipped)
+-    # and that can wreck havoc (see bug 1536486).
++@template
++def unwrap_rustup(prog, name):
++    # rustc and cargo can either be rustup wrappers, or they can be the actual,
++    # plain executables. For cargo, on OSX, rustup sets DYLD_LIBRARY_PATH (at
++    # least until https://github.com/rust-lang/rustup.rs/pull/1752 is merged
++    # and shipped) and that can wreak havoc (see bug 1536486). Similarly, for
++    # rustc, rustup silently honors toolchain overrides set by vendored crates
++    # (see bug 1547196).
+     #
+-    # So if we're in that situation, find the corresponding real plain
+-    # cargo.
++    # In either case, we need to find the plain executables.
+     #
+-    # To achieve that, try to run `cargo +stable`. When it's the rustup
+-    # wrapper, it either prints cargo's help and exits with status 0, or print
++    # To achieve that, try to run `PROG +stable`. When the rustup wrapper is in
++    # use, it either prints PROG's help and exits with status 0, or prints
+     # an error message (error: toolchain 'stable' is not installed) and exits
+-    # with status 1. When it's plain cargo, it exits with a different error
+-    # message (error: no such subcommand: `+stable`), and exits with status
+-    # 101.
+-    if host.os == 'OSX':
+-        with open(os.devnull, 'wb') as devnull:
+-            retcode = subprocess.call(
+-                [cargo, '+stable'], stdout=devnull, stderr=devnull)
+-        if retcode != 101:
+-            # We now proceed to find the real cargo. We're not sure `rustup`
+-            # is in $PATH, but we know the cargo executable location, and that
+-            # it /is/ rustup, so we can pass it `rustup` as argv[0], which
+-            # will make it act as rustup.
+-            # Note we could avoid the `cargo +stable` call above, but there's
+-            # the possibility that there's a `cargo-which` command that would
+-            # not fail with running `cargo which cargo` with a real cargo.
+-            out = check_cmd_output('rustup', 'which', 'cargo',
+-                                   executable=cargo).rstrip()
++    # with status 1. In the cargo case, when plain cargo is in use, it exits
++    # with a different error message (e.g. "error: no such subcommand:
++    # `+stable`"), and exits with status 101.
++    #
++    # Unfortunately, in the rustc case, when plain rustc is in use,
++    # `rustc +stable` will exit with status 1, complaining about a missing
++    # "+stable" file. We'll examine the error output to try and distinguish
++    # between failing rustup and failing rustc.
++    @depends(prog, dependable(name))
++    @imports('subprocess')
++    @imports(_from='__builtin__', _import='open')
++    @imports('os')
++    def unwrap(prog, name):
++        def from_rustup_which():
++            out = check_cmd_output('rustup', 'which', name,
++                                   executable=prog).rstrip()
+             # If for some reason the above failed to return something, keep the
+-            # cargo we found originally.
++            # PROG we found originally.
+             if out:
+-                cargo = out
+-                log.info('Actually using %s', cargo)
+-    return cargo
++                log.info('Actually using \'%s\'', out)
++                return out
++
++            log.info('No `rustup which` output, using \'%s\'', prog)
++            return prog
++
++        (retcode, stdout, stderr) = get_cmd_output(prog, '+stable')
++
++        if name == 'cargo' and retcode != 101:
++            prog = from_rustup_which()
++        elif name == 'rustc':
++            if retcode == 0:
++                prog = from_rustup_which()
++            elif "+stable" in stderr:
++                # PROG looks like plain `rustc`.
++                pass
++            else:
++                # Assume PROG looks like `rustup`. This case is a little weird,
++                # insofar as the user doesn't have the "stable" toolchain
++                # installed, but go ahead and unwrap anyway: the user might
++                # have only certain versions, beta, or nightly installed, and
++                # we'll catch invalid versions later.
++                prog = from_rustup_which()
++
++        return prog
++
++    return unwrap
++
++rustc = unwrap_rustup(rustc, 'rustc')
++cargo = unwrap_rustup(cargo, 'cargo')
+ 
+ 
+ set_config('CARGO', cargo)
++set_config('RUSTC', rustc)
+ 
+ 
+ @depends_if(rustc)
+ @checking('rustc version', lambda info: info.version)
+ def rustc_info(rustc):
+     out = check_cmd_output(rustc, '--version', '--verbose').splitlines()
+     info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:])
+     return namespace(
+diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+@@ -1486,27 +1486,35 @@ class OpenBSDToolchainTest(BaseToolchain
+     def test_gcc(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_GCC_RESULT,
+             'cxx_compiler': self.DEFAULT_GXX_RESULT,
+         })
+ 
+ 
+ @memoize
+-def gen_invoke_cargo(version):
++def gen_invoke_cargo(version, rustup_wrapper=False):
+     def invoke_cargo(stdin, args):
++        args = tuple(args)
++        if not rustup_wrapper and args == ('+stable',):
++            return (101, '', 'we are the real thing')
+         if args == ('--version', '--verbose'):
+             return 0, 'cargo %s\nrelease: %s' % (version, version), ''
+         raise NotImplementedError('unsupported arguments')
+     return invoke_cargo
+ 
+ 
+ @memoize
+-def gen_invoke_rustc(version):
++def gen_invoke_rustc(version, rustup_wrapper=False):
+     def invoke_rustc(stdin, args):
++        args = tuple(args)
++        # TODO: we don't have enough machinery set up to test the `rustup which`
++        # fallback yet.
++        if not rustup_wrapper and args == ('+stable',):
++            return (1, '', 'error: couldn\'t read +stable: No such file or directory')
+         if args == ('--version', '--verbose'):
+             return (0, 'rustc %s\nrelease: %s\nhost: x86_64-unknown-linux-gnu'
+                        % (version, version), '')
+         if args == ('--print', 'target-list'):
+             # Raw list returned by rustc version 1.33 which somehow
+             # don't appear in the default list.
+             # https://github.com/rust-lang/rust/issues/36156
+             rust_targets = [

+ 11 - 11
mozilla-release/patches/1560700-1-70a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1566429744 0
 # Node ID 8a68c8e08c02b82b390f25d296057e017a1c6159
-# Parent  c5c93911599430abc8f054fc6c8a1395e9ad0a88
+# Parent  8e5f8d58002615680b17a3fa35d74ba57909471f
 Bug 1560700 - Change how the rust target is derived from the build system target. r=froydnj
 
 There are a few problems with the strategy currently used to find the
@@ -18,7 +18,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D41481
 diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
 --- a/build/moz.configure/rust.configure
 +++ b/build/moz.configure/rust.configure
-@@ -107,47 +107,40 @@ def rust_compiler(rustc_info, cargo_info
+@@ -175,47 +175,40 @@ def rust_compiler(rustc_info, cargo_info
  
          You can verify this by typing 'cargo --version'.
          ''').format(version, cargo_min_version))
@@ -82,12 +82,12 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
  
  
  @template
- def rust_triple_alias(host_or_target):
+ def rust_triple_alias(host_or_target, host_or_target_c_compiler):
      """Template defining the alias used for rustc's --target flag.
      `host_or_target` is either `host` or `target` (the @depends functions
      from init.configure).
      """
-@@ -170,51 +163,114 @@ def rust_triple_alias(host_or_target):
+@@ -237,51 +230,114 @@ def rust_triple_alias(host_or_target, ho
          # as, the autoconf-derived targets we use.  An example would be that
          # Rust uses distinct target triples for targetting the GNU C++ ABI
          # and the MSVC C++ ABI on Win32, whereas autoconf has a single
@@ -227,7 +227,7 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
              log.debug('Creating `%s` with content:', in_path)
              with LineIO(lambda l: log.debug('| %s', l)) as out:
                  out.write(source)
-@@ -232,26 +288,26 @@ def rust_triple_alias(host_or_target):
+@@ -299,26 +355,26 @@ def rust_triple_alias(host_or_target, ho
  
              def failed():
                  die(dedent('''\
@@ -252,14 +252,14 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
      return rust_target
  
  
- rust_target_triple = rust_triple_alias(target)
- rust_host_triple = rust_triple_alias(host)
+ rust_target_triple = rust_triple_alias(target, c_compiler)
+ rust_host_triple = rust_triple_alias(host, host_c_compiler)
+ 
  
- set_config('RUST_TARGET', rust_target_triple)
 diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
 +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
-@@ -1600,28 +1600,54 @@ def gen_invoke_rustc(version):
+@@ -1686,28 +1686,54 @@ def gen_invoke_rustc(version, rustup_wra
              if Version(version) >= '1.33.0':
                  rust_targets += [
                      'thumbv7neon-linux-androideabi',
@@ -315,7 +315,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  
          paths = {
              mozpath.abspath('/usr/bin/cargo'): gen_invoke_cargo(version),
-@@ -1633,17 +1659,18 @@ class RustTest(BaseConfigureTest):
+@@ -1719,17 +1745,18 @@ class RustTest(BaseConfigureTest):
  
          # Trick the sandbox into not running the target compiler check
          dep = sandbox._depends[sandbox['c_compiler']]
@@ -335,7 +335,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
              'x86_64-unknown-dragonfly',
              'aarch64-unknown-freebsd',
              'i686-unknown-freebsd',
-@@ -1692,58 +1719,76 @@ class RustTest(BaseConfigureTest):
+@@ -1778,58 +1805,76 @@ class RustTest(BaseConfigureTest):
              ('x86_64-pc-mingw32', 'clang', 'x86_64-pc-windows-gnu'),
          ):
              self.assertEqual(self.get_rust_target(autoconf, building_with_gcc), rust)

+ 6 - 4
mozilla-release/patches/1560700-2-70a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1565735438 0
 # Node ID 36d42617dfd2bb6908009998ec2813c411fa1778
-# Parent  936a6fddcd959c6faea60dc17ce15969748816a6
+# Parent  cd0d1855a5787e850d7baaa8b71d128cdb04ff28
 Bug 1560700 - Remove now unused allow_unknown argument to split_triplet. r=chmanchester
 
 Differential Revision: https://phabricator.services.mozilla.com/D41482
@@ -10,7 +10,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D41482
 diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
 --- a/build/moz.configure/init.configure
 +++ b/build/moz.configure/init.configure
-@@ -589,19 +589,18 @@ option('--target', nargs=1,
+@@ -619,19 +619,18 @@ option('--target', nargs=1,
              'used')
  
  
@@ -31,7 +31,7 @@ diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.confi
      # Additionally, some may omit "unknown" when the manufacturer
      # is not specified and emit
      #   CPU_TYPE-OPERATING_SYSTEM
-@@ -644,18 +643,16 @@ def split_triplet(triplet, allow_unknown
+@@ -674,18 +673,16 @@ def split_triplet(triplet, allow_unknown
      elif os.startswith('freebsd'):
          canonical_os = canonical_kernel = 'FreeBSD'
      elif os.startswith('netbsd'):
@@ -50,7 +50,7 @@ diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.confi
      if cpu.endswith('86') or (cpu.startswith('i') and '86' in cpu):
          canonical_cpu = 'x86'
          endianness = 'little'
-@@ -693,49 +690,35 @@ def split_triplet(triplet, allow_unknown
+@@ -723,51 +720,37 @@ def split_triplet(triplet, allow_unknown
          canonical_cpu = 'mips64'
          endianness = 'little' if 'el' in cpu else 'big'
      elif cpu.startswith('aarch64'):
@@ -82,6 +82,8 @@ diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.confi
  
      if os.startswith('darwin'):
          toolchain = '%s-apple-%s' % (cpu, os)
+     elif canonical_cpu == 'aarch64' and canonical_os == 'WINNT':
+         toolchain = 'aarch64-windows-msvc'
      else:
          toolchain = '%s-%s' % (cpu, os)
  

+ 68 - 0
mozilla-release/patches/1562389-1-70a1.patch

@@ -0,0 +1,68 @@
+# HG changeset patch
+# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
+# Date 1562582131 0
+# Node ID eb3e6a4dde4b35ee4de54c7d2e4a583e4bca9e5c
+# Parent  fc6a344c287f119d47ab68ae4150cb71afcc3b2e
+Bug 1562389 - Set correct triple for rustc when host and target are different compiler type. r=froydnj
+
+When host and target are different compiler type, triple for rustc may be incorrect. If target is clang, host is always clang, not using host compiler type.
+
+Example, when host is clang-cl for windows, and target is clang for Android, host's triple for ructc sets `windows-gnu`, not `windows-msvc`.
+
+Differential Revision: https://phabricator.services.mozilla.com/D36421
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -210,27 +210,27 @@ def rust_supported_targets(rustc):
+                 raw_os = 'linux-androideabi'
+             per_raw_os[(t.cpu, endianness, raw_os)] = t
+         else:
+             per_os[key] = t
+     return namespace(per_os=per_os, per_raw_os=per_raw_os)
+ 
+ 
+ @template
+-def rust_triple_alias(host_or_target):
++def rust_triple_alias(host_or_target, host_or_target_c_compiler):
+     """Template defining the alias used for rustc's --target flag.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure).
+     """
+     assert host_or_target in {host, target}
+ 
+     host_or_target_str = {host: 'host', target: 'target'}[host_or_target]
+ 
+-    @depends(rustc, host_or_target, c_compiler, rust_supported_targets,
+-             arm_target, when=rust_compiler)
++    @depends(rustc, host_or_target, host_or_target_c_compiler,
++             rust_supported_targets, arm_target, when=rust_compiler)
+     @checking('for rust %s triplet' % host_or_target_str)
+     @imports('os')
+     @imports('subprocess')
+     @imports(_from='mozbuild.configure.util', _import='LineIO')
+     @imports(_from='mozbuild.shellutil', _import='quote')
+     @imports(_from='tempfile', _import='mkstemp')
+     @imports(_from='textwrap', _import='dedent')
+     def rust_target(rustc, host_or_target, compiler_info,
+@@ -315,18 +315,18 @@ def rust_triple_alias(host_or_target):
+             os.remove(out_path)
+ 
+         # This target is usable.
+         return rustc_target.alias
+ 
+     return rust_target
+ 
+ 
+-rust_target_triple = rust_triple_alias(target)
+-rust_host_triple = rust_triple_alias(host)
++rust_target_triple = rust_triple_alias(target, c_compiler)
++rust_host_triple = rust_triple_alias(host, host_c_compiler)
+ 
+ 
+ @depends(host, rust_host_triple, rustc_info.host)
+ def validate_rust_host_triple(host, rust_host, rustc_host):
+     if rust_host != rustc_host:
+         if host.alias == rust_host:
+             configure_host = host.alias
+         else:

+ 104 - 0
mozilla-release/patches/1562389-2-70a1.patch

@@ -0,0 +1,104 @@
+# HG changeset patch
+# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
+# Date 1562582140 0
+# Node ID c3c853745453f187d60d195a04c5d877f04de896
+# Parent  cbb88524ab230cfdaa8a36c8136568e45d521ac4
+Bug 1562389 - Better detect non-clang-cl native windows clang. r=glandium
+
+When building Gecko/Android/aarch64 on Windows, `--target` parameter may not be incorrect value. Although `check_compiler`'s `info` is target compiler, clang on Windows is always detected as `clang-cl`, not `clang`.
+
+```
+c:/Users/mkato/.mozbuild/clang/bin/clang.exe -E  -dM - < /dev/null
+...
+#define _MSC_VER 1916
+```
+
+So even if using clang on Windows, not clang-cl, we should detect as 'clang' correctly
+
+Differential Revision: https://phabricator.services.mozilla.com/D36422
+
+diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
+--- a/build/moz.configure/init.configure
++++ b/build/moz.configure/init.configure
+@@ -746,16 +746,18 @@ def split_triplet(triplet, allow_unknown
+         return CPU_bitness[cpu]
+ 
+     # Toolchains, most notably for cross compilation may use cpu-os
+     # prefixes. We need to be more specific about the LLVM target on Mac
+     # so cross-language LTO will work correctly.
+ 
+     if os.startswith('darwin'):
+         toolchain = '%s-apple-%s' % (cpu, os)
++    elif canonical_cpu == 'aarch64' and canonical_os == 'WINNT':
++        toolchain = 'aarch64-windows-msvc'
+     else:
+         toolchain = '%s-%s' % (cpu, os)
+ 
+     return namespace(
+         alias=triplet,
+         cpu=sanitize(CPU, canonical_cpu),
+         bitness=sanitize(bitness, canonical_cpu),
+         kernel=sanitize(Kernel, canonical_kernel),
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -415,16 +415,18 @@ def get_compiler_info(compiler, language
+     # Note: We'd normally do a version check for clang, but versions of clang
+     # in Xcode have a completely different versioning scheme despite exposing
+     # the version with the same defines.
+     # So instead, we make things such that the version is missing when the
+     # clang used is below the minimum supported version (currently clang 4.0).
+     # We then only include the version information when the compiler matches
+     # the feature check, so that an unsupported version of clang would have
+     # no version number.
++    # Bug 1562389: We don't check _MT here because it is either clang-cl or
++    # msvc. Building Android is not supported or used anyway.
+     check = dedent('''\
+         #if defined(_MSC_VER)
+         #if defined(__clang__)
+         %COMPILER "clang-cl"
+         %VERSION _MSC_FULL_VER
+         #else
+         %COMPILER "msvc"
+         %VERSION _MSC_FULL_VER
+@@ -581,18 +583,17 @@ def check_compiler(compiler, language, t
+ 
+     if not has_target and (not info.cpu or info.cpu != target.cpu and info.type != 'msvc'):
+         same_arch = same_arch_different_bits()
+         if (target.cpu, info.cpu) in same_arch:
+             flags.append('-m32')
+         elif (info.cpu, target.cpu) in same_arch:
+             flags.append('-m64')
+         elif info.type == 'clang-cl' and target.cpu == 'aarch64':
+-            # clang-cl uses a different name for this target
+-            flags.append('--target=aarch64-windows-msvc')
++            flags.append('--target=%s' % target.toolchain)
+         elif info.type == 'clang':
+             flags.append('--target=%s' % target.toolchain)
+ 
+     return namespace(
+         type=info.type,
+         version=info.version,
+         target_cpu=info.cpu,
+         target_kernel=info.kernel,
+diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+@@ -225,16 +225,17 @@ CLANG_PLATFORM_X86_64_WIN = CLANG_PLATFO
+ @memoize
+ def VS(version):
+     version = Version(version)
+     return FakeCompiler({
+         None: {
+             '_MSC_VER': '%02d%02d' % (version.major, version.minor),
+             '_MSC_FULL_VER': '%02d%02d%05d' % (version.major, version.minor,
+                                                version.patch),
++            '_MT': '1',
+         },
+         '*.cpp': DEFAULT_CXX_97,
+     })
+ 
+ 
+ VS_2013u2 = VS('18.00.30501')
+ VS_2013u3 = VS('18.00.30723')
+ VS_2015 = VS('19.00.23026')

+ 8 - 6
mozilla-release/patches/1564216-1-70a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1563831099 0
 # Node ID 5f82bce8aa2767652f059b641921ab75422fe79c
-# Parent  a37d1a9a270f4cb68e5a7b542414da0935ce0f48
+# Parent  298d8942085aed240297040c452227eacadfacfc
 Bug 1564216 - Require clang 5 for OSX builds. r=froydnj
 
 There is less incentive to keep things building with older versions of
@@ -14,7 +14,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D38581
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -412,32 +412,37 @@ def get_compiler_info(compiler, language
+@@ -411,34 +411,39 @@ def get_compiler_info(compiler, language
      '''
      # Note: MSVC doesn't expose __STDC_VERSION__. It does expose __STDC__,
      # but only when given the -Za option, which disables compiler
@@ -29,6 +29,8 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
      # We then only include the version information when the compiler matches
      # the feature check, so that an unsupported version of clang would have
      # no version number.
+     # Bug 1562389: We don't check _MT here because it is either clang-cl or
+     # msvc. Building Android is not supported or used anyway.
      check = dedent('''\
          #if defined(_MSC_VER)
          #if defined(__clang__)
@@ -102,7 +104,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
      base = {
          '--target=x86_64-linux-gnu': GCC_PLATFORM_X86_64_LINUX[None],
          '--target=x86_64-apple-darwin11.2.0': GCC_PLATFORM_X86_64_OSX[None],
-@@ -637,17 +645,16 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -638,17 +646,16 @@ class LinuxToolchainTest(BaseToolchainTe
          self.do_toolchain_test(self.PATHS, {
              'c_compiler': self.CLANG_4_0_RESULT,
              'cxx_compiler': self.CLANGXX_4_0_RESULT,
@@ -120,7 +122,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
              'CXX': 'clang++-3.3',
          })
  
-@@ -811,28 +818,42 @@ def xcrun(stdin, args):
+@@ -812,28 +819,42 @@ def xcrun(stdin, args):
  
  class OSXToolchainTest(BaseToolchainTest):
      HOST = 'x86_64-apple-darwin11.2.0'
@@ -169,7 +171,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
          'flags': PrependFlags(['-isysroot', xcrun('', ('--show-sdk-path',))[1]]),
      }
  
-@@ -849,24 +870,31 @@ class OSXToolchainTest(BaseToolchainTest
+@@ -850,24 +871,31 @@ class OSXToolchainTest(BaseToolchainTest
              k: v for k, v in self.PATHS.iteritems()
              if os.path.basename(k) not in ('clang', 'clang++')
          }
@@ -202,7 +204,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
              'cxx_compiler': self.GXX_7_RESULT + self.SYSROOT_FLAGS,
          }, environ={
              'CC': 'gcc-7',
-@@ -1442,19 +1470,23 @@ class LinuxCrossCompileToolchainTest(Bas
+@@ -1443,19 +1471,23 @@ class LinuxCrossCompileToolchainTest(Bas
          }, environ={
              'CC': 'afl-clang-fast',
              'CXX': 'afl-clang-fast++',

+ 22 - 29
mozilla-release/patches/1575135-1-70a1.patch

@@ -3,7 +3,7 @@
 # Date 1566319170 0
 #      Tue Aug 20 16:39:30 2019 +0000
 # Node ID e0b2831af0748255359df99a94911c2cb3f8ba1e
-# Parent  60463c69c273e36702cc87c87c896300ffc544d6
+# Parent  3b784d8235bb44edf145cc312000a8242906159d
 Bug 1575135 - Remove unused subprocess imports. r=nalexander
 
 Differential Revision: https://phabricator.services.mozilla.com/D42600
@@ -32,13 +32,31 @@ diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configu
 diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
 --- a/build/moz.configure/rust.configure
 +++ b/build/moz.configure/rust.configure
-@@ -145,17 +145,16 @@ def rust_triple_alias(host_or_target):
+@@ -36,17 +36,16 @@ def unwrap_rustup(prog, name):
+     # with a different error message (e.g. "error: no such subcommand:
+     # `+stable`"), and exits with status 101.
+     #
+     # Unfortunately, in the rustc case, when plain rustc is in use,
+     # `rustc +stable` will exit with status 1, complaining about a missing
+     # "+stable" file. We'll examine the error output to try and distinguish
+     # between failing rustup and failing rustc.
+     @depends(prog, dependable(name))
+-    @imports('subprocess')
+     @imports(_from='__builtin__', _import='open')
+     @imports('os')
+     def unwrap(prog, name):
+         def from_rustup_which():
+             out = check_cmd_output('rustup', 'which', name,
+                                    executable=prog).rstrip()
+             # If for some reason the above failed to return something, keep the
+             # PROG we found originally.
+@@ -223,17 +222,16 @@ def rust_triple_alias(host_or_target, ho
      assert host_or_target in {host, target}
  
      host_or_target_str = {host: 'host', target: 'target'}[host_or_target]
  
-     @depends(rustc, host_or_target, c_compiler, rust_supported_targets,
-              arm_target, when=rust_compiler)
+     @depends(rustc, host_or_target, host_or_target_c_compiler,
+              rust_supported_targets, arm_target, when=rust_compiler)
      @checking('for rust %s triplet' % host_or_target_str)
      @imports('os')
 -    @imports('subprocess')
@@ -50,31 +68,6 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
                      rust_supported_targets, arm_target):
          # Rust's --target options are similar to, but not exactly the same
          # as, the autoconf-derived targets we use.  An example would be that
-diff --git a/build/moz.configure/rust.configure.1575135.later b/build/moz.configure/rust.configure.1575135.later
-new file mode 100644
---- /dev/null
-+++ b/build/moz.configure/rust.configure.1575135.later
-@@ -0,0 +1,20 @@
-+--- rust.configure
-++++ rust.configure
-+@@ -36,17 +36,16 @@ def unwrap_rustup(prog, name):
-+     # with a different error message (e.g. "error: no such subcommand:
-+     # `+stable`"), and exits with status 101.
-+     #
-+     # Unfortunately, in the rustc case, when plain rustc is in use,
-+     # `rustc +stable` will exit with status 1, complaining about a missing
-+     # "+stable" file. We'll examine the error output to try and distinguish
-+     # between failing rustup and failing rustc.
-+     @depends(prog, dependable(name))
-+-    @imports('subprocess')
-+     @imports(_from='__builtin__', _import='open')
-+     @imports('os')
-+     def unwrap(prog, name):
-+         def from_rustup_which():
-+             out = check_cmd_output('rustup', 'which', name,
-+                                    executable=prog).rstrip()
-+             # If for some reason the above failed to return something, keep the
-+             # PROG we found originally.
 diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure
 --- a/build/moz.configure/util.configure
 +++ b/build/moz.configure/util.configure

+ 11 - 9
mozilla-release/patches/1579189-72a1.patch

@@ -2,7 +2,7 @@
 # User Nathan Froyd <froydnj@mozilla.com>
 # Date 1573744598 14400
 # Node ID d64119136e15458d4aea5c548b4d10d7099d78f6
-# Parent  d062a8f2913a9655c2cc74c651b88744e7bd5da4
+# Parent  d4d767c41c2ea4735596115e2e47d2ab38bfd6fc
 Bug 1579189 - raise the minimum clang version to 5; r=#build
 
 We need this for "full" C++17 support (everything is supported, but some
@@ -56,7 +56,7 @@ new file mode 100644
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -412,37 +412,32 @@ def get_compiler_info(compiler, language
+@@ -366,39 +366,34 @@ def get_compiler_info(compiler, language
      '''
      # Note: MSVC doesn't expose __STDC_VERSION__. It does expose __STDC__,
      # but only when given the -Za option, which disables compiler
@@ -71,6 +71,8 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
      # We then only include the version information when the compiler matches
      # the feature check, so that an unsupported version of clang would have
      # no version number.
+     # Bug 1562389: We don't check _MT here because it is either clang-cl or
+     # msvc. Building Android is not supported or used anyway.
      check = dedent('''\
          #if defined(_MSC_VER)
          #if defined(__clang__)
@@ -96,7 +98,7 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
          #endif
  
          #if __cplusplus
-@@ -1055,21 +1050,18 @@ def compiler(language, host_or_target, c
+@@ -1010,21 +1005,18 @@ def compiler(language, host_or_target, c
              if info.version < '8.0.0':
                  raise FatalCheckError(
                      'Only clang-cl 8.0 or newer is supported (found version %s)'
@@ -143,7 +145,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
          '--target=x86_64-apple-darwin11.2.0': GCC_PLATFORM_X86_64_OSX[None],
          '--target=i686-linux-gnu': GCC_PLATFORM_X86_LINUX[None],
          '--target=i686-apple-darwin11.2.0': GCC_PLATFORM_X86_OSX[None],
-@@ -478,16 +478,18 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -479,16 +479,18 @@ class LinuxToolchainTest(BaseToolchainTe
          '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_64_LINUX,
          '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_64_LINUX,
          '/usr/bin/gcc-6': GCC_6 + GCC_PLATFORM_X86_64_LINUX,
@@ -162,7 +164,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  
      GCC_4_7_RESULT = old_gcc_message('4.7.3')
      GXX_4_7_RESULT = GCC_4_7_RESULT
-@@ -521,34 +523,36 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -522,34 +524,36 @@ class LinuxToolchainTest(BaseToolchainTe
          version='7.3.0',
          type='gcc',
          compiler='/usr/bin/g++-7',
@@ -209,7 +211,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
              'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
          })
  
-@@ -667,30 +671,37 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -668,30 +672,37 @@ class LinuxToolchainTest(BaseToolchainTe
          self.do_toolchain_test(paths, {
              'c_compiler': self.DEFAULT_CLANG_RESULT,
              'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
@@ -250,7 +252,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
              k: v for k, v in self.PATHS.iteritems()
              if os.path.basename(k) not in ('gcc', 'g++', 'clang', 'clang++')
          }
-@@ -961,16 +972,18 @@ class WindowsToolchainTest(BaseToolchain
+@@ -962,16 +973,18 @@ class WindowsToolchainTest(BaseToolchain
          '/usr/bin/gcc-4.9': GCC_4_9 + GCC_PLATFORM_X86_WIN,
          '/usr/bin/g++-4.9': GXX_4_9 + GCC_PLATFORM_X86_WIN,
          '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_WIN,
@@ -269,7 +271,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  
      VS_FAILURE_MESSAGE = (
          'This version (%s) of the MSVC compiler is not supported.\nYou must'
-@@ -1011,16 +1024,18 @@ class WindowsToolchainTest(BaseToolchain
+@@ -1012,16 +1025,18 @@ class WindowsToolchainTest(BaseToolchain
          version='18.00.00000',
          flags=['-Xclang', '-std=c++14'],
          type='clang-cl',
@@ -288,7 +290,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
      GXX_5_RESULT = LinuxToolchainTest.GXX_5_RESULT
      GCC_6_RESULT = LinuxToolchainTest.GCC_6_RESULT
      GXX_6_RESULT = LinuxToolchainTest.GXX_6_RESULT
-@@ -1175,16 +1190,18 @@ class Windows64ToolchainTest(WindowsTool
+@@ -1176,16 +1191,18 @@ class Windows64ToolchainTest(WindowsTool
          '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_64_WIN,
          '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_64_WIN,
          '/usr/bin/gcc-6': GCC_6 + GCC_PLATFORM_X86_64_WIN,

+ 15 - 15
mozilla-release/patches/1610944-74a1.patch

@@ -2,7 +2,7 @@
 # User Ricky Stewart <rstewart@mozilla.com>
 # Date 1579799738 0
 # Node ID 4a010069572f2266659189d8813f33b39dec53c2
-# Parent  fbb3db53e279ae62709389155d62bfdcbe11b2c7
+# Parent  30a1844572aaac926c32427019fc48e6e8764356
 Bug 1610944 - configure/test_toolchain_configure.py and configure/test_toolchain_helpers.py support Python 3 r=firefox-build-system-reviewers,mshal CLOSED TREE
 
 Differential Revision: https://phabricator.services.mozilla.com/D60743
@@ -10,11 +10,11 @@ Differential Revision: https://phabricator.services.mozilla.com/D60743
 diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
 --- a/build/moz.configure/rust.configure
 +++ b/build/moz.configure/rust.configure
-@@ -147,16 +147,17 @@ def rust_triple_alias(host_or_target):
+@@ -217,16 +217,17 @@ def rust_triple_alias(host_or_target, ho
      host_or_target_str = {host: 'host', target: 'target'}[host_or_target]
  
-     @depends(rustc, host_or_target, c_compiler, rust_supported_targets,
-              arm_target, when=rust_compiler)
+     @depends(rustc, host_or_target, host_or_target_c_compiler,
+              rust_supported_targets, arm_target, when=rust_compiler)
      @checking('for rust %s triplet' % host_or_target_str)
      @imports('os')
      @imports(_from='mozbuild.configure.util', _import='LineIO')
@@ -28,7 +28,7 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
          # as, the autoconf-derived targets we use.  An example would be that
          # Rust uses distinct target triples for targetting the GNU C++ ABI
          # and the MSVC C++ ABI on Win32, whereas autoconf has a single
-@@ -273,26 +274,26 @@ def rust_triple_alias(host_or_target):
+@@ -343,26 +344,26 @@ def rust_triple_alias(host_or_target, ho
  
          if rustc_target is None:
              die("Don't know how to translate {} for rustc".format(
@@ -60,7 +60,7 @@ diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.confi
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -348,16 +348,17 @@ def try_preprocess(compiler, language, s
+@@ -347,16 +347,17 @@ def try_preprocess(compiler, language, s
      return try_invoke_compiler(compiler, language, source, ['-E'])
  
  
@@ -78,7 +78,7 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
  
      The returned information includes:
      - the compiler type (msvc, clang-cl, clang or gcc)
-@@ -406,17 +407,17 @@ def get_compiler_info(compiler, language
+@@ -405,17 +406,17 @@ def get_compiler_info(compiler, language
  
      # While we're doing some preprocessing, we might as well do some more
      # preprocessor-based tests at the same time, to check the toolchain
@@ -97,7 +97,7 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
                  'condition': condition,
                  'name': name,
                  'value': value,
-@@ -439,17 +440,17 @@ def get_compiler_info(compiler, language
+@@ -438,17 +439,17 @@ def get_compiler_info(compiler, language
      if not result:
          raise FatalCheckError(
              'Unknown compiler or compiler not supported.')
@@ -416,7 +416,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  def CLANG_PLATFORM(gcc_platform):
      base = {
          '--target=x86_64-linux-gnu': GCC_PLATFORM_X86_64_LINUX[None],
-@@ -414,16 +414,17 @@ class BaseToolchainTest(BaseConfigureTes
+@@ -415,16 +415,17 @@ class BaseToolchainTest(BaseConfigureTes
              if var in results:
                  result = results[var]
              elif var.startswith('host_'):
@@ -434,7 +434,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
                  self.assertEquals((var, result),
                                    (var, self.out.getvalue().strip()))
                  return
-@@ -666,17 +667,17 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -667,17 +668,17 @@ class LinuxToolchainTest(BaseToolchainTe
          }, environ={
              'CXX': 'clang',
          })
@@ -453,7 +453,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
          })
  
      def test_guess_cxx_clang(self):
-@@ -703,17 +704,17 @@ class LinuxToolchainTest(BaseToolchainTe
+@@ -704,17 +705,17 @@ class LinuxToolchainTest(BaseToolchainTe
              'CC': 'clang-4.0',
              'CXX': 'clang++-4.0',
          })
@@ -472,7 +472,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  
      def test_absolute_path(self):
          paths = dict(self.PATHS)
-@@ -908,17 +909,17 @@ class OSXToolchainTest(BaseToolchainTest
+@@ -909,17 +910,17 @@ class OSXToolchainTest(BaseToolchainTest
          self.do_toolchain_test(self.PATHS, {
              'c_compiler': self.DEFAULT_CLANG_RESULT + self.SYSROOT_FLAGS,
              'cxx_compiler': self.DEFAULT_CLANGXX_RESULT + self.SYSROOT_FLAGS,
@@ -491,7 +491,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  
      def test_unsupported_clang(self):
          self.do_toolchain_test(self.PATHS, {
-@@ -1051,17 +1052,17 @@ class WindowsToolchainTest(BaseToolchain
+@@ -1052,17 +1053,17 @@ class WindowsToolchainTest(BaseToolchain
      GXX_7_RESULT = LinuxToolchainTest.GXX_7_RESULT
      DEFAULT_GCC_RESULT = LinuxToolchainTest.DEFAULT_GCC_RESULT
      DEFAULT_GXX_RESULT = LinuxToolchainTest.DEFAULT_GXX_RESULT
@@ -510,7 +510,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
          })
  
      def test_unsupported_msvc(self):
-@@ -1124,17 +1125,17 @@ class WindowsToolchainTest(BaseToolchain
+@@ -1125,17 +1126,17 @@ class WindowsToolchainTest(BaseToolchain
          self.do_toolchain_test(self.PATHS, {
              'c_compiler': self.CLANG_CL_8_0_RESULT,
              'cxx_compiler': self.CLANGXX_CL_8_0_RESULT,
@@ -529,7 +529,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
          })
  
      def test_overridden_unsupported_gcc(self):
-@@ -1143,17 +1144,17 @@ class WindowsToolchainTest(BaseToolchain
+@@ -1144,17 +1145,17 @@ class WindowsToolchainTest(BaseToolchain
          }, environ={
              'CC': 'gcc-5',
              'CXX': 'g++-5',

+ 22 - 26
mozilla-release/patches/1635764-78a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1590787792 0
 # Node ID 23f9231f76bf57f5b8a1928c575f3ed1c503f44e
-# Parent  826a517eb2681aba624b8d7c6f7aea2916ae8dec
+# Parent  522a7c3d903af60499dca95b9496aa32808b07bd
 Bug 1635764 - Move --with-system-icu and --with-intl-api to python configure. r=firefox-build-system-reviewers,rstewart
 
 At the same time, because it's now simpler to do so, set the right data
@@ -17,7 +17,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D77416
 diff --git a/aclocal.m4 b/aclocal.m4
 --- a/aclocal.m4
 +++ b/aclocal.m4
-@@ -15,17 +15,16 @@ builtin(include, build/autoconf/codeset.
+@@ -13,17 +13,16 @@ builtin(include, build/autoconf/codeset.
  builtin(include, build/autoconf/altoptions.m4)dnl
  builtin(include, build/autoconf/mozprog.m4)dnl
  builtin(include, build/autoconf/mozheader.m4)dnl
@@ -142,7 +142,7 @@ deleted file mode 100644
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -243,26 +243,24 @@ def old_configure_options(*options):
+@@ -242,22 +242,20 @@ def old_configure_options(*options):
      '--with-android-distribution-directory',
      '--with-android-max-sdk',
      '--with-android-min-sdk',
@@ -154,21 +154,17 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
 -    '--with-intl-api',
      '--with-jitreport-granularity',
      '--with-macbundlename-prefix',
-     '--with-nspr-cflags',
-     '--with-nspr-exec-prefix',
-     '--with-nspr-libs',
-     '--with-nspr-prefix',
      '--with-nss-exec-prefix',
      '--with-nss-prefix',
 -    '--with-system-icu',
      '--with-system-libevent',
-     '--with-system-nspr',
      '--with-system-nss',
      '--with-system-png',
      '--with-system-zlib',
      '--with-user-appdir',
      '--x-includes',
      '--x-libraries',
+ )
 diff --git a/js/app.mozbuild b/js/app.mozbuild
 --- a/js/app.mozbuild
 +++ b/js/app.mozbuild
@@ -194,7 +190,7 @@ diff --git a/js/app.mozbuild b/js/app.mozbuild
 diff --git a/js/moz.configure b/js/moz.configure
 --- a/js/moz.configure
 +++ b/js/moz.configure
-@@ -451,30 +451,92 @@ js_option('--enable-pipeline-operator', 
+@@ -435,30 +435,92 @@ js_option('--enable-pipeline-operator', 
  @depends('--enable-pipeline-operator')
  def enable_pipeline_operator(value):
      if value:
@@ -290,7 +286,7 @@ diff --git a/js/moz.configure b/js/moz.configure
 diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4
 --- a/js/src/aclocal.m4
 +++ b/js/src/aclocal.m4
-@@ -14,17 +14,16 @@ builtin(include, ../../build/autoconf/co
+@@ -12,17 +12,16 @@ builtin(include, ../../build/autoconf/co
  builtin(include, ../../build/autoconf/altoptions.m4)dnl
  builtin(include, ../../build/autoconf/mozprog.m4)dnl
  builtin(include, ../../build/autoconf/mozheader.m4)dnl
@@ -311,7 +307,7 @@ diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -1463,25 +1463,16 @@ AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
+@@ -1456,25 +1456,16 @@ AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
  AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  
  AC_SUBST(MOZ_APP_NAME)
@@ -340,30 +336,30 @@ diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 diff --git a/js/sub.configure b/js/sub.configure
 --- a/js/sub.configure
 +++ b/js/sub.configure
-@@ -49,19 +49,16 @@ def js_subconfigure(host, target, build_
+@@ -44,19 +44,16 @@ def js_subconfigure(host, target, build_
+             handler._stdout = PrefixOutput('js/src> ', handler._stdout)
  
-     options = [host, target] + [
-         o for o in js_configure_args
-         # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
-         # and $NSPR_LIBS.
-         if not o.startswith('--with-system-nspr')
-     ]
+     substs = dict(old_configure['substs'])
+     assignments = dict(old_configure_assignments)
+     environ = dict(os.environ)
+ 
+     options = [host, target] +  js_configure_args
  
 -    if not substs.get('JS_HAS_INTL_API'):
 -        options.append('--without-intl-api')
 -
-     if substs.get('NSPR_CFLAGS') or substs.get('NSPR_LIBS'):
-         options.append(
-             '--with-nspr-cflags=%s' % ' '.join(substs.get('NSPR_CFLAGS', [])))
-         options.append(
-             '--with-nspr-libs=%s' % ' '.join(substs.get('NSPR_LIBS', [])))
- 
      options.append('--prefix=%s/dist' % build_env.topobjdir)
  
+     if substs.get('ZLIB_IN_MOZGLUE'):
+         substs['MOZ_ZLIB_LIBS'] = ''
+ 
+     environ['MOZILLA_CENTRAL_PATH'] = build_env.topsrcdir
+     if 'MOZ_BUILD_APP' in environ:
+         del environ['MOZ_BUILD_APP']
 diff --git a/old-configure.in b/old-configure.in
 --- a/old-configure.in
 +++ b/old-configure.in
-@@ -3064,28 +3064,16 @@ if test -n "$MOZ_TELEMETRY_REPORTING" ||
+@@ -3051,28 +3051,16 @@ if test -n "$MOZ_TELEMETRY_REPORTING" ||
    AC_DEFINE(MOZ_DATA_REPORTING)
    AC_SUBST(MOZ_DATA_REPORTING)
  fi
@@ -417,7 +413,7 @@ diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozb
 diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
 --- a/toolkit/library/moz.build
 +++ b/toolkit/library/moz.build
-@@ -111,21 +111,16 @@ USE_LIBS += [
+@@ -100,21 +100,16 @@ USE_LIBS += [
      'lgpllibs',
      'nspr',
      'nss',

+ 3 - 9
mozilla-release/patches/1638195-PARTIAL-78a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1589514976 0
 # Node ID 2c4692d0b6cbdcfef0ae02bf1c0abb20d96d898d
-# Parent  04b1499da5193fdb01211536e76aea495a350059
+# Parent  10b61c8612bc4be569116e773058a5618d67eaa3
 Bug 1638195 - Remove python configure knowledge of old configure arguments that were removed. r=nalexander
 
 --enable-cookies, removed in bug 1623593.
@@ -23,7 +23,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D75464
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -206,49 +206,41 @@ def old_configure_options(*options):
+@@ -206,48 +206,40 @@ def old_configure_options(*options):
  
      return depends(host_for_sub_configure, target_for_sub_configure, all_options, *options)
  
@@ -53,7 +53,6 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--enable-necko-wifi',
      '--enable-negotiateauth',
 -    '--enable-nfc',
-     '--enable-nspr-build',
      '--enable-official-branding',
      '--enable-parental-controls',
      '--enable-posix-nspr-emulation',
@@ -73,7 +72,7 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--enable-xul',
      '--enable-zipwriter',
      '--includedir',
-@@ -258,38 +250,33 @@ def old_configure_options(*options):
+@@ -257,33 +249,28 @@ def old_configure_options(*options):
      '--with-android-max-sdk',
      '--with-android-min-sdk',
      '--with-app-basename',
@@ -88,10 +87,6 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--with-intl-api',
      '--with-jitreport-granularity',
      '--with-macbundlename-prefix',
-     '--with-nspr-cflags',
-     '--with-nspr-exec-prefix',
-     '--with-nspr-libs',
-     '--with-nspr-prefix',
      '--with-nss-exec-prefix',
      '--with-nss-prefix',
      '--with-qemu-exe',
@@ -99,7 +94,6 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
 -    '--with-system-bz2',
      '--with-system-icu',
      '--with-system-libevent',
-     '--with-system-nspr',
      '--with-system-nss',
      '--with-system-png',
      '--with-system-zlib',

+ 5 - 9
mozilla-release/patches/1639815-1-78a1.patch

@@ -3,7 +3,7 @@
 # Date 1590100726 0
 #      Thu May 21 22:38:46 2020 +0000
 # Node ID a98fde98a836ac69aa7b1fedf3616ab969c3b8a0
-# Parent  f5e7c13c683d1d3ae0b240e98cabdbd09a5f385d
+# Parent  75904b07be2db33b373f7ec55ee61538ec767b9a
 Bug 1639815 - Move --with-qemu-exe and --with-cross-lib to python configure. r=froydnj
 
 Differential Revision: https://phabricator.services.mozilla.com/D76285
@@ -11,7 +11,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D76285
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -247,29 +247,27 @@ def old_configure_options(*options):
+@@ -246,25 +246,23 @@ def old_configure_options(*options):
      '--libdir',
      '--prefix',
      '--with-android-distribution-directory',
@@ -26,25 +26,21 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--with-intl-api',
      '--with-jitreport-granularity',
      '--with-macbundlename-prefix',
-     '--with-nspr-cflags',
-     '--with-nspr-exec-prefix',
-     '--with-nspr-libs',
-     '--with-nspr-prefix',
      '--with-nss-exec-prefix',
      '--with-nss-prefix',
 -    '--with-qemu-exe',
      '--with-sixgill',
      '--with-system-icu',
      '--with-system-libevent',
-     '--with-system-nspr',
      '--with-system-nss',
      '--with-system-png',
      '--with-system-zlib',
      '--with-user-appdir',
+     '--x-includes',
 diff --git a/js/moz.configure b/js/moz.configure
 --- a/js/moz.configure
 +++ b/js/moz.configure
-@@ -443,8 +443,18 @@ js_option('--enable-new-regexp', default
+@@ -447,8 +447,18 @@ js_option('--enable-new-regexp', default
  
  @depends('--enable-new-regexp')
  def enable_new_regexp(value):
@@ -66,7 +62,7 @@ diff --git a/js/moz.configure b/js/moz.configure
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -1517,31 +1517,16 @@ dnl ====================================
+@@ -1511,31 +1511,16 @@ dnl ====================================
  dnl =
  dnl = Standalone module options
  dnl =

+ 9 - 9
mozilla-release/patches/1639815-2-78a1.patch

@@ -3,7 +3,7 @@
 # Date 1590100726 0
 #      Thu May 21 22:38:46 2020 +0000
 # Node ID b719a4f5a39f8d0dd8a0c4bf9870ad641aee7afe
-# Parent  05551d774b9fcc54c8678634e407bb49870a18f7
+# Parent  70ee88d122513f9666a3323def30334f49c1d5d0
 Bug 1639815 - Move --with-sixgill to python configure. r=froydnj
 
 Differential Revision: https://phabricator.services.mozilla.com/D76286
@@ -11,28 +11,28 @@ Differential Revision: https://phabricator.services.mozilla.com/D76286
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -258,17 +258,16 @@ def old_configure_options(*options):
+@@ -253,17 +253,16 @@ def old_configure_options(*options):
+     '--with-branding',
+     '--with-debug-label',
+     '--with-distribution-id',
+     '--with-intl-api',
      '--with-jitreport-granularity',
      '--with-macbundlename-prefix',
-     '--with-nspr-cflags',
-     '--with-nspr-exec-prefix',
-     '--with-nspr-libs',
-     '--with-nspr-prefix',
      '--with-nss-exec-prefix',
      '--with-nss-prefix',
 -    '--with-sixgill',
      '--with-system-icu',
      '--with-system-libevent',
-     '--with-system-nspr',
      '--with-system-nss',
      '--with-system-png',
      '--with-system-zlib',
      '--with-user-appdir',
      '--x-includes',
+     '--x-libraries',
 diff --git a/js/moz.configure b/js/moz.configure
 --- a/js/moz.configure
 +++ b/js/moz.configure
-@@ -453,8 +453,23 @@ set_define('ENABLE_NEW_REGEXP', enable_n
+@@ -459,8 +459,23 @@ set_define('ENABLE_NEW_REGEXP', enable_n
  # Options for generating the shell as a script
  # ============================================
  js_option('--with-qemu-exe', nargs=1, help='Use path as an arm emulator on host platforms')
@@ -59,7 +59,7 @@ diff --git a/js/moz.configure b/js/moz.configure
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -1358,33 +1358,16 @@ dnl ====================================
+@@ -1351,33 +1351,16 @@ dnl ====================================
  dnl = Enable using the clang plugin to build
  dnl ========================================================
  

+ 5 - 5
mozilla-release/patches/1639815-3-78a1.patch

@@ -3,7 +3,7 @@
 # Date 1590100726 0
 #      Thu May 21 22:38:46 2020 +0000
 # Node ID bd8867b35eeeea17a8607f2519d186f1692f9fed
-# Parent  7e5bdf2b054acf7a03e635d536d27cf78e6ef5df
+# Parent  beaa6c0b548c760812586b48eb7131a0ebe3c06b
 Bug 1639815 - Move --enable-readline to python configure. r=froydnj
 
 Differential Revision: https://phabricator.services.mozilla.com/D76287
@@ -11,11 +11,11 @@ Differential Revision: https://phabricator.services.mozilla.com/D76287
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -226,17 +226,16 @@ def old_configure_options(*options):
+@@ -225,17 +225,16 @@ def old_configure_options(*options):
+     '--enable-logrefcnt',
      '--enable-mobile-optimize',
      '--enable-necko-wifi',
      '--enable-negotiateauth',
-     '--enable-nspr-build',
      '--enable-official-branding',
      '--enable-parental-controls',
      '--enable-posix-nspr-emulation',
@@ -32,7 +32,7 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
 diff --git a/js/moz.configure b/js/moz.configure
 --- a/js/moz.configure
 +++ b/js/moz.configure
-@@ -468,8 +468,31 @@ js_option('--with-sixgill', nargs=1, hel
+@@ -472,8 +472,31 @@ js_option('--with-sixgill', nargs=1, hel
  @imports('os')
  def sixgill(value):
      for f in ('bin/xdbfind', 'gcc/xgill.so', 'scripts/wrap_gcc/g++'):
@@ -67,7 +67,7 @@ diff --git a/js/moz.configure b/js/moz.configure
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -1457,51 +1457,16 @@ fi
+@@ -1451,51 +1451,16 @@ fi
  fi # ! SKIP_COMPILER_CHECKS
  
  AC_DEFINE(CPP_THROW_NEW, [throw()])

+ 3 - 3
mozilla-release/patches/1639815-6-78a1.patch

@@ -3,7 +3,7 @@
 # Date 1590100727 0
 #      Thu May 21 22:38:47 2020 +0000
 # Node ID dc731fd750fc03ba51f96ea5061ba352304bdc04
-# Parent  defde1adc89ca3cf6f87efcdc1670b2ca3e4d60b
+# Parent  3346fbae598deb39901e1d2b68e7cb08cff07c32
 Bug 1639815 - Move --disable-icf to python configure. r=froydnj
 
 Differential Revision: https://phabricator.services.mozilla.com/D76290
@@ -52,12 +52,12 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--enable-mobile-optimize',
      '--enable-necko-wifi',
      '--enable-negotiateauth',
-     '--enable-nspr-build',
      '--enable-official-branding',
+     '--enable-parental-controls',
 diff --git a/moz.configure b/moz.configure
 --- a/moz.configure
 +++ b/moz.configure
-@@ -593,16 +593,22 @@ js_option('--enable-dtrace', help='Build
+@@ -595,16 +595,22 @@ js_option('--enable-dtrace', help='Build
  
  dtrace = check_header('sys/sdt.h', when='--enable-dtrace',
                        onerror=lambda: die('dtrace enabled but sys/sdt.h not found'))

+ 10 - 11
mozilla-release/patches/1639815-7-78a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1590105118 0
 # Node ID 943fe621074459d34144ab7c0af07d7443ba5aed
-# Parent  dc3dd57ecba083d4629ff93d9237fbdf0d4df070
+# Parent  8e19f07750421aed7e45f196d2f9137d428fc98b
 Bug 1639815 - Move --enable-strip and --enable-install-strip to python configure. r=nalexander
 
 Differential Revision: https://phabricator.services.mozilla.com/D76291
@@ -10,7 +10,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D76291
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -212,31 +212,29 @@ def old_configure_options(*options):
+@@ -212,30 +212,28 @@ def old_configure_options(*options):
      '--datadir',
      '--enable-content-sandbox',
      '--enable-crashreporter',
@@ -25,7 +25,6 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--enable-mobile-optimize',
      '--enable-necko-wifi',
      '--enable-negotiateauth',
-     '--enable-nspr-build',
      '--enable-official-branding',
      '--enable-parental-controls',
      '--enable-posix-nspr-emulation',
@@ -45,7 +44,7 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -573,17 +573,16 @@ case "$target" in
+@@ -566,17 +566,16 @@ case "$target" in
          WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
          WIN32_GUI_EXE_LDFLAGS=-mwindows
      else
@@ -63,7 +62,7 @@ diff --git a/js/src/old-configure.in b/js/src/old-configure.in
          fi
          WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
          WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
-@@ -1333,32 +1332,16 @@ dnl ====================================
+@@ -1338,32 +1337,16 @@ dnl ====================================
  dnl = Enable using the clang plugin to build
  dnl ========================================================
  
@@ -96,7 +95,7 @@ diff --git a/js/src/old-configure.in b/js/src/old-configure.in
  
  dnl ========================================================
  dnl = Support for demangling undefined symbols
-@@ -1456,18 +1439,16 @@ AC_SUBST(RCFLAGS)
+@@ -1461,18 +1444,16 @@ AC_SUBST(RCFLAGS)
  AC_SUBST(WINDRES)
  AC_SUBST(IMPLIB)
  AC_SUBST(FILTER)
@@ -118,7 +117,7 @@ diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 diff --git a/moz.configure b/moz.configure
 --- a/moz.configure
 +++ b/moz.configure
-@@ -599,16 +599,37 @@ set_define('INCLUDE_MOZILLA_DTRACE', Tru
+@@ -601,16 +601,37 @@ set_define('INCLUDE_MOZILLA_DTRACE', Tru
  add_old_configure_assignment('enable_dtrace', 'yes', when=dtrace)
  
  
@@ -159,7 +158,7 @@ diff --git a/moz.configure b/moz.configure
 diff --git a/old-configure.in b/old-configure.in
 --- a/old-configure.in
 +++ b/old-configure.in
-@@ -677,17 +677,16 @@ case "$target" in
+@@ -688,17 +688,16 @@ case "$target" in
          else
              # Silence problematic clang warnings
              CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
@@ -177,7 +176,7 @@ diff --git a/old-configure.in b/old-configure.in
          fi
          WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
          WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
-@@ -948,17 +947,16 @@ if test -n "$MOZ_LINKER"; then
+@@ -961,17 +960,16 @@ if test -n "$MOZ_LINKER"; then
    AC_DEFINE(MOZ_LINKER)
    MOZ_LINKER_EXTRACT=1
    AC_CHECK_PROGS(XZ, xz)
@@ -195,7 +194,7 @@ diff --git a/old-configure.in b/old-configure.in
  if test -z "$SKIP_COMPILER_CHECKS"; then
  dnl Checks for typedefs, structures, and compiler characteristics.
  dnl ========================================================
-@@ -2415,32 +2413,16 @@ dnl ====================================
+@@ -2438,32 +2436,16 @@ dnl ====================================
  dnl = Enable using the clang plugin to build
  dnl ========================================================
  
@@ -228,7 +227,7 @@ diff --git a/old-configure.in b/old-configure.in
     DEBUG_JS_MODULES=1,
     DEBUG_JS_MODULES=)
  
-@@ -2852,18 +2834,16 @@ AC_SUBST(MOZ_CRASHREPORTER)
+@@ -2869,18 +2851,16 @@ AC_SUBST(MOZ_CRASHREPORTER)
  AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
  AC_SUBST(MOZ_STUB_INSTALLER)
  AC_SUBST(MOZ_ENABLE_SIGNMAR)

+ 747 - 0
mozilla-release/patches/1641775-78a1.patch

@@ -0,0 +1,747 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1590772287 0
+# Node ID 4ba16619f4cb6955ea1f99ec53301ee820839f3a
+# Parent  1fa2822314bf388fff1a6bc10c7742c250be3cee
+Bug 1641775 - Move --with-system-nspr to python configure. r=firefox-build-system-reviewers,rstewart
+
+Versions of NSPR >= 4.10 come with a pkg-config file. We currently
+depend on 4.9.2 for spidermonkey, but much more recent versions for
+Firefox. 4.10 is less than a year newer than 4.9.2, and 4.10 is 7 years
+old, so bumping the requirement to 4.10 is not really a big deal.
+
+With the use of pkg-config, --with-nspr-cflags and --with-nspr-libs are
+not needed.
+
+None of the AC_TRY_COMPILE tests were any useful because
+PR_STATIC_ASSERT and PR_UINT64 have been when we look for them since
+4.8.6 and 4.9 respectively.
+
+Differential Revision: https://phabricator.services.mozilla.com/D77412
+
+diff --git a/aclocal.m4 b/aclocal.m4
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -2,18 +2,16 @@ dnl
+ dnl Local autoconf macros used with mozilla
+ dnl The contents of this file are under the Public Domain.
+ dnl
+ 
+ builtin(include, build/autoconf/hotfixes.m4)dnl
+ builtin(include, build/autoconf/hooks.m4)dnl
+ builtin(include, build/autoconf/config.status.m4)dnl
+ builtin(include, build/autoconf/toolchain.m4)dnl
+-builtin(include, build/autoconf/nspr.m4)dnl
+-builtin(include, build/autoconf/nspr-build.m4)dnl
+ builtin(include, build/autoconf/nss.m4)dnl
+ builtin(include, build/autoconf/pkg.m4)dnl
+ builtin(include, build/autoconf/codeset.m4)dnl
+ builtin(include, build/autoconf/altoptions.m4)dnl
+ builtin(include, build/autoconf/mozprog.m4)dnl
+ builtin(include, build/autoconf/mozheader.m4)dnl
+ builtin(include, build/autoconf/compiler-opts.m4)dnl
+ builtin(include, build/autoconf/expandlibs.m4)dnl
+diff --git a/build/autoconf/nspr-build.m4 b/build/autoconf/nspr-build.m4
+deleted file mode 100644
+--- a/build/autoconf/nspr-build.m4
++++ /dev/null
+@@ -1,202 +0,0 @@
+-dnl This Source Code Form is subject to the terms of the Mozilla Public
+-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-AC_DEFUN([MOZ_CONFIG_NSPR], [
+-
+-ifelse([$1],,define(CONFIGURING_JS,yes))
+-
+-dnl Possible ways this can be called:
+-dnl   from toplevel configure:
+-dnl     JS_STANDALONE=  MOZ_BUILD_APP!=js
+-dnl   from js/src/configure invoked by toplevel configure:
+-dnl     JS_STANDALONE=  MOZ_BUILD_APP=js
+-dnl   from standalone js/src/configure:
+-dnl     JS_STANDALONE=1 MOZ_BUILD_APP=js
+-
+-dnl ========================================================
+-dnl = Find the right NSPR to use.
+-dnl ========================================================
+-MOZ_ARG_WITH_STRING(nspr-cflags,
+-[  --with-nspr-cflags=FLAGS
+-                          Pass FLAGS to CC when building code that uses NSPR.
+-                          Use this when there's no accurate nspr-config
+-                          script available.  This is the case when building
+-                          SpiderMonkey as part of the Mozilla tree: the
+-                          top-level configure script computes NSPR flags
+-                          that accomodate the quirks of that environment.],
+-    NSPR_CFLAGS=$withval)
+-MOZ_ARG_WITH_STRING(nspr-libs,
+-[  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
+-                          See --with-nspr-cflags for more details.],
+-    NSPR_LIBS=$withval)
+-
+-ifdef([CONFIGURING_JS],[
+-    MOZ_ARG_ENABLE_BOOL(nspr-build,
+-[  --enable-nspr-build     Build NSPR from source tree],
+-        MOZ_BUILD_NSPR=1,
+-        MOZ_BUILD_NSPR=)
+-])
+-
+-if test "$MOZ_BUILD_APP" != js || test -n "$JS_STANDALONE"; then
+-  _IS_OUTER_CONFIGURE=1
+-fi
+-
+-MOZ_ARG_WITH_BOOL(system-nspr,
+-[  --with-system-nspr      Use an NSPR that is already built and installed.
+-                          Use the 'nspr-config' script in the current path,
+-                          or look for the script in the directories given with
+-                          --with-nspr-exec-prefix or --with-nspr-prefix.
+-                          (Those flags are only checked if you specify
+-                          --with-system-nspr.)],
+-    _USE_SYSTEM_NSPR=1 )
+-
+-JS_POSIX_NSPR=unset
+-ifdef([CONFIGURING_JS],[
+-    if test -n "$JS_STANDALONE"; then
+-      case "$target" in
+-        *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
+-          if test -z "$_HAS_NSPR"; then
+-            JS_POSIX_NSPR_DEFAULT=1
+-          fi
+-          ;;
+-      esac
+-    fi
+-
+-    MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
+-[  --enable-posix-nspr-emulation
+-                          Enable emulation of NSPR for POSIX systems],
+-    JS_POSIX_NSPR=1,
+-    JS_POSIX_NSPR=)
+-])
+-
+-dnl Pass at most one of
+-dnl   --with-system-nspr
+-dnl   --with-nspr-cflags/libs
+-dnl   --enable-nspr-build
+-dnl   --enable-posix-nspr-emulation
+-
+-AC_MSG_CHECKING([NSPR selection])
+-nspr_opts=
+-which_nspr=default
+-if test -n "$_USE_SYSTEM_NSPR"; then
+-    nspr_opts="x$nspr_opts"
+-    which_nspr="system"
+-fi
+-if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
+-    nspr_opts="x$nspr_opts"
+-    which_nspr="command-line"
+-fi
+-if test -n "$MOZ_BUILD_NSPR"; then
+-    nspr_opts="x$nspr_opts"
+-    which_nspr="source-tree"
+-fi
+-if test "$JS_POSIX_NSPR" = unset; then
+-    JS_POSIX_NSPR=
+-else
+-    nspr_opts="x$nspr_opts"
+-    which_nspr="posix-wrapper"
+-fi
+-
+-if test -z "$nspr_opts"; then
+-    if test "$MOZ_BUILD_APP" != js; then
+-      dnl Toplevel configure defaults to using nsprpub from the source tree
+-      MOZ_BUILD_NSPR=1
+-      which_nspr="source-tree"
+-    else
+-      dnl JS configure defaults to emulated NSPR if available, falling back
+-      dnl to nsprpub.
+-      JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT"
+-      if test -z "$JS_POSIX_NSPR"; then
+-        MOZ_BUILD_NSPR=1
+-        which_nspr="source-tree"
+-      else
+-        which_nspr="posix-wrapper"
+-      fi
+-   fi
+-fi
+-
+-if test -z "$nspr_opts" || test "$nspr_opts" = x; then
+-    AC_MSG_RESULT($which_nspr)
+-else
+-    AC_MSG_ERROR([only one way of using NSPR may be selected. See 'configure --help'.])
+-fi
+-
+-AC_SUBST(MOZ_BUILD_NSPR)
+-
+-if test "$MOZ_BUILD_APP" = js; then
+-  if test "$JS_POSIX_NSPR" = 1; then
+-    AC_DEFINE(JS_POSIX_NSPR)
+-  fi
+-  AC_SUBST(JS_POSIX_NSPR)
+-fi
+-
+-# A (sub)configure invoked by the toplevel configure will always receive
+-# --with-nspr-libs on the command line. It will never need to figure out
+-# anything itself.
+-if test -n "$_IS_OUTER_CONFIGURE"; then
+-
+-if test -n "$_USE_SYSTEM_NSPR"; then
+-    AM_PATH_NSPR($NSPR_MINVER, [MOZ_SYSTEM_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])])
+-fi
+-
+-if test -n "$MOZ_SYSTEM_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
+-    _SAVE_CFLAGS=$CFLAGS
+-    CFLAGS="$CFLAGS $NSPR_CFLAGS"
+-    AC_TRY_COMPILE([#include "prtypes.h"],
+-                [#ifndef PR_STATIC_ASSERT
+-                 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
+-                 #endif],
+-                ,
+-                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
+-    AC_TRY_COMPILE([#include "prtypes.h"],
+-                [#ifndef PR_UINT64
+-                 #error PR_UINT64 not defined or requires including prtypes.h
+-                 #endif],
+-                ,
+-                AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
+-    CFLAGS=$_SAVE_CFLAGS
+-    NSPR_INCLUDE_DIR=`echo ${NSPR_CFLAGS} | sed -e 's/.*-I\([[^ ]]*\).*/\1/'`
+-    NSPR_LIB_DIR=`echo ${NSPR_LIBS} | sed -e 's/.*-L\([[^ ]]*\).*/\1/'`
+-elif test -z "$JS_POSIX_NSPR"; then
+-    NSPR_INCLUDE_DIR="${DIST}/include/nspr"
+-    NSPR_CFLAGS="-I${NSPR_INCLUDE_DIR}"
+-    if test -n "$GNU_CC"; then
+-        if test -n "$MOZ_FOLD_LIBS"; then
+-           NSPR_LIB_DIR=${DIST}/lib
+-        else
+-           NSPR_LIB_DIR=${DIST}/bin
+-        fi
+-        NSPR_LIBS="-L${NSPR_LIB_DIR} -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
+-    else
+-        # NSS needs actual static libs to link to, and this is where they are.
+-        NSPR_LIBS="${DIST}/lib/nspr${NSPR_VERSION}.lib ${DIST}/lib/plc${NSPR_VERSION}.lib ${DIST}/lib/plds${NSPR_VERSION}.lib "
+-        NSPR_LIB_DIR="${DIST}/lib"
+-    fi
+-fi
+-
+-AC_SUBST_LIST(NSPR_CFLAGS)
+-AC_SUBST(NSPR_INCLUDE_DIR)
+-AC_SUBST(NSPR_LIB_DIR)
+-
+-PKGCONF_REQUIRES_PRIVATE="Requires.private: nspr"
+-if test -n "$MOZ_SYSTEM_NSPR"; then
+-    _SAVE_CFLAGS=$CFLAGS
+-    CFLAGS="$CFLAGS $NSPR_CFLAGS"
+-    AC_TRY_COMPILE([#include "prlog.h"],
+-                [#ifndef PR_STATIC_ASSERT
+-                 #error PR_STATIC_ASSERT not defined
+-                 #endif],
+-                ,
+-                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
+-    CFLAGS=$_SAVE_CFLAGS
+-    # piggy back on $MOZ_SYSTEM_NSPR to set a variable for the nspr check for js.pc
+-    PKGCONF_REQUIRES_PRIVATE="Requires.private: nspr >= $NSPR_MINVER"
+-elif test -n "$JS_POSIX_NSPR"; then
+-    PKGCONF_REQUIRES_PRIVATE=
+-fi
+-AC_SUBST([PKGCONF_REQUIRES_PRIVATE])
+-
+-fi # _IS_OUTER_CONFIGURE
+-
+-])
+diff --git a/build/autoconf/nspr.m4 b/build/autoconf/nspr.m4
+deleted file mode 100644
+--- a/build/autoconf/nspr.m4
++++ /dev/null
+@@ -1,110 +0,0 @@
+-# -*- tab-width: 4; -*-
+-# Configure paths for NSPR
+-# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
+-# Based upon gtk.m4 (also PD) by Owen Taylor
+-
+-dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+-dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
+-dnl
+-dnl If the nspr-config script is available, use it to find the
+-dnl appropriate CFLAGS and LIBS, and to check for the required
+-dnl version, and run ACTION-IF-FOUND.
+-dnl
+-dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
+-dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
+-dnl provide default values, and run ACTION-IF-FOUND.  (Some systems
+-dnl ship NSPR without nspr-config, but can glean the appropriate flags
+-dnl and version.)
+-dnl
+-dnl Otherwise, run ACTION-IF-NOT-FOUND.
+-AC_DEFUN([AM_PATH_NSPR],
+-[dnl
+-
+-AC_ARG_WITH(nspr-prefix,
+-	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
+-	nspr_config_prefix="$withval",
+-	nspr_config_prefix="")
+-
+-AC_ARG_WITH(nspr-exec-prefix,
+-	[  --with-nspr-exec-prefix=PFX
+-                          Exec prefix where NSPR is installed],
+-	nspr_config_exec_prefix="$withval",
+-	nspr_config_exec_prefix="")
+-
+-	if test -n "$nspr_config_exec_prefix"; then
+-		nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
+-		if test -z "$NSPR_CONFIG"; then
+-			NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
+-		fi
+-	fi
+-	if test -n "$nspr_config_prefix"; then
+-		nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
+-		if test -z "$NSPR_CONFIG"; then
+-			NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
+-		fi
+-	fi
+-
+-	unset ac_cv_path_NSPR_CONFIG
+-	AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
+-	min_nspr_version=ifelse([$1], ,4.0.0,$1)
+-	AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
+-
+-	no_nspr=""
+-	if test "$NSPR_CONFIG" != "no"; then
+-		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
+-		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
+-		NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`	
+-	elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
+-	    NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
+-		NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
+-		NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
+-	else
+-	    no_nspr="yes"
+-	fi
+-
+-	if test -z "$no_nspr"; then
+-		nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
+-		nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
+-		nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+-		if test -z "$nspr_config_micro_version"; then
+-			nspr_config_micro_version="0"
+-		fi
+-
+-		min_nspr_major_version=`echo $min_nspr_version | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\1/'`
+-		min_nspr_minor_version=`echo $min_nspr_version | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\2/'`
+-		min_nspr_micro_version=`echo $min_nspr_version | \
+-			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\(\.\([[0-9]]*\)\)\{0,1\}/\4/'`
+-		if test -z "$min_nspr_micro_version"; then
+-			min_nspr_micro_version="0"
+-		fi
+-
+-		if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
+-			no_nspr="yes"
+-		elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
+-		     test "$nspr_config_minor_version" -lt "$min_nspr_minor_version"; then
+-			no_nspr="yes"
+-		elif test "$nspr_config_major_version" -eq "$min_nspr_major_version" &&
+-		     test "$nspr_config_minor_version" -eq "$min_nspr_minor_version" &&
+-		     test "$nspr_config_micro_version" -lt "$min_nspr_micro_version"; then
+-			no_nspr="yes"
+-		fi
+-	fi
+-
+-	if test -z "$no_nspr"; then
+-		AC_MSG_RESULT(yes)
+-		ifelse([$2], , :, [$2])     
+-	else
+-		AC_MSG_RESULT(no)
+-		ifelse([$3], , :, [$3])
+-	fi
+-
+-
+-	AC_SUBST_LIST(NSPR_CFLAGS)
+-	AC_SUBST_LIST(NSPR_LIBS)
+-
+-])
+diff --git a/build/moz.configure/nspr.configure b/build/moz.configure/nspr.configure
+new file mode 100644
+--- /dev/null
++++ b/build/moz.configure/nspr.configure
+@@ -0,0 +1,100 @@
++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
++# vim: set filetype=python:
++# This Source Code Form is subject to the terms of the Mozilla Public
++# 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/.
++
++# Top-level configure defaults to building NSPR from source. Standalone JS
++# doesn't.
++js_option('--enable-nspr-build', when=building_js,
++          help='{Build|Do not build} NSPR from source tree')
++
++@depends('--enable-nspr-build', when=building_js)
++def enable_nspr_build(enable):
++    if enable:
++        return enable
++
++js_option('--with-system-nspr', help='Use system NSPR')
++
++@depends(enable_nspr_build, '--with-system-nspr')
++def build_nspr(nspr_build, system_nspr):
++    if nspr_build is not None and nspr_build.origin != 'default':
++        if nspr_build and system_nspr:
++            die('Cannot use both --enable-nspr-build and --with-system-nspr')
++        if not nspr_build and not system_nspr:
++            die('Cannot use --disable-nspr-build without --with-system-nspr')
++    return not system_nspr
++
++set_config('MOZ_BUILD_NSPR', True, when=build_nspr)
++set_config('MOZ_SYSTEM_NSPR', True, when='--with-system-nspr')
++
++@depends(build_nspr, '--with-system-nspr', building_js)
++def js_without_nspr(build_nspr, system_nspr, building_js):
++    if building_js:
++        return not build_nspr and not system_nspr
++
++set_config('JS_WITHOUT_NSPR', True, when=js_without_nspr)
++set_define('JS_WITHOUT_NSPR', True, when=js_without_nspr)
++
++@depends(building_js)
++def nspr_minver(building_js):
++    if building_js:
++        return 'nspr >= 4.10'
++    return 'nspr >= 4.25'
++
++nspr_pkg = pkg_check_modules('NSPR', nspr_minver, when='--with-system-nspr')
++
++@depends_if(nspr_pkg)
++def nspr_pkg(nspr_pkg):
++    def extract(prefix, list):
++        for item in list:
++            if item.startswith(prefix):
++                return item[len(prefix):]
++        return ''
++
++    include_dir = extract('-I', nspr_pkg.cflags)
++    lib_dir = extract('-L', nspr_pkg.libs)
++    return namespace(
++        cflags=nspr_pkg.cflags,
++        include_dir=include_dir,
++        libs=nspr_pkg.libs,
++        lib_dir=lib_dir,
++    )
++
++@depends(nspr_minver, when='--with-system-nspr')
++def pkgconf_requires_private(nspr_minver):
++    return 'Requires.private: %s' % nspr_minver
++
++set_config('PKGCONF_REQUIRES_PRIVATE', pkgconf_requires_private)
++
++# pkg_check_modules takes care of NSPR_CFLAGS and NSPR_LIBS when using --with-system-nspr.
++@depends(check_build_environment, c_compiler, fold_libs, when=build_nspr)
++def nspr_config(build_env, c_compiler, fold_libs):
++    libs = ['nspr4', 'plc4', 'plds4']
++    if c_compiler.type == 'clang-cl':
++        lib_dir = os.path.join(build_env.dist, 'lib')
++        libs = [os.path.join(lib_dir, '%s.lib' % lib) for lib in libs]
++    else:
++        lib_dir = os.path.join(build_env.dist, 'lib' if fold_libs else 'bin')
++        libs = ['-L%s' % lib_dir] + ['-l%s' % lib for lib in libs]
++
++    include_dir = os.path.join(build_env.dist, 'include', 'nspr')
++    return namespace(
++        cflags=['-I%s' % include_dir],
++        include_dir=include_dir,
++        libs=libs,
++        lib_dir=lib_dir,
++    )
++
++set_config('NSPR_CFLAGS', nspr_config.cflags, when=nspr_config)
++set_config('NSPR_LIBS', nspr_config.libs, when=nspr_config)
++
++set_config('NSPR_INCLUDE_DIR', nspr_config.include_dir, when=nspr_config)
++set_config('NSPR_LIB_DIR', nspr_config.lib_dir, when=nspr_config)
++set_config('NSPR_INCLUDE_DIR', nspr_pkg.include_dir, when=nspr_pkg)
++set_config('NSPR_LIB_DIR', nspr_pkg.lib_dir, when=nspr_pkg)
++
++add_old_configure_assignment('NSPR_CFLAGS', nspr_config.cflags, when=nspr_config)
++add_old_configure_assignment('NSPR_LIBS', nspr_config.libs, when=nspr_config)
++add_old_configure_assignment('NSPR_CFLAGS', nspr_pkg.cflags, when=nspr_pkg)
++add_old_configure_assignment('NSPR_LIBS', nspr_pkg.libs, when=nspr_pkg)
+diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
+--- a/build/moz.configure/old.configure
++++ b/build/moz.configure/old.configure
+@@ -227,17 +227,16 @@ def old_configure_options(*options):
+     '--enable-libjpeg-turbo',
+     '--enable-libproxy',
+     '--enable-llvm-hacks',
+     '--enable-logrefcnt',
+     '--enable-mobile-optimize',
+     '--enable-necko-wifi',
+     '--enable-negotiateauth',
+     '--enable-nfc',
+-    '--enable-nspr-build',
+     '--enable-official-branding',
+     '--enable-parental-controls',
+     '--enable-posix-nspr-emulation',
+     '--enable-pref-extensions',
+     '--enable-readline',
+     '--enable-sandbox',
+     '--enable-signmar',
+     '--enable-startup-notification',
+@@ -264,28 +263,23 @@ def old_configure_options(*options):
+     '--with-debug-label',
+     '--with-distribution-id',
+     '--with-doc-include-dirs',
+     '--with-doc-input-dirs',
+     '--with-doc-output-dir',
+     '--with-intl-api',
+     '--with-jitreport-granularity',
+     '--with-macbundlename-prefix',
+-    '--with-nspr-cflags',
+-    '--with-nspr-exec-prefix',
+-    '--with-nspr-libs',
+-    '--with-nspr-prefix',
+     '--with-nss-exec-prefix',
+     '--with-nss-prefix',
+     '--with-qemu-exe',
+     '--with-sixgill',
+     '--with-system-bz2',
+     '--with-system-icu',
+     '--with-system-libevent',
+-    '--with-system-nspr',
+     '--with-system-nss',
+     '--with-system-png',
+     '--with-system-zlib',
+     '--with-unify-dist',
+     '--with-user-appdir',
+     '--x-includes',
+     '--x-libraries',
+ )
+diff --git a/js/moz.configure b/js/moz.configure
+--- a/js/moz.configure
++++ b/js/moz.configure
+@@ -13,16 +13,18 @@ def building_js(build_project):
+ 
+ # Exception to the rule above: JS_STANDALONE is a special option that doesn't
+ # want the js_option treatment. When we're done merging js/src/configure and
+ # top-level configure, it can go away, although the JS_STANDALONE config
+ # will still need to be set depending on building_js above.
+ option(env='JS_STANDALONE', default=building_js,
+        help='Reserved for internal use')
+ 
++include('../build/moz.configure/nspr.configure',
++        when='--enable-compile-environment')
+ include('../build/moz.configure/rust.configure',
+         when='--enable-compile-environment')
+ include('../build/moz.configure/bindgen.configure',
+         when='--enable-compile-environment')
+ 
+ @depends('JS_STANDALONE')
+ def js_standalone(value):
+     if value:
+diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4
+--- a/js/src/aclocal.m4
++++ b/js/src/aclocal.m4
+@@ -3,18 +3,16 @@ dnl Local autoconf macros used with mozi
+ dnl The contents of this file are under the Public Domain.
+ dnl
+ 
+ builtin(include, ../../build/autoconf/hotfixes.m4)dnl
+ builtin(include, ../../build/autoconf/hooks.m4)dnl
+ builtin(include, ../../build/autoconf/config.status.m4)dnl
+ builtin(include, ../../build/autoconf/toolchain.m4)dnl
+ builtin(include, ../../build/autoconf/pkg.m4)dnl
+-builtin(include, ../../build/autoconf/nspr.m4)dnl
+-builtin(include, ../../build/autoconf/nspr-build.m4)dnl
+ builtin(include, ../../build/autoconf/codeset.m4)dnl
+ builtin(include, ../../build/autoconf/altoptions.m4)dnl
+ builtin(include, ../../build/autoconf/mozprog.m4)dnl
+ builtin(include, ../../build/autoconf/mozheader.m4)dnl
+ builtin(include, ../../build/autoconf/compiler-opts.m4)dnl
+ builtin(include, ../../build/autoconf/expandlibs.m4)dnl
+ builtin(include, ../../build/autoconf/arch.m4)dnl
+ builtin(include, ../../build/autoconf/android.m4)dnl
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -38,21 +38,16 @@ dnl ====================================
+ _SUBDIR_CXXFLAGS="$CXXFLAGS"
+ _SUBDIR_LDFLAGS="$LDFLAGS"
+ _SUBDIR_HOST_CC="$HOST_CC"
+ _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
+ _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
+ _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
+ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
+ 
+-dnl Set the version number of the libs included with mozilla
+-dnl ========================================================
+-NSPR_VERSION=4
+-NSPR_MINVER=4.9.2
+-
+ dnl Set the minimum version of toolkit libs used by mozilla
+ dnl ========================================================
+ W32API_VERSION=3.14
+ 
+ dnl Set various checks
+ dnl ========================================================
+ MISSING_X=
+ 
+@@ -1209,18 +1204,16 @@ dnl are defined in build/autoconf/altopt
+ 
+ dnl ========================================================
+ dnl =
+ dnl = Check for external package dependencies
+ dnl =
+ dnl ========================================================
+ MOZ_ARG_HEADER(External Packages)
+ 
+-MOZ_CONFIG_NSPR(js)
+-
+ dnl ========================================================
+ dnl system zlib Support
+ dnl ========================================================
+ dnl Standalone js defaults to system zlib
+ if test -n "$JS_STANDALONE"; then
+     ZLIB_DIR=yes
+ fi
+ 
+@@ -1599,18 +1592,16 @@ HOST_CFLAGS=`echo \
+     $_COMPILATION_HOST_CFLAGS \
+     $HOST_CFLAGS`
+ 
+ HOST_CXXFLAGS=`echo \
+     $_WARNINGS_HOST_CXXFLAGS \
+     $_COMPILATION_HOST_CXXFLAGS \
+     $HOST_CXXFLAGS`
+ 
+-AC_SUBST(MOZ_SYSTEM_NSPR)
+-
+ OS_CFLAGS="$CFLAGS"
+ OS_CXXFLAGS="$CXXFLAGS"
+ OS_CPPFLAGS="$CPPFLAGS"
+ OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
+ OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
+ OS_LDFLAGS="$LDFLAGS"
+ OS_LIBS="$LIBS"
+ AC_SUBST_LIST(OS_CFLAGS)
+diff --git a/js/sub.configure b/js/sub.configure
+--- a/js/sub.configure
++++ b/js/sub.configure
+@@ -42,32 +42,21 @@ def js_subconfigure(host, target, build_
+         handler.setFormatter(formatter)
+         if isinstance(handler, ConfigureOutputHandler):
+             handler._stdout = PrefixOutput('js/src> ', handler._stdout)
+ 
+     substs = dict(old_configure['substs'])
+     assignments = dict(old_configure_assignments)
+     environ = dict(os.environ)
+ 
+-    options = [host, target] + [
+-        o for o in js_configure_args
+-        # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
+-        # and $NSPR_LIBS.
+-        if not o.startswith('--with-system-nspr')
+-    ]
++    options = [host, target] +  js_configure_args
+ 
+     if not substs.get('JS_HAS_INTL_API'):
+         options.append('--without-intl-api')
+ 
+-    if substs.get('NSPR_CFLAGS') or substs.get('NSPR_LIBS'):
+-        options.append(
+-            '--with-nspr-cflags=%s' % ' '.join(substs.get('NSPR_CFLAGS', [])))
+-        options.append(
+-            '--with-nspr-libs=%s' % ' '.join(substs.get('NSPR_LIBS', [])))
+-
+     options.append('--prefix=%s/dist' % build_env.topobjdir)
+ 
+     if substs.get('ZLIB_IN_MOZGLUE'):
+         substs['MOZ_ZLIB_LIBS'] = ''
+ 
+     environ['MOZILLA_CENTRAL_PATH'] = build_env.topsrcdir
+     if 'MOZ_BUILD_APP' in environ:
+         del environ['MOZ_BUILD_APP']
+diff --git a/moz.configure b/moz.configure
+--- a/moz.configure
++++ b/moz.configure
+@@ -235,16 +235,19 @@ set_config('RUST_LIB_PREFIX', library_na
+ set_config('RUST_LIB_SUFFIX', library_name_info.rust_lib.suffix)
+ set_config('OBJ_SUFFIX', library_name_info.obj.suffix)
+ # Lots of compilation tests depend on this variable being present.
+ add_old_configure_assignment('OBJ_SUFFIX', library_name_info.obj.suffix)
+ set_define('MOZ_DLL_PREFIX', depends(library_name_info.dll.prefix)(lambda s: '"%s"' % s))
+ set_config('IMPORT_LIB_SUFFIX', library_name_info.import_lib.suffix)
+ set_define('MOZ_DLL_SUFFIX', depends(library_name_info.dll.suffix)(lambda s: '"%s"' % s))
+ 
++# Same for fold_libs
++fold_libs = dependable(False)
++
+ include(include_project_configure)
+ 
+ @depends('--help')
+ @imports(_from='mozbuild.backend', _import='backends')
+ def build_backends_choices(_):
+     return tuple(backends)
+ 
+ 
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -41,18 +41,16 @@ dnl ====================================
+ _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
+ _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
+ _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
+ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
+ 
+ dnl Set the version number of the libs included with mozilla
+ dnl ========================================================
+ MOZPNG=10635
+-NSPR_VERSION=4
+-NSPR_MINVER=4.32
+ NSS_VERSION=3
+ 
+ dnl Set the minimum version of toolkit libs used by mozilla
+ dnl ========================================================
+ GLIB_VERSION=2.22
+ # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
+ # The macro won't be used when compiling with earlier versions anyway.
+ GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
+@@ -1510,18 +1508,16 @@ dnl are defined in build/autoconf/altopt
+ 
+ dnl ========================================================
+ dnl =
+ dnl = Check for external package dependencies
+ dnl =
+ dnl ========================================================
+ MOZ_ARG_HEADER(External Packages)
+ 
+-MOZ_CONFIG_NSPR()
+-
+ dnl ========================================================
+ dnl system libevent Support
+ dnl ========================================================
+ MOZ_ARG_WITH_STRING(system-libevent,
+ [  --with-system-libevent[=PFX]
+                           Use system libevent [installed at prefix PFX]],
+     LIBEVENT_DIR=$withval)
+ 
+@@ -3134,18 +3130,16 @@ HOST_CXXFLAGS=`echo \
+     $HOST_CXXFLAGS`
+ 
+ AC_SUBST(MOZ_SYSTEM_PNG)
+ AC_SUBST(MOZ_SYSTEM_BZ2)
+ 
+ AC_SUBST_LIST(MOZ_PNG_CFLAGS)
+ AC_SUBST_LIST(MOZ_PNG_LIBS)
+ 
+-AC_SUBST(MOZ_SYSTEM_NSPR)
+-
+ AC_SUBST(MOZ_SYSTEM_NSS)
+ 
+ HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
+ HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
+ OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
+ OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
+ AC_SUBST(HOST_CMFLAGS)
+ AC_SUBST(HOST_CMMFLAGS)

+ 107 - 0
mozilla-release/patches/1641783-78a1.patch

@@ -0,0 +1,107 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1590754551 0
+# Node ID 9cd9dbfb1c6bd3ee67c9c4b6fa6806191ce4075b
+# Parent  4971e7231059165b0488f303cd193bddd4b06baf
+Bug 1641783 - Move MOZ_FOLD_LIBS to python configure. r=froydnj
+
+Also remove MOZ_FOLD_LIBS_FLAGS because it is always empty since bug 1577521.
+
+Differential Revision: https://phabricator.services.mozilla.com/D77410
+
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -1512,25 +1512,16 @@ dnl are defined in build/autoconf/altopt
+ 
+ dnl ========================================================
+ dnl =
+ dnl = Check for external package dependencies
+ dnl =
+ dnl ========================================================
+ MOZ_ARG_HEADER(External Packages)
+ 
+-case "$OS_TARGET" in
+-WINNT|Darwin|Android)
+-  MOZ_FOLD_LIBS=1
+-  ;;
+-*)
+-  MOZ_FOLD_LIBS=
+-  ;;
+-esac
+-
+ MOZ_CONFIG_NSPR()
+ 
+ dnl ========================================================
+ dnl system libevent Support
+ dnl ========================================================
+ MOZ_ARG_WITH_STRING(system-libevent,
+ [  --with-system-libevent[=PFX]
+                           Use system libevent [installed at prefix PFX]],
+@@ -3212,18 +3203,16 @@ AC_SUBST(BIN_SUFFIX)
+ AC_SUBST(USE_N32)
+ AC_SUBST(NS_ENABLE_TSF)
+ AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
+ AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
+ 
+ AC_SUBST(MOZ_DEVTOOLS)
+ 
+ AC_SUBST(MOZ_PACKAGE_JSSHELL)
+-AC_SUBST(MOZ_FOLD_LIBS)
+-AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
+ 
+ AC_SUBST(DMG_TOOL)
+ 
+ dnl Host JavaScript runtime, if any, to use during cross compiles.
+ AC_SUBST(JS_BINARY)
+ 
+ AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
+ 
+diff --git a/security/moz.build b/security/moz.build
+--- a/security/moz.build
++++ b/security/moz.build
+@@ -129,18 +129,16 @@ sandbox_vars = {
+     'NO_PGO': True,
+ }
+ if CONFIG['OS_TARGET'] == 'WINNT':
+     # We want to remove XP_WIN32 eventually. See bug 1535219 for details.
+     sandbox_vars['CFLAGS'] = ['-DXP_WIN32']
+     if CONFIG['CPU_ARCH'] == 'x86':
+         # This should really be the default.
+         sandbox_vars['ASFLAGS'] = ['-safeseh']
+-    if CONFIG['MOZ_FOLD_LIBS_FLAGS']:
+-        sandbox_vars['CFLAGS'] += CONFIG['MOZ_FOLD_LIBS_FLAGS']
+ if CONFIG['MOZ_SYSTEM_NSS']:
+     sandbox_vars['CXXFLAGS'] = CONFIG['NSS_CFLAGS']
+ GYP_DIRS['nss'].sandbox_vars = sandbox_vars
+ GYP_DIRS['nss'].no_chromium = True
+ GYP_DIRS['nss'].no_unified = True
+ # This maps action names from gyp files to
+ # Python scripts that can be used in moz.build GENERATED_FILES.
+ GYP_DIRS['nss'].action_overrides = {
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -45,16 +45,22 @@ def all_configure_options():
+     if not result:
+         return ''
+ 
+     return quote(*result)
+ 
+ 
+ set_config('MOZ_CONFIGURE_OPTIONS', all_configure_options)
+ 
++@depends(target)
++def fold_libs(target):
++    return target.os in ('WINNT', 'OSX', 'Android')
++
++set_config('MOZ_FOLD_LIBS', fold_libs)
++
+ # Profiling
+ # ==============================================================
+ # Some of the options here imply an option from js/moz.configure,
+ # so, need to be declared before the include.
+ 
+ option('--enable-jprof', env='MOZ_JPROF',
+        help='Enable jprof profiling tool (needs mozilla/tools/jprof)')
+ 

+ 5 - 5
mozilla-release/patches/1656044-PARTIAL-81a1.patch

@@ -2,7 +2,7 @@
 # User Ricky Stewart <rstewart@mozilla.com>
 # Date 1596461819 0
 # Node ID e4b490d63e4882297234d519e4ea436dbe854ee0
-# Parent  71b3df332d3cdc161bc9ce646b14f598eb3ac7b6
+# Parent  7d0d9374ef4156b5dbd85856bba856f48d223171
 Bug 1656044 - Move `--enable-mobile-optimize`, `MOZ_GFX_OPTIMIZE_MOBILE` from `old-configure` r=geckoview-reviewers,mhentges,froydnj,glandium,esawin
 
 Differential Revision: https://phabricator.services.mozilla.com/D85321
@@ -22,16 +22,16 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
 -    '--enable-mobile-optimize',
      '--enable-necko-wifi',
      '--enable-negotiateauth',
-     '--enable-nspr-build',
      '--enable-official-branding',
      '--enable-parental-controls',
      '--enable-posix-nspr-emulation',
      '--enable-pref-extensions',
      '--enable-sandbox',
+     '--enable-signmar',
 diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 --- a/js/src/old-configure.in
 +++ b/js/src/old-configure.in
-@@ -513,17 +513,16 @@ case "$target" in
+@@ -508,17 +508,16 @@ case "$target" in
          fi
  
          LDFLAGS=$_SAVE_LDFLAGS
@@ -52,7 +52,7 @@ diff --git a/js/src/old-configure.in b/js/src/old-configure.in
 diff --git a/old-configure.in b/old-configure.in
 --- a/old-configure.in
 +++ b/old-configure.in
-@@ -605,17 +605,16 @@ case "$target" in
+@@ -603,17 +603,16 @@ case "$target" in
      MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
      ;;
  
@@ -70,7 +70,7 @@ diff --git a/old-configure.in b/old-configure.in
          MOZ_OPTIMIZE_FLAGS="-Oz"
          # Disable the outliner, which causes performance regressions, and is
          # enabled on some platforms at -Oz.
-@@ -2304,35 +2303,16 @@ dnl MOZ_ARG_HEADER(Features that require
+@@ -2291,35 +2290,16 @@ dnl MOZ_ARG_HEADER(Features that require
  dnl ========================================================
  dnl =
  dnl = Runtime debugging and Optimization Options

+ 3 - 3
mozilla-release/patches/1659575-81a1.patch

@@ -2,7 +2,7 @@
 # User Ricky Stewart <rstewart@mozilla.com>
 # Date 1597760304 0
 # Node ID 7953ad9a7130a87b30ee704b33600f8ce4e03075
-# Parent  8096efd3b89ccc976e235ea2006b1641d4b7539c
+# Parent  311ad43cad79f23ae4fe0680af6ce08808126526
 Bug 1659575 - Delete `mach python-safety` r=ahal
 
 There are zero uses of this `mach` command over the past 90 days according to our telemetry. There are no external references to `mach python-safety` in-tree, and indeed if you track the history of the originating bug 1468394, it appears that once the `mach` command was created, none of the follow-up work that was discussed (i.e. running this in CI and triaging failures to appropriate owners) was done over the following 2 years.
@@ -298,14 +298,14 @@ deleted file mode 100644
 diff --git a/tools/lint/codespell.yml b/tools/lint/codespell.yml
 --- a/tools/lint/codespell.yml
 +++ b/tools/lint/codespell.yml
-@@ -1,17 +1,16 @@
- ---
+@@ -2,17 +2,16 @@
  codespell:
      description: Check code for common misspellings
      include:
          - browser/base/content/docs/
          - build/docs
          - python/docs
+         - python/mach/docs/
          - python/mozlint
 -        - python/safety/
          - testing/mozbase/docs

+ 5 - 5
mozilla-release/patches/1746299-97a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1639787554 0
 # Node ID efef2e68769eeadbd5568eebee8c023f10bba7f0
-# Parent  f120ed04c401c2eb1b518d00b87a8a920fa5df08
+# Parent  44b9a84693ff500ea90357bba950b77cbf160de7
 Bug 1746299 - Remove broken support for --enable-project=extensions and --enable-extensions. r=Gijs,firefox-build-system-reviewers,mhentges
 
 The former is broken because of a lack of a app.mozbuild file and has
@@ -43,7 +43,7 @@ diff --git a/browser/app.mozbuild b/browser/app.mozbuild
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -155,17 +155,16 @@ def old_configure_options(*options):
+@@ -161,17 +161,16 @@ def old_configure_options(*options):
  @old_configure_options(
      '--cache-file',
      '--datadir',
@@ -58,9 +58,9 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--enable-logrefcnt',
      '--enable-necko-wifi',
      '--enable-negotiateauth',
-     '--enable-nspr-build',
      '--enable-official-branding',
      '--enable-parental-controls',
+     '--enable-posix-nspr-emulation',
 diff --git a/extensions/build.mk b/extensions/build.mk
 deleted file mode 100644
 --- a/extensions/build.mk
@@ -125,7 +125,7 @@ deleted file mode 100644
 diff --git a/old-configure.in b/old-configure.in
 --- a/old-configure.in
 +++ b/old-configure.in
-@@ -1995,46 +1995,16 @@ if test -n "$MOZ_CRASHREPORTER"; then
+@@ -2002,46 +2002,16 @@ if test -n "$MOZ_CRASHREPORTER"; then
    if test "$OS_ARCH" = "WINNT"; then
      if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
        MOZ_CRASHREPORTER_INJECTOR=1
@@ -172,7 +172,7 @@ diff --git a/old-configure.in b/old-configure.in
  # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
  if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
     MOZ_ENABLE_CAIRO_FT=1
-@@ -2654,19 +2624,16 @@ AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
+@@ -2673,19 +2643,16 @@ AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_F
  dnl ========================================================
  dnl disable xul
  dnl ========================================================

+ 4 - 4
mozilla-release/patches/1747754-PARTIAL-97a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1640816331 0
 # Node ID 34308b58e329edae3ade1265ebf7e3882d73b0ea
-# Parent  ffb0c3b2ae328086163b6a5d0ef704cf3b979a38
+# Parent  d5b1bdecefa06a8ad83df5e32c23852fbeec1365
 Bug 1747754 - Move --with-android-min-sdk to python configure. r=firefox-build-system-reviewers,geckoview-reviewers,mhentges,calu
 
 And remove --with-android-max-sdk, which hasn't been used since the
@@ -58,7 +58,7 @@ diff --git a/build/autoconf/android.m4 b/build/autoconf/android.m4
 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
 --- a/build/moz.configure/old.configure
 +++ b/build/moz.configure/old.configure
-@@ -179,18 +179,16 @@ def old_configure_options(*options):
+@@ -184,18 +184,16 @@ def old_configure_options(*options):
      '--enable-system-pixman',
      '--enable-universalchardet',
      '--enable-updater',
@@ -76,11 +76,11 @@ diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configu
      '--with-distribution-id',
      '--with-jitreport-granularity',
      '--with-macbundlename-prefix',
-     '--with-nspr-cflags',
+     '--with-nss-exec-prefix',
 diff --git a/old-configure.in b/old-configure.in
 --- a/old-configure.in
 +++ b/old-configure.in
-@@ -1690,27 +1690,16 @@ MOZ_ARG_WITH_STRING(app-basename,
+@@ -1695,27 +1695,16 @@ MOZ_ARG_WITH_STRING(app-basename,
  WITH_APP_BASENAME=$withval,
  )
  

+ 4 - 4
mozilla-release/patches/PPPPPPP-NSSgetentropy.patch

@@ -3,21 +3,21 @@
 # Date 1570452567 14400
 #      Mon Oct 07 08:49:27 2019 -0400
 # Node ID 45bcb7edc9c43f687eb73116b2023cf793737228
-# Parent  e73c06163708dfda6353549e937303887789024e
+# Parent  57f3f4e7491450b5b56cb1188720231343dcd02f
 Avoid use of getentropy in --enable-stdcxx-compat builds.
 
 diff --git a/security/moz.build b/security/moz.build
 --- a/security/moz.build
 +++ b/security/moz.build
-@@ -139,16 +139,18 @@ sandbox_vars = {
+@@ -137,16 +137,18 @@ sandbox_vars = {
+     'NO_PGO': True,
+ }
  if CONFIG['OS_TARGET'] == 'WINNT':
      # We want to remove XP_WIN32 eventually. See bug 1535219 for details.
      sandbox_vars['CFLAGS'] = ['-DXP_WIN32']
      if CONFIG['CPU_ARCH'] == 'x86':
          # This should really be the default.
          sandbox_vars['ASFLAGS'] = ['-safeseh']
-     if CONFIG['MOZ_FOLD_LIBS_FLAGS']:
-         sandbox_vars['CFLAGS'] += CONFIG['MOZ_FOLD_LIBS_FLAGS']
 +if CONFIG["MOZ_LIBSTDCXX_TARGET_VERSION"] or CONFIG["MOZ_LIBSTDCXX_HOST_VERSION"]:
 +    sandbox_vars['CFLAGS'] = ['-DNSS_STDCXX_COMPAT']
  if CONFIG['MOZ_SYSTEM_NSS']:

+ 9 - 0
mozilla-release/patches/series

@@ -5368,9 +5368,12 @@ NOBUG-20190118-zlib-66a1.patch
 1518106-1-66a1.patch
 1518106-2-66a1.patch
 1517298-66a1.patch
+1519968-66a1.patch
 1522150-1-66a1.patch
 1521584-67a1.patch
 1522507-67a1.patch
+1523143-1-67a1.patch
+1523143-2-67a1.patch
 1523223-67a1.patch
 1522788-67a1.patch
 1522354-1-67a1.patch
@@ -5607,6 +5610,8 @@ NOBUG-removenonascii67a1-25314.patch
 1546501-crashreporter-68a1.patch
 1542826-6only-68a1.patch
 1495672-68a1.patch
+1536486-68a1.patch
+1547196-68a1.patch
 1546697-1-68a1.patch
 1545567-68a1.patch
 1543644-68a1.patch
@@ -5798,6 +5803,8 @@ NOBUG-removenonascii67a1-25314.patch
 1559975-16-69a1.patch
 1559975-17-69a1.patch
 1559975-18-69a1.patch
+1562389-1-70a1.patch
+1562389-2-70a1.patch
 1577934-70a1.patch
 1558372-70a1.patch
 1563085-70a1.patch
@@ -6546,6 +6553,8 @@ NOBUG-removenonascii67a1-25314.patch
 1636122-78a1.patch
 1637305-78a1.patch
 1636251-1-PARTIAL-78a1.patch
+1641783-78a1.patch
+1641775-78a1.patch
 1637474-1-78a1.patch
 1637474-2-78a1.patch
 1637409-78a1.patch