diff --git a/pkgs/development/compilers/openjdk-darwin/default.nix b/pkgs/development/compilers/openjdk-darwin/default.nix index ff9f12f8023..3e4835c8b53 100644 --- a/pkgs/development/compilers/openjdk-darwin/default.nix +++ b/pkgs/development/compilers/openjdk-darwin/default.nix @@ -1,6 +1,6 @@ -{stdenv, fetchurl, ...}: +{ stdenv, fetchurl, setJavaClassPath }: let -jdk = stdenv.mkDerivation { + jdk = stdenv.mkDerivation { name = "openjdk6-b16-24_apr_2009-r1"; src = fetchurl { @@ -11,6 +11,23 @@ jdk = stdenv.mkDerivation { installPhase = '' mkdir -p $out cp -vR * $out/ + + # jni.h expects jni_md.h to be in the header search path. + ln -s $out/include/darwin/*_md.h $out/include/ + ''; + + preFixup = '' + # Propagate the setJavaClassPath setup hook from the JRE so that + # any package that depends on the JRE has $CLASSPATH set up + # properly. + mkdir -p $out/nix-support + echo -n "${setJavaClassPath}" > $out/nix-support/propagated-native-build-inputs + + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat < $out/nix-support/setup-hook + if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi + EOF ''; passthru.jre = jdk;