lol
1{ stdenv, fetchurl, pkgconfig, nspr, perl, python, zip }:
2
3stdenv.mkDerivation rec {
4 version = "185-1.0.0";
5 name = "spidermonkey-${version}";
6
7 src = fetchurl {
8 url = "http://ftp.mozilla.org/pub/mozilla.org/js/js${version}.tar.gz";
9 sha256 = "5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687";
10 };
11
12 propagatedBuildInputs = [ nspr ];
13
14 buildInputs = [ pkgconfig perl python zip ];
15
16 postUnpack = "sourceRoot=\${sourceRoot}/js/src";
17
18 preConfigure = ''
19 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr}/include/nspr"
20 export LIBXUL_DIST=$out
21 '';
22
23 # Explained below in configureFlags for ARM
24 patches = stdenv.lib.optionals stdenv.isArm [
25 ./findvanilla.patch
26 ];
27
28 patchFlags = "-p3";
29
30 # On the Sheevaplug, ARM, its nanojit thing segfaults in japi-tests in
31 # "make check". Disabling tracejit makes it work, but then it needs the
32 # patch findvanilla.patch do disable a checker about allocator safety. In case
33 # of polkit, which is what matters most, it does not override the allocator
34 # so the failure of that test does not matter much.
35 configureFlags = [ "--enable-threadsafe" "--with-system-nspr" ] ++
36 stdenv.lib.optionals stdenv.isArm [
37 "--with-cpu-arch=armv5t"
38 "--disable-tracejit" ];
39
40 # hack around a make problem, see https://github.com/NixOS/nixpkgs/issues/1279#issuecomment-29547393
41 preBuild = "touch -- {.,shell,jsapi-tests}/{-lpthread,-ldl}";
42
43 enableParallelBuilding = true;
44
45 doCheck = true;
46
47 preCheck = ''
48 rm jit-test/tests/sunspider/check-date-format-tofte.js # https://bugzil.la/600522
49
50 paxmark mr shell/js
51 paxmark mr jsapi-tests/jsapi-tests
52 '';
53
54 meta = with stdenv.lib; {
55 description = "Mozilla's JavaScript engine written in C/C++";
56 homepage = https://developer.mozilla.org/en/SpiderMonkey;
57 # TODO: MPL/GPL/LGPL tri-license.
58 maintainers = [ maintainers.goibhniu ];
59 };
60}
61