[gnome-build-meta/add-mozjs91] sdk/gjs: Change dependency from mozjs78 to mozjs91
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/add-mozjs91] sdk/gjs: Change dependency from mozjs78 to mozjs91
- Date: Sat, 9 Oct 2021 23:29:15 +0000 (UTC)
commit 52096efb5ff81c87a931cebc6c4c0718eb843db9
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Oct 9 16:10:32 2021 -0700
sdk/gjs: Change dependency from mozjs78 to mozjs91
This is more complicated than previous ports, because mozjs78 lives in
freedesktop and polkit still depends on it.
elements/sdk-platform.bst | 1 +
elements/sdk/gjs.bst | 2 +-
elements/sdk/mozjs91.bst | 71 ++++++++++++++++++++++
...iscv64-as-target-architecture-to-mozbuild.patch | 52 ++++++++++++++++
...ect-ABI-when-building-on-Linux-for-64-bit.patch | 41 +++++++++++++
...le-AtomicOperations-feeling-lucky.h-on-ri.patch | 33 ++++++++++
...Define-RETURN_INSTR-for-riscv64-in-TestPo.patch | 17 ++++++
files/mozjs91/fix-arm-build.patch | 12 ++++
8 files changed, 228 insertions(+), 1 deletion(-)
---
diff --git a/elements/sdk-platform.bst b/elements/sdk-platform.bst
index 2059f2962..f5455763e 100644
--- a/elements/sdk-platform.bst
+++ b/elements/sdk-platform.bst
@@ -50,6 +50,7 @@ depends:
- sdk/libsoup-2.4.bst
- sdk/libsoup.bst
- sdk/libwpe.bst
+- sdk/mozjs91.bst
- sdk/pango.bst
- sdk/pinentry.bst
- sdk/pipewire.bst
diff --git a/elements/sdk/gjs.bst b/elements/sdk/gjs.bst
index 191a45c3d..304a8f14b 100644
--- a/elements/sdk/gjs.bst
+++ b/elements/sdk/gjs.bst
@@ -14,7 +14,7 @@ depends:
- sdk/gtk+-3.bst
- freedesktop-sdk.bst:components/cairo.bst
- freedesktop-sdk.bst:components/dbus.bst
-- freedesktop-sdk.bst:components/mozjs.bst
+- sdk/mozjs91.bst
- freedesktop-sdk.bst:bootstrap-import.bst
variables:
meson-local: >-
diff --git a/elements/sdk/mozjs91.bst b/elements/sdk/mozjs91.bst
new file mode 100644
index 000000000..8d4860da3
--- /dev/null
+++ b/elements/sdk/mozjs91.bst
@@ -0,0 +1,71 @@
+kind: manual
+
+build-depends:
+- freedesktop-sdk.bst:components/autoconf2.13.bst # 1999 called, LOL
+- freedesktop-sdk.bst:components/pkg-config.bst
+- freedesktop-sdk.bst:components/python3.bst
+- freedesktop-sdk.bst:components/which.bst
+- freedesktop-sdk.bst:components/perl.bst
+- freedesktop-sdk.bst:components/rust.bst
+
+depends:
+- freedesktop-sdk.bst:components/icu.bst
+
+environment-nocache:
+- MAXJOBS
+
+environment:
+ MAXJOBS: '%{max-jobs}'
+ PATH: /usr/bin:/usr/lib/sdk/rust/bin
+ CC: gcc
+ CXX: g++
+
+variables:
+ optimize-debug: "false"
+
+config:
+ configure-commands:
+ - |
+ cat >mozconfig <<EOF
+ ac_add_options --prefix="%{prefix}"
+ ac_add_options --libdir="%{libdir}"
+ ac_add_options --host="%{triplet}"
+ ac_add_options --target="%{triplet}"
+ ac_add_options --enable-application=js
+ ac_add_options --enable-release
+ ac_add_options --with-system-zlib
+ ac_add_options --with-system-icu
+ ac_add_options --enable-readline
+ ac_add_options --disable-jemalloc
+ mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/build-dir
+ EOF
+
+ - |
+ ./mach configure
+
+ build-commands:
+ - |
+ ./mach build -j${MAXJOBS} --verbose
+
+ install-commands:
+ - |
+ cd build-dir && make -j1 install DESTDIR="%{install-root}"
+
+ - rm -rf "%{install-root}%{bindir}"
+ - rm "%{install-root}%{libdir}/libjs_static.ajs"
+
+sources:
+- kind: tar
+ url: https://ftp.mozilla.org/pub/firefox/releases/91.2.0esr/source/firefox-91.2.0esr.source.tar.xz
+ base-dir: 'firefox-91.2.0'
+ ref: 8b55a8b8254ddde03db83f44c9fecfc4ae86ea126b5445a0355d915830bd7410
+- kind: patch
+ path: files/mozjs91/fix-arm-build.patch
+- kind: patch
+ path: files/mozjs91/0001-Add-riscv64-as-target-architecture-to-mozbuild.patch
+- kind: patch
+ path: files/mozjs91/0002-js-jit-Enable-AtomicOperations-feeling-lucky.h-on-ri.patch
+- kind: patch
+ path: files/mozjs91/0003-mfbt-tests-Define-RETURN_INSTR-for-riscv64-in-TestPo.patch
+- kind: patch
+ path: files/mozjs91/0001-Use-correct-ABI-when-building-on-Linux-for-64-bit.patch
diff --git a/files/mozjs91/0001-Add-riscv64-as-target-architecture-to-mozbuild.patch
b/files/mozjs91/0001-Add-riscv64-as-target-architecture-to-mozbuild.patch
new file mode 100644
index 000000000..85f5adfc8
--- /dev/null
+++ b/files/mozjs91/0001-Add-riscv64-as-target-architecture-to-mozbuild.patch
@@ -0,0 +1,52 @@
+diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
+index 5e0741852c..9b2ecce8da 100644
+--- a/build/moz.configure/init.configure
++++ b/build/moz.configure/init.configure
+@@ -741,6 +741,9 @@ def split_triplet(triplet, allow_msvc=False):
+ elif cpu.startswith('aarch64'):
+ canonical_cpu = 'aarch64'
+ endianness = 'little'
++ elif cpu in ('riscv64', 'riscv64gc'):
++ canonical_cpu = 'riscv64'
++ endianness = 'little'
+ elif cpu == 'sh4':
+ canonical_cpu = 'sh4'
+ endianness = 'little'
+diff --git a/python/mozbuild/mozbuild/configure/constants.py
b/python/mozbuild/mozbuild/configure/constants.py
+index 7542dcdc63..49ef3b857d 100644
+--- a/python/mozbuild/mozbuild/configure/constants.py
++++ b/python/mozbuild/mozbuild/configure/constants.py
+@@ -49,6 +49,7 @@ CPU_bitness = {
+ 'mips64': 64,
+ 'ppc': 32,
+ 'ppc64': 64,
++ 'riscv64': 64,
+ 's390': 32,
+ 's390x': 64,
+ 'sh4': 32,
+@@ -87,6 +88,7 @@ CPU_preprocessor_checks = OrderedDict((
+ ('sparc', '__sparc__'),
+ ('mips64', '__mips64'),
+ ('mips32', '__mips__'),
++ ('riscv64', '__riscv && __riscv_xlen == 64'),
+ ('sh4', '__sh__'),
+ ))
+
+diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+index 37c4e26f0f..5d3d5891dc 100755
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+@@ -1208,6 +1208,10 @@ class LinuxCrossCompileToolchainTest(BaseToolchainTest):
+ 'mips-unknown-linux-gnu': big_endian + {
+ '__mips__': 1,
+ },
++ 'riscv64-unknown-linux-gnu': little_endian + {
++ '__riscv': 1,
++ '__riscv_xlen': 64,
++ },
+ 'sh4-unknown-linux-gnu': little_endian + {
+ '__sh__': 1,
+ },
+--
+2.29.2
+
diff --git a/files/mozjs91/0001-Use-correct-ABI-when-building-on-Linux-for-64-bit.patch
b/files/mozjs91/0001-Use-correct-ABI-when-building-on-Linux-for-64-bit.patch
new file mode 100644
index 000000000..5455233eb
--- /dev/null
+++ b/files/mozjs91/0001-Use-correct-ABI-when-building-on-Linux-for-64-bit.patch
@@ -0,0 +1,41 @@
+From fffb297950b0f71cc8d41a8391db648a1ffb27dc Mon Sep 17 00:00:00 2001
+From: James Thomas <james thomas codethink co uk>
+Date: Mon, 8 Feb 2021 14:28:17 +0000
+Subject: [PATCH] Use correct ABI when building on Linux for 64-bit
+
+---
+ third_party/rust/cc/.cargo-checksum.json | 2 +-
+ third_party/rust/cc/src/lib.rs | 8 +++++---
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/third_party/rust/cc/.cargo-checksum.json b/third_party/rust/cc/.cargo-checksum.json
+index 417fde7953..9c6d75b92b 100644
+--- a/third_party/rust/cc/.cargo-checksum.json
++++ b/third_party/rust/cc/.cargo-checksum.json
+@@ -1 +1 @@
+-{"files":{"Cargo.lock":"3aff5f8b0a7f4d72852b11b0526f0002e6bf55f19f1ebd6470d7f97fbd540e60","Cargo.toml":"6ab10d9b6a9c6f0909074e6698c90c6b6a7223661ec2e83174d2593117cbe7f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"4753929dbb7b676c19d7cfa06d0a47e37003554b80c536cbf2b892d591ef61c2","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"388e79dcf3e84078ae0b086c6cdee9cf9eb7e3ffafdcbf3e2
df26163661f5856","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"71620b178583b6e6e5e0d4cac14e2cef6afc62fb6841e0c72ed1784543abf8ac","tests/test.rs":"1605640c9b94a77f48fc92e1dc0485bdf1960da5626e2e00279e4703691656bc"},"package":"aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"}
+\ No newline at end of file
++{"files":{"Cargo.lock":"3aff5f8b0a7f4d72852b11b0526f0002e6bf55f19f1ebd6470d7f97fbd540e60","Cargo.toml":"6ab10d9b6a9c6f0909074e6698c90c6b6a7223661ec2e83174d2593117cbe7f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"906f772cc6a9c98d4cea4f431ef6db0629c618a9232314bc6479da2d177a619e","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"388e79dcf3e84078ae0b086c6cdee9cf9eb7e3ffafdcbf3e2
df26163661f5856","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"71620b178583b6e6e5e0d4cac14e2cef6afc62fb6841e0c72ed1784543abf8ac","tests/test.rs":"1605640c9b94a77f48fc92e1dc0485bdf1960da5626e2e00279e4703691656bc"},"package":"aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"}
+\ No newline at end of file
+diff --git a/third_party/rust/cc/src/lib.rs b/third_party/rust/cc/src/lib.rs
+index 621d31d6b8..d795e5a6d0 100644
+--- a/third_party/rust/cc/src/lib.rs
++++ b/third_party/rust/cc/src/lib.rs
+@@ -1588,9 +1588,11 @@ impl Build {
+ if let Some(arch) = parts.next() {
+ let arch = &arch[5..];
+ cmd.args.push(("-march=rv".to_owned() + arch).into());
+- // ABI is always soft-float right now, update this when this is no longer the
+- // case:
+- if arch.starts_with("64") {
++ if target.contains("linux") && arch.starts_with("64") {
++ cmd.args.push("-mabi=lp64d".into());
++ } else if target.contains("linux") && arch.starts_with("32") {
++ cmd.args.push("-mabi=ilp32d".into());
++ } else if arch.starts_with("64") {
+ cmd.args.push("-mabi=lp64".into());
+ } else {
+ cmd.args.push("-mabi=ilp32".into());
+--
+2.29.2
+
diff --git a/files/mozjs91/0002-js-jit-Enable-AtomicOperations-feeling-lucky.h-on-ri.patch
b/files/mozjs91/0002-js-jit-Enable-AtomicOperations-feeling-lucky.h-on-ri.patch
new file mode 100644
index 000000000..689387f74
--- /dev/null
+++ b/files/mozjs91/0002-js-jit-Enable-AtomicOperations-feeling-lucky.h-on-ri.patch
@@ -0,0 +1,33 @@
+diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h
+index 0486cbad1c..cf6b91cba9 100644
+--- a/js/src/jit/AtomicOperations.h
++++ b/js/src/jit/AtomicOperations.h
+@@ -391,7 +391,8 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) {
+ #elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \
+ defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
+ defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
+- defined(__sh__) || defined(__s390__) || defined(__s390x__)
++ defined(__sh__) || defined(__s390__) || defined(__s390x__) || \
++ defined(__riscv)
+ # include "jit/shared/AtomicOperations-feeling-lucky.h"
+ #else
+ # error "No AtomicOperations support provided for this platform"
+diff --git a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
+index f002cd46c9..1ce40efacc 100644
+--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
++++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
+@@ -63,6 +63,11 @@
+ # define HAS_64BIT_LOCKFREE
+ #endif
+
++#if defined(__riscv) && __riscv_xlen == 64
++# define HAS_64BIT_ATOMICS
++# define HAS_64BIT_LOCKFREE
++#endif
++
+ #ifdef __sparc__
+ # ifdef __LP64__
+ # define HAS_64BIT_ATOMICS
+--
+2.29.2
+
diff --git a/files/mozjs91/0003-mfbt-tests-Define-RETURN_INSTR-for-riscv64-in-TestPo.patch
b/files/mozjs91/0003-mfbt-tests-Define-RETURN_INSTR-for-riscv64-in-TestPo.patch
new file mode 100644
index 000000000..663e07812
--- /dev/null
+++ b/files/mozjs91/0003-mfbt-tests-Define-RETURN_INSTR-for-riscv64-in-TestPo.patch
@@ -0,0 +1,17 @@
+diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp
+index fbd3364715..9d2ffa498b 100644
+--- a/mfbt/tests/TestPoisonArea.cpp
++++ b/mfbt/tests/TestPoisonArea.cpp
+@@ -132,6 +132,9 @@
+ #elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2
+ # define RETURN_INSTR 0x4E800020 /* blr */
+
++#elif defined __riscv
++# define RETURN_INSTR 0x80828082 /* ret; ret */
++
+ #elif defined __sparc || defined __sparcv9
+ # define RETURN_INSTR 0x81c3e008 /* retl */
+
+--
+2.29.2
+
diff --git a/files/mozjs91/fix-arm-build.patch b/files/mozjs91/fix-arm-build.patch
new file mode 100644
index 000000000..4ea99c2bc
--- /dev/null
+++ b/files/mozjs91/fix-arm-build.patch
@@ -0,0 +1,12 @@
+diff -ur mozjs.old/js/src/wasm/WasmSignalHandlers.cpp mozjs/js/src/wasm/WasmSignalHandlers.cpp
+--- mozjs.old/js/src/wasm/WasmSignalHandlers.cpp 2020-06-23 16:37:14.789872847 +0200
++++ mozjs/js/src/wasm/WasmSignalHandlers.cpp 2020-06-23 16:38:00.667125114 +0200
+@@ -244,7 +244,7 @@
+ // If you run into compile problems on a tier-3 platform, you can disable the
+ // emulation here.
+
+-#if defined(__linux__) && defined(__arm__)
++#if 0
+ # define WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
+ #endif
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]