summaryrefslogtreecommitdiff
path: root/repo/js91
diff options
context:
space:
mode:
Diffstat (limited to 'repo/js91')
-rw-r--r--repo/js91/fix-i386-fdlibm.patch18
-rw-r--r--repo/js91/fix-musl-build.patch16
-rw-r--r--repo/js91/fix-rust-target.patch28
-rw-r--r--repo/js91/js91.xibuild75
4 files changed, 137 insertions, 0 deletions
diff --git a/repo/js91/fix-i386-fdlibm.patch b/repo/js91/fix-i386-fdlibm.patch
new file mode 100644
index 0000000..831e5e0
--- /dev/null
+++ b/repo/js91/fix-i386-fdlibm.patch
@@ -0,0 +1,18 @@
+# error: typedef redefinition with different types ('__double_t' (aka 'double') vs 'long double')
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1729459
+
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -30,7 +30,12 @@
+ * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
+ */
+
++#if defined(__linux__) && defined(__i386__)
++// rely on glibc's double_t
++typedef long double __double_t;
++#else
+ typedef double __double_t;
++#endif
+ typedef __double_t double_t;
+
+ /*
diff --git a/repo/js91/fix-musl-build.patch b/repo/js91/fix-musl-build.patch
new file mode 100644
index 0000000..af39467
--- /dev/null
+++ b/repo/js91/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/js91/fix-rust-target.patch b/repo/js91/fix-rust-target.patch
new file mode 100644
index 0000000..4d8918a
--- /dev/null
+++ b/repo/js91/fix-rust-target.patch
@@ -0,0 +1,28 @@
+commit 34b3ac3195a40757bc5f51a1db5a47a4b18c68b5
+Author: Daniel Kolesa <daniel@octaforge.org>
+Date: Sun Jan 23 21:13:38 2022 +0100
+
+ bypass rust triplet checks and just force ours
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+index cd77d72b..0c03cab7 100644
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -261,7 +261,7 @@ def rust_supported_targets(rustc):
+ data.setdefault(key, []).append(namespace(rust_target=t, target=info))
+ return data
+
+-
++@imports("os")
+ def detect_rustc_target(
+ host_or_target, compiler_info, arm_target, rust_supported_targets
+ ):
+@@ -383,7 +383,7 @@ def detect_rustc_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(host_or_target.alias))
diff --git a/repo/js91/js91.xibuild b/repo/js91/js91.xibuild
new file mode 100644
index 0000000..1f1906e
--- /dev/null
+++ b/repo/js91/js91.xibuild
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+NAME="js91"
+DESC="Standalone Mozilla JavaScript engine (91 ESR)"
+
+MAKEDEPS="icu libffi nspr readline autoconf2-13 cargo clang linux-headers lld llvm perl python rust sed zlib"
+
+PKG_VER=91.8.0
+SOURCE="https://ftp.mozilla.org/pub/firefox/releases/${PKG_VER}esr/source/firefox-${PKG_VER}esr.source.tar.xz"
+
+ADDITIONAL="
+fix-i386-fdlibm.patch
+fix-musl-build.patch
+fix-rust-target.patch
+"
+
+prepare() {
+ apply_patches
+ mkdir "$BUILD_ROOT/mozbuild"
+
+ cat > .mozconfig <<- END
+ ac_add_options --enable-application=js
+ mk_add_options MOZ_OBJDIR='${PWD}'/obj
+ ac_add_options --prefix=/usr
+ ac_add_options --enable-release
+ ac_add_options --enable-hardening
+ ac_add_options --enable-optimize="$CFLAGS -O2"
+ ac_add_options --enable-rust-simd
+ ac_add_options --enable-linker=lld
+ ac_add_options --disable-bootstrap
+ ac_add_options --disable-debug
+ ac_add_options --disable-debug-symbols
+ ac_add_options --disable-jemalloc
+ ac_add_options --disable-strip
+
+ # System libraries
+ ac_add_options --with-system-zlib
+ ac_add_options --with-system-icu
+
+ # Features
+ ac_add_options --enable-readline
+ ac_add_options --enable-shared-js
+ ac_add_options --enable-tests
+ ac_add_options --with-intl-api
+ END
+}
+
+build() {
+ export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"
+
+ # FF doesn't have SIMD available on armhf/v7
+ echo 'ac_add_options --enable-rust-simd' >> .mozconfig
+
+ export MACH_USE_SYSTEM_PYTHON=1
+ export MOZBUILD_STATE_PATH="$BUILD_ROOT/mozbuild"
+ export MOZ_NOSPAM=1
+ export PYTHON=/usr/bin/python
+ export SHELL=/bin/ash
+
+ ./mach build
+}
+
+check() {
+ obj/dist/bin/jsapi-tests \
+ --format=none \
+ --exclude-random \
+ basic
+}
+
+package() {
+ cd obj
+ make DESTDIR="$PKG_DEST" install
+ rm -f "$PKG_DEST"/usr/lib/*.ajs
+}
+