[packages/mozjs91] - new, based on mozjs78 and firefox 91.x packaging

qboosh qboosh at pld-linux.org
Mon Apr 4 21:00:26 CEST 2022


commit 7daf7c6f9cec845f522297c32dd1f6862d2fec68
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Apr 4 21:00:13 2022 +0200

    - new, based on mozjs78 and firefox 91.x packaging

 copy-headers.patch             |  33 +++++++++
 glibc-double.patch             |  20 ++++++
 include-configure-script.patch |  45 +++++++++++++
 mozjs-x32-rust.patch           |  19 ++++++
 mozjs91.spec                   | 147 +++++++++++++++++++++++++++++++++++++++++
 system-virtualenv.patch        |  13 ++++
 x32.patch                      |  69 +++++++++++++++++++
 7 files changed, 346 insertions(+)
---
diff --git a/mozjs91.spec b/mozjs91.spec
new file mode 100644
index 0000000..1d1e799
--- /dev/null
+++ b/mozjs91.spec
@@ -0,0 +1,147 @@
+#
+# Conditional build:
+%bcond_without	tests	# tests build
+
+Summary:	SpiderMonkey 91 - JavaScript implementation
+Summary(pl.UTF-8):	SpiderMonkey 91 - implementacja języka JavaScript
+Name:		mozjs91
+Version:	91.7.1
+Release:	1
+License:	MPL v2.0
+Group:		Libraries
+#Source0:	http://ftp.gnome.org/pub/gnome/teams/releng/tarballs-needing-help/mozjs/mozjs-%{version}.tar.bz2
+Source0:	https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
+# Source0-md5:	5bed22ca5921850b0fe250c512945f6f
+Patch0:		copy-headers.patch
+Patch1:		system-virtualenv.patch
+Patch2:		include-configure-script.patch
+Patch3:		x32.patch
+Patch4:		mozjs-x32-rust.patch
+Patch5:		glibc-double.patch
+URL:		https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
+BuildRequires:	autoconf2_13 >= 2.13
+BuildRequires:	cargo
+# "TestWrappingOperations.cpp:27:1: error: non-constant condition for static assertion" with -fwrapv on gcc 6 and 7
+%{?with_tests:BuildRequires:	gcc-c++ >= 6:8}
+BuildRequires:	libicu-devel >= 67.1
+BuildRequires:	libstdc++-devel >= 6:7
+BuildRequires:	llvm
+BuildRequires:	m4 >= 1.1
+BuildRequires:	nspr-devel >= 4.26
+BuildRequires:	perl-base >= 1:5.6
+BuildRequires:	pkgconfig
+BuildRequires:	python3 >= 1:3.8.5-3
+BuildRequires:	python3-virtualenv >= 1.9.1-4
+BuildRequires:	readline-devel
+BuildRequires:	rpm-perlprov
+BuildRequires:	rpmbuild(macros) >= 1.294
+BuildRequires:	rust >= 1.51.0
+BuildRequires:	rust-cbindgen >= 0.19.0
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
+BuildRequires:	zlib-devel >= 1.2.3
+Requires:	nspr >= 4.26
+Requires:	zlib >= 1.2.3
+ExclusiveArch:	%{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+JavaScript Reference Implementation (codename SpiderMonkey). The
+package contains JavaScript runtime (compiler, interpreter,
+decompiler, garbage collector, atom manager, standard classes) and
+small "shell" program that can be used interactively and with .js
+files to run scripts.
+
+%description -l pl.UTF-8
+Wzorcowa implementacja JavaScriptu (o nazwie kodowej SpiderMonkey).
+Pakiet zawiera środowisko uruchomieniowe (kompilator, interpreter,
+dekompilator, odśmiecacz, standardowe klasy) i niewielką powłokę,
+która może być używana interaktywnie lub z plikami .js do uruchamiania
+skryptów.
+
+%package devel
+Summary:	Header files for JavaScript reference library
+Summary(pl.UTF-8):	Pliki nagłówkowe do biblioteki JavaScript
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+Requires:	libstdc++-devel
+Requires:	nspr-devel >= 4.25
+
+%description devel
+Header files for JavaScript reference library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe do biblioteki JavaScript.
+
+%prep
+%setup -q -n firefox-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%ifarch x32
+%patch4 -p1
+%endif
+%patch5 -p1
+
+%build
+export PYTHON="%{__python}"
+export AUTOCONF="%{_bindir}/autoconf2_13"
+export SHELL="/bin/sh"
+cd js/src
+AC_MACRODIR=$(pwd)/../../build/autoconf \
+AWK=awk \
+M4=m4 \
+sh ../../build/autoconf/autoconf.sh --localdir=$(pwd) configure.in >configure
+chmod 755 configure
+mkdir -p obj
+cd obj
+
+%define configuredir ".."
+%configure2_13 \
+	--enable-gcgenerational \
+	--disable-jemalloc \
+	--enable-readline \
+	--enable-shared-js \
+	%{!?with_tests:--disable-tests} \
+	--enable-threadsafe \
+	--with-intl-api \
+	--with-system-icu \
+	--with-system-nspr \
+	--with-system-zlib
+
+%{__make} \
+	HOST_OPTIMIZE_FLAGS= \
+	MODULE_OPTIMIZE_FLAGS= \
+	MOZ_OPTIMIZE_FLAGS="-freorder-blocks" \
+	MOZ_PGO_OPTIMIZE_FLAGS= \
+	MOZILLA_VERSION=%{version}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+cd js/src/obj
+
+%{__make} -C js/src install \
+	DESTDIR=$RPM_BUILD_ROOT \
+	MOZILLA_VERSION=%{version}
+
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.ajs
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc js/src/README.html
+%attr(755,root,root) %{_bindir}/js91
+%attr(755,root,root) %{_libdir}/libmozjs-91.so
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/js91-config
+%{_includedir}/mozjs-91
+%{_pkgconfigdir}/mozjs-91.pc
diff --git a/copy-headers.patch b/copy-headers.patch
new file mode 100644
index 0000000..dac59b4
--- /dev/null
+++ b/copy-headers.patch
@@ -0,0 +1,33 @@
+From 3b3c8e37cca418e07bdeceaf3a601805df28d925 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk at redhat.com>
+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(-)
+
+--- firefox-91.7.1/python/mozbuild/mozbuild/backend/recursivemake.py.orig	2022-04-04 16:49:49.659716864 +0200
++++ firefox-91.7.1/python/mozbuild/mozbuild/backend/recursivemake.py	2022-04-04 16:52:21.312536865 +0200
+@@ -1568,9 +1568,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(
+@@ -1581,7 +1581,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))
diff --git a/glibc-double.patch b/glibc-double.patch
new file mode 100644
index 0000000..ca72249
--- /dev/null
+++ b/glibc-double.patch
@@ -0,0 +1,20 @@
+--- firefox-93.0/modules/fdlibm/src/math_private.h.orig	2021-09-28 00:47:42.000000000 +0200
++++ firefox-93.0/modules/fdlibm/src/math_private.h	2021-10-06 01:23:47.611144150 +0200
+@@ -20,6 +20,7 @@
+ #include <cfloat>
+ #include <stdint.h>
+ #include <sys/types.h>
++#include <math.h>
+ 
+ #include "fdlibm.h"
+ 
+@@ -30,8 +31,7 @@
+  * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
+  */
+ 
+-typedef double      __double_t;
+-typedef __double_t  double_t;
++typedef double_t  __double_t;
+ 
+ /*
+  * The original fdlibm code used statements like:
diff --git a/include-configure-script.patch b/include-configure-script.patch
new file mode 100644
index 0000000..3d896c7
--- /dev/null
+++ b/include-configure-script.patch
@@ -0,0 +1,45 @@
+From 4a06a1a6a71293decb83aee7adb74bc709493106 Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip.chimento at gmail.com>
+Date: Wed, 5 Jul 2017 22:57:09 -0700
+Subject: [PATCH] build: Include configure script, be nicer about options
+
+A configure script is not included in the SpiderMonkey tarball by
+default. Also, we have to account for JHbuild passing extra unknown
+options like --disable-Werror.
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1379540
+---
+ js/src/configure                               | 9 +++++++++
+ python/mozbuild/mozbuild/configure/__init__.py | 2 +-
+ python/mozbuild/mozbuild/configure/options.py  | 6 +++++-
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+ create mode 100755 js/src/configure
+
+diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
+index 0fe640ca..09b460d3 100644
+--- a/python/mozbuild/mozbuild/configure/__init__.py
++++ b/python/mozbuild/mozbuild/configure/__init__.py
+@@ -356,7 +356,7 @@ def run(self, path=None):
+             if self._help:
+                 self._logger.warning(msg)
+             else:
+-                raise InvalidOptionError(msg)
++                print(msg)
+ 
+         # Run the execution queue
+         for func, args in self._execution_queue:
+--- firefox-91.7.1/python/mozbuild/mozbuild/configure/options.py.orig	2022-04-04 16:17:07.144225831 +0200
++++ firefox-91.7.1/python/mozbuild/mozbuild/configure/options.py	2022-04-04 16:26:42.747786858 +0200
+@@ -522,7 +522,11 @@ class CommandLineHelper(object):
+ 
+     def add(self, arg, origin="command-line", args=None):
+         assert origin != "default"
+-        prefix, name, values = Option.split_option(arg)
++        try:
++            prefix, name, values = Option.split_option(arg)
++        except InvalidOptionError as e:
++            print('Ignoring', arg, ':', e)
++            return
+         if args is None:
+             args = self._extra_args
+         if args is self._extra_args and name in self._extra_args:
diff --git a/mozjs-x32-rust.patch b/mozjs-x32-rust.patch
new file mode 100644
index 0000000..b9747de
--- /dev/null
+++ b/mozjs-x32-rust.patch
@@ -0,0 +1,19 @@
+--- firefox-78.2.0/build/moz.configure/rust.configure.orig	2020-08-17 20:33:34.000000000 +0200
++++ firefox-78.2.0/build/moz.configure/rust.configure	2020-10-07 18:29:15.458050574 +0200
+@@ -406,16 +406,6 @@
+ rust_host_triple = rust_triple_alias(host, host_c_compiler)
+ 
+ 
+- at depends(host, rust_host_triple, rustc_info.host)
+-def validate_rust_host_triple(host, rust_host, rustc_host):
+-    if rust_host != rustc_host:
+-        if host.alias == rust_host:
+-            configure_host = host.alias
+-        else:
+-            configure_host = '{}/{}'.format(host.alias, rust_host)
+-        die("The rust compiler host ({}) is not suitable for the configure host ({})."
+-            .format(rustc_host, configure_host))
+-
+ 
+ set_config('RUST_TARGET', rust_target_triple)
+ set_config('RUST_HOST_TARGET', rust_host_triple)
diff --git a/system-virtualenv.patch b/system-virtualenv.patch
new file mode 100644
index 0000000..668fd89
--- /dev/null
+++ b/system-virtualenv.patch
@@ -0,0 +1,13 @@
+--- firefox-91.7.1/python/mozbuild/mozbuild/virtualenv.py.orig	2022-04-04 19:48:54.691146163 +0200
++++ firefox-91.7.1/python/mozbuild/mozbuild/virtualenv.py	2022-04-04 20:09:51.129698210 +0200
+@@ -106,9 +106,7 @@ class VirtualenvManager(VirtualenvHelper
+     @property
+     def virtualenv_script_path(self):
+         """Path to virtualenv's own populator script."""
+-        return os.path.join(
+-            self.topsrcdir, "third_party", "python", "virtualenv", "virtualenv.py"
+-        )
++        return '/usr/bin/virtualenv-3'
+ 
+     def version_info(self):
+         return eval(
diff --git a/x32.patch b/x32.patch
new file mode 100644
index 0000000..5d9860b
--- /dev/null
+++ b/x32.patch
@@ -0,0 +1,69 @@
+--- firefox-91.7.1/build/moz.configure/init.configure.orig	2022-04-04 16:33:40.528846096 +0200
++++ firefox-91.7.1/build/moz.configure/init.configure	2022-04-04 16:35:05.058388323 +0200
+@@ -728,6 +728,8 @@ def split_triplet(triplet, allow_msvc=Fa
+         endianness = "little"
+     elif cpu in ("x86_64", "ia64"):
+         canonical_cpu = cpu
++        if os.endswith('gnux32'):
++            canonical_cpu = 'x32'
+         endianness = "little"
+     elif cpu in ("s390", "s390x"):
+         canonical_cpu = cpu
+--- firefox-60.7.0/mfbt/RandomNum.cpp.orig	2019-05-24 22:04:38.196451155 +0200
++++ firefox-60.7.0/mfbt/RandomNum.cpp	2019-05-24 22:10:43.717804289 +0200
+@@ -58,7 +58,9 @@
+ 
+ // Older glibc versions don't define SYS_getrandom, so we define it here if
+ // it's not available. See bug 995069.
+-#  if defined(__x86_64__)
++#  if defined(__x86_64__) && defined(__ILP32__)
++#    define GETRANDOM_NR (__X32_SYSCALL_BIT + 318)
++#  elif defined(__x86_64__)
+ #    define GETRANDOM_NR 318
+ #  elif defined(__i386__)
+ #    define GETRANDOM_NR 355
+--- firefox-91.7.1/python/mozbuild/mozbuild/configure/constants.py.orig	2022-04-04 16:33:42.568845879 +0200
++++ firefox-91.7.1/python/mozbuild/mozbuild/configure/constants.py	2022-04-04 16:44:51.148857314 +0200
+@@ -60,6 +60,7 @@ CPU_bitness = {
+     "sparc64": 64,
+     "x86": 32,
+     "x86_64": 64,
++    "x32": 32,
+     "wasm32": 32,
+ }
+ 
+@@ -78,8 +79,9 @@ WindowsBinaryType = EnumString.subclass(
+ # The order of those checks matter
+ CPU_preprocessor_checks = OrderedDict(
+     (
++        ("x32", "__x86_64__ && __ILP32__"),
+         ("x86", "__i386__ || _M_IX86"),
+-        ("x86_64", "__x86_64__ || _M_X64"),
++        ("x86_64", "(__x86_64__ && __LP64__) || _M_X64"),
+         ("arm", "__arm__ || _M_ARM"),
+         ("aarch64", "__aarch64__ || _M_ARM64"),
+         ("ia64", "__ia64__"),
+--- firefox-68.7.0/js/src/vm/BigIntType.cpp~	2020-04-03 21:29:59.000000000 +0200
++++ firefox-68.7.0/js/src/vm/BigIntType.cpp	2020-05-01 11:22:53.296439915 +0200
+@@ -263,7 +263,7 @@
+ BigInt::Digit BigInt::digitDiv(Digit high, Digit low, Digit divisor,
+                                Digit* remainder) {
+   MOZ_ASSERT(high < divisor, "division must not overflow");
+-#if defined(__x86_64__)
++#if defined(__x86_64__) && !defined(__ILP32__)
+   Digit quotient;
+   Digit rem;
+   __asm__("divq  %[divisor]"
+--- firefox-91.7.1/js/src/gc/GC.cpp.orig	2022-04-04 16:32:41.617512402 +0200
++++ firefox-91.7.1/js/src/gc/GC.cpp	2022-04-04 16:45:29.361453166 +0200
+@@ -303,8 +303,10 @@ static_assert(js::detail::LIFO_ALLOC_ALI
+               "CellFlagBitsReservedForGC should support LifoAlloc");
+ static_assert(CellAlignBytes >= MinFirstWordAlignment,
+               "CellFlagBitsReservedForGC should support gc::Cell");
++#ifndef JS_CODEGEN_NONE
+ static_assert(js::jit::CodeAlignment >= MinFirstWordAlignment,
+               "CellFlagBitsReservedForGC should support JIT code");
++#endif
+ static_assert(js::gc::JSClassAlignBytes >= MinFirstWordAlignment,
+               "CellFlagBitsReservedForGC should support JSClass pointers");
+ static_assert(js::ScopeDataAlignBytes >= MinFirstWordAlignment,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mozjs91.git/commitdiff/7daf7c6f9cec845f522297c32dd1f6862d2fec68



More information about the pld-cvs-commit mailing list