3
0
Fork 0
forked from mirrors/nixpkgs

Add Mozilla Rhino.

svn path=/nixpkgs/trunk/; revision=17884
This commit is contained in:
Ludovic Courtès 2009-10-19 14:47:04 +00:00
parent 928c0a9f07
commit 26a8597d6e
3 changed files with 166 additions and 0 deletions

View file

@ -0,0 +1,56 @@
{ fetchurl, stdenv, unzip, ant, javac, jvm }:
let
version = "1.7R2";
options = "-Dbuild.compiler=gcj"; # FIXME: We assume GCJ here.
xbeans = fetchurl {
url = "http://www.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
};
in
stdenv.mkDerivation {
name = "rhino-${version}";
src = fetchurl {
url = "ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip";
sha256 = "1p32hkghi6bkc3cf2dcqyaw5cjj7403mykcp0fy8f5bsnv0pszv7";
};
patches = [ ./gcj-type-mismatch.patch ];
preConfigure =
'' find -name \*.jar -or -name \*.class -exec rm -v {} \;
# The build process tries to download it by itself.
ensureDir "build/tmp-xbean"
ln -sv "${xbeans}" "build/tmp-xbean/xbean.zip"
'';
buildInputs = [ unzip ant javac jvm ];
buildPhase = "ant ${options} jar";
doCheck = false;
# FIXME: Install javadoc as well.
installPhase =
'' ensureDir "$out/lib/java"
cp -v *.jar "$out/lib/java"
'';
meta = {
description = "Mozilla Rhino: JavaScript for Java";
longDescription =
'' Rhino is an open-source implementation of JavaScript written
entirely in Java. It is typically embedded into Java applications
to provide scripting to end users.
'';
homepage = http://www.mozilla.org/rhino/;
licenses = [ "MPLv1.1" /* or */ "GPLv2+" ];
maintainers = [ stdenv.lib.maintainers.ludo ];
};
}

View file

@ -0,0 +1,103 @@
Work around GCJ bug #35410:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35410 .
diff --git a/src/org/mozilla/javascript/Arguments.java b/src/org/mozilla/javascript/Arguments.java
index d914294..d658f12 100644
--- a/src/org/mozilla/javascript/Arguments.java
+++ b/src/org/mozilla/javascript/Arguments.java
@@ -144,7 +144,7 @@ final class Arguments extends IdScriptableObject
synchronized (this) {
if (args[index] != NOT_FOUND) {
if (args == activation.originalArgs) {
- args = args.clone();
+ args = (Object[]) args.clone();
}
args[index] = value;
return;
@@ -162,7 +162,7 @@ final class Arguments extends IdScriptableObject
synchronized (this) {
if (args[index] != NOT_FOUND) {
if (args == activation.originalArgs) {
- args = args.clone();
+ args = (Object[]) args.clone();
}
args[index] = NOT_FOUND;
return;
diff --git a/src/org/mozilla/javascript/FunctionObject.java b/src/org/mozilla/javascript/FunctionObject.java
index 1d6c752..3adc100 100644
--- a/src/org/mozilla/javascript/FunctionObject.java
+++ b/src/org/mozilla/javascript/FunctionObject.java
@@ -455,7 +455,7 @@ public class FunctionObject extends BaseFunction
Object converted = convertArg(cx, scope, arg, typeTags[i]);
if (arg != converted) {
if (invokeArgs == args) {
- invokeArgs = args.clone();
+ invokeArgs = (Object[]) args.clone();
}
invokeArgs[i] = converted;
}
diff --git a/src/org/mozilla/javascript/Interpreter.java b/src/org/mozilla/javascript/Interpreter.java
index f7f544d..e125e2f 100644
--- a/src/org/mozilla/javascript/Interpreter.java
+++ b/src/org/mozilla/javascript/Interpreter.java
@@ -285,9 +285,9 @@ public class Interpreter implements Evaluator
// clone stack but keep varSource to point to values
// from this frame to share variables.
- copy.stack = stack.clone();
- copy.stackAttributes = stackAttributes.clone();
- copy.sDbl = sDbl.clone();
+ copy.stack = (Object[]) stack.clone();
+ copy.stackAttributes = (int[]) stackAttributes.clone();
+ copy.sDbl = (double[]) sDbl.clone();
copy.frozen = false;
return copy;
diff --git a/src/org/mozilla/javascript/NativeJavaClass.java b/src/org/mozilla/javascript/NativeJavaClass.java
index f72f9e7..25c6757 100644
--- a/src/org/mozilla/javascript/NativeJavaClass.java
+++ b/src/org/mozilla/javascript/NativeJavaClass.java
@@ -271,7 +271,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
Object x = Context.jsToJava(arg, argTypes[i]);
if (x != arg) {
if (args == origArgs) {
- args = origArgs.clone();
+ args = (Object[]) origArgs.clone();
}
args[i] = x;
}
diff --git a/src/org/mozilla/javascript/NativeJavaMethod.java b/src/org/mozilla/javascript/NativeJavaMethod.java
index b6eaf8b..dc699a0 100644
--- a/src/org/mozilla/javascript/NativeJavaMethod.java
+++ b/src/org/mozilla/javascript/NativeJavaMethod.java
@@ -213,7 +213,7 @@ public class NativeJavaMethod extends BaseFunction
Object coerced = Context.jsToJava(arg, argTypes[i]);
if (coerced != arg) {
if (origArgs == args) {
- args = args.clone();
+ args = (Object[]) args.clone();
}
args[i] = coerced;
}
diff --git a/src/org/mozilla/javascript/regexp/NativeRegExp.java b/src/org/mozilla/javascript/regexp/NativeRegExp.java
index 0bae489..f7124bf 100644
--- a/src/org/mozilla/javascript/regexp/NativeRegExp.java
+++ b/src/org/mozilla/javascript/regexp/NativeRegExp.java
@@ -2168,7 +2168,7 @@ System.out.println("Testing at " + gData.cp + ", op = " + op);
// XXX: If backTrackData will no longer be used, then
// there is no need to clone backTrackData.parens
if (backTrackData.parens != null) {
- gData.parens = backTrackData.parens.clone();
+ gData.parens = (long[]) backTrackData.parens.clone();
}
gData.cp = backTrackData.cp;
@@ -2708,7 +2708,7 @@ class REBackTrackData {
continuation_pc = pc;
lastParen = gData.lastParen;
if (gData.parens != null) {
- parens = gData.parens.clone();
+ parens = (long[]) gData.parens.clone();
}
cp = gData.cp;
stateStackTop = gData.stateStackTop;

View file

@ -4366,6 +4366,13 @@ let
};
redland_1_0_8 = redland.passthru.function { version = "1.0.8"; };
rhino = import ../development/libraries/java/rhino {
inherit fetchurl stdenv unzip;
ant = apacheAntGcj;
javac = gcj;
jvm = gcj;
};
rte = import ../development/libraries/rte {
inherit fetchurl stdenv;
};