Update SpiderMonkey to ESR 128.13

Fixes #7662
This commit is contained in:
Itms 2025-08-04 17:27:45 +02:00
parent 733297a038
commit 7038d87454
20 changed files with 131 additions and 463 deletions

View file

@ -51,10 +51,12 @@ RUN apt-get -qqy update \
zlib1g-dev \
&& apt-get clean
# Install rust and Cargo via rustup, available in Debian12 1.63, need 1.66
# Install rust and Cargo via rustup, available in Debian12 1.63, need 1.76
ENV RUSTUP_HOME=/usr/local/rust
ENV CARGO_HOME=/usr/local/rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.66.0 -y
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.76.0 -y
# Install cbindgen for building SpiderMonkey
RUN /usr/local/rust/bin/cargo install cbindgen
ENV PATH="${RUSTUP_HOME}/bin:${PATH}"
ENV SHELL=/bin/bash

View file

@ -645,7 +645,7 @@ extern_lib_defs = {
compile_settings = function()
if _OPTIONS["with-system-mozjs"] then
if not _OPTIONS["android"] then
pkgconfig.add_includes_after("mozjs-115")
pkgconfig.add_includes_after("mozjs-128")
end
else
filter "Debug"
@ -659,17 +659,17 @@ extern_lib_defs = {
link_settings = function()
if _OPTIONS["with-system-mozjs"] then
if _OPTIONS["android"] then
links { "mozjs-115" }
links { "mozjs-128" }
else
pkgconfig.add_links("mozjs-115")
pkgconfig.add_links("mozjs-128")
end
else
filter { "Debug" }
links { "mozjs115-debug" }
links { "mozjs128-debug" }
filter { "Release" }
links { "mozjs115-release" }
links { "mozjs128-release" }
filter { }
links { "mozjs115-rust" }
links { "mozjs128-rust" }
add_source_lib_paths("spidermonkey")
end
end,

View file

@ -51,7 +51,7 @@ newoption { category = "Pyrogenesis", trigger = "sanitize-undefined-behaviour",
newoption { category = "Pyrogenesis", trigger = "strip-binaries", description = "Strip created binaries" }
newoption { category = "Pyrogenesis", trigger = "with-system-cxxtest", description = "Search standard paths for cxxtest, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-lto", description = "Enable Link Time Optimization (LTO)" }
newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs115, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs128, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" }
newoption { category = "Pyrogenesis", trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" }
@ -166,7 +166,7 @@ end
-- The pc file doesn't specify the required -DDEBUG needed in that case
local mozjs_is_debug_build = false
if _OPTIONS["with-system-mozjs"] then
local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-115 --cflags) ./tests/mozdebug.c -o /dev/null")
local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-128 --cflags) ./tests/mozdebug.c -o /dev/null")
if errorCode ~= 0 then
mozjs_is_debug_build = true
end

View file

@ -4,7 +4,7 @@ cd /D "%~dp0"
rem **SVN revision to checkout for windows-libs or windows-libs-amd64**
rem **Update this line when you commit an update to windows-libs or windows-libs-amd64**
set "svnrev=28268"
set "svnrev=28273"
if "%1" == "--amd64" (
set "LIBS_PATH=win64"

View file

@ -6,11 +6,11 @@ set -e
cd "$(dirname "$0")"
# This should match the version in config/milestone.txt
PV=115.16.1
PV=128.13.0
FOLDER="mozjs-${PV}"
# If same-version changes are needed, increment this.
LIB_VERSION="${PV}+wfg6"
LIB_NAME="mozjs115"
LIB_VERSION="${PV}+wfg0"
LIB_NAME="mozjs128"
build_archive()
{
@ -75,14 +75,6 @@ rm -Rf "${FOLDER}"
(
cd "${FOLDER}"
# Fix build on recent macOS versions.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1844694
# The --enable-bootstrap fix mentioned on the ticket does not fix the issue. Instead,
# use Homebrew's workaround.
if [ "${OS}" = "Darwin" ]; then
sed -i '' 's/\["-Wl,--version"]/["-Wl,-ld_classic,--version"]/g' build/moz.configure/toolchain.configure
fi
# shellcheck disable=SC1091
. ../patches/patch.sh
)
@ -220,7 +212,7 @@ DEB="debug"
REL="release"
# Fetch the jsrust static library. Path is grepped from the build file as it varies by rust toolset.
rust_path=$(grep jsrust <"${FOLDER}/build-release/js/src/build/backend.mk" | cut -d = -f 2 | cut -c2-)
rust_path="${FOLDER}/build-release/$(grep jsrust "${FOLDER}/build-release/js/src/build/backend.mk" | cut -d / -f 2-)"
cp -L "${rust_path}" "lib/${LIB_PREFIX}${LIB_NAME}-rust${STATIC_LIB_SUFFIX}"
if [ "${OS}" = "Darwin" ]; then
@ -229,21 +221,21 @@ if [ "${OS}" = "Darwin" ]; then
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}js_static${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}"
elif [ "${OS}" = "Windows_NT" ]; then
# Windows needs DLLs to binaries/, static stubs to lib/ and debug symbols
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "bin/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "bin/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${DEB}/dist/bin/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "bin/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${REL}/dist/bin/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "bin/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${STATIC_LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${DEB}${STATIC_LIB_SUFFIX}"
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${STATIC_LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${STATIC_LIB_SUFFIX}"
# Copy debug symbols as well.
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}.pdb" "bin/${LIB_PREFIX}${LIB_NAME}-${DEB}.pdb"
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}.pdb" "bin/${LIB_PREFIX}${LIB_NAME}-${REL}.pdb"
# Copy the debug jsrust library.
rust_path=$(grep jsrust <"${FOLDER}/build-debug/js/src/build/backend.mk" | cut -d = -f 2 | cut -c2-)
rust_path="${FOLDER}/build-debug/$(grep jsrust "${FOLDER}/build-debug/js/src/build/backend.mk" | cut -d / -f 2-)"
cp -L "${rust_path}" "lib/${LIB_PREFIX}${LIB_NAME}-rust-debug${STATIC_LIB_SUFFIX}"
else
# Copy shared libs to lib/, they will also be copied to binaries/system, so the compiler and executable (resp.) can find them.
cp -L "${FOLDER}/build-${REL}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${REL}/dist/bin/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${REL}${LIB_SUFFIX}"
if [ "${OS}" != "FreeBSD" ]; then
cp -L "${FOLDER}/build-${DEB}/js/src/build/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}"
cp -L "${FOLDER}/build-${DEB}/dist/bin/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}" "lib/${LIB_PREFIX}${LIB_NAME}-${DEB}${LIB_SUFFIX}"
fi
fi

View file

@ -1,45 +0,0 @@
# HG changeset patch
# User Mike Hommey <mh+mozilla@glandium.org>
# Date 1714550740 0
# Node ID 223087fdc29f18678f6174e9807b8780e439acf6
# Parent dbf00dfdc037f79df923fbb6681de64bc74c5a8e
Bug 1894423 - Remove unused ExclusiveData move constructor. r=spidermonkey-reviewers,jonco
Because the constructor is actually not used, the compiler used to not
complain about it being broken. Recent changes on clang trunk made it
catch this problem without the constructor being used.
As Mutex doesn't have a move constructor, it's also not only a matter of
adding the missing underscore to lock.
As the constructor is never used, just remove it.
Differential Revision: https://phabricator.services.mozilla.com/D209108
diff --git a/js/src/threading/ExclusiveData.h b/js/src/threading/ExclusiveData.h
--- a/js/src/threading/ExclusiveData.h
+++ b/js/src/threading/ExclusiveData.h
@@ -104,21 +104,16 @@ class ExclusiveData {
/**
* Create a new `ExclusiveData`, constructing the protected value in place.
*/
template <typename... Args>
explicit ExclusiveData(const MutexId& id, Args&&... args)
: lock_(id), value_(std::forward<Args>(args)...) {}
- ExclusiveData(ExclusiveData&& rhs)
- : lock_(std::move(rhs.lock)), value_(std::move(rhs.value_)) {
- MOZ_ASSERT(&rhs != this, "self-move disallowed!");
- }
-
ExclusiveData& operator=(ExclusiveData&& rhs) {
this->~ExclusiveData();
new (mozilla::KnownNotNull, this) ExclusiveData(std::move(rhs));
return *this;
}
/**
* An RAII class that provides exclusive access to a `ExclusiveData<T>`'s

View file

@ -1,7 +1,7 @@
--- a/js/src/old-configure
+++ b/js/src/old-configure
@@ -5081,10 +5081,10 @@
@@ -2595,10 +2595,10 @@
fi
-if test -n "$JS_STANDALONE"; then
@ -13,4 +13,4 @@
+JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-release"
fi
JS_CONFIG_LIBS="$NSPR_LIBS $LIBS"
if test -n "$GNU_CC"; then
if test "$CC_TYPE" != clang-cl ; then

View file

@ -0,0 +1,35 @@
diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure
index 418331b87..65a20b17b 100644
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -12,7 +12,7 @@ def pkg_config(prefixes):
@depends(compile_environment, target)
def use_pkg_config(compile_environment, target):
- return compile_environment and target.os not in ("WINNT", "OSX", "Android")
+ return compile_environment and target.os not in ("WINNT", "Android")
pkg_config = check_prog(
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index 264027e57..e1b3cfabd 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -100,7 +100,7 @@ with only_when(host_is_osx | target_is_osx):
)
def mac_sdk_min_version():
- return "14.4"
+ return "13.3"
@depends(
"--with-macos-sdk",
@@ -1875,7 +1875,7 @@ def select_linker_tmpl(host_or_target):
die("Unsupported linker " + linker)
# Check the kind of linker
- version_check = ["-Wl,--version"]
+ version_check = ["-Wl,-ld_classic,--version"]
cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
def try_linker(linker):

View file

@ -1,17 +0,0 @@
diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -14,11 +14,11 @@
"PKG_CONFIG",
pkg_config,
bootstrap=depends(when=target_sysroot.bootstrapped)(lambda: "pkgconf"),
allow_missing=True,
when=compile_environment
- & depends(target.os)(lambda os: os not in ("WINNT", "OSX", "Android")),
+ & depends(target.os)(lambda os: os not in ("WINNT", "Android")),
)
@depends_if(pkg_config)
@checking("for pkg-config version")

View file

@ -1,159 +0,0 @@
# HG changeset patch
# User Markus Stange <mstange.moz@gmail.com>
# Date 1706240334 0
# Node ID a412d893c38f632f34b44a9c5b3fd8cc30bb87be
# Parent 2a507cc2cf84980ce9f160d1ef80107ee7474ae4
Bug 1876415 - Make timestamp formats consistent between Jitdump and the marker file. r=glandium
On Linux and Android, both jitdump and the marker file will keep using
`CLOCK_MONOTONIC` nanoseconds, as before.
On macOS, both jitdump and the marker file will now be using
`TimeStamp::RawMachAbsoluteTimeNanoseconds()` , i.e. "nanoseconds since
mach_absolute_time origin".
This value has the advantage that it is also relatively easy to obtain
in other browser engines, because their internal timestamp value is stored
in milliseconds or nanoseconds rather than in `mach_absolute_time` ticks.
In the past, on macOS, Firefox was using `CLOCK_MONOTONIC` nanoseconds for
jitdump and `TimeStamp::RawMachAbsoluteTimeValue()` for the marker file.
This inconsistency is now fixed.
I will update samply to change how it treats jitdump timestamps on macOS.
There are no other consumers of jitdump files on macOS that I know of.
On Windows, we will keep using raw QPC values for the marker file - this
matches what's in the ETW events. Jitdump on Windows is mostly unused but
I'm updating it to match.
Furthermore, this fixes the order in mozglue/misc/moz.build to make sure
we always use the TimeStamp_darwin implementation on Darwin (and not just
due to a broken configure check, see bug 1681445), and it fixes the #ifdef
in TimeStamp.h to match the Darwin check.
Differential Revision: https://phabricator.services.mozilla.com/D199592
diff --git a/js/src/jit/PerfSpewer.cpp b/js/src/jit/PerfSpewer.cpp
--- a/js/src/jit/PerfSpewer.cpp
+++ b/js/src/jit/PerfSpewer.cpp
@@ -118,19 +118,26 @@ static bool IsPerfProfiling() { return J
#endif
AutoLockPerfSpewer::AutoLockPerfSpewer() { PerfMutex.lock(); }
AutoLockPerfSpewer::~AutoLockPerfSpewer() { PerfMutex.unlock(); }
#ifdef JS_ION_PERF
static uint64_t GetMonotonicTimestamp() {
- struct timespec ts = {};
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts.tv_sec * 1000000000 + ts.tv_nsec;
+ using mozilla::TimeStamp;
+# ifdef XP_LINUX
+ return TimeStamp::Now().RawClockMonotonicNanosecondsSinceBoot();
+# elif XP_WIN
+ return TimeStamp::Now().RawQueryPerformanceCounterValue().value();
+# elif XP_MACOSX
+ return TimeStamp::Now().RawMachAbsoluteTimeNanoseconds();
+# else
+ MOZ_CRASH("no timestamp");
+# endif
}
// values are from /usr/include/elf.h
static uint32_t GetMachineEncoding() {
# if defined(JS_CODEGEN_X86)
return 3; // EM_386
# elif defined(JS_CODEGEN_X64)
return 62; // EM_X86_64
diff --git a/mozglue/misc/TimeStamp.h b/mozglue/misc/TimeStamp.h
--- a/mozglue/misc/TimeStamp.h
+++ b/mozglue/misc/TimeStamp.h
@@ -469,18 +469,19 @@ class TimeStamp {
static MFBT_API void RecordProcessRestart();
#ifdef XP_LINUX
uint64_t RawClockMonotonicNanosecondsSinceBoot() {
return static_cast<uint64_t>(mValue);
}
#endif
-#ifdef XP_MACOSX
- uint64_t RawMachAbsoluteTimeValue() { return static_cast<uint64_t>(mValue); }
+#ifdef XP_DARWIN
+ // Returns the number of nanoseconds since the mach_absolute_time origin.
+ MFBT_API uint64_t RawMachAbsoluteTimeNanoseconds() const;
#endif
#ifdef XP_WIN
Maybe<uint64_t> RawQueryPerformanceCounterValue() {
// mQPC is stored in `mt` i.e. QueryPerformanceCounter * 1000
// so divide out the 1000
return mValue.mHasQPC ? Some(mValue.mQPC / 1000ULL) : Nothing();
}
diff --git a/mozglue/misc/TimeStamp_darwin.cpp b/mozglue/misc/TimeStamp_darwin.cpp
--- a/mozglue/misc/TimeStamp_darwin.cpp
+++ b/mozglue/misc/TimeStamp_darwin.cpp
@@ -131,26 +131,28 @@ void TimeStamp::Startup() {
// find the number of significant digits in sResolution, for the
// sake of ToSecondsSigDigits()
for (sResolutionSigDigs = 1; !(sResolutionSigDigs == sResolution ||
10 * sResolutionSigDigs > sResolution);
sResolutionSigDigs *= 10)
;
gInitialized = true;
-
- return;
}
void TimeStamp::Shutdown() {}
TimeStamp TimeStamp::Now(bool aHighResolution) {
return TimeStamp(ClockTime());
}
+uint64_t TimeStamp::RawMachAbsoluteTimeNanoseconds() const {
+ return static_cast<uint64_t>(double(mValue) * sNsPerTick);
+}
+
// Computes and returns the process uptime in microseconds.
// Returns 0 if an error was encountered.
uint64_t TimeStamp::ComputeProcessUptime() {
struct timeval tv;
int rv = gettimeofday(&tv, nullptr);
if (rv == -1) {
return 0;
diff --git a/mozglue/misc/moz.build b/mozglue/misc/moz.build
--- a/mozglue/misc/moz.build
+++ b/mozglue/misc/moz.build
@@ -105,24 +105,24 @@ if CONFIG["OS_ARCH"] == "WINNT":
if not CONFIG["JS_STANDALONE"]:
SOURCES += [
"/ipc/mscom/COMWrappers.cpp",
"/ipc/mscom/ProcessRuntime.cpp",
"PreXULSkeletonUI.cpp",
]
+elif CONFIG["OS_ARCH"] == "Darwin":
+ SOURCES += [
+ "TimeStamp_darwin.cpp",
+ ]
elif CONFIG["HAVE_CLOCK_MONOTONIC"]:
SOURCES += [
"TimeStamp_posix.cpp",
]
-elif CONFIG["OS_ARCH"] == "Darwin":
- SOURCES += [
- "TimeStamp_darwin.cpp",
- ]
elif CONFIG["COMPILE_ENVIRONMENT"]:
error("No TimeStamp implementation on this platform. Build will not succeed")
if CONFIG["OS_ARCH"] == "WINNT":
SOURCES += [
"ConditionVariable_windows.cpp",
"Mutex_windows.cpp",
"RWLock_windows.cpp",

View file

@ -1,148 +0,0 @@
# HG changeset patch
# User Filipe Laíns <lains@riseup.net>
# Date 1733719242 0
# Node ID b0dbc944fb7b5f7df9ae370a247405d5c7c181ee
# Parent 550046479ed6e9c01ea14ae7156002f5ec815ae5
Bug 1935621 - Fix virtual environment sysconfig path calculation r=firefox-build-system-reviewers,ahochheiden
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Differential Revision: https://phabricator.services.mozilla.com/D231480
diff --git a/python/mach/mach/site.py b/python/mach/mach/site.py
--- a/python/mach/mach/site.py
+++ b/python/mach/mach/site.py
@@ -12,16 +12,17 @@ import json
import os
import platform
import shutil
import site
import subprocess
import sys
import sysconfig
import tempfile
+import warnings
from contextlib import contextmanager
from pathlib import Path
from typing import Callable, Optional
from mach.requirements import (
MachEnvRequirements,
UnexpectedFlexibleRequirementException,
)
@@ -814,43 +815,85 @@ class CommandSiteManager:
self._metadata,
)
class PythonVirtualenv:
"""Calculates paths of interest for general python virtual environments"""
def __init__(self, prefix):
- if _is_windows:
- self.bin_path = os.path.join(prefix, "Scripts")
- self.python_path = os.path.join(self.bin_path, "python.exe")
+ self.prefix = os.path.realpath(prefix)
+ self.paths = self._get_sysconfig_paths(self.prefix)
+
+ # Name of the Python executable to use in virtual environments.
+ # An executable with the same name as sys.executable might not exist in
+ # virtual environments. An executable with 'python' as the steam —
+ # without version numbers or ABI flags — will always be present in
+ # virtual environments, so we use that.
+ python_exe_name = "python" + sysconfig.get_config_var("EXE")
+
+ self.bin_path = self.paths["scripts"]
+ self.python_path = os.path.join(self.bin_path, python_exe_name)
+
+ @staticmethod
+ def _get_sysconfig_paths(prefix):
+ """Calculate the sysconfig paths of a virtual environment in the given prefix.
+
+ The virtual environment MUST be using the same Python distribution as us.
+ """
+ # Determine the sysconfig scheme used in virtual environments
+ if "venv" in sysconfig.get_scheme_names():
+ # A 'venv' scheme was added in Python 3.11 to allow users to
+ # calculate the paths for a virtual environment, since the default
+ # scheme may not always be the same as used on virtual environments.
+ # Some common examples are the system Python distributed by macOS,
+ # Debian, and Fedora.
+ # For more information, see https://github.com/python/cpython/issues/89576
+ venv_scheme = "venv"
+ elif os.name == "nt":
+ # We know that before the 'venv' scheme was added, on Windows,
+ # the 'nt' scheme was used in virtual environments.
+ venv_scheme = "nt"
+ elif os.name == "posix":
+ # We know that before the 'venv' scheme was added, on POSIX,
+ # the 'posix_prefix' scheme was used in virtual environments.
+ venv_scheme = "posix_prefix"
else:
- self.bin_path = os.path.join(prefix, "bin")
- self.python_path = os.path.join(self.bin_path, "python")
- self.prefix = os.path.realpath(prefix)
+ # This should never happen with upstream Python, as the 'venv'
+ # scheme should always be available on >=3.11, and no other
+ # platforms are supported by the upstream on older Python versions.
+ #
+ # Since the 'venv' scheme isn't available, and we have no knowledge
+ # of this platform/distribution, fallback to the default scheme.
+ #
+ # Hitting this will likely be the result of running a custom Python
+ # distribution targetting a platform that is not supported by the
+ # upstream.
+ # In this case, unless the Python vendor patched the Python
+ # distribution in such a way as the default scheme may not always be
+ # the same scheme, using the default scheme should be correct.
+ # If the vendor did patch Python as such, to work around this issue,
+ # I would recommend them to define a 'venv' scheme that matches
+ # the layout used on virtual environments in their Python distribution.
+ # (rec. signed Filipe Laíns — upstream sysconfig maintainer)
+ venv_scheme = sysconfig.get_default_scheme()
+ warnings.warn(
+ f"Unknown platform '{os.name}', using the default install scheme '{venv_scheme}'. "
+ "If this is incorrect, please ask your Python vendor to add a 'venv' sysconfig scheme "
+ "(see https://github.com/python/cpython/issues/89576, or check the code comment).",
+ stacklevel=2,
+ )
+ # Build the sysconfig config_vars dictionary for the virtual environment.
+ venv_vars = sysconfig.get_config_vars().copy()
+ venv_vars["base"] = venv_vars["platbase"] = prefix
+ # Get sysconfig paths for the virtual environment.
+ return sysconfig.get_paths(venv_scheme, vars=venv_vars)
- @functools.lru_cache(maxsize=None)
def resolve_sysconfig_packages_path(self, sysconfig_path):
- # macOS uses a different default sysconfig scheme based on whether it's using the
- # system Python or running in a virtualenv.
- # Manually define the scheme (following the implementation in
- # "sysconfig._get_default_scheme()") so that we're always following the
- # code path for a virtualenv directory structure.
- if os.name == "posix":
- scheme = "posix_prefix"
- else:
- scheme = os.name
-
- sysconfig_paths = sysconfig.get_paths(scheme)
- data_path = Path(sysconfig_paths["data"])
- path = Path(sysconfig_paths[sysconfig_path])
- relative_path = path.relative_to(data_path)
-
- # Path to virtualenv's "site-packages" directory for provided sysconfig path
- return os.path.normpath(os.path.normcase(Path(self.prefix) / relative_path))
+ return self.paths[sysconfig_path]
def site_packages_dirs(self):
dirs = []
if sys.platform.startswith("win"):
dirs.append(os.path.normpath(os.path.normcase(self.prefix)))
purelib = self.resolve_sysconfig_packages_path("purelib")
platlib = self.resolve_sysconfig_packages_path("platlib")

View file

@ -1,8 +1,8 @@
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -50,9 +50,12 @@
if CONFIG["ENABLE_WASM_CRANELIFT"]:
CONFIGURE_SUBST_FILES += ["rust/extra-bindgen-flags"]
@@ -47,9 +47,12 @@
with Files("builtin/intl/*"):
BUG_COMPONENT = component_intl
+DIRS += [
+ "rust"

View file

@ -0,0 +1,46 @@
# HG changeset patch
# User Steve Fink <sfink@mozilla.com>
# Date 1746227785 0
# Node ID 5c04f022856284273c3f1a0367a599431798bab3
# Parent 0a9b2997cbcf9652ce9440ba74cbbb3bf513a937
Bug 1953622 - Suppress -Wdangling-pointer warning when storing a Rooted address r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D241310
diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -1140,21 +1140,30 @@ using RootedTraits =
* function that requires a handle, e.g. Foo(Root<T>(cx, x)).
*
* If you want to add additional methods to Rooted for a specific
* specialization, define a RootedOperations<T> specialization containing them.
*/
template <typename T>
class MOZ_RAII Rooted : public detail::RootedTraits<T>::StackBase,
public js::RootedOperations<T, Rooted<T>> {
+
+ // Intentionally store a pointer into the stack.
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
inline void registerWithRootLists(RootedListHeads& roots) {
this->stack = &roots[JS::MapTypeToRootKind<T>::kind];
this->prev = *this->stack;
*this->stack = this;
}
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12)
+#pragma GCC diagnostic pop
+#endif
inline RootedListHeads& rootLists(RootingContext* cx) {
return cx->stackRoots_;
}
inline RootedListHeads& rootLists(JSContext* cx) {
return rootLists(RootingContext::get(cx));
}

View file

@ -1,31 +0,0 @@
From 0bfc032c102b8a251e4dc751d0b48992ebf72641 Mon Sep 17 00:00:00 2001
From: phosit <phosit@autistici.org>
Date: Sun, 5 Jan 2025 14:29:33 +0100
Subject: [PATCH] Supress -Wdangling-pointer warning on GCC
---
js/public/RootingAPI.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
index 42be14e67351..6b167cb8ea2e 100644
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -1166,7 +1166,14 @@ class MOZ_RAII Rooted : public detail::RootedTraits<T>::StackBase,
inline void registerWithRootLists(RootedListHeads& roots) {
this->stack = &roots[JS::MapTypeToRootKind<T>::kind];
this->prev = *this->stack;
+#if defined(__GNUC__) && __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
*this->stack = this;
+#if defined(__GNUC__) && __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
}
inline RootedListHeads& rootLists(RootingContext* cx) {
--
2.47.1

View file

@ -15,15 +15,9 @@ patch -p1 <"${PATCHES}"/FixRustLinkage.diff
patch -p1 <"${PATCHES}"/FixLibNames.diff
# Add needed debug define in pkg-config file.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1935346
patch -p1 <"${PATCHES}"/FixPkgConfigDebug.diff
# On macOS, embedded build is broken due to a faulty check for pkg-config
# https://bugzilla.mozilla.org/show_bug.cgi?id=1776255
# The fix above is included in ESR 128, but does not apply to 115
# Instead, require pkg-config on macOS even though it's not needed here
# (from https://bugzilla.mozilla.org/show_bug.cgi?id=1783570)
patch -p1 <"${PATCHES}"/FixMacOSPkgConfig.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.
@ -33,19 +27,15 @@ if [ "$(uname -m)" = "i686" ] && [ "${OS}" != "Windows_NT" ]; then
patch -p1 <"${PATCHES}"/FixFpNormIssue.diff
fi
# Fix build with clang19
# https://bugzilla.mozilla.org/show_bug.cgi?id=1894423
# Fixed in ESR 128
patch -p1 <"${PATCHES}"/FixClang19.diff
# Fix build with Python >=3.12.8 and Python >=3.13.1
# https://bugzilla.mozilla.org/show_bug.cgi?id=1935621
patch -p1 <"${PATCHES}"/FixPython3.12.8.diff
# Fix build for profiling with samply.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1876415
# Fixed in ESR 128
patch -p1 <"${PATCHES}"/FixProfiling.diff
# Fix build on macOS
# Workarounds adapted from Homebrew's formula at https://github.com/Homebrew/homebrew-core/blob/main/Formula/s/spidermonkey.rb
# - Allow use of pkg-config to use the same zlib for SM and pyrogenesis (https://bugzilla.mozilla.org/show_bug.cgi?id=1783570)
# - Force allowing build with older macOS SDK
# - Fix invocation of recent compiler (https://bugzilla.mozilla.org/show_bug.cgi?id=1844694)
if [ "${OS}" = "Darwin" ]; then
patch -p1 <"${PATCHES}"/FixMacOSBuild.diff
fi
# Supress warning on newer GCC compilers.
patch -p1 <"${PATCHES}"/SupressDanglingPointerWarning.patch
# https://bugzilla.mozilla.org/show_bug.cgi?id=1953622
patch -p1 <"${PATCHES}"/SuppressDanglingPointerWarning.patch

View file

@ -46,6 +46,7 @@ private:
JS::HandleObject) final;
bool empty() const final;
bool isDrainingStopped() const final { return false; }
js::UniquePtr<JS::JobQueue::SavedJobQueue> saveJobQueue(JSContext*) final;

View file

@ -83,7 +83,7 @@ bool ScriptException::CatchPending(const ScriptRequest& rq)
msg << "JavaScript error: ";
if (report->filename)
{
msg << report->filename;
msg << report->filename.c_str();
msg << " line " << report->lineno << "\n";
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -35,7 +35,7 @@
#include "jspubtd.h"
#include "jsapi.h"
#if MOZJS_MAJOR_VERSION != 115
#if MOZJS_MAJOR_VERSION != 128
#error Your compiler is trying to use an incorrect major version of the \
SpiderMonkey library. The SpiderMonkey API is subject to changes, and the \
game will not build with the selected version of the library. Make sure \

View file

@ -373,7 +373,7 @@ void CBinarySerializerScriptImpl::HandleScriptVal(const ScriptRequest& rq, JS::H
JS::RootedFunction func(rq.cx, JS_ValueToFunction(rq.cx, val));
if (func)
{
JS::RootedString string(rq.cx, JS_GetFunctionId(func));
JS::RootedString string(rq.cx, JS_GetMaybePartialFunctionId(func));
if (string)
{
if (JS::StringHasLatin1Chars(string))

View file

@ -411,10 +411,12 @@ JS::Value CStdDeserializer::ReadScriptVal(const char* /*name*/, JS::HandleObject
#if BYTE_ORDER != LITTLE_ENDIAN
#error TODO: need to convert JS ArrayBuffer data from little-endian
#endif
void* contents = malloc(length);
ENSURE(contents);
RawBytes("buffer data", (u8*)contents, length);
JS::RootedObject bufferObj(rq.cx, JS::NewArrayBufferWithContents(rq.cx, length, contents));
void* bufferData = js_malloc(length);
ENSURE(bufferData);
RawBytes("buffer data", (u8*)bufferData, length);
mozilla::UniquePtr<void, JS::FreePolicy> contents{ bufferData };
JS::RootedObject bufferObj(rq.cx, JS::NewArrayBufferWithContents(rq.cx, length, std::move(contents)));
AddScriptBackref(bufferObj);
return JS::ObjectValue(*bufferObj);