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