From ad7e58727d20c925be97463c9d1dffb316881564 Mon Sep 17 00:00:00 2001 From: Michael Eden Date: Wed, 20 Mar 2019 16:36:12 -0400 Subject: [PATCH] spidermonkey_52: cross compilation --- .../development/interpreters/spidermonkey/52.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/spidermonkey/52.nix b/pkgs/development/interpreters/spidermonkey/52.nix index ea96e5ed334a..1d7a11df5a41 100644 --- a/pkgs/development/interpreters/spidermonkey/52.nix +++ b/pkgs/development/interpreters/spidermonkey/52.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, which, readline, icu, zlib, nspr }: +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, which, readline, icu, zlib, nspr, buildPackages }: let version = "52.9.0"; @@ -14,7 +14,7 @@ in stdenv.mkDerivation rec { setOutputFlags = false; # Configure script only understands --includedir buildInputs = [ readline icu zlib nspr ]; - nativeBuildInputs = [ autoconf213 pkgconfig perl which python2 zip ]; + nativeBuildInputs = [ autoconf213 pkgconfig perl which buildPackages.python2 zip ]; # Apparently this package fails to build correctly with modern compilers, which at least # on ARMv6 causes polkit testsuite to break with an assertion failure in spidermonkey. @@ -31,10 +31,12 @@ in stdenv.mkDerivation rec { }) ]; + configurePlatforms = [ "host" "target" ]; + preConfigure = '' export CXXFLAGS="-fpermissive" export LIBXUL_DIST=$out - export PYTHON="${python2.interpreter}" + export PYTHON="${buildPackages.python2.interpreter}" configureFlagsArray+=("--includedir=$dev/include") cd js/src @@ -43,7 +45,7 @@ in stdenv.mkDerivation rec { ''; configureFlags = [ - "--with-system-nspr" + "--with-nspr-prefix=${nspr}" "--with-system-zlib" "--with-system-icu" "--with-intl-api" @@ -51,6 +53,12 @@ in stdenv.mkDerivation rec { "--enable-shared-js" ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc"; + makeFlags = [ + "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" + ]; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + enableParallelBuilding = true; postInstall = ''