-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build SpiderMonkey from mozilla-central
#367
Changes from 42 commits
77a8c0f
cb468af
5e1d162
e4c37db
12ed88b
647d083
b685d83
4fdc927
2d73bd5
3a07532
275b0bf
8f70da7
21e4719
72565d7
a4ef58c
ff396af
04d028b
492fa80
f3df728
79b6437
09bacb5
53af133
0415557
42e3f53
ec75f13
39ee6af
eb153ee
67d017b
d2d9396
180303f
ec74f8b
891d2a8
46c148a
82bf020
ddfc424
6168acb
4556799
3f78041
48bda0a
da4f0da
a7b92e8
75c45be
69ed8c0
76cccdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: 'Create pull requests to update mozilla-central version to the latest' | ||
|
||
on: | ||
schedule: | ||
- cron: "00 14 * * 1" # run every Monday at 14:00 UTC (10:00 Eastern Daylight Time) | ||
workflow_call: | ||
workflow_dispatch: # or you can run it manually | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check Version | ||
# Check the latest changes on mozilla-central via the Mercurial pushlog HTTP API | ||
# See https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmo/pushlog.html#hgweb-commands | ||
run: | | ||
COMMIT_HASH=$( | ||
curl -s "https://hg.mozilla.org/mozilla-central/json-pushes?tipsonly=1&version=2" |\ | ||
jq --join-output '(.lastpushid | tostring) as $pushid | empty, .pushes[$pushid].changesets[0]' | ||
) | ||
echo "MOZCENTRAL_VERSION=$COMMIT_HASH" >> $GITHUB_ENV | ||
- name: Update `mozcentral.version` File | ||
run: echo $MOZCENTRAL_VERSION > mozcentral.version | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
add-paths: mozcentral.version | ||
commit-message: | | ||
chore(deps): upgrade SpiderMonkey to `${{ env.MOZCENTRAL_VERSION }}` | ||
branch: chore/upgrade-spidermonkey-to-${{ env.MOZCENTRAL_VERSION }} | ||
title: Upgrade SpiderMonkey to mozilla-central commit `${{ env.MOZCENTRAL_VERSION }}` | ||
body: | | ||
Changeset: https://hg.mozilla.org/mozilla-central/rev/${{ env.MOZCENTRAL_VERSION }} | ||
labels: dependencies |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d25c9bdacb64ae50779dc91f5919ca0189ad6c36 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux | |
SUDO='sudo' | ||
fi | ||
$SUDO apt-get update --yes | ||
$SUDO apt-get install --yes cmake graphviz llvm clang pkg-config m4 \ | ||
$SUDO apt-get install --yes cmake graphviz llvm clang pkg-config m4 unzip \ | ||
wget curl python3-distutils python3-dev | ||
# Install Doxygen | ||
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series | ||
|
@@ -28,15 +28,16 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux | |
rm -rf doxygen-1.9.7 doxygen-1.9.7.linux.bin.tar.gz | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS | ||
brew update || true # allow failure | ||
brew install cmake doxygen pkg-config wget coreutils # `coreutils` installs the `realpath` command | ||
brew install cmake doxygen pkg-config wget unzip coreutils # `coreutils` installs the `realpath` command | ||
elif [[ "$OSTYPE" == "msys"* ]]; then # Windows | ||
echo "Dependencies are not going to be installed automatically on Windows." | ||
else | ||
echo "Unsupported OS" | ||
exit 1 | ||
fi | ||
# Install rust compiler | ||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.69 # force to use Rust 1.69 because 1.70 has linking issues on Windows | ||
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.76 | ||
cargo install cbindgen | ||
# Setup Poetry | ||
curl -sSL https://install.python-poetry.org | python3 - --version "1.7.1" | ||
if [[ "$OSTYPE" == "msys"* ]]; then # Windows | ||
|
@@ -51,15 +52,15 @@ echo "Done installing dependencies" | |
echo "Downloading uncrustify source code" | ||
wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz | ||
mkdir -p uncrustify-source | ||
tar -xzvf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder | ||
tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder | ||
echo "Done downloading uncrustify source code" | ||
|
||
echo "Building uncrustify" | ||
cd uncrustify-source | ||
mkdir -p build | ||
cd build | ||
if [[ "$OSTYPE" == "msys"* ]]; then # Windows | ||
cmake ../ -T ClangCL | ||
cmake ../ | ||
cmake --build . -j$CPUS --config Release | ||
cp Release/uncrustify.exe ../../uncrustify.exe | ||
else | ||
|
@@ -71,9 +72,10 @@ cd ../.. | |
echo "Done building uncrustify" | ||
|
||
echo "Downloading spidermonkey source code" | ||
wget -c -q https://ftp.mozilla.org/pub/firefox/releases/115.8.0esr/source/firefox-115.8.0esr.source.tar.xz | ||
mkdir -p firefox-source | ||
tar xf firefox-115.8.0esr.source.tar.xz -C firefox-source --strip-components=1 # strip the root folder | ||
# Read the commit hash for mozilla-central from the `mozcentral.version` file | ||
MOZCENTRAL_VERSION=$(cat mozcentral.version) | ||
wget -c -q -O firefox-source-${MOZCENTRAL_VERSION}.zip https://hg.mozilla.org/mozilla-central/archive/${MOZCENTRAL_VERSION}.zip | ||
unzip -q firefox-source-${MOZCENTRAL_VERSION}.zip && mv mozilla-central-${MOZCENTRAL_VERSION} firefox-source | ||
echo "Done downloading spidermonkey source code" | ||
|
||
echo "Building spidermonkey" | ||
|
@@ -85,14 +87,20 @@ sed -i'' -e '/"winheap.cpp"/d' ./memory/mozalloc/moz.build # https://bugzilla.mo | |
sed -i'' -e 's/"install-name-tool"/"install_name_tool"/' ./moz.configure # `install-name-tool` does not exist, but we have `install_name_tool` | ||
sed -i'' -e 's/bool Unbox/JS_PUBLIC_API bool Unbox/g' ./js/public/Class.h # need to manually add JS_PUBLIC_API to js::Unbox until it gets fixed in Spidermonkey | ||
sed -i'' -e 's/bool js::Unbox/JS_PUBLIC_API bool js::Unbox/g' ./js/src/vm/JSObject.cpp # same here | ||
sed -i'' -e 's/shared_lib = self._pretty_path(libdef.output_path, backend_file)/shared_lib = libdef.lib_name/' ./python/mozbuild/mozbuild/backend/recursivemake.py | ||
sed -i'' -e 's/if version < Version(mac_sdk_min_version())/if False/' ./build/moz.configure/toolchain.configure # do not verify the macOS SDK version as the reqiuired version is not available on Github Actions runner | ||
philippedistributive marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sed -i'' -e 's/return JS::GetWeakRefsEnabled() == JS::WeakRefSpecifier::Disabled/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable FinalizationRegistry | ||
Xmader marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sed -i'' -e 's/return !IsIteratorHelpersEnabled()/return false/' ./js/src/vm/GlobalObject.cpp # forcibly enable iterator helpers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @caleb-distributive is this truly needed? Doesn't the switch in PyInit_pythonmonkey cover this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the commit message in 42e3f53 |
||
sed -i'' -e '/MOZ_CRASH_UNSAFE_PRINTF/,/__PRETTY_FUNCTION__);/d' ./mfbt/LinkedList.h # would crash in Debug Build: in `~LinkedList()` it should have removed all this list's elements before the list's destruction | ||
sed -i'' -e '/MOZ_ASSERT(stackRootPtr == nullptr);/d' ./js/src/vm/JSContext.cpp # would assert false in Debug Build since we extensively use `new JS::Rooted` | ||
cd js/src | ||
mkdir -p _build | ||
cd _build | ||
mkdir -p ../../../../_spidermonkey_install/ | ||
../configure \ | ||
--prefix=$(realpath $PWD/../../../../_spidermonkey_install) \ | ||
--with-intl-api \ | ||
--without-system-zlib \ | ||
$(if [[ "$OSTYPE" != "msys"* ]]; then echo "--without-system-zlib"; fi) \ | ||
--disable-debug-symbols \ | ||
--disable-jemalloc \ | ||
--disable-tests \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,7 +276,7 @@ JSObject *ExceptionType::toJsError(JSContext *cx, PyObject *exceptionValue, PyOb | |
JS::RootedString filename(cx, JS_NewStringCopyZ(cx, PyUnicode_AsUTF8(fileName))); | ||
JS::RootedString message(cx, JS_NewStringCopyZ(cx, msgStream.str().c_str())); | ||
// stack argument cannot be passed in as a string anymore (deprecated), and could not find a proper example using the new argument type | ||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, lineno, 0, nullptr, message, JS::NothingHandleValue, &rval)) { | ||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, lineno, JS::ColumnNumberOneOrigin(1), nullptr, message, JS::NothingHandleValue, &rval)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why no longer 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
One Origin There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
See https://hg.mozilla.org/mozilla-central/file/d25c9bd/js/public/ErrorReport.h#l537 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return NULL; | ||
} | ||
|
||
|
@@ -306,7 +306,7 @@ JSObject *ExceptionType::toJsError(JSContext *cx, PyObject *exceptionValue, PyOb | |
JS::RootedString filename(cx, JS_NewStringCopyZ(cx, "")); // cannot be null or omitted, but is overriden by the errorReport | ||
JS::RootedString message(cx, JS_NewStringCopyZ(cx, msgStream.str().c_str())); | ||
// filename cannot be null | ||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, 0, 0, errorReport, message, JS::NothingHandleValue, &rval)) { | ||
if (!JS::CreateError(cx, JSExnType::JSEXN_ERR, nullptr, filename, 0, JS::ColumnNumberOneOrigin(1), errorReport, message, JS::NothingHandleValue, &rval)) { | ||
return NULL; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from https://hg.mozilla.org/mozilla-central/file/d25c9bd/js/public/Promise.h#l84.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't understand why you'll need to change this.
Is this grammatically incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, yes, "stops" refers to the present or future, whereas "stopped" refers to the past