diff --git a/pkgs/development/interpreters/spidermonkey/38.nix b/pkgs/development/interpreters/spidermonkey/38.nix index d48cf841b048..2c45ba589767 100644 --- a/pkgs/development/interpreters/spidermonkey/38.nix +++ b/pkgs/development/interpreters/spidermonkey/38.nix @@ -1,6 +1,8 @@ -{ stdenv, fetchurl, pkgconfig, gnused_422, perl, python2, zip, libffi, readline, icu, zlib, nspr +{ stdenv, fetchurl, pkgconfig, gnused_422, perl, python2, zip, libffi, readline, icu, zlib, buildPackages , libobjc }: +with stdenv.lib; + stdenv.mkDerivation rec { version = "38.8.0"; name = "spidermonkey-${version}"; @@ -10,7 +12,7 @@ stdenv.mkDerivation rec { sha256 = "10lrync6cxnjlnadc0j3vg8r2dq9b3wwanw8qj1h6ncxwb7asxcl"; }; - buildInputs = [ libffi readline icu zlib nspr ] + buildInputs = [ libffi readline icu zlib ] ++ stdenv.lib.optional stdenv.isDarwin libobjc; nativeBuildInputs = [ pkgconfig perl python2 zip gnused_422 ]; @@ -19,13 +21,13 @@ stdenv.mkDerivation rec { preConfigure = '' export CXXFLAGS="-fpermissive" export LIBXUL_DIST=$out - export PYTHON="${python2.interpreter}" + export PYTHON="${buildPackages.python2.interpreter}" ''; configureFlags = [ "--enable-threadsafe" "--with-system-ffi" - "--with-system-nspr" + "--enable-posix-nspr-emulation" "--with-system-zlib" "--with-system-icu" "--enable-readline" @@ -34,8 +36,17 @@ stdenv.mkDerivation rec { # not be good defaults for other uses. "--enable-gcgenerational" "--enable-shared-js" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" ]; + configurePlatforms = []; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + # This addresses some build system bug. It's quite likely to be safe # to re-enable parallel builds if the source revision changes. enableParallelBuilding = true; diff --git a/pkgs/development/interpreters/spidermonkey/60.nix b/pkgs/development/interpreters/spidermonkey/60.nix index 1dfaf9a22860..518fc5f77b72 100644 --- a/pkgs/development/interpreters/spidermonkey/60.nix +++ b/pkgs/development/interpreters/spidermonkey/60.nix @@ -1,6 +1,8 @@ -{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, buildPackages , which, readline, zlib, icu }: +with stdenv.lib; + let version = "60.4.0"; in stdenv.mkDerivation rec { @@ -24,7 +26,7 @@ in stdenv.mkDerivation rec { preConfigure = '' export CXXFLAGS="-fpermissive" export LIBXUL_DIST=$out - export PYTHON="${python2.interpreter}" + export PYTHON="${buildPackages.python2.interpreter}" # We can't build in js/src/, so create a build dir mkdir obj @@ -45,8 +47,17 @@ in stdenv.mkDerivation rec { # https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e "--enable-optimize" "--enable-release" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" ]; + configurePlatforms = []; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + # Remove unnecessary static lib preFixup = '' rm $out/lib/libjs_static.ajs