From 739c65c54cb0e957df5e9b76f93fb02554e5cac3 Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Wed, 4 May 2022 23:52:30 +0100
Subject: moved everything to new file formatting

---
 repo/system/js78/js78.xibuild                      |  66 +++++
 repo/system/js78/patches/disable-jslint.patch      |  17 ++
 .../fd6847c9416f9eebde636e21d794d25d1be8791d.patch |  37 +++
 repo/system/js78/patches/fix-musl-build.patch      |  16 ++
 .../js78/patches/fix-python3.10-compilation.patch  | 312 +++++++++++++++++++++
 repo/system/js78/patches/fix-rust-target.patch     |  15 +
 6 files changed, 463 insertions(+)
 create mode 100644 repo/system/js78/js78.xibuild
 create mode 100644 repo/system/js78/patches/disable-jslint.patch
 create mode 100644 repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
 create mode 100644 repo/system/js78/patches/fix-musl-build.patch
 create mode 100644 repo/system/js78/patches/fix-python3.10-compilation.patch
 create mode 100644 repo/system/js78/patches/fix-rust-target.patch

(limited to 'repo/system/js78')

diff --git a/repo/system/js78/js78.xibuild b/repo/system/js78/js78.xibuild
new file mode 100644
index 0000000..199740a
--- /dev/null
+++ b/repo/system/js78/js78.xibuild
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+MAKEDEPS="gcc autoconf2-13 icu rustc zlib which zip clang llvm patch make python-six python-mach"
+DEPS="readline nspr bash zlib"
+
+PKG_VER=78.15.0
+SOURCE=https://archive.mozilla.org/pub/firefox/releases/${PKG_VER}esr/source/firefox-${PKG_VER}esr.source.tar.xz
+ADDITIONAL="
+    patches/disable-jslint.patch
+    patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
+    patches/fix-musl-build.patch
+    patches/fix-python3.10-compilation.patch
+    "
+
+DESC="JavaScript interpreter and libraries - Version 78"
+
+prepare () {
+    apply_patches
+    export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"
+
+    mountpoint -q /dev/shm || mount -t tmpfs devshm /dev/shm
+    export PATH=/opt/rustc/bin:$PATH
+    export LD_LIBRARY_PATH=/opt/rustc/lib:$LD_LIBRARY_PATH
+    export RUST_TARGET="x86_64"
+}
+
+build () {
+    mkdir build
+    cd    build 
+
+    SHELL=/bin/bash PYTHON=/usr/bin/python3 \
+        ../js/src/configure --prefix=/usr \
+                --with-intl-api \
+                --with-libclang-path=/usr/lib \
+                --with-system-icu \
+                --with-system-nspr \
+                --with-system-zlib \
+                --enable-ctypes \
+                --enable-hardening \
+                --enable-optimize="$CFLAGS -O2" \
+                --enable-readline \
+                --enable-release \
+                --enable-shared-js \
+                --enable-system-ffi \
+                --enable-tests \
+                --disable-debug \
+                --disable-debug-symbols \
+                --disable-jemalloc \
+                --disable-strip
+
+
+    make
+}
+
+check () {
+    dist/bin/jsapi-tests \
+		--format=none \
+		--exclude-random \
+		basic
+}
+
+package () {
+    make DESTDIR=$PKG_DEST install 
+    [ -f $PKG_DEST/usr/lib/libjs_static.ajs ] && rm $PKG_DEST/usr/lib/libjs_static.ajs 
+    sed -i '/@NSPR_CFLAGS@/d' $PKG_DEST/usr/bin/js78-config
+}
diff --git a/repo/system/js78/patches/disable-jslint.patch b/repo/system/js78/patches/disable-jslint.patch
new file mode 100644
index 0000000..04a8b3e
--- /dev/null
+++ b/repo/system/js78/patches/disable-jslint.patch
@@ -0,0 +1,17 @@
+--- a/js/src/build/moz.build
++++ b/js/src/build/moz.build
+@@ -80,14 +80,3 @@
+ NO_EXPAND_LIBS = True
+ 
+ DIST_INSTALL = True
+-
+-# Run SpiderMonkey style checker after linking the static library. This avoids
+-# running the script for no-op builds.
+-GeneratedFile(
+-    'spidermonkey_checks', script='/config/run_spidermonkey_checks.py',
+-    inputs=[
+-        '!%sjs_static.%s' % (CONFIG['LIB_PREFIX'], CONFIG['LIB_SUFFIX']),
+-        '/config/check_spidermonkey_style.py',
+-        '/config/check_macroassembler_style.py',
+-        '/config/check_js_opcode.py'
+-        ])
diff --git a/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch b/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
new file mode 100644
index 0000000..1af68d9
--- /dev/null
+++ b/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
@@ -0,0 +1,37 @@
+See https://bugzilla.mozilla.org/show_bug.cgi?id=1539739
+
+From fd6847c9416f9eebde636e21d794d25d1be8791d Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh@glandium.org>
+Date: Sat, 1 Jun 2019 09:06:01 +0900
+Subject: [PATCH] Bug 1526653 - Include struct definitions for user_vfp and
+ user_vfp_exc.
+
+---
+ js/src/wasm/WasmSignalHandlers.cpp | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
+index 636537f8478..383c380f04c 100644
+--- a/js/src/wasm/WasmSignalHandlers.cpp
++++ b/js/src/wasm/WasmSignalHandlers.cpp
+@@ -248,7 +248,16 @@ using mozilla::DebugOnly;
+ #endif
+ 
+ #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
+-#  include <sys/user.h>
++struct user_vfp {
++  unsigned long long fpregs[32];
++  unsigned long fpscr;
++};
++
++struct user_vfp_exc {
++  unsigned long fpexc;
++  unsigned long fpinst;
++  unsigned long fpinst2;
++};
+ #endif
+ 
+ #if defined(ANDROID)
+-- 
+2.20.1
+
diff --git a/repo/system/js78/patches/fix-musl-build.patch b/repo/system/js78/patches/fix-musl-build.patch
new file mode 100644
index 0000000..af39467
--- /dev/null
+++ b/repo/system/js78/patches/fix-musl-build.patch
@@ -0,0 +1,16 @@
+Upstream: No
+Reason: mozjs60 miscompiles on musl if built with HAVE_THREAD_TLS_KEYWORD:
+https://github.com/void-linux/void-packages/issues/2598
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -1272,6 +1272,9 @@
+     *-android*|*-linuxandroid*)
+       :
+       ;;
++    *-musl*)
++      :
++      ;;
+     *)
+       AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
+       ;;
diff --git a/repo/system/js78/patches/fix-python3.10-compilation.patch b/repo/system/js78/patches/fix-python3.10-compilation.patch
new file mode 100644
index 0000000..4473d9b
--- /dev/null
+++ b/repo/system/js78/patches/fix-python3.10-compilation.patch
@@ -0,0 +1,312 @@
+#https://src.fedoraproject.org/rpms/mozjs78/blob/rawhide/f/Fixup-compatibility-of-mozbuild-with-Python-3.10.patch
+
+m a88d0c8e27b48344942187c2611bb121bde9332d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
+Date: Tue, 13 Jul 2021 11:46:20 +0200
+Subject: [PATCH] Fixup compatibility of mozbuild with Python 3.10
+
+---
+ python/mach/mach/config.py                                    | 4 ++--
+ python/mach/mach/main.py                                      | 4 ++--
+ python/mach/mach/decorators.py                                | 2 +-
+ python/mozbuild/mozbuild/backend/configenvironment.py         | 3 ++-
+ python/mozbuild/mozbuild/makeutil.py                          | 2 +-
+ python/mozbuild/mozbuild/util.py                              | 2 +-
+ testing/marionette/client/marionette_driver/wait.py           | 2 +-
+ testing/mozbase/manifestparser/manifestparser/filters.py      | 3 ++-
+ testing/mozbase/versioninfo.py                                | 2 +-
+ testing/web-platform/tests/tools/manifest/vcs.py              | 2 +-
+ .../web-platform/tests/tools/third_party/h2/h2/settings.py    | 2 +-
+ .../tests/tools/third_party/html5lib/html5lib/_trie/_base.py  | 2 +-
+ .../tools/third_party/html5lib/html5lib/treebuilders/dom.py   | 2 +-
+ .../tests/tools/third_party/hyper/hyper/common/headers.py     | 2 +-
+ .../tests/tools/third_party/hyper/hyper/h2/settings.py        | 2 +-
+ .../tests/tools/third_party/hyper/hyper/http11/connection.py  | 4 ++--
+ .../third_party/hyper/hyper/packages/hyperframe/flags.py      | 2 +-
+ .../tests/tools/third_party/hyperframe/hyperframe/flags.py    | 2 +-
+ testing/web-platform/tests/tools/wptserve/wptserve/config.py  | 3 ++-
+ testing/web-platform/tests/webdriver/tests/support/sync.py    | 2 +-
+ 19 files changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py
+index 7210eca82..edb4d2e93 100644
+--- a/python/mach/mach/config.py
++++ b/python/mach/mach/config.py
+@@ -144,7 +144,7 @@ def reraise_attribute_error(func):
+     return _
+ 
+ 
+-class ConfigSettings(collections.Mapping):
++class ConfigSettings(collections.abc.Mapping):
+     """Interface for configuration settings.
+ 
+     This is the main interface to the configuration.
+@@ -190,7 +190,7 @@ class ConfigSettings(collections.Mapping):
+     will result in exceptions being raised.
+     """
+ 
+-    class ConfigSection(collections.MutableMapping, object):
++    class ConfigSection(collections.abc.MutableMapping, object):
+         """Represents an individual config section."""
+         def __init__(self, config, name, settings):
+             object.__setattr__(self, '_config', config)
+diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py
+index 27f7f34a6..5f63271a3 100644
+--- a/python/mach/mach/decorators.py
++++ b/python/mach/mach/decorators.py
+@@ -140,7 +140,7 @@ def CommandProvider(cls):
+               'Conditions argument must take a list ' + \
+               'of functions. Found %s instead.'
+ 
+-        if not isinstance(command.conditions, collections.Iterable):
++        if not isinstance(command.conditions, collections.abc.Iterable):
+             msg = msg % (command.name, type(command.conditions))
+             raise MachError(msg)
+
+--- a/python/mach/mach/main.py
++++ b/python/mach/mach/main.py
+@@ -16,7 +16,7 @@
+ import sys
+ import traceback
+ import uuid
+-from collections import Iterable
++from collections.abc import Iterable
+ 
+ from six import string_types
+ 
+diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
+index 20d1a9fa6..8747958bd 100644
+--- a/python/mozbuild/mozbuild/backend/configenvironment.py
++++ b/python/mozbuild/mozbuild/backend/configenvironment.py
+@@ -9,7 +9,8 @@ import six
+ import sys
+ import json
+ 
+-from collections import Iterable, OrderedDict
++from collections import OrderedDict
++from collections.abc import Iterable
+ from types import ModuleType
+ 
+ import mozpack.path as mozpath
+diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
+index 4da1a3b26..4ce56848c 100644
+--- a/python/mozbuild/mozbuild/makeutil.py
++++ b/python/mozbuild/mozbuild/makeutil.py
+@@ -7,7 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
+ import os
+ import re
+ import six
+-from collections import Iterable
++from collections.abc import Iterable
+ 
+ 
+ class Makefile(object):
+diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
+index 044cf645c..98ed3ef52 100644
+--- a/python/mozbuild/mozbuild/util.py
++++ b/python/mozbuild/mozbuild/util.py
+@@ -782,7 +782,7 @@ class HierarchicalStringList(object):
+         self._strings = StrictOrderingOnAppendList()
+         self._children = {}
+ 
+-    class StringListAdaptor(collections.Sequence):
++    class StringListAdaptor(collections.abc.Sequence):
+         def __init__(self, hsl):
+             self._hsl = hsl
+ 
+diff --git a/testing/marionette/client/marionette_driver/wait.py b/testing/marionette/client/marionette_driver/wait.py
+index eeaa1e23d..c147f463f 100644
+--- a/testing/marionette/client/marionette_driver/wait.py
++++ b/testing/marionette/client/marionette_driver/wait.py
+@@ -82,7 +82,7 @@ class Wait(object):
+ 
+         exceptions = []
+         if ignored_exceptions is not None:
+-            if isinstance(ignored_exceptions, collections.Iterable):
++            if isinstance(ignored_exceptions, collections.abc.Iterable):
+                 exceptions.extend(iter(ignored_exceptions))
+             else:
+                 exceptions.append(ignored_exceptions)
+diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
+index 287ee033b..b1d608003 100644
+--- a/testing/mozbase/manifestparser/manifestparser/filters.py
++++ b/testing/mozbase/manifestparser/manifestparser/filters.py
+@@ -12,7 +12,8 @@ from __future__ import absolute_import
+ 
+ import itertools
+ import os
+-from collections import defaultdict, MutableSequence
++from collections import defaultdict
++from collections.abc import MutableSequence
+ 
+ import six
+ from six import string_types
+diff --git a/testing/mozbase/versioninfo.py b/testing/mozbase/versioninfo.py
+index 91d1a0473..8c1680069 100755
+--- a/testing/mozbase/versioninfo.py
++++ b/testing/mozbase/versioninfo.py
+@@ -11,7 +11,7 @@ from commit messages.
+ 
+ from __future__ import absolute_import, print_function
+ 
+-from collections import Iterable
++from collections.abc import Iterable
+ from distutils.version import StrictVersion
+ import argparse
+ import os
+diff --git a/testing/web-platform/tests/tools/manifest/vcs.py b/testing/web-platform/tests/tools/manifest/vcs.py
+index 7c0feeb81..05ee19c7c 100644
+--- a/testing/web-platform/tests/tools/manifest/vcs.py
++++ b/testing/web-platform/tests/tools/manifest/vcs.py
+@@ -3,7 +3,7 @@ import json
+ import os
+ import stat
+ from collections import deque
+-from collections import MutableMapping
++from collections.abc import MutableMapping
+ 
+ from six import with_metaclass, PY2
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
+index 3da720329..e097630e9 100644
+--- a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
++++ b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
+@@ -88,7 +88,7 @@ class ChangedSetting:
+         )
+ 
+ 
+-class Settings(collections.MutableMapping):
++class Settings(collections.abc.MutableMapping):
+     """
+     An object that encapsulates HTTP/2 settings state.
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
+index a1158bbbf..a9295a2ba 100644
+--- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
++++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
+@@ -1,6 +1,6 @@
+ from __future__ import absolute_import, division, unicode_literals
+ 
+-from collections import Mapping
++from collections.abc import Mapping
+ 
+ 
+ class Trie(Mapping):
+diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
+index dcfac220b..818a33433 100644
+--- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
++++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
+@@ -1,7 +1,7 @@
+ from __future__ import absolute_import, division, unicode_literals
+ 
+ 
+-from collections import MutableMapping
++from collections.abc import MutableMapping
+ from xml.dom import minidom, Node
+ import weakref
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
+index 655a591ac..6454f550a 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
+@@ -10,7 +10,7 @@ import collections
+ from hyper.common.util import to_bytestring, to_bytestring_tuple
+ 
+ 
+-class HTTPHeaderMap(collections.MutableMapping):
++class HTTPHeaderMap(collections.abc.MutableMapping):
+     """
+     A structure that contains HTTP headers.
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
+index fedc5e3c4..040afea92 100755
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
+@@ -151,7 +151,7 @@ class ChangedSetting:
+         )
+ 
+ 
+-class Settings(collections.MutableMapping):
++class Settings(collections.abc.MutableMapping):
+     """
+     An object that encapsulates HTTP/2 settings state.
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
+index 61361c358..a214311d2 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
+@@ -10,7 +10,7 @@ import os
+ import socket
+ import base64
+ 
+-from collections import Iterable, Mapping
++from collections.abc import Iterable, Mapping
+ 
+ import collections
+ from hyperframe.frame import SettingsFrame
+@@ -295,7 +295,7 @@ class HTTP11Connection(object):
+                 return
+ 
+             # Iterables that set a specific content length.
+-            elif isinstance(body, collections.Iterable):
++            elif isinstance(body, collections.abc.Iterable):
+                 for item in body:
+                     try:
+                         self._sock.send(item)
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
+index e8f630056..8f2ea689b 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
+@@ -11,7 +11,7 @@ import collections
+ Flag = collections.namedtuple("Flag", ["name", "bit"])
+ 
+ 
+-class Flags(collections.MutableSet):
++class Flags(collections.abc.MutableSet):
+     """
+     A simple MutableSet implementation that will only accept known flags as elements.
+ 
+diff --git a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
+index 05b35017e..14c352e10 100644
+--- a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
++++ b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
+@@ -11,7 +11,7 @@ import collections
+ Flag = collections.namedtuple("Flag", ["name", "bit"])
+ 
+ 
+-class Flags(collections.MutableSet):
++class Flags(collections.abc.MutableSet):
+     """
+     A simple MutableSet implementation that will only accept known flags as
+     elements.
+diff --git a/testing/web-platform/tests/tools/wptserve/wptserve/config.py b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
+index 7766565fe..3c1c36d6f 100644
+--- a/testing/web-platform/tests/tools/wptserve/wptserve/config.py
++++ b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
+@@ -2,7 +2,8 @@ import copy
+ import logging
+ import os
+ 
+-from collections import defaultdict, Mapping
++from collections import defaultdict
++from collections.abc import Mapping
+ from six import integer_types, iteritems, itervalues, string_types
+ 
+ from . import sslutils
+diff --git a/testing/web-platform/tests/webdriver/tests/support/sync.py b/testing/web-platform/tests/webdriver/tests/support/sync.py
+index 3fc77131c..8e8f6b819 100644
+--- a/testing/web-platform/tests/webdriver/tests/support/sync.py
++++ b/testing/web-platform/tests/webdriver/tests/support/sync.py
+@@ -81,7 +81,7 @@ class Poll(object):
+ 
+         exceptions = []
+         if ignored_exceptions is not None:
+-            if isinstance(ignored_exceptions, collections.Iterable):
++            if isinstance(ignored_exceptions, collections.abc.Iterable):
+                 exceptions.extend(iter(ignored_exceptions))
+             else:
+                 exceptions.append(ignored_exceptions)
+-- 
+2.31.1
+
+
diff --git a/repo/system/js78/patches/fix-rust-target.patch b/repo/system/js78/patches/fix-rust-target.patch
new file mode 100644
index 0000000..f1a98df
--- /dev/null
+++ b/repo/system/js78/patches/fix-rust-target.patch
@@ -0,0 +1,15 @@
+Allow us to just set RUST_TARGEt ourselves instead of hacking around in mozilla's
+weird custom build system...
+
+diff -upr firefox-68.9.0.orig/build/moz.configure/rust.configure firefox-68.9.0/build/moz.configure/rust.configure
+--- firefox-68.9.0.orig/build/moz.configure/rust.configure	2020-06-02 22:54:39.982616128 +0200
++++ firefox-68.9.0/build/moz.configure/rust.configure	2020-06-02 23:08:37.656332899 +0200
+@@ -345,7 +345,7 @@ def rust_triple_alias(host_or_target):
+ 
+             return None
+ 
+-        rustc_target = find_candidate(candidates)
++        rustc_target = os.environ['RUST_TARGET']
+ 
+         if rustc_target is None:
+             die("Don't know how to translate {} for rustc".format(
-- 
cgit v1.2.1