From 6a5488832e96b5c0eec1d0e42c10dabc828f50e4 Mon Sep 17 00:00:00 2001 From: Itms Date: Sun, 13 Oct 2024 22:13:45 +0200 Subject: [PATCH] Upgrade SpiderMonkey to ESR 102 --- libraries/source/spidermonkey/build.sh | 46 ++++--- libraries/source/spidermonkey/mozconfig | 16 ++- .../spidermonkey/patches/FixClang16Build.diff | 24 ---- .../spidermonkey/patches/FixDllMain.diff | 35 +++++ .../patches/FixFedoraVirtualEnv.diff | 15 -- .../patches/FixHeadersForMSVC.diff | 38 +++++ .../patches/FixInstallScheme.diff | 26 ---- .../spidermonkey/patches/FixLibNames.diff | 2 +- .../patches/FixMozillaBuild4.diff | 36 +++++ .../patches/FixUnicodePython311.diff | 130 ------------------ .../spidermonkey/patches/FixVirtualEnv.diff | 16 --- .../spidermonkey/patches/FixWinHeap.diff | 4 +- .../source/spidermonkey/patches/patch.sh | 39 ++---- 13 files changed, 159 insertions(+), 268 deletions(-) delete mode 100644 libraries/source/spidermonkey/patches/FixClang16Build.diff create mode 100644 libraries/source/spidermonkey/patches/FixDllMain.diff delete mode 100644 libraries/source/spidermonkey/patches/FixFedoraVirtualEnv.diff create mode 100644 libraries/source/spidermonkey/patches/FixHeadersForMSVC.diff delete mode 100644 libraries/source/spidermonkey/patches/FixInstallScheme.diff create mode 100644 libraries/source/spidermonkey/patches/FixMozillaBuild4.diff delete mode 100644 libraries/source/spidermonkey/patches/FixUnicodePython311.diff delete mode 100644 libraries/source/spidermonkey/patches/FixVirtualEnv.diff diff --git a/libraries/source/spidermonkey/build.sh b/libraries/source/spidermonkey/build.sh index 1a70f7c6b3..19e49f20e7 100755 --- a/libraries/source/spidermonkey/build.sh +++ b/libraries/source/spidermonkey/build.sh @@ -4,10 +4,10 @@ set -e cd "$(dirname "$0")" # This should match the version in config/milestone.txt -FOLDER="mozjs-91.13.1" +FOLDER="mozjs-102.15.1" # If same-version changes are needed, increment this. -LIB_VERSION="91.13.1+2" -LIB_NAME="mozjs91" +LIB_VERSION="102.15.1+0" +LIB_NAME="mozjs102" if [ -e .already-built ] && [ "$(cat .already-built)" = "${LIB_VERSION}" ]; then echo "Spidermonkey is already up to date." @@ -17,9 +17,11 @@ fi OS="${OS:=$(uname -s)}" # fetch +# This tarball is built from https://ftp.mozilla.org/pub/firefox/releases/102.15.1esr/source +# by running js/src/make-source-package.py if [ ! -e "${FOLDER}.tar.xz" ]; then curl -fLo "${FOLDER}.tar.xz" \ - "https://svn.wildfiregames.com/public/source-libs/trunk/spidermonkey/${FOLDER}.tar.xz" + "https://releases.wildfiregames.com/libs/${FOLDER}.tar.xz" fi # unpack @@ -46,18 +48,16 @@ tar xfJ "${FOLDER}.tar.xz" ( cd "${FOLDER}" - # Prevent the SpiderMonkey build system from reading dependencies from - # user-installed python packages. - PYTHONNOUSERSITE=true + # Silence notifications and warnings from the Mozilla build system + export MOZ_NOSPAM=1 + export CFLAGS="${CFLAGS} -w" + export CXXFLAGS="${CXXFLAGS} -w" - # Standalone SpiderMonkey can not use jemalloc (see https://bugzilla.mozilla.org/show_bug.cgi?id=1465038) - # Jitspew doesn't compile on VS17 in the zydis disassembler - since we don't use it, deactivate it. - # Trace-logging doesn't compile for now. - CONF_OPTS="--disable-tests - --disable-jemalloc - --disable-js-shell - --without-intl-api - --enable-shared-js" + # Do not let mach fetch python and rust packages online: use vendored content + export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="none" + + # Do not let mach install tools in the user's home, create a disposable folder + export MOZBUILD_STATE_PATH="${MOZBUILD_STATE_PATH:=$(pwd)/mozbuild-state}" if [ -n "$PROFILE" ]; then CONF_OPTS="$CONF_OPTS --enable-profiling @@ -105,23 +105,21 @@ tar xfJ "${FOLDER}.tar.xz" ${CTARGET:+--target=${CTARGET}}" # Build - ./mach create-mach-environment - # Debug (broken on FreeBSD) if [ "${OS}" != "FreeBSD" ]; then MOZCONFIG="$(pwd)/../mozconfig" \ - OPTIONS="${CONF_OPTS} \ + MOZCONFIG_OPTIONS="${CONF_OPTS} \ --enable-debug \ --disable-optimize \ --enable-gczeal" \ - BUILD_DIR="build-debug" \ + BUILD_DIR="build-debug" \ ./mach build "${JOBS}" fi # Release MOZCONFIG="$(pwd)/../mozconfig" \ - OPTIONS="${CONF_OPTS} \ + MOZCONFIG_OPTIONS="${CONF_OPTS} \ --enable-optimize" \ - BUILD_DIR="build-release" \ + BUILD_DIR="build-release" \ ./mach build "${JOBS}" ) @@ -157,6 +155,12 @@ if [ "${OS}" = "Windows_NT" ]; then cd "${FOLDER}"/build-release/dist/include rm -f mozzconf.h zconf.h zlib.h ) + + # SpiderMonkey can be linked/included in projects built with MSVC, however, since clang is now the only + # supported compiler on Windows, the codebase has accumulated some divergences with MSVC. + # Upstream tries on a best-effort basis to keep the SM headers MSVC-compatible. + patch -d "${FOLDER}"/build-debug/dist/include -p1 -Date: Mon, 15 May 2023 22:02:52 +0200 -Subject: [PATCH 1/1] Use default pass manager for clang - ---- - build/moz.configure/flags.configure | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure -index cc8ca1e6aada..40f4c7d905ec 100644 ---- a/build/moz.configure/flags.configure -+++ b/build/moz.configure/flags.configure -@@ -36,6 +36,7 @@ option( - ubsan, - ) - def new_pass_manager_flags(enabled, compiler, host, target, pgo, enable_fuzzing, ubsan): -+ return None - if host.os == "OSX": - # Some native Mac builds hang with the new pass manager. Given the - # inability to test in CI, don't take the risk of further breakage. --- -2.39.3 - diff --git a/libraries/source/spidermonkey/patches/FixDllMain.diff b/libraries/source/spidermonkey/patches/FixDllMain.diff new file mode 100644 index 0000000000..b9426c5955 --- /dev/null +++ b/libraries/source/spidermonkey/patches/FixDllMain.diff @@ -0,0 +1,35 @@ + +# HG changeset patch +# User Mike Hommey +# Date 1684789421 0 +# Node ID 888d869b7f7534934ec2d0f63beeb4cb55860661 +# Parent b15de32be05d9c1ef2e783b468e6e0c3601217ff +Bug 1751561 - Don't include DllMain when mozglue is linked statically. r=jandem + +mozglue has its own DllMain, which conflicts with this one. + +Differential Revision: https://phabricator.services.mozilla.com/D178410 + +diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp +--- a/js/src/jsapi.cpp ++++ b/js/src/jsapi.cpp +@@ -4224,17 +4224,17 @@ #else + *valueOut = 0; + #endif + return true; + } + + /************************************************************************/ + + #if !defined(STATIC_EXPORTABLE_JS_API) && !defined(STATIC_JS_API) && \ +- defined(XP_WIN) ++ defined(XP_WIN) && (defined(MOZ_MEMORY) || !defined(JS_STANDALONE)) + + # include "util/WindowsWrapper.h" + + /* + * Initialization routine for the JS DLL. + */ + BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { + return TRUE; + diff --git a/libraries/source/spidermonkey/patches/FixFedoraVirtualEnv.diff b/libraries/source/spidermonkey/patches/FixFedoraVirtualEnv.diff deleted file mode 100644 index 5df044bb08..0000000000 --- a/libraries/source/spidermonkey/patches/FixFedoraVirtualEnv.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- a/third_party/python/virtualenv/virtualenv/discovery/py_info.py -+++ b/third_party/python/virtualenv/virtualenv/discovery/py_info.py -@@ -177,7 +177,11 @@ - ) - if not os.path.exists(path): # some broken packaging don't respect the sysconfig, fallback to distutils path - # the pattern include the distribution name too at the end, remove that via the parent call -- fallback = os.path.join(self.prefix, os.path.dirname(self.distutils_install["headers"])) -+ # A hack for https://github.com/pypa/virtualenv/issues/2208 -+ distutils_path = self.distutils_install["headers"] -+ if distutils_path.startswith(u"local/"): -+ distutils_path = distutils_path[6:] -+ fallback = os.path.join(self.prefix, os.path.dirname(distutils_path)) - if os.path.exists(fallback): - path = fallback - return path diff --git a/libraries/source/spidermonkey/patches/FixHeadersForMSVC.diff b/libraries/source/spidermonkey/patches/FixHeadersForMSVC.diff new file mode 100644 index 0000000000..9fc59c0d86 --- /dev/null +++ b/libraries/source/spidermonkey/patches/FixHeadersForMSVC.diff @@ -0,0 +1,38 @@ +diff --git a/jspubtd.h b/jspubtd.h +index 97de470db..1507b6b6b 100644 +--- a/jspubtd.h ++++ b/jspubtd.h +@@ -51,6 +51,11 @@ enum JSType { + enum JSProtoKey { + #define PROTOKEY_AND_INITIALIZER(name, clasp) JSProto_##name, + JS_FOR_EACH_PROTOTYPE(PROTOKEY_AND_INITIALIZER) ++// Workaround MSVC's __VA_ARGS__ quirk, until bug 1768634 is solved ++// https://bugzilla.mozilla.org/show_bug.cgi?id=1768634 ++#ifdef _MSC_VER ++ , ++#endif + #undef PROTOKEY_AND_INITIALIZER + JSProto_LIMIT + }; + +diff --git a/mozilla/Result.h b/mozilla/Result.h +index cc4f87826..0e763a300 100644 +--- a/mozilla/Result.h ++++ b/mozilla/Result.h +@@ -212,10 +212,16 @@ using UnsignedIntType = std::conditional_t< + */ + template + class ResultImplementation { ++// These assertions fail with MSVC 14.1. Similar bugs: ++// https://bugzilla.mozilla.org/show_bug.cgi?id=1778246 ++// https://bugzilla.mozilla.org/show_bug.cgi?id=1778247 ++// TODO: test with recent MSVC before reporting a bug ++#ifndef _MSC_VER + static_assert(std::is_trivially_copyable_v && + std::is_trivially_destructible_v); + static_assert(std::is_trivially_copyable_v && + std::is_trivially_destructible_v); ++#endif + + static constexpr size_t kRequiredSize = std::max(sizeof(V), sizeof(E)); + diff --git a/libraries/source/spidermonkey/patches/FixInstallScheme.diff b/libraries/source/spidermonkey/patches/FixInstallScheme.diff deleted file mode 100644 index 0b2c9568ca..0000000000 --- a/libraries/source/spidermonkey/patches/FixInstallScheme.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- a/python/mozbuild/mozbuild/virutalenv.py -+++ b/python/mozbuild/mozbuild/virtualenv.py -@@ -587,18 +587,11 @@ - """ - -- # Defer "distutils" import until this function is called so that -- # "mach bootstrap" doesn't fail due to Linux distro python-distutils -- # package not being installed. -- # By the time this function is called, "distutils" must be installed -- # because it's needed by the "virtualenv" package. -- from distutils import dist -+ import sysconfig - -- distribution = dist.Distribution({"script_args": "--no-user-cfg"}) -- installer = distribution.get_command_obj("install") -- installer.prefix = os.path.normpath(self.virtualenv_root) -- installer.finalize_options() -- - # Path to virtualenv's "site-packages" directory -- site_packages = installer.install_purelib -+ site_packages = sysconfig.get_path( -+ 'purelib', -+ scheme='posix_prefix', -+ vars={ 'base': os.path.normpath(self.virtualenv_root) }) - - pip_dist_info = next( diff --git a/libraries/source/spidermonkey/patches/FixLibNames.diff b/libraries/source/spidermonkey/patches/FixLibNames.diff index 27a1ee41f6..61671e99f5 100644 --- a/libraries/source/spidermonkey/patches/FixLibNames.diff +++ b/libraries/source/spidermonkey/patches/FixLibNames.diff @@ -1,6 +1,6 @@ --- a/js/src/old-configure +++ b/js/src/old-configure -@@ -7035,10 +7035,10 @@ +@@ -5081,10 +5081,10 @@ diff --git a/libraries/source/spidermonkey/patches/FixMozillaBuild4.diff b/libraries/source/spidermonkey/patches/FixMozillaBuild4.diff new file mode 100644 index 0000000000..65995d124d --- /dev/null +++ b/libraries/source/spidermonkey/patches/FixMozillaBuild4.diff @@ -0,0 +1,36 @@ + +# HG changeset patch +# User Mike Hommey +# Date 1663730995 0 +# Node ID 8e4ceab106b12c3816163829494ac5e7938a6be6 +# Parent ef44d7041454440fdd144b79c115c8d6439ec31a +Bug 1790540 - Gracefully handle when topobjdir is not set in MozbuildObject.mozconfig. r=firefox-build-system-reviewers,nalexander + +This is a condition that happens when going through the js/src code path +in build/moz.configure/init.configure:mozconfig. + +Differential Revision: https://phabricator.services.mozilla.com/D157769 + +diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py +--- a/python/mozbuild/mozbuild/base.py ++++ b/python/mozbuild/mozbuild/base.py +@@ -193,17 +193,17 @@ class MozbuildObject(ProcessExecutionMix + + # If we can't resolve topobjdir, oh well. We'll figure out when we need + # one. + return cls( + topsrcdir, None, None, topobjdir=topobjdir, mozconfig=mozconfig, **kwargs + ) + + def resolve_mozconfig_topobjdir(self, default=None): +- topobjdir = self.mozconfig["topobjdir"] or default ++ topobjdir = self.mozconfig.get("topobjdir") or default + if not topobjdir: + return None + + if "@CONFIG_GUESS@" in topobjdir: + topobjdir = topobjdir.replace("@CONFIG_GUESS@", self.resolve_config_guess()) + + if not os.path.isabs(topobjdir): + topobjdir = os.path.abspath(os.path.join(self.topsrcdir, topobjdir)) + diff --git a/libraries/source/spidermonkey/patches/FixUnicodePython311.diff b/libraries/source/spidermonkey/patches/FixUnicodePython311.diff deleted file mode 100644 index 35f3bf572f..0000000000 --- a/libraries/source/spidermonkey/patches/FixUnicodePython311.diff +++ /dev/null @@ -1,130 +0,0 @@ -From c6c6300e8698ba1d3db96591b9c150c49b8e6d76 Mon Sep 17 00:00:00 2001 -From: Ralph Sennhauser -Date: Fri, 13 Jan 2023 13:13:47 +0100 -Subject: [PATCH] Fix use of removed 'U' support in python 3.11 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Form https://docs.python.org/3.11/whatsnew/3.11.html: - -open(), io.open(), codecs.open() and fileinput.FileInput no longer -accept 'U' (“universal newline”) in the file mode. In Python 3, -“universal newline” mode is used by default whenever a file is opened in -text mode, and the 'U' flag has been deprecated since Python 3.3. The -newline parameter to these functions controls how universal newlines -work. (Contributed by Victor Stinner in bpo-37330.) - -https://github.com/python/cpython/issues/81511 ---- - python/mozbuild/mozbuild/action/process_define_files.py | 2 +- - python/mozbuild/mozbuild/backend/base.py | 2 +- - python/mozbuild/mozbuild/preprocessor.py | 6 +++--- - python/mozbuild/mozbuild/util.py | 4 ++-- - python/mozbuild/mozpack/files.py | 4 ++-- - 5 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py -index f1d401ac2600..aca59d0f0517 100644 ---- a/python/mozbuild/mozbuild/action/process_define_files.py -+++ b/python/mozbuild/mozbuild/action/process_define_files.py -@@ -36,7 +36,7 @@ def process_define_file(output, input): - ) and not config.substs.get("JS_STANDALONE"): - config = PartialConfigEnvironment(mozpath.join(topobjdir, "js", "src")) - -- with open(path, "rU") as input: -+ with open(path, "r") as input: - r = re.compile( - "^\s*#\s*(?P[a-z]+)(?:\s+(?P\S+)(?:\s+(?P\S+))?)?", re.U - ) -diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py -index 7bc1986d863b..b64a70946863 100644 ---- a/python/mozbuild/mozbuild/backend/base.py -+++ b/python/mozbuild/mozbuild/backend/base.py -@@ -272,7 +272,7 @@ class BuildBackend(LoggingMixin): - return status - - @contextmanager -- def _write_file(self, path=None, fh=None, readmode="rU"): -+ def _write_file(self, path=None, fh=None, readmode="r"): - """Context manager to write a file. - - This is a glorified wrapper around FileAvoidWrite with integration to -diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py -index f7820b9c9147..857f1a6c9bfd 100644 ---- a/python/mozbuild/mozbuild/preprocessor.py -+++ b/python/mozbuild/mozbuild/preprocessor.py -@@ -531,7 +531,7 @@ class Preprocessor: - - if args: - for f in args: -- with io.open(f, "rU", encoding="utf-8") as input: -+ with io.open(f, "r", encoding="utf-8") as input: - self.processFile(input=input, output=out) - if depfile: - mk = Makefile() -@@ -860,7 +860,7 @@ class Preprocessor: - args = self.applyFilters(args) - if not os.path.isabs(args): - args = os.path.join(self.curdir, args) -- args = io.open(args, "rU", encoding="utf-8") -+ args = io.open(args, "r", encoding="utf-8") - except Preprocessor.Error: - raise - except Exception: -@@ -914,7 +914,7 @@ class Preprocessor: - def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout, marker="#"): - pp = Preprocessor(defines=defines, marker=marker) - for f in includes: -- with io.open(f, "rU", encoding="utf-8") as input: -+ with io.open(f, "r", encoding="utf-8") as input: - pp.processFile(input=input, output=output) - return pp.includes - -diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py -index 071daecc397b..b59aabbea61b 100644 ---- a/python/mozbuild/mozbuild/util.py -+++ b/python/mozbuild/mozbuild/util.py -@@ -225,7 +225,7 @@ class FileAvoidWrite(BytesIO): - still occur, as well as diff capture if requested. - """ - -- def __init__(self, filename, capture_diff=False, dry_run=False, readmode="rU"): -+ def __init__(self, filename, capture_diff=False, dry_run=False, readmode="r"): - BytesIO.__init__(self) - self.name = filename - assert type(capture_diff) == bool -@@ -1447,7 +1447,7 @@ def patch_main(): - - def my_get_command_line(): - with open( -- os.path.join(os.path.dirname(__file__), "fork_interpose.py"), "rU" -+ os.path.join(os.path.dirname(__file__), "fork_interpose.py"), "r" - ) as fork_file: - fork_code = fork_file.read() - # Add our relevant globals. -diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py -index 8150e72d6fa2..001c497b2796 100644 ---- a/python/mozbuild/mozpack/files.py -+++ b/python/mozbuild/mozpack/files.py -@@ -574,7 +574,7 @@ class PreprocessedFile(BaseFile): - pp = Preprocessor(defines=self.defines, marker=self.marker) - pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings) - -- with _open(self.path, "rU") as input: -+ with _open(self.path, "r") as input: - with _open(os.devnull, "w") as output: - pp.processFile(input=input, output=output) - -@@ -631,7 +631,7 @@ class PreprocessedFile(BaseFile): - pp = Preprocessor(defines=self.defines, marker=self.marker) - pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings) - -- with _open(self.path, "rU") as input: -+ with _open(self.path, "r") as input: - pp.processFile(input=input, output=dest, depfile=deps_out) - - dest.close() --- -2.38.2 - diff --git a/libraries/source/spidermonkey/patches/FixVirtualEnv.diff b/libraries/source/spidermonkey/patches/FixVirtualEnv.diff deleted file mode 100644 index 2a638c9f9e..0000000000 --- a/libraries/source/spidermonkey/patches/FixVirtualEnv.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- a/python/mozbuild/mozbuild/virtualenv.py -+++ b/python/mozbuild/mozbuild/virtualenv.py -@@ -246,11 +246,12 @@ - if os.path.exists(self.virtualenv_root): - shutil.rmtree(self.virtualenv_root) - - args = [ - python, -- self.virtualenv_script_path, -+ "-m", -+ "virtualenv", - # Without this, virtualenv.py may attempt to contact the outside - # world and search for or download a newer version of pip, - # setuptools, or wheel. This is bad for security, reproducibility, - # and speed. - "--no-download", diff --git a/libraries/source/spidermonkey/patches/FixWinHeap.diff b/libraries/source/spidermonkey/patches/FixWinHeap.diff index 1eb7022737..6f94372724 100644 --- a/libraries/source/spidermonkey/patches/FixWinHeap.diff +++ b/libraries/source/spidermonkey/patches/FixWinHeap.diff @@ -33,9 +33,9 @@ diff --git a/memory/mozalloc/moz.build b/memory/mozalloc/moz.build UNIFIED_SOURCES += [ "mozalloc.cpp", + "mozalloc_abort.cpp", "mozalloc_oom.cpp", ] - SOURCES += [ - "mozalloc_abort.cpp", + if CONFIG["MOZ_MEMORY"]: diff --git a/libraries/source/spidermonkey/patches/patch.sh b/libraries/source/spidermonkey/patches/patch.sh index e0cd5ca85d..8fc3dbb6da 100755 --- a/libraries/source/spidermonkey/patches/patch.sh +++ b/libraries/source/spidermonkey/patches/patch.sh @@ -14,10 +14,18 @@ patch -p1 <"${PATCHES}"/FixRustLinkage.diff # Differentiate debug/release library names. patch -p1 <"${PATCHES}"/FixLibNames.diff +# Fix Windows build environment under MozillaBuild 4, fixed in ESR 115 +# https://bugzilla.mozilla.org/show_bug.cgi?id=1790540 +patch -p1 <"${PATCHES}"/FixMozillaBuild4.diff + # Fix Windows build, fixed in ESR 115 # https://bugzilla.mozilla.org/show_bug.cgi?id=1802675 patch -p1 <"${PATCHES}"/FixWinHeap.diff +# Fix linking on Windows with mozglue, fixed in ESR 115 +# https://bugzilla.mozilla.org/show_bug.cgi?id=1751561 +patch -p1 <"${PATCHES}"/FixDllMain.diff + # There is an issue on 32-bit linux builds sometimes. # NB: the patch here is Comment 21 modified by Comment 25 # but that seems to imperfectly fix the issue with GCC. @@ -26,34 +34,3 @@ patch -p1 <"${PATCHES}"/FixWinHeap.diff if [ "$(uname -m)" = "i686" ] && [ "${OS}" != "Windows_NT" ]; then patch -p1 <"${PATCHES}"/FixFpNormIssue.diff fi - -if [ "$OS" = "Darwin" ]; then - # The bundled virtualenv version is not working on MacOS - # with recent homebrew and needs to be upgraded. - # Install it locally to not pollute anything. - pip3 install --upgrade -t virtualenv virtualenv - export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH" - patch -p1 <"${PATCHES}"/FixVirtualEnv.diff -fi - -if [ "$OS" = "Linux" ]; then - # Use sysconfig instead of distutils with the bundled virtualenv - # This fixes an issue with install schemes on recent Debian and Fedora - # Furthermore, distutils is going to be deprecated and is replaced - # by sysconfig in ESR102 - patch -p1 <"${PATCHES}"/FixInstallScheme.diff - - # Extend the previous fix with a portion of the following commit - # https://phabricator.services.mozilla.com/D130410 - # This will prevent bug 1739486 from happening on Fedora - patch -p1 <"${PATCHES}"/FixFedoraVirtualEnv.diff -fi - -# Python >= 3.11 support -PYTHON_MINOR_VERSION="$(python3 -c 'import sys; print(sys.version_info.minor)')" -if [ "$PYTHON_MINOR_VERSION" -ge 11 ]; then - patch -p1 <"${PATCHES}"/FixUnicodePython311.diff -fi - -# fixed in SM102 -patch -p1 <"${PATCHES}"/FixClang16Build.diff