spidermonkey_38, spidermonkey_60: fix cross compilation

This is essentially the same as done in
65f2b0a2a3.

For spidermonkey_38 I set --enable-posix-nspr-emulation, as it would
otherwise complain about a wrong NSPR version and that trick seemed to
be successful in spidermonkey_60 anyway.
This commit is contained in:
Justin Humm 2019-08-01 23:22:12 +02:00 committed by Frederik Rietdijk
parent 7ee6674ec3
commit 4908aaf3c9
2 changed files with 28 additions and 6 deletions

View File

@ -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;

View File

@ -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