diff --git a/pkgs/development/libraries/java/classpath/default.nix b/pkgs/development/libraries/java/classpath/default.nix new file mode 100644 index 00000000000..f3231ab4ee7 --- /dev/null +++ b/pkgs/development/libraries/java/classpath/default.nix @@ -0,0 +1,59 @@ +{ fetchurl, stdenv, javac, jvm, antlr, pkgconfig, gtk, gconf }: + +stdenv.mkDerivation rec { + name = "classpath-0.98"; + + src = fetchurl { + url = "mirror://gnu/classpath/${name}.tar.gz"; + sha256 = "0gxcdysw36vk3dpylg6f44c0fc8g10ayyb521l8bcygz9p6ml6sh"; + }; + + patches = [ ./missing-casts.patch ]; + + buildInputs = [ javac jvm antlr pkgconfig gtk gconf ]; + + configurePhase = '' + # GCJ tries to compile all of Classpath during the `configure' run when + # trying to build in the source tree (see + # http://www.mail-archive.com/classpath@gnu.org/msg15079.html), thus we + # build out-of-tree. + mkdir ../build + cd ../build + echo "building in \`$PWD'" + + ../${name}/configure --prefix="$out" \ + --enable-fast-install --disable-dependency-tracking \ + ${configureFlags} + ''; + + /* Plug-in support requires Xulrunner and all that. Maybe someday, + optionally. + + Compilation with `-Werror' is disabled because of this: + + native/jni/native-lib/cpnet.c: In function 'cpnet_addMembership': + native/jni/native-lib/cpnet.c:583: error: dereferencing type-punned pointer will break strict-aliasing rules + native/jni/native-lib/cpnet.c: In function 'cpnet_dropMembership': + native/jni/native-lib/cpnet.c:598: error: dereferencing type-punned pointer will break strict-aliasing rules + + */ + + configureFlags = "--disable-Werror --disable-plugin --with-antlr-jar=${antlr}/lib/antlr.jar"; + + meta = { + description = "GNU Classpath, essential libraries for Java"; + + longDescription = '' + GNU Classpath, Essential Libraries for Java, is a GNU project to create + free core class libraries for use with virtual machines and compilers + for the Java programming language. + ''; + + homepage = http://www.gnu.org/software/classpath/; + + # The exception makes it similar to LGPLv2+ AFAICS. + license = "GPLv2+ + exception"; + + maintainers = [ stdenv.lib.maintainers.ludo ]; + }; +} diff --git a/pkgs/development/libraries/java/classpath/missing-casts.patch b/pkgs/development/libraries/java/classpath/missing-casts.patch new file mode 100644 index 00000000000..863ca2cac8c --- /dev/null +++ b/pkgs/development/libraries/java/classpath/missing-casts.patch @@ -0,0 +1,80 @@ +Add missing casts. The GCC folks applied a similar patch in +GCC's own copy of Classpath: +http://gcc.gnu.org/ml/java/2007-05/msg00039.html . + +--- classpath-0.98/javax/management/NotificationBroadcasterSupport.java 2009-07-30 16:52:08.000000000 +0200 ++++ classpath-0.98/javax/management/NotificationBroadcasterSupport.java 2009-07-30 16:51:58.000000000 +0200 +@@ -218,7 +218,7 @@ + { + if (info == null || info.length == 0) + return new MBeanNotificationInfo[0]; +- return info.clone(); ++ return (MBeanNotificationInfo[]) info.clone(); + } + + /** + +--- classpath-0.98/java/util/concurrent/CopyOnWriteArrayList.java 2008-03-27 18:39:25.000000000 +0100 ++++ classpath-0.98/java/util/concurrent/CopyOnWriteArrayList.java 2009-07-30 17:08:30.000000000 +0200 +@@ -147,7 +148,7 @@ public class CopyOnWriteArrayList + */ + public CopyOnWriteArrayList(E[] array) + { +- data = array.clone(); ++ data = (E[]) array.clone(); + } + + /** +@@ -364,7 +365,7 @@ public class CopyOnWriteArrayList + public synchronized E set(int index, E e) + { + E result = data[index]; +- E[] newData = data.clone(); ++ E[] newData = (E[]) data.clone(); + newData[index] = e; + data = newData; + return result; + +--- classpath-0.98/java/util/EnumMap.java 2007-07-24 17:26:36.000000000 +0200 ++++ classpath-0.98/java/util/EnumMap.java 2009-07-30 17:12:19.000000000 +0200 +@@ -398,7 +398,7 @@ public class EnumMap, + // Can't happen. + result = null; + } +- result.store = store.clone(); ++ result.store = (V[]) store.clone(); + return result; + } + +--- classpath-0.98/gnu/java/lang/reflect/GenericSignatureParser.java 2008-03-01 11:13:31.000000000 +0100 ++++ classpath-0.98/gnu/java/lang/reflect/GenericSignatureParser.java 2009-07-30 17:14:24.000000000 +0200 +@@ -75,7 +75,7 @@ final class TypeVariableImpl extends Typ + public Type[] getBounds() + { + resolve(bounds); +- return bounds.clone(); ++ return (Type[]) bounds.clone(); + } + + public GenericDeclaration getGenericDeclaration() +@@ -154,7 +154,7 @@ final class ParameterizedTypeImpl extend + + public Type[] getActualTypeArguments() + { +- return typeArgs.clone(); ++ return (Type[]) typeArgs.clone(); + } + + public Type getRawType() + +--- classpath-0.98/external/jsr166/java/util/ArrayDeque.java 2006-12-10 21:25:40.000000000 +0100 ++++ classpath-0.98/external/jsr166/java/util/ArrayDeque.java 2009-07-30 17:15:35.000000000 +0200 +@@ -787,7 +790,7 @@ public class ArrayDeque extends Abstr + ArrayDeque result = (ArrayDeque) super.clone(); + // Classpath local: we don't have Arrays.copyOf yet. + // result.elements = Arrays.copyOf(elements, elements.length); +- result.elements = elements.clone(); ++ result.elements = (E[]) elements.clone(); + return result; + + } catch (CloneNotSupportedException e) { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2053f94c103..19fea7ec2f9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2831,6 +2831,14 @@ let inherit (xlibs) libX11 xf86vidmodeproto libXmu libXxf86vm; }; + classpath = import ../development/libraries/java/classpath { + javac = gcj; + jvm = gcj; + inherit fetchurl stdenv pkgconfig antlr; + inherit (gtkLibs) gtk; + gconf = gnome.GConf; + }; + clearsilver = import ../development/libraries/clearsilver { inherit fetchurl stdenv python; }; diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index 8f18a79cbc4..43479a11a03 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -88,6 +88,7 @@ in { cdrkit = linux; chatzilla = linux; cksfv = all; + classpath = linux; clisp = linux; cmake = all; compiz = linux;