about summary refs log tree commit diff
path: root/pkgs/development/interpreters/spidermonkey/default.nix
blob: 1fe4b90b2b80b1e6063d1dc1292d3187121b7d5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ stdenv, fetchurl, readline }:

stdenv.mkDerivation rec {
  name = "spidermonkey-1.7";

  src = fetchurl {
    url = mirror://mozilla/js/js-1.7.0.tar.gz;
    sha256 = "12v6v2ccw1y6ng3kny3xw0lfs58d1klylqq707k0x04m707kydj4";
  };

  hardeningDisable = [ "format" ]
    ++ stdenv.lib.optional stdenv.isi686 "stackprotector";

  buildInputs = [ readline ];

  postUnpack = "sourceRoot=\${sourceRoot}/src";

  makefileExtra = ./Makefile.extra;
  makefile = "Makefile.ref";

  patchPhase =
    ''
      cat ${makefileExtra} >> ${makefile}
      sed -e 's/ -ltermcap/ -lncurses/' -i ${makefile}
    '';

  CFLAGS = "-DPIC -fPIC -DJS_C_STRINGS_ARE_UTF8";

  makeFlags = "-f ${makefile} JS_DIST=\${out} BUILD_OPT=1 JS_READLINE=1";

  meta = with stdenv.lib; {
    description = "Mozilla's JavaScript engine written in C/C++";
    homepage = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey";
    license = licenses.mpl20;
    platforms = platforms.all;
  };
}