cjs: Patch to mozjs-115.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackware-id.org>
This commit is contained in:
Willy Sudiarto Raharjo 2024-03-28 14:11:47 +07:00
parent 54a78cab63
commit bed771899f
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 168 additions and 2 deletions

163
cjs/855.patch Normal file
View file

@ -0,0 +1,163 @@
From 93954f3941fef53842b486c21bb51b2d258cadc9 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Fri, 30 Jun 2023 19:18:47 +0800
Subject: [PATCH 1/3] meson: Bump to mozjs-115
---
meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index fb440ae96..ea4337384 100644
--- a/meson.build
+++ b/meson.build
@@ -39,7 +39,7 @@ if cc.get_id() == 'msvc'
add_project_arguments(cxx.get_supported_arguments([
'-utf-8', # Use UTF-8 mode
'/Zc:externConstexpr', # Required for 'extern constexpr' on MSVC
- '/Zc:preprocessor', # Required to consume the mozjs-102 headers on MSVC
+ '/Zc:preprocessor', # Required to consume the mozjs-115 headers on MSVC
# Ignore spurious compiler warnings for things that GLib and SpiderMonkey
# header files commonly do
@@ -128,7 +128,7 @@ gio = dependency('gio-2.0', version: glib_required_version,
ffi = dependency('libffi', fallback: ['libffi', 'ffi_dep'])
gi = dependency('gobject-introspection-1.0', version: '>= 1.66.0',
fallback: ['gobject-introspection', 'girepo_dep'])
-spidermonkey = dependency('mozjs-102')
+spidermonkey = dependency('mozjs-115')
# We might need to look for the headers and lib's for Cairo
# manually on MSVC/clang-cl builds...
--
GitLab
From e3ec055a9a9c9bc19423a5d9413d0cdc569fbdc5 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Fri, 30 Jun 2023 19:21:38 +0800
Subject: [PATCH 2/3] mozjs115: Replace ModuleInstantiate with ModuleLink
Link: https://bugzilla.mozilla.org/show_bug.cgi?id=1778076
---
cjs/context.cpp | 4 ++--
cjs/module.cpp | 2 +-
test/gjs-tests.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 587a244bb..e9fad5c19 100644
--- a/cjs/context.cpp
+++ b/cjs/context.cpp
@@ -601,7 +601,7 @@ static void load_context_module(JSContext* cx, const char* uri,
g_error("Failed to load %s module.", debug_identifier);
}
- if (!JS::ModuleInstantiate(cx, loader)) {
+ if (!JS::ModuleLink(cx, loader)) {
gjs_log_exception(cx);
g_error("Failed to instantiate %s module.", debug_identifier);
}
@@ -1494,7 +1494,7 @@ bool GjsContextPrivate::eval_module(const char* identifier,
return false;
}
- if (!JS::ModuleInstantiate(m_cx, obj)) {
+ if (!JS::ModuleLink(m_cx, obj)) {
gjs_log_exception(m_cx);
g_set_error(error, GJS_ERROR, GJS_ERROR_FAILED,
"Failed to resolve imports for module: '%s'", identifier);
diff --git a/gjs/module.cpp b/gjs/module.cpp
index 74fa00835..0630d000d 100644
--- a/cjs/module.cpp
+++ b/cjs/module.cpp
@@ -635,7 +635,7 @@ static bool import_resolved(JSContext* cx, unsigned argc, JS::Value* vp) {
JS::RootedObject module(cx, &args[0].toObject());
JS::RootedValue evaluation_promise(cx);
- if (!JS::ModuleInstantiate(cx, module) ||
+ if (!JS::ModuleLink(cx, module) ||
!JS::ModuleEvaluate(cx, module, &evaluation_promise))
return fail_import(cx, args);
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 06d96225f..384472762 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -308,7 +308,7 @@ static void gjstest_test_func_gjs_context_eval_module_file_fail_instantiate() {
g_test_expect_message("Gjs", G_LOG_LEVEL_WARNING, "*foo*");
// evaluating this module without registering 'foo' first should make it
- // fail ModuleInstantiate
+ // fail ModuleLink
bool ok = gjs_context_eval_module_file(
gjs, "resource:///org/gnome/gjs/mock/test/modules/import.js",
&exit_status, &error);
--
GitLab
From 3c509db3f9212354b4d9e330f1f7775f0aa8151d Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Fri, 30 Jun 2023 19:25:14 +0800
Subject: [PATCH 3/3] mozjs115: Replace mozilla::Tuple with std::tuple
Link: https://bugzilla.mozilla.org/show_bug.cgi?id=1276351
---
gjs/gjs_pch.hh | 1 -
gjs/text-encoding.cpp | 6 +++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/gjs/gjs_pch.hh b/gjs/gjs_pch.hh
index 1f9818c0a..5a930a80d 100644
--- a/cjs/gjs_pch.hh
+++ b/cjs/gjs_pch.hh
@@ -119,7 +119,6 @@
#include <mozilla/Maybe.h>
#include <mozilla/ScopeExit.h>
#include <mozilla/Span.h>
-#include <mozilla/Tuple.h>
#include <mozilla/UniquePtr.h>
#include <mozilla/Unused.h>
#include <mozilla/Vector.h>
diff --git a/gjs/text-encoding.cpp b/gjs/text-encoding.cpp
index 17380e87f..cf28dfca1 100644
--- a/cjs/text-encoding.cpp
+++ b/cjs/text-encoding.cpp
@@ -15,6 +15,7 @@
#include <iterator> // for distance
#include <memory> // for unique_ptr
#include <string> // for u16string
+#include <tuple> // for tuple
#include <gio/gio.h>
#include <glib-object.h>
@@ -39,7 +40,6 @@
#include <jspubtd.h> // for JSProto_InternalError
#include <mozilla/Maybe.h>
#include <mozilla/Span.h>
-#include <mozilla/Tuple.h>
#include <mozilla/Unused.h>
#include "cjs/jsapi-util-args.h"
@@ -485,7 +485,7 @@ static bool gjs_encode_into_uint8array(JSContext* cx, JS::HandleString str,
return false;
}
- mozilla::Maybe<mozilla::Tuple<size_t, size_t>> results;
+ mozilla::Maybe<std::tuple<size_t, size_t>> results;
{
JS::AutoCheckCannotGC nogc(cx);
@@ -504,7 +504,7 @@ static bool gjs_encode_into_uint8array(JSContext* cx, JS::HandleString str,
}
size_t read, written;
- mozilla::Tie(read, written) = *results;
+ std::tie(read, written) = *results;
g_assert(written <= len);
--
GitLab

View file

@ -2,7 +2,7 @@
# Slackware build script for cjs # Slackware build script for cjs
# Copyright 2014-2023 Willy Sudiarto Raharjo <willysr@slackware-id.org> # Copyright 2014-2024 Willy Sudiarto Raharjo <willysr@slackware-id.org>
# All rights reserved. # All rights reserved.
# #
# Redistribution and use of this script, with or without modification, is # Redistribution and use of this script, with or without modification, is
@ -24,7 +24,7 @@
PRGNAM=cjs PRGNAM=cjs
VERSION=${VERSION:-6.0.0} VERSION=${VERSION:-6.0.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-2}
TAG=${TAG:-_csb} TAG=${TAG:-_csb}
if [ -z "$ARCH" ]; then if [ -z "$ARCH" ]; then
@ -74,6 +74,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Patch to mozjs-115
patch -p1 < $CWD/855.patch
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \