about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/openjdk
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/openjdk')
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/004_add-fontconfig.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/005_enable-infinality.patch261
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/11.nix164
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/8.nix256
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/bootstrap.nix40
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch13
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix58
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix59
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix49
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch14
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch15
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/generate-cacerts.pl366
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/make-bootstrap.nix31
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch30
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch21
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch24
-rw-r--r--nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch26
18 files changed, 1455 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/004_add-fontconfig.patch b/nixpkgs/pkgs/development/compilers/openjdk/004_add-fontconfig.patch
new file mode 100644
index 000000000000..8172bc821905
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/004_add-fontconfig.patch
@@ -0,0 +1,14 @@
+This patch was downloaded from https://aur.archlinux.org/cgit/aur.git/tree/?h=java8-openjdk
+More info can be found at http://www.infinality.net/forum/viewtopic.php?f=2&t=275
+diff -ur a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
+--- a/jdk/make/lib/Awt2dLibraries.gmk	2015-07-13 20:50:59.000000000 +0300
++++ b/jdk/make/lib/Awt2dLibraries.gmk	2015-08-24 12:12:22.930330643 +0300
+@@ -824,7 +824,7 @@
+     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
+         $(call SET_SHARED_LIBRARY_ORIGIN), \
+     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
+-    LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
++    LDFLAGS_SUFFIX_linux := -lfontconfig -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
+     LDFLAGS_SUFFIX_solaris := -lawt -lawt_headless -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+     LDFLAGS_SUFFIX_aix := -lawt -lawt_headless $(LIBM) $(LIBCXX) -ljava -ljvm,\
+     LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/005_enable-infinality.patch b/nixpkgs/pkgs/development/compilers/openjdk/005_enable-infinality.patch
new file mode 100644
index 000000000000..f8de96989967
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/005_enable-infinality.patch
@@ -0,0 +1,261 @@
+This patch was downloaded from https://aur.archlinux.org/cgit/aur.git/tree/?h=java8-openjdk
+More info can be found at http://www.infinality.net/forum/viewtopic.php?f=2&t=275
+diff -ur a/jdk/src/share/native/sun/font/freetypeScaler.c b/jdk/src/share/native/sun/font/freetypeScaler.c
+--- a/jdk/src/share/native/sun/font/freetypeScaler.c	2014-09-14 16:28:06.108295959 +0200
++++ b/jdk/src/share/native/sun/font/freetypeScaler.c	2014-09-14 16:28:45.569693174 +0200
+@@ -23,6 +23,9 @@
+  * questions.
+  */
+ 
++/* Use Infinality patches as default */
++#define INFINALITY
++
+ #include "jni.h"
+ #include "jni_util.h"
+ #include "jlong.h"
+@@ -38,6 +41,10 @@
+ #include FT_SIZES_H
+ #include FT_OUTLINE_H
+ #include FT_SYNTHESIS_H
++#ifdef INFINALITY
++#include FT_LCD_FILTER_H
++#include <fontconfig/fontconfig.h>
++#endif
+ 
+ #include "fontscaler.h"
+ 
+@@ -676,6 +683,147 @@ static void CopyFTSubpixelVToSubpixel(co
+     }
+ }
+ 
++#ifdef INFINALITY
++typedef struct {
++    FT_Render_Mode ftRenderMode;
++    int ftLoadFlags;
++    FT_LcdFilter ftLcdFilter;
++} RenderingProperties;
++
++static FcPattern* matchedPattern(const FcChar8* family, double ptSize) {
++    /*
++      we will create pattern to find our family and size in
++      fontconfig configuration, and then will return it's
++      properties:
++    */
++    FcPattern* fcPattern = 0;
++    fcPattern = FcPatternCreate();
++    FcValue fcValue;
++    fcValue.type = FcTypeString;
++    fcValue.u.s = family;
++    FcPatternAdd(fcPattern, FC_FAMILY, fcValue, FcTrue);
++    FcPatternAddBool(fcPattern, FC_SCALABLE, FcTrue);
++    FcPatternAddDouble(fcPattern, FC_SIZE, ptSize);
++    // TODO FcPatternAddInteger(pattern, FC_WEIGHT, weight_value);
++    // TODO FcPatternAddInteger(pattern, FC_SLANT, slant_value);
++    // TODO FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value);
++    // TODO FcPatternAddInteger(pattern, FC_WIDTH, stretch); 100 in most cases
++    FcConfigSubstitute(0, fcPattern, FcMatchPattern);
++    FcConfigSubstitute(0, fcPattern, FcMatchFont);
++    FcDefaultSubstitute(fcPattern);
++    FcResult res;
++
++    FcPattern *pattern = 0;
++    pattern = FcFontMatch(0, fcPattern, &res);
++    FcPatternDestroy(fcPattern);
++    return pattern;
++}
++
++static void readFontconfig(const FcChar8* family, double ptSize, jint aaType, RenderingProperties* rp) {
++
++    FcPattern *pattern = matchedPattern(family, ptSize);
++
++    int ftLoadFalgs = FT_LOAD_DEFAULT;
++    FT_Render_Mode ftRenderMode;
++    FT_LcdFilter ftLcdFilter;
++    char horizontal = 1;
++    FcBool b;
++
++    // subpixel order:
++    if (aaType == TEXT_AA_ON)
++        ftRenderMode = FT_RENDER_MODE_NORMAL;
++    else if (aaType == TEXT_AA_OFF)
++        ftRenderMode = FT_RENDER_MODE_MONO;
++    else if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &b) == FcResultMatch)
++        if (b) {
++            int subpixel = FC_RGBA_UNKNOWN;
++            FcPatternGetInteger(pattern, FC_RGBA, 0, &subpixel);
++            if (subpixel == FC_RGBA_UNKNOWN)
++                subpixel = FC_RGBA_NONE;
++                switch (subpixel) {
++                case FC_RGBA_NONE:
++                    ftRenderMode = FT_RENDER_MODE_NORMAL;
++                    break;
++                case FC_RGBA_RGB:
++                case FC_RGBA_BGR:
++                    ftRenderMode = FT_RENDER_MODE_LCD;
++                    horizontal = 1;
++                    break;
++                case FC_RGBA_VRGB:
++                case FC_RGBA_VBGR:
++                    ftRenderMode = FT_RENDER_MODE_LCD_V;
++                    horizontal = 0;
++                    break;
++                default:
++                    break;
++                }
++            } else {
++                ftRenderMode = FT_RENDER_MODE_NORMAL;
++            }
++
++    // loading mode:
++    if (aaType == TEXT_AA_OFF)
++        ftLoadFalgs |= FT_LOAD_TARGET_MONO;
++    else {
++        int hint_style = FC_HINT_NONE;
++        FcPatternGetInteger(pattern, FC_HINT_STYLE, 0, &hint_style);
++        switch (hint_style) {
++        case FC_HINT_NONE:
++            ftLoadFalgs |= FT_LOAD_NO_HINTING;
++            break;
++        case FC_HINT_SLIGHT:
++            ftLoadFalgs |= FT_LOAD_TARGET_LIGHT;
++            break;
++        case FC_HINT_MEDIUM:
++            ftLoadFalgs |= FT_LOAD_TARGET_NORMAL;
++            break;
++        case FC_HINT_FULL:
++            if (aaType == TEXT_AA_ON)
++                ftLoadFalgs |= FT_LOAD_TARGET_NORMAL;
++            else
++                ftLoadFalgs |= horizontal ? FT_LOAD_TARGET_LCD : FT_LOAD_TARGET_LCD_V;
++            break;
++        default:
++            // what else to use as default?
++            ftLoadFalgs |= FT_LOAD_TARGET_NORMAL;
++            break;
++        }
++    }
++
++    // autohinting:
++    if (FcPatternGetBool(pattern, FC_AUTOHINT, 0, &b) == FcResultMatch)
++        if (b)
++            ftLoadFalgs |= FT_LOAD_FORCE_AUTOHINT;
++
++    // LCD filter:
++    int filter = FC_LCD_DEFAULT;
++    FcPatternGetInteger(pattern, FC_LCD_FILTER, 0, &filter);
++    switch (filter) {
++    case FC_LCD_NONE:
++        ftLcdFilter = FT_LCD_FILTER_NONE;
++        break;
++    case FC_LCD_DEFAULT:
++        ftLcdFilter = FT_LCD_FILTER_DEFAULT;
++        break;
++    case FC_LCD_LIGHT:
++        ftLcdFilter = FT_LCD_FILTER_LIGHT;
++        break;
++    case FC_LCD_LEGACY:
++        ftLcdFilter = FT_LCD_FILTER_LEGACY;
++        break;
++    default:
++        // new unknown lcd filter type?! will use default one:
++        ftLcdFilter = FT_LCD_FILTER_DEFAULT;
++        break;
++    }
++
++    FcPatternDestroy(pattern);
++
++    rp->ftRenderMode = ftRenderMode;
++    rp->ftLoadFlags = ftLoadFalgs;
++    rp->ftLcdFilter = ftLcdFilter;
++}
++#endif
+ 
+ /*
+  * Class:     sun_font_FreetypeFontScaler
+@@ -691,7 +839,9 @@ Java_sun_font_FreetypeFontScaler_getGlyp
+     UInt16 width, height;
+     GlyphInfo *glyphInfo;
+     int glyph_index;
++#ifndef INFINALITY
+     int renderFlags = FT_LOAD_RENDER, target;
++#endif
+     FT_GlyphSlot ftglyph;
+ 
+     FTScalerContext* context =
+@@ -709,6 +859,11 @@ Java_sun_font_FreetypeFontScaler_getGlyp
+         return ptr_to_jlong(getNullGlyphImage());
+     }
+ 
++#ifdef INFINALITY
++    RenderingProperties renderingProperties;
++    readFontconfig((const FcChar8 *) scalerInfo->face->family_name,
++                   context->ptsz, context->aaType, &renderingProperties);
++#else
+     /* if algorithmic styling is required then we do not request bitmap */
+     if (context->doBold || context->doItalize) {
+         renderFlags =  FT_LOAD_DEFAULT;
+@@ -731,10 +886,17 @@ Java_sun_font_FreetypeFontScaler_getGlyp
+         target = FT_LOAD_TARGET_LCD_V;
+     }
+     renderFlags |= target;
++#endif
+ 
+     glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode);
+ 
++#ifdef INFINALITY
++    FT_Library_SetLcdFilter(scalerInfo->library, renderingProperties.ftLcdFilter);
++    error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderingProperties.ftLoadFlags);
++#else
+     error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags);
++#endif
++
+     if (error) {
+         //do not destroy scaler yet.
+         //this can be problem of particular context (e.g. with bad transform)
+@@ -753,9 +915,13 @@ Java_sun_font_FreetypeFontScaler_getGlyp
+ 
+     /* generate bitmap if it is not done yet
+      e.g. if algorithmic styling is performed and style was added to outline */
++#ifdef INFINALITY
++    FT_Render_Glyph(ftglyph, renderingProperties.ftRenderMode);
++#else
+     if (ftglyph->format == FT_GLYPH_FORMAT_OUTLINE) {
+         FT_Render_Glyph(ftglyph, FT_LOAD_TARGET_MODE(target));
+     }
++#endif
+ 
+     width  = (UInt16) ftglyph->bitmap.width;
+     height = (UInt16) ftglyph->bitmap.rows;
+@@ -969,7 +1135,9 @@ Java_sun_font_FreetypeFontScaler_getGlyp
+ static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
+         FTScalerContext *context, FTScalerInfo* scalerInfo,
+         jint glyphCode, jfloat xpos, jfloat ypos) {
++#ifndef INFINALITY
+     int renderFlags;
++#endif
+     int glyph_index;
+     FT_Error error;
+     FT_GlyphSlot ftglyph;
+@@ -984,11 +1152,22 @@ static FT_Outline* getFTOutline(JNIEnv*
+         return NULL;
+     }
+ 
++#ifdef INFINALITY
++    RenderingProperties renderingProperties;
++    readFontconfig((const FcChar8 *) scalerInfo->face->family_name,
++                   context->ptsz, context->aaType, &renderingProperties);
++#else
+     renderFlags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
++#endif
+ 
+     glyph_index = FT_Get_Char_Index(scalerInfo->face, glyphCode);
+ 
++#ifdef INFINALITY
++    error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderingProperties.ftLoadFlags);
++#else
+     error = FT_Load_Glyph(scalerInfo->face, glyphCode, renderFlags);
++#endif
++
+     if (error) {
+         return NULL;
+     }
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/11.nix b/nixpkgs/pkgs/development/compilers/openjdk/11.nix
new file mode 100644
index 000000000000..f2a566c87df6
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/11.nix
@@ -0,0 +1,164 @@
+{ stdenv, lib, fetchurl, bash, cpio, autoconf, pkgconfig, file, which, unzip, zip, cups, freetype
+, alsaLib, bootjdk, perl, liberation_ttf, fontconfig, zlib, lndir
+, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor, libXrandr
+, libjpeg, giflib
+, setJavaClassPath
+, minimal ? false
+, enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf
+}:
+
+let
+
+  /**
+   * The JDK libraries are in directories that depend on the CPU.
+   */
+  architecture =
+    if stdenv.hostPlatform.system == "i686-linux" then
+      "i386"
+    else "amd64";
+
+  major = "11";
+  update = ".0.2";
+  build = "9";
+  repover = "jdk-${major}${update}+${build}";
+
+  openjdk = stdenv.mkDerivation {
+    name = "openjdk-${major}${update}-b${build}";
+
+    src = fetchurl {
+      url = "http://hg.openjdk.java.net/jdk-updates/jdk${major}u/archive/${repover}.tar.gz";
+      sha256 = "0xc7nksvj72cgw8zrmvlcwaasinpij1j1959398a4nqvzpvpxg30";
+    };
+
+    nativeBuildInputs = [ pkgconfig ];
+    buildInputs = [
+      autoconf cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
+      libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst
+      libXi libXinerama libXcursor libXrandr lndir fontconfig
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      gtk3 gnome_vfs GConf glib
+    ];
+
+    patches = [
+      ./fix-java-home-jdk10.patch
+      ./read-truststore-from-env-jdk10.patch
+      ./currency-date-range-jdk10.patch
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      ./swing-use-gtk-jdk10.patch
+    ];
+
+    preConfigure = ''
+      chmod +x configure
+      substituteInPlace configure --replace /bin/bash "${bash}/bin/bash"
+
+      configureFlagsArray=(
+        "--with-boot-jdk=${bootjdk.home}"
+        "--with-update-version=${major}${update}"
+        "--with-build-number=${build}"
+        "--with-milestone=fcs"
+        "--enable-unlimited-crypto"
+        "--disable-debug-symbols"
+        "--with-zlib=system"
+        "--with-giflib=system"
+        "--with-stdc++lib=dynamic"
+
+        # glibc 2.24 deprecated readdir_r so we need this
+        # See https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg49006.html
+        "--with-extra-cflags=-Wno-error=deprecated-declarations -Wno-error=format-contains-nul -Wno-error=unused-result"
+    ''
+    + lib.optionalString (architecture == "amd64") " \"--with-jvm-features=zgc\""
+    + lib.optionalString minimal " \"--enable-headless-only\""
+    + ");"
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1306558
+    # https://github.com/JetBrains/jdk8u/commit/eaa5e0711a43d64874111254d74893fa299d5716
+    + stdenv.lib.optionalString stdenv.cc.isGNU ''
+      NIX_CFLAGS_COMPILE+=" -fno-lifetime-dse -fno-delete-null-pointer-checks -std=gnu++98 -Wno-error"
+    '';
+
+    NIX_LDFLAGS= lib.optionals (!minimal) [
+      "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      "-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"
+    ];
+
+    buildFlags = [ "all" ];
+
+    installPhase = ''
+      mkdir -p $out/lib/openjdk $out/share
+
+      cp -av build/*/images/jdk/* $out/lib/openjdk
+
+      # Remove some broken manpages.
+      rm -rf $out/lib/openjdk/man/ja*
+
+      # Mirror some stuff in top-level.
+      mkdir $out/include $out/share/man
+      ln -s $out/lib/openjdk/include/* $out/include/
+      ln -s $out/lib/openjdk/man/* $out/share/man/
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/linux/*_md.h $out/include/
+
+      # Remove crap from the installation.
+      rm -rf $out/lib/openjdk/demo
+      ${lib.optionalString minimal ''
+        rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
+      ''}
+
+      ln -s $out/lib/openjdk/bin $out/bin
+    '';
+
+    preFixup = ''
+      # Propagate the setJavaClassPath setup hook so that any package
+      # that depends on the JDK has $CLASSPATH set up properly.
+      mkdir -p $out/nix-support
+      #TODO or printWords?  cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
+      echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
+
+      # Set JAVA_HOME automatically.
+      mkdir -p $out/nix-support
+      cat <<EOF > $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
+      EOF
+    '';
+
+    postFixup = ''
+      # Build the set of output library directories to rpath against
+      LIBDIRS=""
+      for output in $outputs; do
+        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
+      done
+
+      # Add the local library paths to remove dependencies on the bootstrap
+      for output in $outputs; do
+        OUTPUTDIR=$(eval echo \$$output)
+        BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
+        echo "$BINLIBS" | while read i; do
+          patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
+          patchelf --shrink-rpath "$i" || true
+        done
+      done
+
+      # Test to make sure that we don't depend on the bootstrap
+      for output in $outputs; do
+        if grep -q -r '${bootjdk}' $(eval echo \$$output); then
+          echo "Extraneous references to ${bootjdk} detected"
+          exit 1
+        fi
+      done
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = http://openjdk.java.net/;
+      license = licenses.gpl2;
+      description = "The open-source Java Development Kit";
+      maintainers = with maintainers; [ edwtjo ];
+      platforms = ["i686-linux" "x86_64-linux"];
+    };
+
+    passthru = {
+      inherit architecture;
+      home = "${openjdk}/lib/openjdk";
+    };
+  };
+in openjdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/8.nix b/nixpkgs/pkgs/development/compilers/openjdk/8.nix
new file mode 100644
index 000000000000..a3a0a9d59346
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/8.nix
@@ -0,0 +1,256 @@
+{ stdenv, lib, fetchurl, bash, cpio, pkgconfig, file, which, unzip, zip, cups, freetype
+, alsaLib, bootjdk, cacert, perl, liberation_ttf, fontconfig, zlib, lndir
+, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor, libXrandr
+, libjpeg, giflib
+, setJavaClassPath
+, minimal ? false
+, enableInfinality ? true # font rendering patch
+, enableGnome2 ? true, gtk2, gnome_vfs, glib, GConf
+}:
+
+let
+
+  /**
+   * The JRE libraries are in directories that depend on the CPU.
+   */
+  architecture =
+    if stdenv.hostPlatform.system == "i686-linux" then
+      "i386"
+    else if stdenv.hostPlatform.system == "x86_64-linux" then
+      "amd64"
+    else
+      throw "openjdk requires i686-linux or x86_64 linux";
+
+  update = "202";
+  build = "ga";
+  baseurl = "http://hg.openjdk.java.net/jdk8u/jdk8u";
+  repover = "jdk8u${update}-${build}";
+  jdk8 = fetchurl {
+             url = "${baseurl}/archive/${repover}.tar.gz";
+             sha256 = "0asx7qkhmrlfmhrljck5gb3yp4v0aa8k35y4xfcph41x0m0mvrdb";
+          };
+  langtools = fetchurl {
+             url = "${baseurl}/langtools/archive/${repover}.tar.gz";
+             sha256 = "07q6l3slmi5fgwjnsk6bd8miv8glmw15w5f6yyvp8nlp2d54l33n";
+          };
+  hotspot = fetchurl {
+             url = "${baseurl}/hotspot/archive/${repover}.tar.gz";
+             sha256 = "01k4pwhn3nmkzdhdj1v58dgir4iwsj9mm2ml1541z31s53g037cq";
+          };
+  corba = fetchurl {
+             url = "${baseurl}/corba/archive/${repover}.tar.gz";
+             sha256 = "0v39kl2iiyh74p3cp6bjhshkwxpgbffza9abzjgp7cpdfhcc73p0";
+          };
+  jdk = fetchurl {
+             url = "${baseurl}/jdk/archive/${repover}.tar.gz";
+             sha256 = "0z1cy6aq09j25jyryj47rms15h5175p2h23fg5pv035zapf8nb1b";
+          };
+  jaxws = fetchurl {
+             url = "${baseurl}/jaxws/archive/${repover}.tar.gz";
+             sha256 = "0y0mk4sra9d29kgx842m5y4bz9gczc9ypkajv6m5igjv7sizzsv7";
+          };
+  jaxp = fetchurl {
+             url = "${baseurl}/jaxp/archive/${repover}.tar.gz";
+             sha256 = "07ssrjhffkdncxxhsbid21hlg51y7js3x7sb4g474vmmi3qj6vmb";
+          };
+  nashorn = fetchurl {
+             url = "${baseurl}/nashorn/archive/${repover}.tar.gz";
+             sha256 = "0r0b8ra0ibzbdpxz6nv6i2zrzh2j5sxgprpnl6gf4d9h0i29ickj";
+          };
+  openjdk8 = stdenv.mkDerivation {
+    name = "openjdk-8u${update}b${build}";
+
+    srcs = [ jdk8 langtools hotspot corba jdk jaxws jaxp nashorn ];
+    sourceRoot = ".";
+
+    outputs = [ "out" "jre" ];
+
+    nativeBuildInputs = [ pkgconfig ];
+    buildInputs = [
+      cpio file which unzip zip perl bootjdk zlib cups freetype alsaLib
+      libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst
+      libXi libXinerama libXcursor libXrandr lndir fontconfig
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      gtk2 gnome_vfs GConf glib
+    ];
+
+    #move the seven other source dirs under the main jdk8u directory,
+    #with version suffixes removed, as the remainder of the build will expect
+    prePatch = ''
+      mainDir=$(find . -maxdepth 1 -name jdk8u\*);
+      find . -maxdepth 1 -name \*jdk\* -not -name jdk8u\* | awk -F- '{print $1}' | while read p; do
+        mv $p-* $mainDir/$p
+      done
+      cd $mainDir
+    '';
+
+    patches = [
+      ./fix-java-home-jdk8.patch
+      ./read-truststore-from-env-jdk8.patch
+      ./currency-date-range-jdk8.patch
+    ] ++ lib.optionals (!minimal && enableInfinality) [
+      ./004_add-fontconfig.patch
+      ./005_enable-infinality.patch
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      ./swing-use-gtk-jdk8.patch
+    ];
+
+    preConfigure = ''
+      chmod +x configure
+      substituteInPlace configure --replace /bin/bash "${bash}/bin/bash"
+      substituteInPlace hotspot/make/linux/adlc_updater --replace /bin/sh "${stdenv.shell}"
+      substituteInPlace hotspot/make/linux/makefiles/dtrace.make --replace /usr/include/sys/sdt.h "/no-such-path"
+    ''
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1306558
+    # https://github.com/JetBrains/jdk8u/commit/eaa5e0711a43d64874111254d74893fa299d5716
+    + stdenv.lib.optionalString stdenv.cc.isGNU ''
+      NIX_CFLAGS_COMPILE+=" -fno-lifetime-dse -fno-delete-null-pointer-checks -std=gnu++98 -Wno-error"
+    '';
+
+    configureFlags = [
+      "--with-boot-jdk=${bootjdk.home}"
+      "--with-update-version=${update}"
+      "--with-build-number=${build}"
+      "--with-milestone=fcs"
+      "--enable-unlimited-crypto"
+      "--disable-debug-symbols"
+      "--disable-freetype-bundling"
+      "--with-zlib=system"
+      "--with-giflib=system"
+      "--with-stdc++lib=dynamic"
+
+      # glibc 2.24 deprecated readdir_r so we need this
+      # See https://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg49006.html
+      "--with-extra-cflags=\"-Wno-error=deprecated-declarations\""
+    ] ++ lib.optional minimal "--disable-headful";
+
+    NIX_LDFLAGS= lib.optionals (!minimal) [
+      "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic"
+    ] ++ lib.optionals (!minimal && enableGnome2) [
+      "-lgtk-x11-2.0" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2"
+    ];
+
+    buildFlags = [ "all" ];
+
+    doCheck = false; # fails with "No rule to make target 'y'."
+
+    installPhase = ''
+      mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk
+
+      cp -av build/*/images/j2sdk-image/* $out/lib/openjdk
+
+      # Remove some broken manpages.
+      rm -rf $out/lib/openjdk/man/ja*
+
+      # Mirror some stuff in top-level.
+      mkdir $out/include $out/share/man
+      ln -s $out/lib/openjdk/include/* $out/include/
+      ln -s $out/lib/openjdk/man/* $out/share/man/
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/linux/*_md.h $out/include/
+
+      # Remove crap from the installation.
+      rm -rf $out/lib/openjdk/demo $out/lib/openjdk/sample
+      ${lib.optionalString minimal ''
+        rm $out/lib/openjdk/jre/lib/${architecture}/{libjsound,libjsoundalsa,libsplashscreen,libawt*,libfontmanager}.so
+        rm $out/lib/openjdk/jre/bin/policytool
+        rm $out/lib/openjdk/bin/{policytool,appletviewer}
+      ''}
+
+      # Move the JRE to a separate output and setup fallback fonts
+      mv $out/lib/openjdk/jre $jre/lib/openjdk/
+      mkdir $out/lib/openjdk/jre
+      ${lib.optionalString (!minimal) ''
+        mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback
+        lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback
+      ''}
+      lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre
+
+      rm -rf $out/lib/openjdk/jre/bina
+      ln -s $out/lib/openjdk/bin $out/lib/openjdk/jre/bin
+
+      # Make sure cmm/*.pf are not symlinks:
+      # https://youtrack.jetbrains.com/issue/IDEA-147272
+      rm -rf $out/lib/openjdk/jre/lib/cmm
+      ln -s {$jre,$out}/lib/openjdk/jre/lib/cmm
+
+      # Remove duplicate binaries.
+      for i in $(cd $out/lib/openjdk/bin && echo *); do
+        if [ "$i" = java ]; then continue; fi
+        if cmp -s $out/lib/openjdk/bin/$i $jre/lib/openjdk/jre/bin/$i; then
+          ln -sfn $jre/lib/openjdk/jre/bin/$i $out/lib/openjdk/bin/$i
+        fi
+      done
+
+      # Generate certificates.
+      (
+        cd $jre/lib/openjdk/jre/lib/security
+        rm cacerts
+        perl ${./generate-cacerts.pl} $jre/lib/openjdk/jre/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
+      )
+
+      ln -s $out/lib/openjdk/bin $out/bin
+      ln -s $jre/lib/openjdk/jre/bin $jre/bin
+      ln -s $jre/lib/openjdk/jre $out/jre
+    '';
+
+    # FIXME: this is unnecessary once the multiple-outputs branch is merged.
+    preFixup = ''
+      prefix=$jre stripDirs "$STRIP" "$stripDebugList" "''${stripDebugFlags:--S}"
+      patchELF $jre
+      propagatedBuildInputs+=" $jre"
+
+      # Propagate the setJavaClassPath setup hook from the JRE so that
+      # any package that depends on the JRE has $CLASSPATH set up
+      # properly.
+      mkdir -p $jre/nix-support
+      printWords ${setJavaClassPath} > $jre/nix-support/propagated-build-inputs
+
+      # Set JAVA_HOME automatically.
+      mkdir -p $out/nix-support
+      cat <<EOF > $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out/lib/openjdk; fi
+      EOF
+    '';
+
+    postFixup = ''
+      # Build the set of output library directories to rpath against
+      LIBDIRS=""
+      for output in $outputs; do
+        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort | uniq | tr '\n' ':'):$LIBDIRS"
+      done
+
+      # Add the local library paths to remove dependencies on the bootstrap
+      for output in $outputs; do
+        OUTPUTDIR=$(eval echo \$$output)
+        BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
+        echo "$BINLIBS" | while read i; do
+          patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
+          patchelf --shrink-rpath "$i" || true
+        done
+      done
+
+      # Test to make sure that we don't depend on the bootstrap
+      for output in $outputs; do
+        if grep -q -r '${bootjdk}' $(eval echo \$$output); then
+          echo "Extraneous references to ${bootjdk} detected"
+          exit 1
+        fi
+      done
+    '';
+
+    meta = with stdenv.lib; {
+      homepage = http://openjdk.java.net/;
+      license = licenses.gpl2;
+      description = "The open-source Java Development Kit";
+      maintainers = with maintainers; [ edwtjo nequissimus ];
+      platforms = platforms.linux;
+    };
+
+    passthru = {
+      inherit architecture;
+      home = "${openjdk8}/lib/openjdk";
+    };
+  };
+in openjdk8
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/bootstrap.nix b/nixpkgs/pkgs/development/compilers/openjdk/bootstrap.nix
new file mode 100644
index 000000000000..e58888cc9ed8
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/bootstrap.nix
@@ -0,0 +1,40 @@
+{ stdenv
+, runCommand, fetchurl, zlib
+
+, version
+}:
+
+assert stdenv.hostPlatform.libc == "glibc";
+
+let
+  fetchboot = version: arch: sha256: fetchurl {
+    name = "openjdk${version}-bootstrap-${arch}-linux.tar.xz";
+    url  = "http://tarballs.nixos.org/openjdk/2018-03-31/${version}/${arch}-linux.tar.xz";
+    inherit sha256;
+  };
+
+  src = if stdenv.hostPlatform.system == "x86_64-linux" then
+    (if version == "10"    then fetchboot "10" "x86_64" "08085fsxc1qhqiv3yi38w8lrg3vm7s0m2yvnwr1c92v019806yq2"
+    else if version == "8" then fetchboot "8"  "x86_64" "18zqx6jhm3lizn9hh6ryyqc9dz3i96pwaz8f6nxfllk70qi5gvks"
+    else throw "No bootstrap jdk for version ${version}")
+  else if stdenv.hostPlatform.system == "i686-linux" then
+    (if version == "10"    then fetchboot "10" "i686" "1blb9gyzp8gfyggxvggqgpcgfcyi00ndnnskipwgdm031qva94p7"
+    else if version == "8" then fetchboot "8"  "i686" "1yx04xh8bqz7amg12d13rw5vwa008rav59mxjw1b9s6ynkvfgqq9"
+    else throw "No bootstrap for version")
+  else throw "No bootstrap jdk for system ${stdenv.hostPlatform.system}";
+
+  bootstrap = runCommand "openjdk-bootstrap" {
+    passthru.home = "${bootstrap}/lib/openjdk";
+  } ''
+    tar xvf ${src}
+    mv openjdk-bootstrap $out
+
+    LIBDIRS="$(find $out -name \*.so\* -exec dirname {} \; | sort | uniq | tr '\n' ':')"
+
+    find "$out" -type f -print0 | while IFS= read -r -d "" elf; do
+      isELF "$elf" || continue
+      patchelf --set-interpreter $(cat "${stdenv.cc}/nix-support/dynamic-linker") "$elf" || true
+      patchelf --set-rpath "${stdenv.cc.libc}/lib:${stdenv.cc.cc.lib}/lib:${zlib}/lib:$LIBDIRS" "$elf" || true
+    done
+  '';
+in bootstrap
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch b/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch
new file mode 100644
index 000000000000..e058eff07466
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch
@@ -0,0 +1,13 @@
+--- ./make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java
++++ ./make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java
+@@ -281,8 +281,8 @@
+             checkCurrencyCode(newCurrency);
+             String timeString = currencyInfo.substring(4, length - 4);
+             long time = format.parse(timeString).getTime();
+-            if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) * 365 * 24 * 60 * 60 * 1000) {
+-                throw new RuntimeException("time is more than 10 years from present: " + time);
++            if (Math.abs(time - System.currentTimeMillis()) > ((long) 20) * 365 * 24 * 60 * 60 * 1000) {
++                throw new RuntimeException("time is more than 20 years from present: " + time);
+             }
+             specialCaseCutOverTimes[specialCaseCount] = time;
+             specialCaseOldCurrencies[specialCaseCount] = oldCurrency;
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch b/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch
new file mode 100644
index 000000000000..2ff0fcc3d411
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch
@@ -0,0 +1,14 @@
+diff -Naur openjdk-7u65-b32-upstream/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java openjdk-7u65-b32/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java
+--- openjdk-7u65-b32-upstream/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java	2014-07-17 05:42:14.000000000 -0430
++++ openjdk-7u65-b32/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java	2014-12-30 10:15:50.327905933 -0430
+@@ -281,8 +281,8 @@
+             checkCurrencyCode(newCurrency);
+             String timeString = currencyInfo.substring(4, length - 4);
+             long time = format.parse(timeString).getTime();
+-            if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) * 365 * 24 * 60 * 60 * 1000) {
+-                throw new RuntimeException("time is more than 10 years from present: " + time);
++            if (Math.abs(time - System.currentTimeMillis()) > ((long) 20) * 365 * 24 * 60 * 60 * 1000) {
++                throw new RuntimeException("time is more than 20 years from present: " + time);
+             }
+             specialCaseCutOverTimes[specialCaseCount] = time;
+             specialCaseOldCurrencies[specialCaseCount] = oldCurrency;
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix
new file mode 100644
index 000000000000..61c2d57423e4
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/11.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, unzip, setJavaClassPath, freetype }:
+let
+  jce-policies = fetchurl {
+    # Ugh, unversioned URLs... I hope this doesn't change often enough to cause pain before we move to a Darwin source build of OpenJDK!
+    url    = "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip";
+    sha256 = "0nk7m0lgcbsvldq2wbfni2pzq8h818523z912i7v8hdcij5s48c0";
+  };
+
+  jdk = stdenv.mkDerivation rec {
+    name = "zulu11.2.3-jdk11.0.1";
+
+    src = fetchurl {
+      url = "https://cdn.azul.com/zulu/bin/${name}-macosx_x64.tar.gz";
+      sha256 = "1jxnxmy79inwf3146ygry1mzv3dj6yrzqll16j7dpr91x1p3dpqy";
+      curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/zulu-mac/";
+    };
+
+    buildInputs = [ unzip freetype ];
+
+    installPhase = ''
+      mkdir -p $out
+      mv * $out
+
+      unzip ${jce-policies}
+      mv -f ZuluJCEPolicies/*.jar $out/lib/security/
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/darwin/*_md.h $out/include/
+
+      if [ -f $out/LICENSE ]; then
+        install -D $out/LICENSE $out/share/zulu/LICENSE
+        rm $out/LICENSE
+      fi
+    '';
+
+    preFixup = ''
+      # Propagate the setJavaClassPath setup hook from the JDK so that
+      # any package that depends on the JDK has $CLASSPATH set up
+      # properly.
+      mkdir -p $out/nix-support
+      printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
+
+      install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/lib/libfontmanager.dylib
+
+      # Set JAVA_HOME automatically.
+      cat <<EOF >> $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
+      EOF
+    '';
+
+    passthru = {
+      home = jdk;
+    };
+
+    meta.platforms = stdenv.lib.platforms.darwin;
+
+  };
+in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
new file mode 100644
index 000000000000..7457ffceab1f
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/8.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchurl, unzip, setJavaClassPath, freetype }:
+let
+  jce-policies = fetchurl {
+    # Ugh, unversioned URLs... I hope this doesn't change often enough to cause pain before we move to a Darwin source build of OpenJDK!
+    url    = "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip";
+    sha256 = "0nk7m0lgcbsvldq2wbfni2pzq8h818523z912i7v8hdcij5s48c0";
+  };
+
+  jdk = stdenv.mkDerivation {
+    name = "zulu1.8.0_121-8.20.0.5";
+
+    src = fetchurl {
+      url = "http://cdn.azul.com/zulu/bin/zulu8.20.0.5-jdk8.0.121-macosx_x64.zip";
+      sha256 = "2a58bd1d9b0cbf0b3d8d1bcdd117c407e3d5a0ec01e2f53565c9bec5cf9ea78b";
+      curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/zulu-linux/";
+    };
+
+    buildInputs = [ unzip freetype ];
+
+    installPhase = ''
+      mkdir -p $out
+      mv * $out
+
+      unzip ${jce-policies}
+      mv -f ZuluJCEPolicies/*.jar $out/jre/lib/security/
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/darwin/*_md.h $out/include/
+
+      if [ -f $out/LICENSE ]; then
+        install -D $out/LICENSE $out/share/zulu/LICENSE
+        rm $out/LICENSE
+      fi
+    '';
+
+    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
+      printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
+
+      install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/jre/lib/libfontmanager.dylib
+
+      # Set JAVA_HOME automatically.
+      cat <<EOF >> $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
+      EOF
+    '';
+
+    passthru = {
+      jre = jdk;
+      home = jdk;
+    };
+
+    meta.platforms = stdenv.lib.platforms.darwin;
+
+  };
+in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix b/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix
new file mode 100644
index 000000000000..54239e58002f
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/darwin/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchurl, unzip, setJavaClassPath, freetype }:
+let
+  jdk = stdenv.mkDerivation {
+    name = "openjdk-7u60b30";
+
+    # From https://github.com/alexkasko/openjdk-unofficial-builds
+    src = fetchurl {
+      url = https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u60-unofficial-macosx-x86_64-bundle.zip;
+      sha256 = "af510a4d566712d82c17054bb39f91d98c69a85586e244c6123669a0bd4b7401";
+    };
+
+    buildInputs = [ unzip freetype ];
+
+    installPhase = ''
+      mv */Contents/Home $out
+
+      # jni.h expects jni_md.h to be in the header search path.
+      ln -s $out/include/darwin/*_md.h $out/include/
+
+      if [ -f $out/LICENSE ]; then
+        install -D $out/LICENSE $out/share/zulu/LICENSE
+        rm $out/LICENSE
+      fi
+    '';
+
+    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
+      printWords ${setJavaClassPath} > $out/nix-support/propagated-build-inputs
+
+      install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/jre/lib/libfontmanager.dylib
+
+      # Set JAVA_HOME automatically.
+      cat <<EOF >> $out/nix-support/setup-hook
+      if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
+      EOF
+    '';
+
+    passthru = {
+      jre = jdk;
+      home = jdk;
+    };
+
+    meta.platforms = stdenv.lib.platforms.darwin;
+
+  };
+in jdk
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch b/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch
new file mode 100644
index 000000000000..c037fde29722
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch
@@ -0,0 +1,14 @@
+--- a/src/hotspot/os/linux/os_linux.cpp	2017-07-04 23:09:02.533972226 -0400
++++ b/src/hotspot/os/linux/os_linux.cpp	2017-07-04 23:07:52.118338845 -0400
+@@ -2270,8 +2270,5 @@
+   assert(ret, "cannot locate libjvm");
+   char *rp = NULL;
+   if (ret && dli_fname[0] != '\0') {
+-    rp = os::Posix::realpath(dli_fname, buf, buflen);
+-  }
+-  if (rp == NULL) {
+-    return;
++    snprintf(buf, buflen, "%s", dli_fname);
+   }
+
+   if (Arguments::sun_java_launcher_is_altjvm()) {
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch b/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch
new file mode 100644
index 000000000000..6189412c999c
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch
@@ -0,0 +1,15 @@
+--- a/hotspot/src/os/linux/vm/os_linux.cpp  2015-02-04 21:14:39.000000000 +0100
++++ b/hotspot/src/os/linux/vm/os_linux.cpp  2015-05-19 16:17:29.960107613 +0200
+@@ -2304,10 +2304,8 @@
+   assert(ret, "cannot locate libjvm");
+   char *rp = NULL;
+   if (ret && dli_fname[0] != '\0') {
+-    rp = realpath(dli_fname, buf);
++    snprintf(buf, buflen, "%s", dli_fname);
+   }
+-  if (rp == NULL)
+-    return;
+
+   if (Arguments::created_by_gamma_launcher()) {
+     // Support for the gamma launcher.  Typical value for buf is
+
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/generate-cacerts.pl b/nixpkgs/pkgs/development/compilers/openjdk/generate-cacerts.pl
new file mode 100644
index 000000000000..3bdd42f7274f
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/generate-cacerts.pl
@@ -0,0 +1,366 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2007, 2008 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# generate-cacerts.pl generates a JKS keystore named 'cacerts' from
+# OpenSSL's certificate bundle using OpenJDK's keytool.
+
+# First extract each of OpenSSL's bundled certificates into its own
+# aliased filename.
+
+# Downloaded from http://cvs.fedoraproject.org/viewvc/rpms/ca-certificates/F-12/generate-cacerts.pl?revision=1.2
+# Check and prevention of duplicate aliases added by Vlastimil Babka <caster@gentoo.org>
+
+$file = $ARGV[1];
+open(CERTS, $file);
+@certs = <CERTS>;
+close(CERTS);
+
+$pem_file_count = 0;
+$in_cert_block = 0;
+$write_current_cert = 1;
+foreach $cert (@certs)
+{
+    if ($cert =~ /Issuer: /)
+    {
+        $_ = $cert;
+        if ($cert =~ /personal-freemail/)
+        {
+            $cert_alias = "thawtepersonalfreemailca";
+        }
+        elsif ($cert =~ /personal-basic/)
+        {
+            $cert_alias = "thawtepersonalbasicca";
+        }
+        elsif ($cert =~ /personal-premium/)
+        {
+            $cert_alias = "thawtepersonalpremiumca";
+        }
+        elsif ($cert =~ /server-certs/)
+        {
+            $cert_alias = "thawteserverca";
+        }
+        elsif ($cert =~ /premium-server/)
+        {
+            $cert_alias = "thawtepremiumserverca";
+        }
+        elsif ($cert =~ /Class 1 Public Primary Certification Authority$/)
+        {
+            $cert_alias = "verisignclass1ca";
+        }
+        elsif ($cert =~ /Class 1 Public Primary Certification Authority - G2/)
+        {
+            $cert_alias = "verisignclass1g2ca";
+        }
+        elsif ($cert =~
+               /VeriSign Class 1 Public Primary Certification Authority - G3/)
+        {
+            $cert_alias = "verisignclass1g3ca";
+        }
+        elsif ($cert =~ /Class 2 Public Primary Certification Authority$/)
+        {
+            $cert_alias = "verisignclass2ca";
+        }
+        elsif ($cert =~ /Class 2 Public Primary Certification Authority - G2/)
+        {
+            $cert_alias = "verisignclass2g2ca";
+        }
+        elsif ($cert =~
+               /VeriSign Class 2 Public Primary Certification Authority - G3/)
+        {
+            $cert_alias = "verisignclass2g3ca";
+        }
+        elsif ($cert =~ /Class 3 Public Primary Certification Authority$/)
+        {
+            $cert_alias = "verisignclass3ca";
+        }
+        # Version 1 of Class 3 Public Primary Certification Authority
+        # - G2 is added.  Version 3 is excluded.  See below.
+        elsif ($cert =~
+               /VeriSign Class 3 Public Primary Certification Authority - G3/)
+        {
+            $cert_alias = "verisignclass3g3ca";
+        }
+        elsif ($cert =~
+               /RSA Data Security.*Secure Server Certification Authority/)
+        {
+            $cert_alias = "verisignserverca";
+        }
+        elsif ($cert =~ /GTE CyberTrust Global Root/)
+        {
+            $cert_alias = "gtecybertrustglobalca";
+        }
+        elsif ($cert =~ /Baltimore CyberTrust Root/)
+        {
+            $cert_alias = "baltimorecybertrustca";
+        }
+        elsif ($cert =~ /www.entrust.net\/Client_CA_Info\/CPS/)
+        {
+            $cert_alias = "entrustclientca";
+        }
+        elsif ($cert =~ /www.entrust.net\/GCCA_CPS/)
+        {
+            $cert_alias = "entrustglobalclientca";
+        }
+        elsif ($cert =~ /www.entrust.net\/CPS_2048/)
+        {
+            $cert_alias = "entrust2048ca";
+        }
+        elsif ($cert =~ /www.entrust.net\/CPS /)
+        {
+            $cert_alias = "entrustsslca";
+        }
+        elsif ($cert =~ /www.entrust.net\/SSL_CPS/)
+        {
+            $cert_alias = "entrustgsslca";
+        }
+        elsif ($cert =~ /The Go Daddy Group/)
+        {
+            $cert_alias = "godaddyclass2ca";
+        }
+        elsif ($cert =~ /Starfield Class 2 Certification Authority/)
+        {
+            $cert_alias = "starfieldclass2ca";
+        }
+        elsif ($cert =~ /ValiCert Class 2 Policy Validation Authority/)
+        {
+            $cert_alias = "valicertclass2ca";
+        }
+        elsif ($cert =~ /GeoTrust Global CA$/)
+        {
+            $cert_alias = "geotrustglobalca";
+        }
+        elsif ($cert =~ /Equifax Secure Certificate Authority/)
+        {
+            $cert_alias = "equifaxsecureca";
+        }
+        elsif ($cert =~ /Equifax Secure eBusiness CA-1/)
+        {
+            $cert_alias = "equifaxsecureebusinessca1";
+        }
+        elsif ($cert =~ /Equifax Secure eBusiness CA-2/)
+        {
+            $cert_alias = "equifaxsecureebusinessca2";
+        }
+        elsif ($cert =~ /Equifax Secure Global eBusiness CA-1/)
+        {
+            $cert_alias = "equifaxsecureglobalebusinessca1";
+        }
+        elsif ($cert =~ /Sonera Class1 CA/)
+        {
+            $cert_alias = "soneraclass1ca";
+        }
+        elsif ($cert =~ /Sonera Class2 CA/)
+        {
+            $cert_alias = "soneraclass2ca";
+        }
+        elsif ($cert =~ /AAA Certificate Services/)
+        {
+            $cert_alias = "comodoaaaca";
+        }
+        elsif ($cert =~ /AddTrust Class 1 CA Root/)
+        {
+            $cert_alias = "addtrustclass1ca";
+        }
+        elsif ($cert =~ /AddTrust External CA Root/)
+        {
+            $cert_alias = "addtrustexternalca";
+        }
+        elsif ($cert =~ /AddTrust Qualified CA Root/)
+        {
+            $cert_alias = "addtrustqualifiedca";
+        }
+        elsif ($cert =~ /UTN-USERFirst-Hardware/)
+        {
+            $cert_alias = "utnuserfirsthardwareca";
+        }
+        elsif ($cert =~ /UTN-USERFirst-Client Authentication and Email/)
+        {
+            $cert_alias = "utnuserfirstclientauthemailca";
+        }
+        elsif ($cert =~ /UTN - DATACorp SGC/)
+        {
+            $cert_alias = "utndatacorpsgcca";
+        }
+        elsif ($cert =~ /UTN-USERFirst-Object/)
+        {
+            $cert_alias = "utnuserfirstobjectca";
+        }
+        elsif ($cert =~ /America Online Root Certification Authority 1/)
+        {
+            $cert_alias = "aolrootca1";
+        }
+        elsif ($cert =~ /DigiCert Assured ID Root CA/)
+        {
+            $cert_alias = "digicertassuredidrootca";
+        }
+        elsif ($cert =~ /DigiCert Global Root CA/)
+        {
+            $cert_alias = "digicertglobalrootca";
+        }
+        elsif ($cert =~ /DigiCert High Assurance EV Root CA/)
+        {
+            $cert_alias = "digicerthighassuranceevrootca";
+        }
+        elsif ($cert =~ /GlobalSign Root CA$/)
+        {
+            $cert_alias = "globalsignca";
+        }
+        elsif ($cert =~ /GlobalSign Root CA - R2/)
+        {
+            $cert_alias = "globalsignr2ca";
+        }
+        elsif ($cert =~ /Elektronik.*Kas.*2005/)
+        {
+            $cert_alias = "extra-elektronikkas2005";
+        }
+        elsif ($cert =~ /Elektronik/)
+        {
+            $cert_alias = "extra-elektronik2005";
+        }
+        # Mozilla does not provide these certificates:
+        #   baltimorecodesigningca
+        #   gtecybertrust5ca
+        #   trustcenterclass2caii
+        #   trustcenterclass4caii
+        #   trustcenteruniversalcai
+        else
+        {
+            # Generate an alias using the OU and CN attributes of the
+            # Issuer field if both are present, otherwise use only the
+            # CN attribute.  The Issuer field must have either the OU
+            # or the CN attribute.
+            $_ = $cert;
+            if ($cert =~ /OU=/)
+            {
+                s/Issuer:.*?OU=//;
+                # Remove other occurrences of OU=.
+                s/OU=.*CN=//;
+                # Remove CN= if there were not other occurrences of OU=.
+                s/CN=//;
+                s/\/emailAddress.*//;
+                s/Certificate Authority/ca/g;
+                s/Certification Authority/ca/g;
+            }
+            elsif ($cert =~ /CN=/)
+            {
+                s/Issuer:.*CN=//;
+                s/\/emailAddress.*//;
+                s/Certificate Authority/ca/g;
+                s/Certification Authority/ca/g;
+            }
+            s/\W//g;
+            tr/A-Z/a-z/;
+            $cert_alias = "extra-$_";
+
+        }
+        while (-e "$cert_alias.pem")
+        {
+            $cert_alias = "$cert_alias" . "_";
+        }
+    }
+    # When it attempts to parse:
+    #
+    # Class 3 Public Primary Certification Authority - G2, Version 3
+    #
+    # keytool says:
+    #
+    # #2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
+    # Unparseable AuthorityInfoAccess extension due to
+    # java.io.IOException: Invalid encoding of URI
+    #
+    # If we do not exclude this file
+    # openjdk/jdk/test/lib/security/cacerts/VerifyCACerts.java fails
+    # on this cert, printing:
+    #
+    # Couldn't verify: java.security.SignatureException: Signature
+    # does not match.
+    #
+    elsif ($cert =~
+           /A6:0F:34:C8:62:6C:81:F6:8B:F7:7D:A9:F6:67:58:8A:90:3F:7D:36/)
+    {
+        $write_current_cert = 0;
+        $pem_file_count--;
+    }
+    elsif ($cert eq "-----BEGIN CERTIFICATE-----\n")
+    {
+        $_ = $cert;
+        s/\W//g;
+        tr/A-Z/a-z/;
+        $cert_alias = "extra-$_";
+        while (-e "$cert_alias.pem")
+        {
+            $cert_alias = "$cert_alias" . "_";
+        }
+        if ($in_cert_block != 0)
+        {
+            die "$file is malformed.";
+        }
+        $in_cert_block = 1;
+        if ($write_current_cert == 1)
+        {
+            $pem_file_count++;
+            if (-e "$cert_alias.pem")
+            {
+                print "$cert_alias";
+                die "already exists"
+            }
+            open(PEM, ">$cert_alias.pem");
+            print PEM $cert;
+        }
+    }
+    elsif ($cert eq "-----END CERTIFICATE-----\n")
+    {
+        $in_cert_block = 0;
+        if ($write_current_cert == 1)
+        {
+            print PEM $cert;
+            close(PEM);
+        }
+        $write_current_cert = 1
+    }
+    else
+    {
+        if ($in_cert_block == 1 && $write_current_cert == 1)
+        {
+            print PEM $cert;
+        }
+    }
+}
+
+# Check that the correct number of .pem files were produced.
+@pem_files = <*.pem>;
+if (@pem_files != $pem_file_count)
+{
+    print "$pem_file_count";
+    die "Number of .pem files produced does not match".
+        " number of certs read from $file.";
+}
+
+# Now store each cert in the 'cacerts' file using keytool.
+$certs_written_count = 0;
+foreach $pem_file (@pem_files)
+{
+    system "$ARGV[0] -noprompt -import".
+        " -alias `basename $pem_file .pem`".
+        " -keystore cacerts -storepass 'changeit' -file $pem_file";
+    unlink($pem_file);
+    $certs_written_count++;
+}
+
+# Check that the correct number of certs were added to the keystore.
+if ($certs_written_count != $pem_file_count)
+{
+    die "Number of certs added to keystore does not match".
+        " number of certs read from $file.";
+}
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/make-bootstrap.nix b/nixpkgs/pkgs/development/compilers/openjdk/make-bootstrap.nix
new file mode 100644
index 000000000000..aac54417e2a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/make-bootstrap.nix
@@ -0,0 +1,31 @@
+{ runCommand, openjdk, nukeReferences }:
+
+runCommand "${openjdk.name}-bootstrap.tar.xz" {} ''
+  mkdir -pv openjdk-bootstrap/lib
+
+  # Do a deep copy of the openjdk
+  cp -vrL ${openjdk.home} openjdk-bootstrap/lib
+
+  # Includes are needed for building the native jvm
+  cp -vrL ${openjdk}/include openjdk-bootstrap
+
+  # The binaries are actually stored in the openjdk lib
+  ln -sv lib/openjdk/bin openjdk-bootstrap/bin
+  find . -name libjli.so
+  (cd openjdk-bootstrap/lib; find . -name libjli.so -exec ln -sfv {} libjli.so \;)
+
+  chmod -R +w openjdk-bootstrap
+
+  # Remove components we don't need
+  find openjdk-bootstrap -name \*.diz -exec rm {} \;
+  find openjdk-bootstrap -name \*.ttf -exec rm {} \;
+  find openjdk-bootstrap -name \*.gif -exec rm {} \;
+  find openjdk-bootstrap -name src.zip -exec rm {} \;
+  rm -rf openjdk-bootstrap/lib/openjdk/jre/bin
+
+  # Remove all of the references to the native nix store
+  find openjdk-bootstrap -print0 | xargs -0 ${nukeReferences}/bin/nuke-refs
+
+  # Create the output tarball
+  tar cv openjdk-bootstrap | xz > $out
+''
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch b/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch
new file mode 100644
index 000000000000..6203064f5c06
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch
@@ -0,0 +1,30 @@
+--- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java	2017-06-26 21:48:25.000000000 -0400
++++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java	2017-07-05 20:45:57.491295030 -0400
+@@ -71,6 +71,7 @@
+      *
+      * The preference of the default trusted KeyStore is:
+      *    javax.net.ssl.trustStore
++     *    system environment variable JAVAX_NET_SSL_TRUSTSTORE
+      *    jssecacerts
+      *    cacerts
+      */
+@@ -132,7 +133,8 @@
+                 public TrustStoreDescriptor run() {
+                     // Get the system properties for trust store.
+                     String storePropName = System.getProperty(
+-                            "javax.net.ssl.trustStore", jsseDefaultStore);
++                            "javax.net.ssl.trustStore",
++                            System.getenv("JAVAX_NET_SSL_TRUSTSTORE"));
+                     String storePropType = System.getProperty(
+                             "javax.net.ssl.trustStoreType",
+                             KeyStore.getDefaultType());
+@@ -144,6 +146,9 @@
+                     String temporaryName = "";
+                     File temporaryFile = null;
+                     long temporaryTime = 0L;
++                    if (storePropName == null) {
++                        storePropName = jsseDefaultStore;
++                    }
+                     if (!"NONE".equals(storePropName)) {
+                         String[] fileNames =
+                                 new String[] {storePropName, defaultStore};
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch b/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch
new file mode 100644
index 000000000000..4902b8e84011
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch
@@ -0,0 +1,21 @@
+diff -ur openjdk-7u65-b32/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java openjdk-7u65-b32.new/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java
+--- openjdk-7u65-b32/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	2014-07-17 12:12:14.000000000 +0200
++++ openjdk-7u65-b32.new/jdk/src/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java	2014-12-09 13:31:27.821960372 +0100
+@@ -161,6 +161,7 @@
+         /*
+          * Try:
+          *      javax.net.ssl.trustStore  (if this variable exists, stop)
++         *      system environment variable JAVAX_NET_SSL_TRUSTSTORE
+          *      jssecacerts
+          *      cacerts
+          *
+@@ -169,6 +169,9 @@
+ 
+         try {
+             storeFileName = props.get("trustStore");
++            if (storeFileName == null) {
++                storeFileName = System.getenv("JAVAX_NET_SSL_TRUSTSTORE");
++            }
+             if (!"NONE".equals(storeFileName)) {
+                 if (storeFileName != null) {
+                     storeFile = new File(storeFileName);
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch b/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch
new file mode 100644
index 000000000000..b9258c500db4
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch
@@ -0,0 +1,24 @@
+--- a/src/java.desktop/share/classes/javax/swing/UIManager.java
++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java
+@@ -607,11 +607,9 @@
+         if (osType == OSInfo.OSType.WINDOWS) {
+             return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
+         } else {
+-            String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
+             Toolkit toolkit = Toolkit.getDefaultToolkit();
+-            if ("gnome".equals(desktop) &&
+-                    toolkit instanceof SunToolkit &&
+-                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
++            if (toolkit instanceof SunToolkit &&
++                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
+                 // May be set on Linux and Solaris boxs.
+                 return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
+             }
+@@ -1341,7 +1339,7 @@
+             lafName = (String) lafData.remove("defaultlaf");
+         }
+         if (lafName == null) {
+-            lafName = getCrossPlatformLookAndFeelClassName();
++            lafName = getSystemLookAndFeelClassName();
+         }
+         lafName = swingProps.getProperty(defaultLAFKey, lafName);
diff --git a/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch b/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch
new file mode 100644
index 000000000000..9538aade6726
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch
@@ -0,0 +1,26 @@
+diff -ru3 a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java
+--- a/jdk/src/share/classes/javax/swing/UIManager.java	2016-07-26 00:41:37.000000000 +0300
++++ b/jdk/src/share/classes/javax/swing/UIManager.java	2016-10-02 22:46:01.890071761 +0300
+@@ -607,11 +607,9 @@
+         if (osType == OSInfo.OSType.WINDOWS) {
+             return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
+         } else {
+-            String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
+             Toolkit toolkit = Toolkit.getDefaultToolkit();
+-            if ("gnome".equals(desktop) &&
+-                    toolkit instanceof SunToolkit &&
+-                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
++            if (toolkit instanceof SunToolkit &&
++                    ((SunToolkit) toolkit).isNativeGTKAvailable()) {
+                 // May be set on Linux and Solaris boxs.
+                 return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
+             }
+@@ -1341,7 +1339,7 @@
+             lafName = (String) lafData.remove("defaultlaf");
+         }
+         if (lafName == null) {
+-            lafName = getCrossPlatformLookAndFeelClassName();
++            lafName = getSystemLookAndFeelClassName();
+         }
+         lafName = swingProps.getProperty(defaultLAFKey, lafName);
+