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