diff --git a/cjs/855.patch b/cjs/855.patch new file mode 100644 index 0000000..106faf6 --- /dev/null +++ b/cjs/855.patch @@ -0,0 +1,163 @@ +From 93954f3941fef53842b486c21bb51b2d258cadc9 Mon Sep 17 00:00:00 2001 +From: Xi Ruoyao +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 +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 +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 + #include + #include +-#include + #include + #include + #include +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 // for distance + #include // for unique_ptr + #include // for u16string ++#include // for tuple + + #include + #include +@@ -39,7 +40,6 @@ + #include // for JSProto_InternalError + #include + #include +-#include + #include + + #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> results; ++ mozilla::Maybe> 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 + diff --git a/cjs/cjs.SlackBuild b/cjs/cjs.SlackBuild index e4030fe..56f4a50 100644 --- a/cjs/cjs.SlackBuild +++ b/cjs/cjs.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for cjs -# Copyright 2014-2023 Willy Sudiarto Raharjo +# Copyright 2014-2024 Willy Sudiarto Raharjo # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,7 +24,7 @@ PRGNAM=cjs VERSION=${VERSION:-6.0.0} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_csb} if [ -z "$ARCH" ]; then @@ -74,6 +74,9 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# Patch to mozjs-115 +patch -p1 < $CWD/855.patch + mkdir -p build cd build CFLAGS="$SLKCFLAGS" \