diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e4f784 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/firefox-102.1.0esr.source.tar.xz diff --git a/0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch b/0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch new file mode 100644 index 0000000..a20d39a --- /dev/null +++ b/0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch @@ -0,0 +1,109 @@ +From 0e790bd2eb846e90495eb81952cf35cc7fc8766a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Mon, 27 Jun 2022 19:55:16 +0100 +Subject: [PATCH] Python/Build: Use r instead of rU file read modes + +Fixes Python 3.11 build +--- + 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 f1d401a..aca59d0 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 7bc1986..b64a709 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 f7820b9..857f1a6 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 071daec..b59aabb 100644 +--- a/python/mozbuild/mozbuild/util.py ++++ b/python/mozbuild/mozbuild/util.py +@@ -236,7 +236,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 +diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py +index 8150e72..001c497 100644 +--- a/python/mozbuild/mozpack/files.py ++++ b/python/mozbuild/mozpack/files.py +@@ -554,7 +554,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) + +@@ -611,7 +611,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.36.1 + diff --git a/0001-Skip-failing-tests-on-ppc64-and-s390x.patch b/0001-Skip-failing-tests-on-ppc64-and-s390x.patch new file mode 100644 index 0000000..5c28664 --- /dev/null +++ b/0001-Skip-failing-tests-on-ppc64-and-s390x.patch @@ -0,0 +1,36 @@ +From db3a0a25b97377b388532b23e73a10d246f66496 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Mon, 3 Aug 2020 10:27:00 +0200 +Subject: [PATCH] Skip failing tests on ppc64 and s390x + +ppc64 and s390x: non262/extensions/clone-errors.js +s390x: test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js +s390x, ppc64 and aarch64: test262/built-ins/Date/UTC/fp-evaluation-order.js +--- + js/src/tests/jstests.list | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/js/src/tests/jstests.list b/js/src/tests/jstests.list +index 73ce42f..1797646 100644 +--- a/js/src/tests/jstests.list ++++ b/js/src/tests/jstests.list +@@ -53,6 +53,15 @@ skip-if(!this.hasOwnProperty("Intl")) include test262/intl402/jstests.list + skip-if(!this.hasOwnProperty("Atomics")) include test262/built-ins/Atomics/jstests.list + skip-if(!this.hasOwnProperty("SharedArrayBuffer")) include test262/built-ins/SharedArrayBuffer/jstests.list + ++# Crashes on s390x and ppc64, avoid it ++skip-if(xulRuntime.XPCOMABI.match(/s390x|ppc64-/)) script non262/extensions/clone-errors.js ++ ++# Crashes on s390x, ppc64, aarch64 ++skip-if(xulRuntime.XPCOMABI.match(/s390x|aarch64|ppc64-/)) script test262/built-ins/Date/UTC/fp-evaluation-order.js ++ ++# Crashes on s390x, avoid it ++skip-if(xulRuntime.XPCOMABI.match(/s390x/)) script test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js ++ + ##################################### + # Test262 tests disabled on browser # + ##################################### +-- +2.31.1 + + diff --git a/D152549.diff b/D152549.diff new file mode 100644 index 0000000..3bd15d2 --- /dev/null +++ b/D152549.diff @@ -0,0 +1,18 @@ +diff --git a/js/src/build/Makefile.in b/js/src/build/Makefile.in +--- a/js/src/build/Makefile.in ++++ b/js/src/build/Makefile.in +@@ -29,10 +29,13 @@ + $(SYSINSTALL) $(JS_LIBRARY_NAME).pc $(DESTDIR)$(libdir)/pkgconfig + + install:: ../js-config.h + $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(JS_LIBRARY_NAME) + ++install:: ../../../mozglue/baseprofiler/public/ProfilingCategoryList.h ++ $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(JS_LIBRARY_NAME)/js ++ + ###################################################### + # BEGIN SpiderMonkey header installation + # + # Mozilla/Gecko/Firefox mostly doesn't concern itself with defining a sensible + # install target, because it's shipping primarily packaged builds. And even if + diff --git a/D152556.diff b/D152556.diff new file mode 100644 index 0000000..039c815 --- /dev/null +++ b/D152556.diff @@ -0,0 +1,17 @@ +diff --git a/js/public/Debug.h b/js/public/Debug.h +--- a/js/public/Debug.h ++++ b/js/public/Debug.h +@@ -137,11 +137,11 @@ + js::Debugger* debugger; + + // Check that |thing| is in the same compartment as our debuggerObject. Used + // for assertions when constructing BuiltThings. We can overload this as we + // add more instantiations of BuiltThing. +-#if DEBUG ++#ifdef DEBUG + void assertBuilt(JSObject* obj); + #else + void assertBuilt(JSObject* obj) {} + #endif + + diff --git a/copy-headers.patch b/copy-headers.patch new file mode 100644 index 0000000..dfddcfa --- /dev/null +++ b/copy-headers.patch @@ -0,0 +1,38 @@ +From 3b3c8e37cca418e07bdeceaf3a601805df28d925 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Wed, 15 Jul 2020 08:27:39 +0200 +Subject: [PATCH] build: Copy headers on install instead of symlinking + +Patch by Philip Chimento ported forward to mozjs78 +--- + python/mozbuild/mozbuild/backend/recursivemake.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py +index 858d4d4..8c229e8 100644 +--- a/python/mozbuild/mozbuild/backend/recursivemake.py ++++ b/python/mozbuild/mozbuild/backend/recursivemake.py +@@ -1533,9 +1533,9 @@ class RecursiveMakeBackend(MakeBackend): + " of srcdir-relative or absolute paths." + ) + +- install_manifest.add_pattern_link(basepath, wild, dest_dir) ++ install_manifest.add_pattern_copy(basepath, wild, dest_dir) + else: +- install_manifest.add_pattern_link(f.srcdir, f, dest_dir) ++ install_manifest.add_pattern_copy(f.srcdir, f, dest_dir) + elif isinstance(f, AbsolutePath): + if not f.full_path.lower().endswith((".dll", ".pdb", ".so")): + raise Exception( +@@ -1546,7 +1546,7 @@ class RecursiveMakeBackend(MakeBackend): + install_manifest.add_optional_exists(dest_file) + absolute_files.append(f.full_path) + else: +- install_manifest.add_link(f.full_path, dest_file) ++ install_manifest.add_copy(f.full_path, dest_file) + else: + install_manifest.add_optional_exists(dest_file) + objdir_files.append(self._pretty_path(f, backend_file)) +-- +2.37.1 + diff --git a/emitter.patch b/emitter.patch new file mode 100644 index 0000000..8d5aafb --- /dev/null +++ b/emitter.patch @@ -0,0 +1,67 @@ +From d1d785c169345b81c76213f6dd9be32b4db60294 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Wed, 15 Jul 2020 08:39:47 +0200 +Subject: [PATCH] Build: allow LOCAL_INCLUDES paths with topsrcdir or topobjdir + +--- + python/mozbuild/mozbuild/frontend/emitter.py | 10 --------- + .../mozbuild/test/frontend/test_emitter.py | 22 ------------------- + 2 files changed, 32 deletions(-) + +diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py +index 0b7ccef..a3c7f2f 100644 +--- a/python/mozbuild/mozbuild/frontend/emitter.py ++++ b/python/mozbuild/mozbuild/frontend/emitter.py +@@ -1365,16 +1365,6 @@ class TreeMetadataEmitter(LoggingMixin): + "(resolved to %s)" % (local_include, full_path), + context, + ) +- if ( +- full_path == context.config.topsrcdir +- or full_path == context.config.topobjdir +- ): +- raise SandboxValidationError( +- "Path specified in LOCAL_INCLUDES " +- "(%s) resolves to the topsrcdir or topobjdir (%s), which is " +- "not allowed" % (local_include, full_path), +- context, +- ) + include_obj = LocalInclude(context, local_include) + local_includes.append(include_obj.path.full_path) + yield include_obj +diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py +index 99507fc..821de22 100644 +--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py ++++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py +@@ -1076,28 +1076,6 @@ class TestEmitterBasic(unittest.TestCase): + + self.assertEqual(local_includes, expected) + +- def test_local_includes_invalid(self): +- """Test that invalid LOCAL_INCLUDES are properly detected.""" +- reader = self.reader("local_includes-invalid/srcdir") +- +- with six.assertRaisesRegex( +- self, +- SandboxValidationError, +- "Path specified in LOCAL_INCLUDES.*resolves to the " +- "topsrcdir or topobjdir", +- ): +- self.read_topsrcdir(reader) +- +- reader = self.reader("local_includes-invalid/objdir") +- +- with six.assertRaisesRegex( +- self, +- SandboxValidationError, +- "Path specified in LOCAL_INCLUDES.*resolves to the " +- "topsrcdir or topobjdir", +- ): +- self.read_topsrcdir(reader) +- + def test_local_includes_file(self): + """Test that a filename can't be used in LOCAL_INCLUDES.""" + reader = self.reader("local_includes-filename") +-- +2.37.1 + diff --git a/fix-soname.patch b/fix-soname.patch new file mode 100644 index 0000000..8323264 --- /dev/null +++ b/fix-soname.patch @@ -0,0 +1,26 @@ +From d21c7cb9343d8c495d987e71be0f35887574c820 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Wed, 15 Jul 2020 08:21:47 +0200 +Subject: [PATCH] Add soname switch to linker, regardless of Operating System + +Fix backported from Debian: http://bugs.debian.org/746705 +--- + config/rules.mk | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/config/rules.mk b/config/rules.mk +index 90a9946..dc87789 100644 +--- a/config/rules.mk ++++ b/config/rules.mk +@@ -291,6 +291,8 @@ ifeq ($(OS_ARCH),GNU) + OS_CPPFLAGS += -DPATH_MAX=1024 -DMAXPATHLEN=1024 + endif + ++EXTRA_DSO_LDOPTS += -Wl,-soname,lib$(JS_LIBRARY_NAME).so.0 ++ + # + # MINGW32 + # +-- +2.37.1 + diff --git a/icu_sources_data-Write-command-output-to-our-stderr.patch b/icu_sources_data-Write-command-output-to-our-stderr.patch new file mode 100644 index 0000000..8468425 --- /dev/null +++ b/icu_sources_data-Write-command-output-to-our-stderr.patch @@ -0,0 +1,44 @@ +From: Simon McVittie +Date: Mon, 9 Oct 2017 09:23:14 +0100 +Subject: icu_sources_data: Write command output to our stderr + +Saying "See output in /tmp/foobar" is all very well for a developer +build, but on a buildd our /tmp is going to get thrown away after +the build. Just log the usual way instead. +--- + intl/icu_sources_data.py | 16 ++++------------ + 1 file changed, 4 insertions(+), 12 deletions(-) + +diff --git a/intl/icu_sources_data.py b/intl/icu_sources_data.py +index 4db52af..d62960d 100644 +--- a/intl/icu_sources_data.py ++++ b/intl/icu_sources_data.py +@@ -188,21 +188,13 @@ def update_sources(topsrcdir): + + def try_run(name, command, cwd=None, **kwargs): + try: +- with tempfile.NamedTemporaryFile(prefix=name, delete=False) as f: +- subprocess.check_call( +- command, cwd=cwd, stdout=f, stderr=subprocess.STDOUT, **kwargs +- ) +- except subprocess.CalledProcessError: +- print( +- """Error running "{}" in directory {} +- See output in {}""".format( +- " ".join(command), cwd, f.name +- ), +- file=sys.stderr, ++ subprocess.check_call( ++ command, cwd=cwd, stdout=sys.stderr, stderr=subprocess.STDOUT, **kwargs + ) ++ except subprocess.CalledProcessError: ++ print('''Error running "{}" in directory {}'''.format(' '.join(command), cwd), file=sys.stderr) + return False + else: +- os.unlink(f.name) + return True + + +-- +2.31.1 + diff --git a/icu_sources_data.py-Decouple-from-Mozilla-build-system.patch b/icu_sources_data.py-Decouple-from-Mozilla-build-system.patch new file mode 100644 index 0000000..8572c21 --- /dev/null +++ b/icu_sources_data.py-Decouple-from-Mozilla-build-system.patch @@ -0,0 +1,29 @@ +From: Simon McVittie +Date: Mon, 9 Oct 2017 09:22:12 +0100 +Subject: icu_sources_data.py: Decouple from Mozilla build system + +mozpack.path is a wrapper around os.path that normalizes path +separators on Windows, but on Unix we only have one path separator +so there's nothing to normalize. Avoid needing to import all of it. +--- + intl/icu_sources_data.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/intl/icu_sources_data.py b/intl/icu_sources_data.py +index 2936df9..4db52af 100644 +--- a/intl/icu_sources_data.py ++++ b/intl/icu_sources_data.py +@@ -21,7 +21,9 @@ import subprocess + import sys + import tempfile + +-from mozpack import path as mozpath ++# Close enough ++import os.path as mozpath ++mozpath.normsep = lambda p: p + + # The following files have been determined to be dead/unused by a + # semi-automated analysis. You can just remove any of the files below +-- +2.31.1 + diff --git a/init_patch.patch b/init_patch.patch new file mode 100644 index 0000000..28ed1d3 --- /dev/null +++ b/init_patch.patch @@ -0,0 +1,28 @@ +From 00414eb67ab0591911167155963b5524fbf2b0c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Mon, 9 Aug 2021 14:38:58 +0200 +Subject: [PATCH] Don't throw InvalidOptionError on invalid options + +--- + python/mozbuild/mozbuild/configure/__init__.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py +index f3167f6..c9e1132 100644 +--- a/python/mozbuild/mozbuild/configure/__init__.py ++++ b/python/mozbuild/mozbuild/configure/__init__.py +@@ -557,10 +557,7 @@ class ConfigureSandbox(dict): + for arg in self._helper: + without_value = arg.split("=", 1)[0] + msg = "Unknown option: %s" % without_value +- if self._help: +- self._logger.warning(msg) +- else: +- raise InvalidOptionError(msg) ++ self._logger.warning(msg) + + # Run the execution queue + for func, args in self._execution_queue: +-- +2.31.1 + diff --git a/known_failures.txt b/known_failures.txt new file mode 100644 index 0000000..027ceff --- /dev/null +++ b/known_failures.txt @@ -0,0 +1,12 @@ +non262/Intl/available-locales-resolved.js +non262/Intl/available-locales-supported.js +non262/Intl/DateTimeFormat/fractional-second-digits-append-item.js +non262/Intl/DateTimeFormat/tz-environment-variable.js +non262/Intl/DateTimeFormat/day-period-hour-cycle.js +non262/Intl/DateTimeFormat/timeZone_version.js +non262/Date/toString-localized.js +non262/Date/reset-time-zone-cache-same-offset.js +non262/Date/time-zones-imported.js +non262/Date/time-zones-historic.js +non262/Date/toString-localized-posix.js +non262/Date/time-zone-path.js diff --git a/mozjs102.spec b/mozjs102.spec new file mode 100644 index 0000000..4b73a25 --- /dev/null +++ b/mozjs102.spec @@ -0,0 +1,233 @@ +%global major 102 + +# LTO - Enable in Release builds, but consider disabling for development as it increases compile time +%global build_with_lto 1 + +# Require tests to pass? +%global require_tests 1 + +%if 0%{?build_with_lto} +# LTO is the default +%else +%define _lto_cflags %{nil} +%endif + +# Big endian platforms +%ifarch ppc ppc64 s390 s390x +%global big_endian 1 +%endif + +Name: mozjs%{major} +Version: 102.1.0 +Release: 1%{?dist} +Summary: SpiderMonkey JavaScript library + +License: MPL-2.0 AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND GPL-3.0-or-later +URL: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey +Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz + +# Known failures with system libicu +Source1: known_failures.txt + +# Patches from mozjs68, rebased for mozjs78: +Patch01: fix-soname.patch +Patch02: copy-headers.patch +Patch03: tests-increase-timeout.patch +Patch09: icu_sources_data.py-Decouple-from-Mozilla-build-system.patch +Patch10: icu_sources_data-Write-command-output-to-our-stderr.patch + +# Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873 +Patch12: emitter.patch +Patch13: tests-Use-native-TemporaryDirectory.patch + +# Build fixes +Patch14: init_patch.patch +Patch15: remove-sloppy-m4-detection-from-bundled-autoconf.patch +Patch16: 0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch +# These two should get uplifted into the next esr +Patch17: D152556.diff +Patch18: D152549.diff + +# TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed +Patch20: spidermonkey_checks_disable.patch + +# s390x/ppc64 fixes +Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch + +BuildRequires: cargo +BuildRequires: ccache +BuildRequires: clang-devel +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: m4 +BuildRequires: make +%if !0%{?rhel} +BuildRequires: nasm +%endif +BuildRequires: libicu-devel +BuildRequires: llvm +BuildRequires: rust +BuildRequires: rustfmt +BuildRequires: perl-devel +BuildRequires: pkgconfig(libffi) +BuildRequires: pkgconfig(zlib) +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-six +BuildRequires: readline-devel +BuildRequires: wget +BuildRequires: zip + +%description +SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of +JavaScript. It is intended to be embedded in other applications +that provide host environments for JavaScript. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%prep +%autosetup -n firefox-%{version}/js/src -N + +pushd ../.. +%autopatch -p1 + +# Copy out the LICENSE file +cp LICENSE js/src/ + +# Copy out file containing known test failures with system libicu +cp %{SOURCE1} js/src/ + +# Remove zlib directory (to be sure using system version) +rm -rf modules/zlib + +# Remove unneeded bundled stuff +rm -rf js/src/devtools/automation/variants/ +rm -rf js/src/octane/ +rm -rf js/src/ctypes/libffi/ + +popd + +%build +%if 0%{?build_with_lto} +# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd +export CARGO_PROFILE_RELEASE_LTO=true +%endif + +# Use bundled autoconf +export M4=m4 +export AWK=awk +export AC_MACRODIR=/builddir/build/BUILD/firefox-%{version}/build/autoconf/ + +sh ../../build/autoconf/autoconf.sh --localdir=/builddir/build/BUILD/firefox-%{version}/js/src configure.in > configure +chmod +x configure + +%configure \ + --with-system-icu \ + --with-system-zlib \ + --disable-tests \ + --disable-strip \ + --with-intl-api \ + --enable-readline \ + --enable-shared-js \ + --enable-optimize \ + --disable-debug \ + --enable-pie \ + --disable-jemalloc + +%make_build + +%install +%make_install + +# Fix permissions +chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc + +# Avoid multilib conflicts +case `uname -i` in + i386 | ppc | s390 | sparc ) + wordsize="32" + ;; + x86_64 | ppc64 | s390x | sparc64 ) + wordsize="64" + ;; + *) + wordsize="" + ;; +esac + +if test -n "$wordsize" +then + mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \ + %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h + + cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h < + +#if __WORDSIZE == 32 +# include "js-config-32.h" +#elif __WORDSIZE == 64 +# include "js-config-64.h" +#else +# error "unexpected value for __WORDSIZE macro" +#endif + +#endif +EOF + +fi + +# Remove unneeded files +rm %{buildroot}%{_bindir}/js%{major}-config +rm %{buildroot}%{_libdir}/libjs_static.ajs + +# Rename library and create symlinks, following fix-soname.patch +mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \ + %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0 +ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0 +ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so + +%check +# Run SpiderMonkey tests +%if 0%{?require_tests} +%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} +%else +%{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || : +%endif + +# Run basic JIT tests +%if 0%{?require_tests} + +# large-arraybuffers/basic.js fails on s390x +%ifarch s390 s390x +%{python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic +%else +%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic +%endif + +%else +%{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || : +%endif + +%files +%doc README.html +%license LICENSE +%{_libdir}/libmozjs-%{major}.so.0* + +%files devel +%{_bindir}/js%{major} +%{_libdir}/libmozjs-%{major}.so +%{_libdir}/pkgconfig/*.pc +%{_includedir}/mozjs-%{major}/ + +%changelog +* Wed Jul 27 2022 Frantisek Zatloukal - 102.1.0-1 +- Initial mozjs102 package based on mozjs91 diff --git a/remove-sloppy-m4-detection-from-bundled-autoconf.patch b/remove-sloppy-m4-detection-from-bundled-autoconf.patch new file mode 100644 index 0000000..10b8b16 --- /dev/null +++ b/remove-sloppy-m4-detection-from-bundled-autoconf.patch @@ -0,0 +1,29 @@ +From 2d99a7b076578a3394fb9d5be6eb44f9cfebc681 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Mon, 9 Aug 2021 16:15:37 +0200 +Subject: [PATCH] Remove sloppy m4 detection from bundled autoconf + +--- + build/autoconf/autoconf.sh | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/build/autoconf/autoconf.sh b/build/autoconf/autoconf.sh +index ceb8a25..606c74e 100644 +--- a/build/autoconf/autoconf.sh ++++ b/build/autoconf/autoconf.sh +@@ -114,12 +114,6 @@ fi + + # Use the frozen version of Autoconf if available. + r= f= +-# Some non-GNU m4's don't reject the --help option, so give them /dev/null. +-case `$M4 --help < /dev/null 2>&1` in +-*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;; +-*traditional*) ;; +-*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; +-esac + + $M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || + { rm -f $tmpin $tmpout; exit 2; } +-- +2.31.1 + diff --git a/sources b/sources new file mode 100644 index 0000000..4045972 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (firefox-102.1.0esr.source.tar.xz) = 2505b87ce4115445568eb6b7d8af41678bd787fd07f3f79e9f0a22d90cdf752ae5d4371856cf9c56e2d9da7d5b7c3939dc2aab5753fcc017398e7d65260f6f03 diff --git a/spidermonkey_checks_disable.patch b/spidermonkey_checks_disable.patch new file mode 100644 index 0000000..451d3ee --- /dev/null +++ b/spidermonkey_checks_disable.patch @@ -0,0 +1,22 @@ +From 6ebe8ce6a3267c96454de3cd453269b4c4053a3e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Mon, 9 Aug 2021 14:41:14 +0200 +Subject: [PATCH] Don't die on SpiderMonkey checks + +--- + config/run_spidermonkey_checks.py | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/config/run_spidermonkey_checks.py b/config/run_spidermonkey_checks.py +index 0f842d9..b49db52 100644 +--- a/config/run_spidermonkey_checks.py ++++ b/config/run_spidermonkey_checks.py +@@ -11,5 +11,3 @@ import sys + def main(output, lib_file, *scripts): + for script in scripts: + retcode = subprocess.call([sys.executable, script], cwd=buildconfig.topsrcdir) +- if retcode != 0: +- raise Exception(script + " failed") +-- +2.31.1 + diff --git a/tests-Use-native-TemporaryDirectory.patch b/tests-Use-native-TemporaryDirectory.patch new file mode 100644 index 0000000..054685c --- /dev/null +++ b/tests-Use-native-TemporaryDirectory.patch @@ -0,0 +1,66 @@ +From 1af9fdd2124547099eb0cf5a71b513ef5592dbf9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Tue, 10 Aug 2021 00:00:50 +0200 +Subject: [PATCH] Tests: Use native TemporaryDirectory + +Without ugly wrapper for Py < 3.2 that doesn't work half of the times... +--- + js/src/jit-test/jit_test.py | 2 +- + js/src/tests/jstests.py | 2 +- + js/src/tests/lib/tempfile.py | 17 +---------------- + 3 files changed, 3 insertions(+), 18 deletions(-) + +diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py +index f5d7794..8d443aa 100755 +--- a/js/src/jit-test/jit_test.py ++++ b/js/src/jit-test/jit_test.py +@@ -38,7 +38,7 @@ from lib.tests import ( + get_environment_overlay, + change_env, + ) +-from lib.tempfile import TemporaryDirectory ++from tempfile import TemporaryDirectory + + + def which(name): +diff --git a/js/src/tests/jstests.py b/js/src/tests/jstests.py +index 6fa2f5f..53ceff6 100755 +--- a/js/src/tests/jstests.py ++++ b/js/src/tests/jstests.py +@@ -37,7 +37,7 @@ from lib.tests import ( + from lib.results import ResultsSink, TestOutput + from lib.progressbar import ProgressBar + from lib.adaptor import xdr_annotate +-from lib.tempfile import TemporaryDirectory ++from tempfile import TemporaryDirectory + + if sys.platform.startswith("linux") or sys.platform.startswith("darwin"): + from lib.tasks_unix import run_all_tests +diff --git a/js/src/tests/lib/tempfile.py b/js/src/tests/lib/tempfile.py +index ecc21c9..f0a1fa3 100644 +--- a/js/src/tests/lib/tempfile.py ++++ b/js/src/tests/lib/tempfile.py +@@ -2,19 +2,4 @@ + # License, v. 2.0. If a copy of the MPL was not distributed with this + # file, You can obtain one at http://mozilla.org/MPL/2.0/. + from __future__ import absolute_import +- +-try: +- # Python 3.2 +- from tempfile import TemporaryDirectory +-except ImportError: +- import tempfile +- import shutil +- from contextlib import contextmanager +- +- @contextmanager +- def TemporaryDirectory(*args, **kwds): +- d = tempfile.mkdtemp(*args, **kwds) +- try: +- yield d +- finally: +- shutil.rmtree(d) ++from tempfile import TemporaryDirectory +-- +2.31.1 + diff --git a/tests-increase-timeout.patch b/tests-increase-timeout.patch new file mode 100644 index 0000000..2ba725c --- /dev/null +++ b/tests-increase-timeout.patch @@ -0,0 +1,26 @@ +From 9be85b155c6df0454c5faef9e850f572c99e3615 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Wed, 15 Jul 2020 08:32:44 +0200 +Subject: [PATCH] Increase the test timeout for slower buildds + +Ported forward from Debian: https://bugs.debian.org/878284 +--- + js/src/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/js/src/Makefile.in b/js/src/Makefile.in +index 6daed72..16db2de 100644 +--- a/js/src/Makefile.in ++++ b/js/src/Makefile.in +@@ -53,7 +53,7 @@ check:: check-js-msg + + check-jstests: + $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON3) -u $(srcdir)/tests/jstests.py \ +- --no-progress --format=automation --timeout 300 \ ++ --no-progress --format=automation --timeout 600 \ + $(JSTESTS_EXTRA_ARGS) \ + $(DIST)/bin/js$(BIN_SUFFIX) + +-- +2.37.1 +