From d9e9a7d71376f8cde547180f456211b4775e5b4c Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Thu, 17 Sep 2020 19:36:02 +0200 Subject: [PATCH] - new, based on mozjs68 (but now rust is required in base library) --- copy-headers.patch | 38 ++++++++++ include-configure-script.patch | 48 ++++++++++++ mozjs78.spec | 131 +++++++++++++++++++++++++++++++++ system-virtualenv.patch | 12 +++ x32.patch | 55 ++++++++++++++ 5 files changed, 284 insertions(+) create mode 100644 copy-headers.patch create mode 100644 include-configure-script.patch create mode 100644 mozjs78.spec create mode 100644 system-virtualenv.patch create mode 100644 x32.patch diff --git a/copy-headers.patch b/copy-headers.patch new file mode 100644 index 0000000..dfa1fdb --- /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 e3fc8fe..bed5ae9 100644 +--- a/python/mozbuild/mozbuild/backend/recursivemake.py ++++ b/python/mozbuild/mozbuild/backend/recursivemake.py +@@ -1457,9 +1457,9 @@ class RecursiveMakeBackend(MakeBackend): + raise Exception("Wildcards are only supported in the filename part" + " of srcdir-relative or absolute paths.") + +- install_manifest.add_pattern_link(basepath, wild, path) ++ install_manifest.add_pattern_copy(basepath, wild, path) + else: +- install_manifest.add_pattern_link(f.srcdir, f, path) ++ install_manifest.add_pattern_copy(f.srcdir, f, path) + elif isinstance(f, AbsolutePath): + if not f.full_path.lower().endswith(('.dll', '.pdb', '.so')): + raise Exception("Absolute paths installed to FINAL_TARGET_FILES must" +@@ -1468,7 +1468,7 @@ class RecursiveMakeBackend(MakeBackend): + install_manifest.add_optional_exists(dest) + absolute_files.append(f.full_path) + else: +- install_manifest.add_link(f.full_path, dest) ++ install_manifest.add_copy(f.full_path, dest) + else: + install_manifest.add_optional_exists(dest) + objdir_files.append(self._pretty_path(f, backend_file)) +-- +2.26.2 + diff --git a/include-configure-script.patch b/include-configure-script.patch new file mode 100644 index 0000000..211d717 --- /dev/null +++ b/include-configure-script.patch @@ -0,0 +1,48 @@ +From 4a06a1a6a71293decb83aee7adb74bc709493106 Mon Sep 17 00:00:00 2001 +From: Philip Chimento +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: +diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py +index 4310c862..15bfe425 100644 +--- a/python/mozbuild/mozbuild/configure/options.py ++++ b/python/mozbuild/mozbuild/configure/options.py +@@ -402,7 +402,11 @@ def __init__(self, environ=os.environ, argv=sys.argv): + + 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/mozjs78.spec b/mozjs78.spec new file mode 100644 index 0000000..3671b82 --- /dev/null +++ b/mozjs78.spec @@ -0,0 +1,131 @@ +# +# Conditional build: +%bcond_without tests # tests build + +Summary: SpiderMonkey 78 - JavaScript implementation +Summary(pl.UTF-8): SpiderMonkey 78 - implementacja języka JavaScript +Name: mozjs78 +Version: 78.2.0 +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: http://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz +# Source0-md5: e071f6c9bea8344d4556323f02bf6125 +Patch0: copy-headers.patch +Patch1: system-virtualenv.patch +Patch2: include-configure-script.patch +Patch3: x32.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:4.4 +BuildRequires: nspr-devel >= 4.25 +BuildRequires: perl-base >= 1:5.6 +BuildRequires: pkgconfig +BuildRequires: python3 >= 1:3.2 +BuildRequires: python3-virtualenv >= 1.9.1-4 +BuildRequires: readline-devel +BuildRequires: rpm-perlprov +BuildRequires: rpmbuild(macros) >= 1.294 +BuildRequires: rust >= 1.41.0 +BuildRequires: zlib-devel >= 1.2.3 +Requires: nspr >= 4.25 +Requires: zlib >= 1.2.3 +ExclusiveArch: %{x8664} %{ix86} x32 aarch64 +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 + +%build +export PYTHON="%{__python}" +export AUTOCONF="%{_bindir}/autoconf2_13" +export SHELL="/bin/sh" +cd js/src +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}/js78 +%attr(755,root,root) %{_libdir}/libmozjs-78.so + +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/js78-config +%{_includedir}/mozjs-78 +%{_pkgconfigdir}/mozjs-78.pc diff --git a/system-virtualenv.patch b/system-virtualenv.patch new file mode 100644 index 0000000..e64dd0f --- /dev/null +++ b/system-virtualenv.patch @@ -0,0 +1,12 @@ +--- firefox-78.2.0/python/mozbuild/mozbuild/virtualenv.py.orig 2020-09-15 21:32:27.365726770 +0200 ++++ firefox-78.2.0/python/mozbuild/mozbuild/virtualenv.py 2020-09-15 21:37:16.580826624 +0200 +@@ -63,8 +63,7 @@ + @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' + + @property + def bin_path(self): diff --git a/x32.patch b/x32.patch new file mode 100644 index 0000000..efcf419 --- /dev/null +++ b/x32.patch @@ -0,0 +1,55 @@ +diff -ur mozjs-60.1.0/build/moz.configure/init.configure mozjs-60.1.0-x32/build/moz.configure/init.configure +--- mozjs-60.1.0/build/moz.configure/init.configure 2018-06-19 00:23:55.000000000 +0200 ++++ mozjs-60.1.0-x32/build/moz.configure/init.configure 2019-03-31 10:40:40.743730317 +0200 +@@ -630,6 +630,8 @@ + 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 +diff -ur mozjs-60.1.0/python/mozbuild/mozbuild/configure/constants.py mozjs-60.1.0-x32/python/mozbuild/mozbuild/configure/constants.py +--- mozjs-60.1.0/python/mozbuild/mozbuild/configure/constants.py 2018-06-19 00:24:03.000000000 +0200 ++++ mozjs-60.1.0-x32/python/mozbuild/mozbuild/configure/constants.py 2019-03-31 10:39:21.792681467 +0200 +@@ -57,6 +57,7 @@ + 'sparc64': 64, + 'x86': 32, + 'x86_64': 64, ++ 'x32': 32, + } + + CPU = EnumString.subclass(*CPU_bitness.keys()) +@@ -73,6 +74,7 @@ + + # The order of those checks matter + CPU_preprocessor_checks = OrderedDict(( ++ ('x32', '__x86_64__ && __ILP32__'), + ('x86', '__i386__ || _M_IX86'), + ('x86_64', '__x86_64__ || _M_X64'), + ('arm', '__arm__ || _M_ARM'), +--- 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]" -- 2.44.0