1{ fetchurl, stdenv, unzip, ant, javac, jvm }:
2
3let
4 version = "1.7R2";
5 options = "-Dbuild.compiler=gcj"; # FIXME: We assume GCJ here.
6
7 xbeans = fetchurl {
8 url = "http://archive.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
9 sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
10 };
11in
12
13stdenv.mkDerivation {
14 name = "rhino-${version}";
15
16 src = fetchurl {
17 url = "mirror://mozilla/js/rhino1_7R2.zip";
18 sha256 = "1p32hkghi6bkc3cf2dcqyaw5cjj7403mykcp0fy8f5bsnv0pszv7";
19 };
20
21 patches = [ ./gcj-type-mismatch.patch ];
22
23 hardeningDisable = [ "fortify" "format" ];
24
25 preConfigure =
26 ''
27 find -name \*.jar -or -name \*.class -exec rm -v {} \;
28
29 # The build process tries to download it by itself.
30 mkdir -p "build/tmp-xbean"
31 ln -sv "${xbeans}" "build/tmp-xbean/xbean.zip"
32 '';
33
34 buildInputs = [ unzip ant javac jvm ];
35
36 buildPhase = "ant ${options} jar";
37 doCheck = false;
38
39 # FIXME: Install javadoc as well.
40 installPhase =
41 ''
42 mkdir -p "$out/share/java"
43 cp -v *.jar "$out/share/java"
44 '';
45
46 meta = with stdenv.lib; {
47 description = "An implementation of JavaScript written in Java";
48
49 longDescription =
50 '' Rhino is an open-source implementation of JavaScript written
51 entirely in Java. It is typically embedded into Java applications
52 to provide scripting to end users.
53 '';
54
55 homepage = http://www.mozilla.org/rhino/;
56
57 license = with licenses; [ mpl11 /* or */ gpl2Plus ];
58 platforms = platforms.linux;
59 };
60}