1{ stdenv, fetchurl, unzip, setJavaClassPath, freetype }:
2let
3 jdk = stdenv.mkDerivation {
4 name = "openjdk-7u60b30";
5
6 # From https://github.com/alexkasko/openjdk-unofficial-builds
7 src = fetchurl {
8 url = https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u60-unofficial-macosx-x86_64-bundle.zip;
9 sha256 = "af510a4d566712d82c17054bb39f91d98c69a85586e244c6123669a0bd4b7401";
10 };
11
12 buildInputs = [ unzip freetype ];
13
14 installPhase = ''
15 mv */Contents/Home $out
16
17 # jni.h expects jni_md.h to be in the header search path.
18 ln -s $out/include/darwin/*_md.h $out/include/
19 '';
20
21 preFixup = ''
22 # Propagate the setJavaClassPath setup hook from the JRE so that
23 # any package that depends on the JRE has $CLASSPATH set up
24 # properly.
25 mkdir -p $out/nix-support
26 printWords ${setJavaClassPath} > $out/nix-support/propagated-native-build-inputs
27
28 install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/jre/lib/libfontmanager.dylib
29
30 # Set JAVA_HOME automatically.
31 cat <<EOF >> $out/nix-support/setup-hook
32 if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
33 EOF
34 '';
35
36 passthru = {
37 jre = jdk;
38 home = jdk;
39 };
40
41 meta.platforms = stdenv.lib.platforms.darwin;
42
43 };
44in jdk