2019-08-01 22:22:12 +01:00
|
|
|
{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, buildPackages
|
2018-12-13 09:57:27 +00:00
|
|
|
, which, readline, zlib, icu }:
|
2018-09-06 07:02:16 +01:00
|
|
|
|
2019-08-01 22:22:12 +01:00
|
|
|
with stdenv.lib;
|
|
|
|
|
2018-09-06 07:02:16 +01:00
|
|
|
let
|
2019-10-15 10:26:59 +01:00
|
|
|
version = "60.9.0";
|
2019-08-13 22:52:01 +01:00
|
|
|
in stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "spidermonkey";
|
|
|
|
inherit version;
|
2018-09-06 07:02:16 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
|
2019-10-15 10:26:59 +01:00
|
|
|
sha256 = "0gy5x2rnnbkqmjd9sq93s3q5na9nkba68xwpizild7k6qn63qicz";
|
2018-09-06 07:02:16 +01:00
|
|
|
};
|
|
|
|
|
2019-10-15 10:26:59 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
setOutputFlags = false; # Configure script only understands --includedir
|
|
|
|
|
2018-12-13 09:57:27 +00:00
|
|
|
buildInputs = [ readline zlib icu ];
|
2018-09-06 07:02:16 +01:00
|
|
|
nativeBuildInputs = [ autoconf213 pkgconfig perl which python2 zip ];
|
|
|
|
|
|
|
|
patches = [
|
2019-10-15 10:26:59 +01:00
|
|
|
# Fixed in 62.0
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1415202
|
2018-09-06 07:02:16 +01:00
|
|
|
(fetchpatch {
|
2019-10-15 10:26:59 +01:00
|
|
|
url = "https://src.fedoraproject.org/rpms/mozjs60/raw/a1b605c73f382db25977cb2d4d70a3ba2ff85b92/f/Always-use-the-equivalent-year-to-determine-the-time-zone.patch";
|
|
|
|
sha256 = "12i225qbzlyfj2disms50zrr5jy8zgn2cc4rgsg58sfgf1bn7150";
|
2018-09-06 07:02:16 +01:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export CXXFLAGS="-fpermissive"
|
|
|
|
export LIBXUL_DIST=$out
|
2019-08-01 22:22:12 +01:00
|
|
|
export PYTHON="${buildPackages.python2.interpreter}"
|
2018-09-06 07:02:16 +01:00
|
|
|
|
|
|
|
# We can't build in js/src/, so create a build dir
|
|
|
|
mkdir obj
|
|
|
|
cd obj/
|
|
|
|
configureScript=../js/src/configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-icu"
|
|
|
|
"--with-intl-api"
|
|
|
|
"--enable-readline"
|
|
|
|
"--enable-shared-js"
|
|
|
|
"--enable-posix-nspr-emulation"
|
|
|
|
"--disable-jemalloc"
|
2018-12-13 09:57:27 +00:00
|
|
|
# Fedora and Arch disable optimize, but it doesn't seme to be necessary
|
|
|
|
# It turns on -O3 which some gcc version had a problem with:
|
|
|
|
# https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e
|
|
|
|
"--enable-optimize"
|
2018-09-06 07:02:16 +01:00
|
|
|
"--enable-release"
|
2019-08-01 22:22:12 +01:00
|
|
|
] ++ 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}"
|
2018-09-06 07:02:16 +01:00
|
|
|
];
|
|
|
|
|
2019-08-01 22:22:12 +01:00
|
|
|
configurePlatforms = [];
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
2018-12-13 09:57:27 +00:00
|
|
|
# Remove unnecessary static lib
|
|
|
|
preFixup = ''
|
2019-10-15 10:26:59 +01:00
|
|
|
moveToOutput bin/js60-config "$dev"
|
2018-12-13 09:57:27 +00:00
|
|
|
rm $out/lib/libjs_static.ajs
|
2019-10-15 10:26:59 +01:00
|
|
|
ln -s $out/bin/js60 $out/bin/js
|
2018-12-13 09:57:27 +00:00
|
|
|
'';
|
|
|
|
|
2018-09-06 07:02:16 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Mozilla's JavaScript engine written in C/C++";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://developer.mozilla.org/en/SpiderMonkey";
|
2018-09-06 07:02:16 +01:00
|
|
|
license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license.
|
|
|
|
maintainers = [ maintainers.abbradar ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|