1{ fetchurl, lib, stdenv, unzip, ant, javac, jvm }:
2
3let
4 version = "1.7R2";
5
6 xbeans = fetchurl {
7 url = "http://archive.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
8 sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
9 };
10in
11
12stdenv.mkDerivation {
13 pname = "rhino";
14 inherit 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 nativeBuildInputs = [ unzip ];
35 buildInputs = [ ant javac jvm ];
36
37 buildPhase = "ant jar";
38 doCheck = false;
39
40 # FIXME: Install javadoc as well.
41 installPhase =
42 ''
43 mkdir -p "$out/share/java"
44 cp -v *.jar "$out/share/java"
45 '';
46
47 meta = with lib; {
48 description = "An implementation of JavaScript written in Java";
49
50 longDescription =
51 '' Rhino is an open-source implementation of JavaScript written
52 entirely in Java. It is typically embedded into Java applications
53 to provide scripting to end users.
54 '';
55
56 homepage = "http://www.mozilla.org/rhino/";
57
58 license = with licenses; [ mpl11 /* or */ gpl2Plus ];
59 platforms = platforms.linux ++ platforms.darwin;
60 };
61}