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