summaryrefslogtreecommitdiffstats
path: root/pkgs/development/interpreters/spidermonkey
diff options
context:
space:
mode:
authorKirill A. Korinsky <kirill@korins.ky>2022-07-08 21:50:38 +0200
committerJan Tojnar <jtojnar@gmail.com>2022-08-10 23:33:20 +0200
commit60259663a44e6fa8b65017ef149058da801708a1 (patch)
tree0d4a9bd1970d151d3c2f6c7e8f754fabfd48626e /pkgs/development/interpreters/spidermonkey
parentf6c8d04c78f1e79eee6fb9c85f5abecbb0f89c27 (diff)
spidermonkey_*: fix build under macOS
Diffstat (limited to 'pkgs/development/interpreters/spidermonkey')
-rw-r--r--pkgs/development/interpreters/spidermonkey/allow-system-s-nspr-and-icu-on-bootstrapped-sysroot.patch40
-rw-r--r--pkgs/development/interpreters/spidermonkey/always-check-for-pkg-config.patch23
-rw-r--r--pkgs/development/interpreters/spidermonkey/common.nix15
3 files changed, 77 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/spidermonkey/allow-system-s-nspr-and-icu-on-bootstrapped-sysroot.patch b/pkgs/development/interpreters/spidermonkey/allow-system-s-nspr-and-icu-on-bootstrapped-sysroot.patch
new file mode 100644
index 000000000000..29966d90864d
--- /dev/null
+++ b/pkgs/development/interpreters/spidermonkey/allow-system-s-nspr-and-icu-on-bootstrapped-sysroot.patch
@@ -0,0 +1,40 @@
+From a26bb162d9403138d64b84e8fa4f0471084c45b2 Mon Sep 17 00:00:00 2001
+From: "Kirill A. Korinsky" <kirill@korins.ky>
+Date: Fri, 8 Jul 2022 21:21:25 +0200
+Subject: [PATCH] Allow system's nspr and icu on bootstrapped sysroot
+
+This patch partially reverts https://github.com/mozilla/gecko-dev/commit/9aa3587bbf0416dd2eb5b614f7b301c71c64286b
+---
+ build/moz.configure/nspr.configure | 2 +-
+ js/moz.configure | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/build/moz.configure/nspr.configure b/build/moz.configure/nspr.configure
+index 06f03d9bc72d..9687c84a7290 100644
+--- a/build/moz.configure/nspr.configure
++++ b/build/moz.configure/nspr.configure
+@@ -19,7 +19,7 @@ def enable_nspr_build(enable):
+ return enable
+
+
+-system_lib_option("--with-system-nspr", help="Use system NSPR")
++option("--with-system-nspr", help="Use system NSPR")
+
+
+ @depends(enable_nspr_build, "--with-system-nspr", js_standalone)
+diff --git a/js/moz.configure b/js/moz.configure
+index b7ba9790425d..5ff5cb2da266 100644
+--- a/js/moz.configure
++++ b/js/moz.configure
+@@ -1129,7 +1129,7 @@ set_define(
+
+ # ECMAScript Internationalization API Support (uses ICU)
+ # ======================================================
+-system_lib_option("--with-system-icu", help="Use system ICU")
++option("--with-system-icu", help="Use system ICU")
+
+ system_icu = pkg_check_modules("MOZ_ICU", "icu-i18n >= 71.1", when="--with-system-icu")
+
+--
+2.37.0
+
diff --git a/pkgs/development/interpreters/spidermonkey/always-check-for-pkg-config.patch b/pkgs/development/interpreters/spidermonkey/always-check-for-pkg-config.patch
new file mode 100644
index 000000000000..c6e43b60aa59
--- /dev/null
+++ b/pkgs/development/interpreters/spidermonkey/always-check-for-pkg-config.patch
@@ -0,0 +1,23 @@
+From 9d3f6e9ff5e66af90a5d187d902f7893fb91c24b Mon Sep 17 00:00:00 2001
+From: "Kirill A. Korinsky" <kirill@korins.ky>
+Date: Fri, 1 Jul 2022 12:23:37 +0200
+Subject: [PATCH] Always check for pkg-config
+
+---
+ build/moz.configure/pkg.configure | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure
+index 6b460ae174eed..0056ecd7ae2d8 100644
+--- a/build/moz.configure/pkg.configure
++++ b/build/moz.configure/pkg.configure
+@@ -15,8 +15,7 @@ pkg_config = check_prog(
+ pkg_config,
+ bootstrap=depends(when=target_sysroot.bootstrapped)(lambda: "pkgconf"),
+ allow_missing=True,
+- when=compile_environment
+- & depends(target.os)(lambda os: os not in ("WINNT", "OSX", "Android")),
++ when=compile_environment,
+ )
+
+
diff --git a/pkgs/development/interpreters/spidermonkey/common.nix b/pkgs/development/interpreters/spidermonkey/common.nix
index a5a49e13d9ef..8e2b1234fdbc 100644
--- a/pkgs/development/interpreters/spidermonkey/common.nix
+++ b/pkgs/development/interpreters/spidermonkey/common.nix
@@ -19,6 +19,7 @@
, zip
, autoconf213
, yasm
+, xcbuild
# runtime
, icu
@@ -26,6 +27,8 @@
, nspr
, readline
, zlib
+, libobjc
+, libiconv
}:
stdenv.mkDerivation (finalAttrs: rec {
@@ -56,6 +59,10 @@ stdenv.mkDerivation (finalAttrs: rec {
# - https://hg.mozilla.org/mozilla-central/rev/6803dda74d33
./add-riscv64-support.patch
] ++ lib.optionals (lib.versionAtLeast version "102") [
+ # use pkg-config at all systems
+ ./always-check-for-pkg-config.patch
+ ./allow-system-s-nspr-and-icu-on-bootstrapped-sysroot.patch
+
# Patches required by GJS
# https://discourse.gnome.org/t/gnome-43-to-depend-on-spidermonkey-102/10658
# Install ProfilingCategoryList.h
@@ -84,6 +91,8 @@ stdenv.mkDerivation (finalAttrs: rec {
] ++ lib.optionals (lib.versionOlder version "91") [
autoconf213
yasm # to buid icu? seems weird
+ ] ++ lib.optionals stdenv.isDarwin [
+ xcbuild
];
buildInputs = [
@@ -91,6 +100,9 @@ stdenv.mkDerivation (finalAttrs: rec {
nspr
readline
zlib
+ ] ++ lib.optionals stdenv.isDarwin [
+ libobjc
+ libiconv
];
depsBuildBuild = [
@@ -152,6 +164,7 @@ stdenv.mkDerivation (finalAttrs: rec {
'' + lib.optionalString (lib.versionAtLeast version "91") ''
export M4=m4
export AWK=awk
+ export AS=$CC
export AC_MACRODIR=$PWD/build/autoconf/
pushd js/src
@@ -181,6 +194,6 @@ stdenv.mkDerivation (finalAttrs: rec {
homepage = "https://spidermonkey.dev/";
license = licenses.mpl20; # TODO: MPL/GPL/LGPL tri-license for 78.
maintainers = with maintainers; [ abbradar lostnet catap ];
- platforms = platforms.linux;
+ platforms = platforms.unix;
};
})