diff --git a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix index 712efc2f6e4b9..b4a45f6a10f42 100644 --- a/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix +++ b/pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix @@ -16,7 +16,7 @@ # runtime dependencies , cups # runtime dependencies for GTK+ Look and Feel -, gtkSupport ? true +, headless ? false , cairo , glib , gtk3 @@ -26,7 +26,7 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name; runtimeDependencies = [ cups - ] ++ lib.optionals gtkSupport [ + ] ++ lib.optionals (!headless) [ cairo glib gtk3 ]; runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies; diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index 34ed06e1de123..198e4348d23a0 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -18,7 +18,7 @@ , zlib # extra params , extraCLibs ? [ ] -, gtkSupport ? stdenv.isLinux +, headless ? !stdenv.isLinux , useMusl ? false , ... } @ args: @@ -45,7 +45,7 @@ let "xorg" "zlib" "extraCLibs" - "gtkSupport" + "headless" "useMusl" "passthru" "meta" @@ -66,7 +66,7 @@ let binPath = lib.makeBinPath (lib.optionals useMusl [ musl-gcc ] ++ [ stdenv.cc ]); runtimeLibraryPath = lib.makeLibraryPath - ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); + ([ cups ] ++ lib.optionals (!headless) [ cairo glib gtk3 ]); graalvm-ce = stdenv.mkDerivation ({ pname = "graalvm-ce"; diff --git a/pkgs/development/compilers/openjdk/10/default.nix b/pkgs/development/compilers/openjdk/10/default.nix new file mode 100644 index 0000000000000..3ea9c0ba19d3b --- /dev/null +++ b/pkgs/development/compilers/openjdk/10/default.nix @@ -0,0 +1,175 @@ +{ stdenv, lib, pkgs, fetchurl, bash, cpio, pkg-config, file, which, unzip, zip, cups, freetype +, alsaLib, openjdk10-bootstrap, perl, liberation_ttf, fontconfig, zlib, lndir +, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor, libXrandr +, libjpeg, giflib +, gnumake42 +, setJavaClassPath +, headless ? false +, enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf +}: + +let + + # when building a headless jdk, also bootstrap it with a headless jdk + openjdk-bootstrap' = openjdk10-bootstrap.override { inherit headless; }; + + openjdk10 = stdenv.mkDerivation rec { + pname = "openjdk" + lib.optionalString headless "-headless"; + version = "10.0.2+13"; + + src = pkgs.fetchFromGitHub { + owner = "openjdk"; + repo = "jdk10u"; + rev = "jdk-${version}"; + sha256 = "sha256-BsSTX7WkyVOX6OjO1WDI8RnH9j065nG8gC9Wlo6p9gY="; + }; + + outputs = [ "out" "jre" ]; + + nativeBuildInputs = [ pkg-config gnumake42 ]; + buildInputs = [ + cpio file which unzip zip perl openjdk-bootstrap' zlib cups freetype alsaLib + libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst + libXi libXinerama libXcursor libXrandr lndir fontconfig + ] ++ lib.optionals (!headless && enableGnome2) [ + gtk3 gnome_vfs GConf glib + ]; + + patches = [ + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/openjdk-10-idlj-reproducibility.patch + ./patches/openjdk-10-pointer-comparison.patch + ./patches/openjdk-10-setsignalhandler.patch + ./patches/openjdk-currency-time-bomb2.patch + ] ++ lib.optionals (!headless && enableGnome2) [ + ./patches/swing-use-gtk-jdk10.patch + ]; + + preConfigure = '' + chmod +x configure + substituteInPlace configure --replace /bin/bash "${bash}/bin/bash" + + configureFlagsArray=( + "--with-boot-jdk=${openjdk-bootstrap'.home}" + "--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 -Wno-error=format-contains-nul -Wno-error=unused-result" + '' + + lib.optionalString headless "\"--enable-headless-only\"" + + ");" + # https://bugzilla.redhat.com/show_bug.cgi?id=1306558 + # https://github.com/JetBrains/jdk8u/commit/eaa5e0711a43d64874111254d74893fa299d5716 + + lib.optionalString stdenv.cc.isGNU '' + NIX_CFLAGS_COMPILE+=" -fcommon -fno-lifetime-dse -fno-delete-null-pointer-checks -std=gnu++98 -Wno-error" + ''; + + NIX_LDFLAGS= lib.optionals (!headless) [ + "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic" + ] ++ lib.optionals (!headless && enableGnome2) [ + "-lgtk-3" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2" + ]; + + buildFlags = [ "images" ]; + + installPhase = '' + mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk + + 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/ + + # Copy the JRE to a separate output and setup fallback fonts + cp -av build/*/images/jre $jre/lib/openjdk/ + mkdir $out/lib/openjdk/jre + ${lib.optionalString (!headless) '' + mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback + lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback + ''} + + # Remove crap from the installation. + rm -rf $out/lib/openjdk/demo + ${lib.optionalString headless '' + for d in $out/lib/openjdk/lib $jre/lib/openjdk/jre/lib; do + rm ''${d}/{libjsound,libjsoundalsa,libfontmanager}.so + done + ''} + + lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre + + # 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 + + 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 + ''; + + preFixup = '' + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat < $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 '${openjdk-bootstrap'}' $(eval echo \$$output); then + echo "Extraneous references to ${openjdk-bootstrap'} detected" + exit 1 + fi + done + ''; + + meta = with 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 = { + home = "${openjdk10}/lib/openjdk"; + }; + }; +in openjdk10 diff --git a/pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/10/patches/fix-java-home-jdk10.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-java-home-jdk10.patch rename to pkgs/development/compilers/openjdk/10/patches/fix-java-home-jdk10.patch diff --git a/pkgs/development/compilers/openjdk/10/patches/openjdk-10-idlj-reproducibility.patch b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-idlj-reproducibility.patch new file mode 100644 index 0000000000000..b29a06f2724ab --- /dev/null +++ b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-idlj-reproducibility.patch @@ -0,0 +1,36 @@ +From a0a0c6a43b88d946f2b5484892cf0209bd7c0e68 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= +Date: Sat, 8 Dec 2018 21:25:31 +0100 +Subject: [PATCH] Make idlj respect SOURCE_DATE_EPOCH. + +--- + .../sun/tools/corba/se/idl/toJavaPortable/Util.java | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java +index 7397619f2..583d6b8e4 100644 +--- a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java ++++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java +@@ -1146,7 +1146,18 @@ public class Util extends com.sun.tools.corba.se.idl.Util + else + formatter.setTimeZone (java.util.TimeZone.getDefault ()); + +- stream.println ("* " + formatter.format (new Date ())); ++ try { ++ String epoch = System.getenv("SOURCE_DATE_EPOCH"); ++ if(epoch != null) { ++ long unixTime = Long.parseLong(epoch); ++ stream.println ("* " + formatter.format (new Date (unixTime*1000L))); ++ } else { ++ stream.println ("* " + formatter.format (new Date ())); ++ } ++ } catch (Exception e) { ++ //in case of error fall back to default ++ stream.println ("* " + formatter.format (new Date ())); ++ } + + // + /////////////// +-- +2.19.2 + diff --git a/pkgs/development/compilers/openjdk/10/patches/openjdk-10-pointer-comparison.patch b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-pointer-comparison.patch new file mode 100644 index 0000000000000..9c09f8e39142e --- /dev/null +++ b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-pointer-comparison.patch @@ -0,0 +1,14 @@ +Patch inspired by file comparison with openjdk@19. + +diff -u -r openjdk-10.alt/src/hotspot/os/linux/os_linux.cpp openjdk-10/src/hotspot/os/linux/os_linux.cpp +--- openjdk-10.alt/src/hotspot/os/linux/os_linux.cpp 2023-04-05 15:02:56.994779480 +0200 ++++ openjdk-10/src/hotspot/os/linux/os_linux.cpp 2023-04-05 15:07:47.267537301 +0200 +@@ -2155,7 +2155,7 @@ + } + + p = OSContainer::cpu_cpuset_memory_nodes(); +- if (p < 0) ++ if (p == NULL) + st->print("cpu_memory_nodes() failed\n"); + else { + st->print("cpu_memory_nodes: %s\n", p); diff --git a/pkgs/development/compilers/openjdk/10/patches/openjdk-10-setsignalhandler.patch b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-setsignalhandler.patch new file mode 100644 index 0000000000000..c91ae6b318680 --- /dev/null +++ b/pkgs/development/compilers/openjdk/10/patches/openjdk-10-setsignalhandler.patch @@ -0,0 +1,25 @@ +Patch inspired by file comparison with openjdk@19. + +diff -u -r openjdk-10.alt/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c openjdk-10/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c +--- openjdk-10.alt/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c 2023-04-05 15:03:00.070787628 +0200 ++++ openjdk-10/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c 2023-04-05 15:29:51.379824348 +0200 +@@ -67,8 +67,17 @@ + longjmp(context, 1); + } + +-void set_signal_handler() { +- static char altstack[SIGSTKSZ]; ++static char* altstack = NULL; ++ ++ void set_signal_handler() { ++ if (altstack == NULL) { ++ // Dynamically allocated in case SIGSTKSZ is not constant ++ altstack = (char*)malloc(SIGSTKSZ); ++ if (altstack == NULL) { ++ fprintf(stderr, "Test ERROR. Unable to malloc altstack space\n"); ++ exit(7); ++ } ++ } + + stack_t ss = { + .ss_size = SIGSTKSZ, diff --git a/pkgs/development/compilers/openjdk/10/patches/openjdk-currency-time-bomb2.patch b/pkgs/development/compilers/openjdk/10/patches/openjdk-currency-time-bomb2.patch new file mode 100644 index 0000000000000..d2ea04d63bf5d --- /dev/null +++ b/pkgs/development/compilers/openjdk/10/patches/openjdk-currency-time-bomb2.patch @@ -0,0 +1,13 @@ +Fix a time bomb present in the OpenJDK tools. + +--- a/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java ++++ b/make/jdk/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java +@@ -285,7 +285,7 @@ public class GenerateCurrencyData { + 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); ++ System.err.println("note: time is more than 10 years from \"present\": " + time); + } + specialCaseCutOverTimes[specialCaseCount] = time; + specialCaseOldCurrencies[specialCaseCount] = oldCurrency; diff --git a/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/10/patches/read-truststore-from-env-jdk10.patch similarity index 100% rename from pkgs/development/compilers/openjdk/read-truststore-from-env-jdk10.patch rename to pkgs/development/compilers/openjdk/10/patches/read-truststore-from-env-jdk10.patch diff --git a/pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch b/pkgs/development/compilers/openjdk/10/patches/swing-use-gtk-jdk10.patch similarity index 100% rename from pkgs/development/compilers/openjdk/swing-use-gtk-jdk10.patch rename to pkgs/development/compilers/openjdk/10/patches/swing-use-gtk-jdk10.patch diff --git a/pkgs/development/compilers/openjdk/11.nix b/pkgs/development/compilers/openjdk/11/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/11.nix rename to pkgs/development/compilers/openjdk/11/default.nix index 04df2d28a45ca..19b9ab5da15b1 100644 --- a/pkgs/development/compilers/openjdk/11.nix +++ b/pkgs/development/compilers/openjdk/11/default.nix @@ -15,7 +15,7 @@ let build = "9"; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk11-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk11-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation rec { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -38,11 +38,11 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap.patch - ./fix-library-path-jdk11.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap.patch + ./patches/fix-library-path-jdk11.patch # Fix build for gnumake-4.4.1: # https://github.com/openjdk/jdk/pull/12992 @@ -52,7 +52,7 @@ let hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk10.patch + ./patches/swing-use-gtk-jdk10.patch ]; preConfigure = '' @@ -160,7 +160,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; - meta = import ./meta.nix lib version; + meta = import ../meta.nix lib version; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/11/patches/currency-date-range-jdk10.patch similarity index 100% rename from pkgs/development/compilers/openjdk/currency-date-range-jdk10.patch rename to pkgs/development/compilers/openjdk/11/patches/currency-date-range-jdk10.patch diff --git a/pkgs/development/compilers/openjdk/11/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/11/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/11/patches/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/pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch b/pkgs/development/compilers/openjdk/11/patches/fix-library-path-jdk11.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-library-path-jdk11.patch rename to pkgs/development/compilers/openjdk/11/patches/fix-library-path-jdk11.patch diff --git a/pkgs/development/compilers/openjdk/increase-javadoc-heap.patch b/pkgs/development/compilers/openjdk/11/patches/increase-javadoc-heap.patch similarity index 100% rename from pkgs/development/compilers/openjdk/increase-javadoc-heap.patch rename to pkgs/development/compilers/openjdk/11/patches/increase-javadoc-heap.patch diff --git a/pkgs/development/compilers/openjdk/11/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/11/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/11/patches/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/pkgs/development/compilers/openjdk/11/patches/swing-use-gtk-jdk10.patch b/pkgs/development/compilers/openjdk/11/patches/swing-use-gtk-jdk10.patch new file mode 100644 index 0000000000000..b9258c500db4d --- /dev/null +++ b/pkgs/development/compilers/openjdk/11/patches/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/pkgs/development/compilers/openjdk/12.nix b/pkgs/development/compilers/openjdk/12/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/12.nix rename to pkgs/development/compilers/openjdk/12/default.nix index ab0696e172c05..e54b0b3a1f35b 100644 --- a/pkgs/development/compilers/openjdk/12.nix +++ b/pkgs/development/compilers/openjdk/12/default.nix @@ -1,7 +1,7 @@ { stdenv, lib, fetchurl, bash, pkg-config, autoconf, cpio, file, which, unzip , zip, perl, cups, freetype, alsa-lib, libjpeg, giflib, libpng, zlib, lcms2 , libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama -, libXcursor, libXrandr, fontconfig, openjdk11-bootstrap, fetchpatch +, libXcursor, libXrandr, fontconfig, openjdk12-bootstrap, fetchpatch , setJavaClassPath , headless ? false , enableJavaFX ? false, openjfx @@ -14,7 +14,7 @@ let build = "ga"; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk11-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk12-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation rec { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -35,10 +35,10 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 # so grab the work-around from @@ -53,7 +53,7 @@ let sha256 = "0ja84kih5wkjn58pml53s59qnavb1z92dc88cbgw7vcyqwc1gs0h"; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk10.patch + ./patches/swing-use-gtk-jdk10.patch ]; prePatch = '' @@ -161,7 +161,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; - meta = import ./meta.nix lib version; + meta = import ../meta.nix lib version; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/12/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/12/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/12/patches/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/pkgs/development/compilers/openjdk/12/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/12/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/12/patches/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/pkgs/development/compilers/openjdk/12/patches/increase-javadoc-heap.patch b/pkgs/development/compilers/openjdk/12/patches/increase-javadoc-heap.patch new file mode 100644 index 0000000000000..6a1b253f9132e --- /dev/null +++ b/pkgs/development/compilers/openjdk/12/patches/increase-javadoc-heap.patch @@ -0,0 +1,12 @@ +--- a/make/Docs.gmk 2019-07-24 13:07:37.013405090 -0400 ++++ b/make/Docs.gmk 2019-07-24 13:07:28.406550535 -0400 +@@ -274,7 +274,7 @@ + $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES)) + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + +- $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) ++ $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created + diff --git a/pkgs/development/compilers/openjdk/12/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/12/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/12/patches/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/pkgs/development/compilers/openjdk/12/patches/swing-use-gtk-jdk10.patch b/pkgs/development/compilers/openjdk/12/patches/swing-use-gtk-jdk10.patch new file mode 100644 index 0000000000000..b9258c500db4d --- /dev/null +++ b/pkgs/development/compilers/openjdk/12/patches/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/pkgs/development/compilers/openjdk/13.nix b/pkgs/development/compilers/openjdk/13/default.nix similarity index 94% rename from pkgs/development/compilers/openjdk/13.nix rename to pkgs/development/compilers/openjdk/13/default.nix index 5d5d9f774771e..5945f9a1da6bc 100644 --- a/pkgs/development/compilers/openjdk/13.nix +++ b/pkgs/development/compilers/openjdk/13/default.nix @@ -14,7 +14,7 @@ let build = "-ga"; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk13-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk13-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation rec { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -35,10 +35,10 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 # so grab the work-around from @@ -53,7 +53,7 @@ let sha256 = "0ja84kih5wkjn58pml53s59qnavb1z92dc88cbgw7vcyqwc1gs0h"; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; prePatch = '' @@ -166,7 +166,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; - meta = (import ./meta.nix lib version) // { broken = true; }; + meta = (import ../meta.nix lib version) // { broken = true; }; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/13/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/13/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/13/patches/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/pkgs/development/compilers/openjdk/13/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/13/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/13/patches/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/pkgs/development/compilers/openjdk/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/13/patches/increase-javadoc-heap-jdk13.patch similarity index 100% rename from pkgs/development/compilers/openjdk/increase-javadoc-heap-jdk13.patch rename to pkgs/development/compilers/openjdk/13/patches/increase-javadoc-heap-jdk13.patch diff --git a/pkgs/development/compilers/openjdk/13/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/13/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/13/patches/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/pkgs/development/compilers/openjdk/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/13/patches/swing-use-gtk-jdk13.patch similarity index 100% rename from pkgs/development/compilers/openjdk/swing-use-gtk-jdk13.patch rename to pkgs/development/compilers/openjdk/13/patches/swing-use-gtk-jdk13.patch diff --git a/pkgs/development/compilers/openjdk/14.nix b/pkgs/development/compilers/openjdk/14/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/14.nix rename to pkgs/development/compilers/openjdk/14/default.nix index 348fd3996c9f2..04deb3b5a702d 100644 --- a/pkgs/development/compilers/openjdk/14.nix +++ b/pkgs/development/compilers/openjdk/14/default.nix @@ -14,7 +14,7 @@ let build = "-ga"; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk14-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk14-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation rec { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -35,10 +35,10 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 # so grab the work-around from @@ -48,7 +48,7 @@ let sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r"; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; prePatch = '' @@ -162,7 +162,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; - meta = (import ./meta.nix lib version) // { broken = true; }; + meta = (import ../meta.nix lib version) // { broken = true; }; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/14/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/14/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/14/patches/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/pkgs/development/compilers/openjdk/14/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/14/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/14/patches/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/pkgs/development/compilers/openjdk/14/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/14/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/14/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/14/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/14/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/14/patches/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/pkgs/development/compilers/openjdk/14/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/14/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/14/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/15.nix b/pkgs/development/compilers/openjdk/15/default.nix similarity index 94% rename from pkgs/development/compilers/openjdk/15.nix rename to pkgs/development/compilers/openjdk/15/default.nix index 2447b0783ca4c..1f19a25d803a7 100644 --- a/pkgs/development/compilers/openjdk/15.nix +++ b/pkgs/development/compilers/openjdk/15/default.nix @@ -17,7 +17,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk15-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk15-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -38,10 +38,10 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 # so grab the work-around from @@ -51,7 +51,7 @@ let sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r"; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; prePatch = '' @@ -165,7 +165,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "major" version; - meta = import ./meta.nix lib version.major; + meta = import ../meta.nix lib version.major; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/15/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/15/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/15/patches/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/pkgs/development/compilers/openjdk/15/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/15/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/15/patches/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/pkgs/development/compilers/openjdk/15/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/15/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/15/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/15/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/15/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/15/patches/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/pkgs/development/compilers/openjdk/15/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/15/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/15/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/16.nix b/pkgs/development/compilers/openjdk/16/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/16.nix rename to pkgs/development/compilers/openjdk/16/default.nix index 12ba5c9c16dbb..16591ffbda221 100644 --- a/pkgs/development/compilers/openjdk/16.nix +++ b/pkgs/development/compilers/openjdk/16/default.nix @@ -16,7 +16,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk16-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk16-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -40,10 +40,10 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 # so grab the work-around from @@ -52,9 +52,9 @@ let url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch"; sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r"; }) - ./fix-glibc-2.34.patch + ./patches/fix-glibc-2.34.patch ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; prePatch = '' @@ -170,7 +170,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/16/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/16/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/16/patches/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/pkgs/development/compilers/openjdk/fix-glibc-2.34.patch b/pkgs/development/compilers/openjdk/16/patches/fix-glibc-2.34.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-glibc-2.34.patch rename to pkgs/development/compilers/openjdk/16/patches/fix-glibc-2.34.patch diff --git a/pkgs/development/compilers/openjdk/16/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/16/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/16/patches/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/pkgs/development/compilers/openjdk/16/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/16/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/16/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/16/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/16/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/16/patches/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/pkgs/development/compilers/openjdk/16/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/16/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/16/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/17.nix b/pkgs/development/compilers/openjdk/17/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/17.nix rename to pkgs/development/compilers/openjdk/17/default.nix index 1c9aee9af5e95..e9533d6af07c7 100644 --- a/pkgs/development/compilers/openjdk/17.nix +++ b/pkgs/development/compilers/openjdk/17/default.nix @@ -16,7 +16,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk17-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk17-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -39,12 +39,12 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk17.patch - ./fix-library-path-jdk17.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk17.patch + ./patches/fix-library-path-jdk17.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -70,7 +70,7 @@ let hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -183,7 +183,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/17/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/17/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/17/patches/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/pkgs/development/compilers/openjdk/17/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/17/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/17/patches/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/pkgs/development/compilers/openjdk/fix-library-path-jdk17.patch b/pkgs/development/compilers/openjdk/17/patches/fix-library-path-jdk17.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-library-path-jdk17.patch rename to pkgs/development/compilers/openjdk/17/patches/fix-library-path-jdk17.patch diff --git a/pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk17.patch b/pkgs/development/compilers/openjdk/17/patches/ignore-LegalNoticeFilePlugin-jdk17.patch similarity index 100% rename from pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk17.patch rename to pkgs/development/compilers/openjdk/17/patches/ignore-LegalNoticeFilePlugin-jdk17.patch diff --git a/pkgs/development/compilers/openjdk/17/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/17/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/17/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/17/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/17/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/17/patches/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/pkgs/development/compilers/openjdk/17/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/17/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/17/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/18.nix b/pkgs/development/compilers/openjdk/18/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/18.nix rename to pkgs/development/compilers/openjdk/18/default.nix index 5ce4ff8f54671..53fa376adedfe 100644 --- a/pkgs/development/compilers/openjdk/18.nix +++ b/pkgs/development/compilers/openjdk/18/default.nix @@ -16,7 +16,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk18-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk18-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -39,11 +39,11 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk18.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -61,7 +61,7 @@ let hash = "sha256-nvO8RcmKwMcPdzq28mZ4If1XJ6FQ76CYWqRIozPCk5U="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -180,7 +180,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/18/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/18/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/18/patches/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/pkgs/development/compilers/openjdk/18/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/18/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/18/patches/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/pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk18.patch b/pkgs/development/compilers/openjdk/18/patches/ignore-LegalNoticeFilePlugin-jdk18.patch similarity index 100% rename from pkgs/development/compilers/openjdk/ignore-LegalNoticeFilePlugin-jdk18.patch rename to pkgs/development/compilers/openjdk/18/patches/ignore-LegalNoticeFilePlugin-jdk18.patch diff --git a/pkgs/development/compilers/openjdk/18/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/18/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/18/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/18/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/18/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/18/patches/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/pkgs/development/compilers/openjdk/18/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/18/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/18/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/19.nix b/pkgs/development/compilers/openjdk/19/default.nix similarity index 94% rename from pkgs/development/compilers/openjdk/19.nix rename to pkgs/development/compilers/openjdk/19/default.nix index 187d724b57b55..fd6f9cfbe851e 100644 --- a/pkgs/development/compilers/openjdk/19.nix +++ b/pkgs/development/compilers/openjdk/19/default.nix @@ -19,7 +19,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk19-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk19-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -44,11 +44,11 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk18.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -74,7 +74,7 @@ let hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -185,7 +185,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/19/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/19/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/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/pkgs/development/compilers/openjdk/19/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/19/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/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/pkgs/development/compilers/openjdk/19/patches/ignore-LegalNoticeFilePlugin-jdk18.patch b/pkgs/development/compilers/openjdk/19/patches/ignore-LegalNoticeFilePlugin-jdk18.patch new file mode 100644 index 0000000000000..cda93580efb10 --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/ignore-LegalNoticeFilePlugin-jdk18.patch @@ -0,0 +1,21 @@ +--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java ++++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java +@@ -112,18 +112,6 @@ + .filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes())) + .findFirst(); + if (otarget.isEmpty()) { +- if (errorIfNotSameContent) { +- // all legal notices of the same file name are expected +- // to contain the same content +- Optional ores = +- entries.stream().filter(e -> e.linkedTarget() == null) +- .findAny(); +- +- if (ores.isPresent()) { +- throw new PluginException(ores.get().path() + " " + +- entry.path() + " contain different content"); +- } +- } + entries.add(entry); + } else { + entries.add(ResourcePoolEntry.createSymLink(entry.path(), diff --git a/pkgs/development/compilers/openjdk/19/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/19/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/19/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/19/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/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/pkgs/development/compilers/openjdk/19/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/19/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/19/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/20.nix b/pkgs/development/compilers/openjdk/20/default.nix similarity index 94% rename from pkgs/development/compilers/openjdk/20.nix rename to pkgs/development/compilers/openjdk/20/default.nix index bdb7d057f2633..61dd4e3af8929 100644 --- a/pkgs/development/compilers/openjdk/20.nix +++ b/pkgs/development/compilers/openjdk/20/default.nix @@ -19,7 +19,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk20-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk20-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -42,11 +42,11 @@ let ]; patches = [ - ./fix-java-home-jdk10.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + ./patches/fix-java-home-jdk10.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk18.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -72,7 +72,7 @@ let hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -183,7 +183,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/20/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/20/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/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/pkgs/development/compilers/openjdk/20/patches/fix-java-home-jdk10.patch b/pkgs/development/compilers/openjdk/20/patches/fix-java-home-jdk10.patch new file mode 100644 index 0000000000000..c037fde29722f --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/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/pkgs/development/compilers/openjdk/20/patches/ignore-LegalNoticeFilePlugin-jdk18.patch b/pkgs/development/compilers/openjdk/20/patches/ignore-LegalNoticeFilePlugin-jdk18.patch new file mode 100644 index 0000000000000..cda93580efb10 --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/ignore-LegalNoticeFilePlugin-jdk18.patch @@ -0,0 +1,21 @@ +--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java ++++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java +@@ -112,18 +112,6 @@ + .filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes())) + .findFirst(); + if (otarget.isEmpty()) { +- if (errorIfNotSameContent) { +- // all legal notices of the same file name are expected +- // to contain the same content +- Optional ores = +- entries.stream().filter(e -> e.linkedTarget() == null) +- .findAny(); +- +- if (ores.isPresent()) { +- throw new PluginException(ores.get().path() + " " + +- entry.path() + " contain different content"); +- } +- } + entries.add(entry); + } else { + entries.add(ResourcePoolEntry.createSymLink(entry.path(), diff --git a/pkgs/development/compilers/openjdk/20/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/20/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/20/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/20/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/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/pkgs/development/compilers/openjdk/20/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/20/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/20/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/21.nix b/pkgs/development/compilers/openjdk/21/default.nix similarity index 94% rename from pkgs/development/compilers/openjdk/21.nix rename to pkgs/development/compilers/openjdk/21/default.nix index 623ac281acf7f..4dd01f1db3ee7 100644 --- a/pkgs/development/compilers/openjdk/21.nix +++ b/pkgs/development/compilers/openjdk/21/default.nix @@ -19,7 +19,7 @@ let }; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk21-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk21-bootstrap.override { inherit headless; }; openjdk = stdenv.mkDerivation { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -42,11 +42,11 @@ let ]; patches = [ - ./fix-java-home-jdk21.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + ./patches/fix-java-home-jdk21.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk18.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -65,7 +65,7 @@ let hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -177,7 +177,7 @@ let disallowedReferences = [ openjdk-bootstrap ]; pos = builtins.unsafeGetAttrPos "feature" version; - meta = import ./meta.nix lib version.feature; + meta = import ../meta.nix lib version.feature; passthru = { architecture = ""; diff --git a/pkgs/development/compilers/openjdk/21/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/21/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/21/patches/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/pkgs/development/compilers/openjdk/fix-java-home-jdk21.patch b/pkgs/development/compilers/openjdk/21/patches/fix-java-home-jdk21.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-java-home-jdk21.patch rename to pkgs/development/compilers/openjdk/21/patches/fix-java-home-jdk21.patch diff --git a/pkgs/development/compilers/openjdk/21/patches/ignore-LegalNoticeFilePlugin-jdk18.patch b/pkgs/development/compilers/openjdk/21/patches/ignore-LegalNoticeFilePlugin-jdk18.patch new file mode 100644 index 0000000000000..cda93580efb10 --- /dev/null +++ b/pkgs/development/compilers/openjdk/21/patches/ignore-LegalNoticeFilePlugin-jdk18.patch @@ -0,0 +1,21 @@ +--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java ++++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java +@@ -112,18 +112,6 @@ + .filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes())) + .findFirst(); + if (otarget.isEmpty()) { +- if (errorIfNotSameContent) { +- // all legal notices of the same file name are expected +- // to contain the same content +- Optional ores = +- entries.stream().filter(e -> e.linkedTarget() == null) +- .findAny(); +- +- if (ores.isPresent()) { +- throw new PluginException(ores.get().path() + " " + +- entry.path() + " contain different content"); +- } +- } + entries.add(entry); + } else { + entries.add(ResourcePoolEntry.createSymLink(entry.path(), diff --git a/pkgs/development/compilers/openjdk/21/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/21/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/21/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/21/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/21/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/21/patches/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/pkgs/development/compilers/openjdk/21/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/21/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/21/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/22.nix b/pkgs/development/compilers/openjdk/22/default.nix similarity index 93% rename from pkgs/development/compilers/openjdk/22.nix rename to pkgs/development/compilers/openjdk/22/default.nix index 97d1a3b3b44df..cae3c4faf49a2 100644 --- a/pkgs/development/compilers/openjdk/22.nix +++ b/pkgs/development/compilers/openjdk/22/default.nix @@ -54,11 +54,11 @@ let # https://openjdk.org/jeps/223 # https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/Runtime.Version.html featureVersion = "22"; - info = builtins.getAttr featureVersion (lib.importJSON ./info.json); + info = builtins.getAttr featureVersion (lib.importJSON ../info.json); version = info.version; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk22-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk22-bootstrap.override { inherit headless; }; in stdenv.mkDerivation (finalAttrs: { @@ -109,11 +109,11 @@ stdenv.mkDerivation (finalAttrs: { ]; patches = [ - ./fix-java-home-jdk21.patch - ./read-truststore-from-env-jdk10.patch - ./currency-date-range-jdk10.patch - ./increase-javadoc-heap-jdk13.patch - ./ignore-LegalNoticeFilePlugin-jdk18.patch + ./patches/fix-java-home-jdk21.patch + ./patches/read-truststore-from-env-jdk10.patch + ./patches/currency-date-range-jdk10.patch + ./patches/increase-javadoc-heap-jdk13.patch + ./patches/ignore-LegalNoticeFilePlugin-jdk18.patch # -Wformat etc. are stricter in newer gccs, per # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677 @@ -132,7 +132,7 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg="; }) ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk13.patch + ./patches/swing-use-gtk-jdk13.patch ]; postPatch = '' @@ -252,7 +252,7 @@ stdenv.mkDerivation (finalAttrs: { disallowedReferences = [ openjdk-bootstrap ]; pos = __curPos; - meta = import ./meta.nix lib featureVersion; + meta = import ../meta.nix lib featureVersion; passthru = { updateScript = @@ -265,7 +265,7 @@ stdenv.mkDerivation (finalAttrs: { writeShellScript "update-java" '' ${finalAttrs.finalPackage}/bin/java \ -cp ${java-json} \ - ${./JavaUpdater.java} \ + ${../JavaUpdater.java} \ 22 pkgs/development/compilers/openjdk/info.json ''; diff --git a/pkgs/development/compilers/openjdk/22/patches/currency-date-range-jdk10.patch b/pkgs/development/compilers/openjdk/22/patches/currency-date-range-jdk10.patch new file mode 100644 index 0000000000000..e058eff074660 --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/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/pkgs/development/compilers/openjdk/22/patches/fix-java-home-jdk21.patch b/pkgs/development/compilers/openjdk/22/patches/fix-java-home-jdk21.patch new file mode 100644 index 0000000000000..ede201ed1ada5 --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/fix-java-home-jdk21.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 = nullptr; + if (ret && dli_fname[0] != '\0') { +- rp = os::Posix::realpath(dli_fname, buf, buflen); +- } +- if (rp == nullptr) { +- return; ++ snprintf(buf, buflen, "%s", dli_fname); + } + + if (Arguments::sun_java_launcher_is_altjvm()) { diff --git a/pkgs/development/compilers/openjdk/22/patches/ignore-LegalNoticeFilePlugin-jdk18.patch b/pkgs/development/compilers/openjdk/22/patches/ignore-LegalNoticeFilePlugin-jdk18.patch new file mode 100644 index 0000000000000..cda93580efb10 --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/ignore-LegalNoticeFilePlugin-jdk18.patch @@ -0,0 +1,21 @@ +--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java ++++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin.java +@@ -112,18 +112,6 @@ + .filter(e -> Arrays.equals(e.contentBytes(), entry.contentBytes())) + .findFirst(); + if (otarget.isEmpty()) { +- if (errorIfNotSameContent) { +- // all legal notices of the same file name are expected +- // to contain the same content +- Optional ores = +- entries.stream().filter(e -> e.linkedTarget() == null) +- .findAny(); +- +- if (ores.isPresent()) { +- throw new PluginException(ores.get().path() + " " + +- entry.path() + " contain different content"); +- } +- } + entries.add(entry); + } else { + entries.add(ResourcePoolEntry.createSymLink(entry.path(), diff --git a/pkgs/development/compilers/openjdk/22/patches/increase-javadoc-heap-jdk13.patch b/pkgs/development/compilers/openjdk/22/patches/increase-javadoc-heap-jdk13.patch new file mode 100644 index 0000000000000..6e48db6ac3b9c --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/increase-javadoc-heap-jdk13.patch @@ -0,0 +1,12 @@ +diff -uw -r a/make/Docs.gmk b/make/Docs.gmk +--- a/make/Docs.gmk 2019-10-09 08:05:43.107349180 -0400 ++++ b/make/Docs.gmk 2019-10-09 08:09:29.330118790 -0400 +@@ -277,7 +277,7 @@ + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) + + $1_JAVA_ARGS := -Dextlink.spec.version=$$(VERSION_SPECIFICATION) \ +- -Djspec.version=$$(VERSION_SPECIFICATION) ++ -Djspec.version=$$(VERSION_SPECIFICATION) -Xmx1G + + ifeq ($$(ENABLE_FULL_DOCS), true) + # Tell the ModuleGraph taglet to generate html links to soon-to-be-created diff --git a/pkgs/development/compilers/openjdk/22/patches/read-truststore-from-env-jdk10.patch b/pkgs/development/compilers/openjdk/22/patches/read-truststore-from-env-jdk10.patch new file mode 100644 index 0000000000000..6203064f5c068 --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/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/pkgs/development/compilers/openjdk/22/patches/swing-use-gtk-jdk13.patch b/pkgs/development/compilers/openjdk/22/patches/swing-use-gtk-jdk13.patch new file mode 100644 index 0000000000000..8a1b9b6149bb7 --- /dev/null +++ b/pkgs/development/compilers/openjdk/22/patches/swing-use-gtk-jdk13.patch @@ -0,0 +1,22 @@ +--- a/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-08-08 01:05:04.000000000 -0400 ++++ b/src/java.desktop/share/classes/javax/swing/UIManager.java 2019-10-09 08:20:31.791606748 -0400 +@@ -660,9 +660,8 @@ + Toolkit toolkit = Toolkit.getDefaultToolkit(); + if (toolkit instanceof SunToolkit) { + SunToolkit suntk = (SunToolkit)toolkit; +- String desktop = suntk.getDesktop(); + boolean gtkAvailable = suntk.isNativeGTKAvailable(); +- if ("gnome".equals(desktop) && gtkAvailable) { ++ if (gtkAvailable) { + return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; + } + } +@@ -1397,7 +1396,7 @@ + lafName = lafData.remove("defaultlaf"); + } + if (lafName == null) { +- lafName = getCrossPlatformLookAndFeelClassName(); ++ lafName = getSystemLookAndFeelClassName(); + } + lafName = swingProps.getProperty(defaultLAFKey, lafName); + diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8/default.nix similarity index 92% rename from pkgs/development/compilers/openjdk/8.nix rename to pkgs/development/compilers/openjdk/8/default.nix index 70561d83f3088..17e13ba65c438 100644 --- a/pkgs/development/compilers/openjdk/8.nix +++ b/pkgs/development/compilers/openjdk/8/default.nix @@ -24,7 +24,7 @@ let build = "ga"; # when building a headless jdk, also bootstrap it with a headless jdk - openjdk-bootstrap = openjdk8-bootstrap.override { gtkSupport = !headless; }; + openjdk-bootstrap = openjdk8-bootstrap.override { inherit headless; }; openjdk8 = stdenv.mkDerivation rec { pname = "openjdk" + lib.optionalString headless "-headless"; @@ -48,12 +48,12 @@ let ]; patches = [ - ./fix-java-home-jdk8.patch - ./read-truststore-from-env-jdk8.patch - ./currency-date-range-jdk8.patch - ./fix-library-path-jdk8.patch + ./patches/fix-java-home-jdk8.patch + ./patches/read-truststore-from-env-jdk8.patch + ./patches/currency-date-range-jdk8.patch + ./patches/fix-library-path-jdk8.patch ] ++ lib.optionals (!headless && enableGnome2) [ - ./swing-use-gtk-jdk8.patch + ./patches/swing-use-gtk-jdk8.patch ]; # Hotspot cares about the host(!) version otherwise @@ -208,14 +208,7 @@ let disallowedReferences = [ openjdk8-bootstrap ]; - meta = with lib; { - homepage = "http://openjdk.java.net/"; - license = licenses.gpl2; - description = "Open-source Java Development Kit"; - maintainers = with maintainers; [ edwtjo ]; - platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ]; - mainProgram = "java"; - }; + meta = import ../meta.nix lib version; passthru = { inherit architecture; diff --git a/pkgs/development/compilers/openjdk/generate-cacerts.pl b/pkgs/development/compilers/openjdk/8/generate-cacerts.pl similarity index 100% rename from pkgs/development/compilers/openjdk/generate-cacerts.pl rename to pkgs/development/compilers/openjdk/8/generate-cacerts.pl diff --git a/pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch b/pkgs/development/compilers/openjdk/8/patches/currency-date-range-jdk8.patch similarity index 100% rename from pkgs/development/compilers/openjdk/currency-date-range-jdk8.patch rename to pkgs/development/compilers/openjdk/8/patches/currency-date-range-jdk8.patch diff --git a/pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch b/pkgs/development/compilers/openjdk/8/patches/fix-java-home-jdk8.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-java-home-jdk8.patch rename to pkgs/development/compilers/openjdk/8/patches/fix-java-home-jdk8.patch diff --git a/pkgs/development/compilers/openjdk/fix-library-path-jdk8.patch b/pkgs/development/compilers/openjdk/8/patches/fix-library-path-jdk8.patch similarity index 100% rename from pkgs/development/compilers/openjdk/fix-library-path-jdk8.patch rename to pkgs/development/compilers/openjdk/8/patches/fix-library-path-jdk8.patch diff --git a/pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch b/pkgs/development/compilers/openjdk/8/patches/read-truststore-from-env-jdk8.patch similarity index 100% rename from pkgs/development/compilers/openjdk/read-truststore-from-env-jdk8.patch rename to pkgs/development/compilers/openjdk/8/patches/read-truststore-from-env-jdk8.patch diff --git a/pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch b/pkgs/development/compilers/openjdk/8/patches/swing-use-gtk-jdk8.patch similarity index 100% rename from pkgs/development/compilers/openjdk/swing-use-gtk-jdk8.patch rename to pkgs/development/compilers/openjdk/8/patches/swing-use-gtk-jdk8.patch diff --git a/pkgs/development/compilers/openjdk/9/default.nix b/pkgs/development/compilers/openjdk/9/default.nix new file mode 100644 index 0000000000000..78dca7b37cb03 --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/default.nix @@ -0,0 +1,187 @@ +{ stdenv, lib, pkgs, fetchurl, bash, cpio, pkg-config, file, which, unzip, zip, cups, freetype +, alsaLib, openjdk9-bootstrap, cacert, perl, liberation_ttf, fontconfig, zlib, lndir +, libX11, libICE, libXrender, libXext, libXt, libXtst, libXi, libXinerama, libXcursor +, libjpeg, giflib +, gnumake42 +, setJavaClassPath +, headless ? false +, enableGnome2 ? true, gtk2, gnome_vfs, glib, GConf +}: + +let + + # when building a headless jdk, also bootstrap it with a headless jdk + openjdk-bootstrap' = openjdk9-bootstrap.override { inherit headless; }; + + openjdk9 = stdenv.mkDerivation rec { + pname = "openjdk" + lib.optionalString headless "-headless"; + version = "9.0.4+12"; + + src = pkgs.fetchFromGitHub { + owner = "openjdk"; + repo = "jdk9u"; + rev = "jdk-${version}"; + sha256 = "sha256-GJsNHF8QzwAjon6raImZQVDYsLOQP0EW/Zmv7l/fSYs="; + }; + + outputs = [ "out" "jre" ]; + + nativeBuildInputs = [ pkg-config gnumake42 ]; + buildInputs = [ + cpio file which unzip zip perl openjdk-bootstrap' zlib cups freetype alsaLib + libjpeg giflib libX11 libICE libXext libXrender libXtst libXt libXtst + libXi libXinerama libXcursor lndir fontconfig + ] ++ lib.optionals (!headless && enableGnome2) [ + gtk2 gnome_vfs glib GConf + ]; + + patches = [ + ./patches/fix-java-home-jdk9.patch + ./patches/read-truststore-from-env-jdk9.patch + ./patches/openjdk-9-pointer-comparison.patch + ./patches/openjdk-currency-time-bomb.patch + ] ++ lib.optionals (!headless && enableGnome2) [ + ./patches/swing-use-gtk-jdk9.patch + ]; + + preConfigure = '' + chmod +x configure + substituteInPlace configure --replace /bin/bash "${bash}/bin/bash" + + configureFlagsArray=( + "--with-boot-jdk=${openjdk-bootstrap'.home}" + "--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 -Wno-error=format-contains-nul -Wno-error=unused-result" + '' + + lib.optionalString headless "\"--enable-headless-only\"" + + ");" + # https://bugzilla.redhat.com/show_bug.cgi?id=1306558 + # https://github.com/JetBrains/jdk8u/commit/eaa5e0711a43d64874111254d74893fa299d5716 + + lib.optionalString stdenv.cc.isGNU '' + NIX_CFLAGS_COMPILE+=" -fcommon -fno-lifetime-dse -fno-delete-null-pointer-checks -std=gnu++98 -Wno-error" + ''; + + NIX_LDFLAGS= lib.optionals (!headless) [ + "-lfontconfig" "-lcups" "-lXinerama" "-lXrandr" "-lmagic" + ] ++ lib.optionals (!headless && enableGnome2) [ + "-lgtk-x11-2.0" "-lgio-2.0" "-lgnomevfs-2" "-lgconf-2" + ]; + + buildFlags = [ "images" ]; + + installPhase = '' + mkdir -p $out/lib/openjdk $out/share $jre/lib/openjdk + + 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/ + + # Copy the JRE to a separate output and setup fallback fonts + cp -av build/*/images/jre $jre/lib/openjdk/ + mkdir $out/lib/openjdk/jre + ${lib.optionalString (!headless) '' + mkdir -p $jre/lib/openjdk/jre/lib/fonts/fallback + lndir ${liberation_ttf}/share/fonts/truetype $jre/lib/openjdk/jre/lib/fonts/fallback + ''} + + # Remove crap from the installation. + rm -rf $out/lib/openjdk/demo + ${lib.optionalString headless '' + for d in $out/lib/openjdk/lib $jre/lib/openjdk/jre/lib; do + rm ''${d}/{libjsound,libjsoundalsa,libfontmanager}.so + done + ''} + + lndir $jre/lib/openjdk/jre $out/lib/openjdk/jre + + # Make sure cmm/*.pf are not symlinks: + # https://youtrack.jetbrains.com/issue/IDEA-147272 + # in 9, it seems no *.pf files end up in $out ... ? + # 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 = '' + # Set JAVA_HOME automatically. + mkdir -p $out/nix-support + cat < $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 '${openjdk-bootstrap'}' $(eval echo \$$output); then + echo "Extraneous references to ${openjdk-bootstrap'} detected" + exit 1 + fi + done + ''; + + meta = with lib; { + homepage = http://openjdk.java.net/; + license = licenses.gpl2; + description = "The open-source Java Development Kit"; + maintainers = with maintainers; [ edwtjo ]; + platforms = platforms.linux; + }; + + passthru = { + home = "${openjdk9}/lib/openjdk"; + }; + }; +in openjdk9 diff --git a/pkgs/development/compilers/openjdk/9/generate-cacerts.pl b/pkgs/development/compilers/openjdk/9/generate-cacerts.pl new file mode 100644 index 0000000000000..3bdd42f7274fc --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/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 + +$file = $ARGV[1]; +open(CERTS, $file); +@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/pkgs/development/compilers/openjdk/9/patches/fix-java-home-jdk9.patch b/pkgs/development/compilers/openjdk/9/patches/fix-java-home-jdk9.patch new file mode 100644 index 0000000000000..f9755d58e48f1 --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/patches/fix-java-home-jdk9.patch @@ -0,0 +1,14 @@ +--- a/hotspot/src/os/linux/vm/os_linux.cpp 2017-07-04 23:09:02.533972226 -0400 ++++ b/hotspot/src/os/linux/vm/os_linux.cpp 2017-07-04 23:07:52.118338845 -0400 +@@ -2318,10 +2318,7 @@ + assert(ret, "cannot locate libjvm"); + char *rp = NULL; + if (ret && dli_fname[0] != '\0') { +- rp = realpath(dli_fname, buf); +- } +- if (rp == NULL) { +- return; ++ snprintf(buf, buflen, "%s", dli_fname); + } + + if (Arguments::sun_java_launcher_is_altjvm()) { diff --git a/pkgs/development/compilers/openjdk/9/patches/openjdk-9-pointer-comparison.patch b/pkgs/development/compilers/openjdk/9/patches/openjdk-9-pointer-comparison.patch new file mode 100644 index 0000000000000..dd443ae81753f --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/patches/openjdk-9-pointer-comparison.patch @@ -0,0 +1,27 @@ +The following patch prevents build failures due to comparisons between +a pointer and an integer. It has been adapted from openjdk@10. + +diff -u -r openjdk-9.alt/hotspot/src/share/vm/memory/virtualspace.cpp openjdk-9/hotspot/src/share/vm/memory/virtualspace.cpp +--- openjdk-9.alt/hotspot/src/share/vm/memory/virtualspace.cpp 2023-04-05 13:46:58.841965513 +0200 ++++ openjdk-9/hotspot/src/share/vm/memory/virtualspace.cpp 2023-04-05 13:48:43.902387837 +0200 +@@ -581,7 +581,7 @@ + assert(markOopDesc::encode_pointer_as_mark(&_base[size])->decode_pointer() == &_base[size], + "area must be distinguishable from marks for mark-sweep"); + +- if (base() > 0) { ++ if (base() != NULL) { + MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); + } + } +diff -u -r openjdk-9.alt/hotspot/src/share/vm/opto/lcm.cpp openjdk-9/hotspot/src/share/vm/opto/lcm.cpp +--- openjdk-9.alt/hotspot/src/share/vm/opto/lcm.cpp 2023-04-05 13:46:58.849965545 +0200 ++++ openjdk-9/hotspot/src/share/vm/opto/lcm.cpp 2023-04-05 13:47:53.566187260 +0200 +@@ -39,7 +39,7 @@ + // Check whether val is not-null-decoded compressed oop, + // i.e. will grab into the base of the heap if it represents NULL. + static bool accesses_heap_base_zone(Node *val) { +- if (Universe::narrow_oop_base() > 0) { // Implies UseCompressedOops. ++ if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops. + if (val && val->is_Mach()) { + if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) { + // This assumes all Decodes with TypePtr::NotNull are matched to nodes that diff --git a/pkgs/development/compilers/openjdk/9/patches/openjdk-currency-time-bomb.patch b/pkgs/development/compilers/openjdk/9/patches/openjdk-currency-time-bomb.patch new file mode 100644 index 0000000000000..7738eb159597a --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/patches/openjdk-currency-time-bomb.patch @@ -0,0 +1,13 @@ +Fix a time bomb present in the OpenJDK tools. + +--- a/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java ++++ b/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java +@@ -285,7 +285,7 @@ public class GenerateCurrencyData { + 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); ++ System.err.println("note: time is more than 10 years from \"present\": " + time); + } + specialCaseCutOverTimes[specialCaseCount] = time; + specialCaseOldCurrencies[specialCaseCount] = oldCurrency; diff --git a/pkgs/development/compilers/openjdk/9/patches/read-truststore-from-env-jdk9.patch b/pkgs/development/compilers/openjdk/9/patches/read-truststore-from-env-jdk9.patch new file mode 100644 index 0000000000000..cb8d59ff8063d --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/patches/read-truststore-from-env-jdk9.patch @@ -0,0 +1,20 @@ +--- a/jdk/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java 2017-06-26 21:48:25.000000000 -0400 ++++ b/jdk/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java.new 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 + */ +@@ -144,6 +145,9 @@ + String temporaryName = ""; + File temporaryFile = null; + long temporaryTime = 0L; ++ if (storePropName == null){ ++ storePropName = System.getenv("JAVAX_NET_SSL_TRUSTSTORE"); ++ } + if (!"NONE".equals(storePropName)) { + String[] fileNames = + new String[] {storePropName, defaultStore}; diff --git a/pkgs/development/compilers/openjdk/9/patches/swing-use-gtk-jdk9.patch b/pkgs/development/compilers/openjdk/9/patches/swing-use-gtk-jdk9.patch new file mode 100644 index 0000000000000..07d95ba71b8a5 --- /dev/null +++ b/pkgs/development/compilers/openjdk/9/patches/swing-use-gtk-jdk9.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/java.desktop/share/classes/javax/swing/UIManager.java 2016-07-26 00:41:37.000000000 +0300 ++++ b/jdk/src/java.desktop/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); + diff --git a/pkgs/development/compilers/openjdk/bootstrap.nix b/pkgs/development/compilers/openjdk/bootstrap.nix index e58888cc9ed85..e03f98a154d23 100644 --- a/pkgs/development/compilers/openjdk/bootstrap.nix +++ b/pkgs/development/compilers/openjdk/bootstrap.nix @@ -1,7 +1,13 @@ { stdenv +, pkgs , runCommand, fetchurl, zlib , version +, headless ? false +, javaPackages +, GConf +, gnome_vfs +, glib }: assert stdenv.hostPlatform.libc == "glibc"; @@ -13,28 +19,42 @@ let 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 - ''; + blobs = { + "i686-linux" = { + "8" = fetchboot "8" "i686" "1yx04xh8bqz7amg12d13rw5vwa008rav59mxjw1b9s6ynkvfgqq9"; + "10" = fetchboot "10" "i686" "1blb9gyzp8gfyggxvggqgpcgfcyi00ndnnskipwgdm031qva94p7"; + }; + }; + + jdks = { + "x86_64-linux" = { + "8" = pkgs.callPackage ./bootstrap {}; + "10" = pkgs.callPackage ./10 { + inherit headless GConf gnome_vfs glib; + inherit (javaPackages.compiler) openjdk10-bootstrap; + }; + }; + }; + + blob = blobs.${stdenv.hostPlatform.system}.${version} or null; + + jdk = jdks.${stdenv.hostPlatform.system}.${version} or null; + + bootstrap = + if jdk != null then jdk + else if blob != null then runCommand "openjdk-bootstrap" { + passthru.home = "${bootstrap}/lib/openjdk"; + } '' + tar xvf ${blob} + 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 + '' + else throw "No bootstrap for jdk ${version} for system ${stdenv.hostPlatform.system}"; in bootstrap diff --git a/pkgs/development/compilers/openjdk/bootstrap/default.nix b/pkgs/development/compilers/openjdk/bootstrap/default.nix new file mode 100644 index 0000000000000..4f2e6275becf9 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/default.nix @@ -0,0 +1,441 @@ +{ pkgs +, lib +, stdenv +, makeWrapper +, fetchurl +, fetchzip +, fetchFromSavannah +, fastjar +, libffi +, zlib +, zip +, unzip +, autoconf +, automake +, autoconf-archive +, libtool +, gettext +, texinfo +, coreutils +, diffutils +, gawk +, gnugrep +, pkg-config +, which +, cpio +, libxslt +, perl +, nss +, krb5 +, pcsclite +, xorg +, libjpeg +, libpng +, giflib +, lcms2 +, gtk2 +, alsa-lib +, cups +, ... }: + +# Java bootstrap from C++ +# +# Thanks to Guix for doing it first, which helped a lot. +# +# Most rationale can be found in java-bootstrap.scm + +let + + jikes = stdenv.mkDerivation rec { + pname = "jikes"; + version = "1.22"; + src = fetchzip { + url = "mirror://sourceforge/jikes/Jikes/jikes-${version}.tar.bz2"; + hash = "sha256-58FRyopZ855cyradP+Qa5fEHsMAUHBiCi+1eOzZZK/o=e3"; + }; + }; + + classpath = stdenv.mkDerivation rec { + pname = "classpath"; + version = "0.93"; + src = fetchzip { + url = "mirror://gnu/classpath/classpath-${version}.tar.gz"; + hash = "sha256-dP4lmumUKkOlwWOFHncPnsxR2y3Qr6mE+K3eb+x5zbY="; + }; + patches = [ + ./patches/classpath-miscompilation.patch + ]; + buildInputs = [ + jikes + fastjar + ]; + configureFlags = [ + "--disable-Werror" + "--disable-gmp" + "--disable-gtk-peer" + "--disable-gconf-peer" + "--disable-plugin" + "--disable-dssi" + "--disable-alsa" + "--disable-gjdoc" + "--disable-examples" + ]; + }; + + jamvm-1 = stdenv.mkDerivation rec { + pname = "jamvm-bootstrap-1"; + version = "1.5.1"; + src = fetchzip { + url = "mirror://sourceforge/jamvm/jamvm/JamVM%20${version}/jamvm-${version}.tar.gz"; + hash = "sha256-tBdFKV5IyQ0XRajdbLasm3wJMy9YUsu5NBoNlVInZSc="; + }; + # Remove precompiled software. + postPatch = '' + rm lib/classes.zip + ''; + configureFlags = [ + "--with-classpath-install-dir=${classpath}" + "--disable-int-caching" + "--enable-runtime-reloc-checks" + "--enable-ffi" + ]; + buildInputs = [ jikes libffi zlib zip ]; + hardeningDisable = [ "all" ]; + }; + + # FIXME current timestamp is being put in $out + ant-bootstrap = stdenv.mkDerivation rec { + pname = "ant-bootstrap"; + version = "1.8.4"; + src = fetchzip { + url = "mirror://apache/ant/source/apache-ant-${version}-src.tar.bz2"; + hash = "sha256-S9f+h+CIo/rQ5DUOHxN16tcJ57BQU/1wtq+yIlUbH64="; + }; + postPatch = '' + substituteInPlace build.xml \ + --replace 'depends="jars,test-jar"' 'depends="jars"' + ''; + buildInputs = [ jikes unzip zip ]; + buildPhase = '' + export JAVA_HOME=${jamvm-1} + export JAVACMD=${jamvm-1}/bin/jamvm + export JAVAC=${jikes}/bin/jikes + export CLASSPATH=${classpath}/share/classpath/glibj.zip + export ANT_OPTS=-Dbuild.compiler=jikes + export BOOTJAVAC_OPTS='-nowarn' + mkdir $out + sh bootstrap.sh -Ddist.dir=$out + ''; + dontInstall = true; + }; + + ecj-bootstrap = stdenv.mkDerivation rec { + pname = "ecj-bootstrap"; + version = "3.2.2"; + src = fetchzip { + url = "http://archive.eclipse.org/eclipse/downloads/drops/R-${version}-200702121330/ecjsrc.zip"; + hash = "sha256-Hdt/yYaZOQOV8bKIQz+xouX8iPr2eV3z6zh9R376I3o="; + stripRoot = false; + }; + buildInputs = [ jikes fastjar makeWrapper ]; + buildPhase = '' + jikes --classpath ${jamvm-1}/lib/rt.jar:${ant-bootstrap}/lib/ant.jar $(find -name '*.java') + ''; + installPhase = '' + mkdir -p $out/{bin,share/java} + fastjar cf $out/share/java/ecj-${version}.jar . + makeWrapper ${jamvm-1}/bin/jamvm $out/bin/javac \ + --prefix CLASSPATH : '.' \ + --prefix CLASSPATH : $out/share/java/ecj-${version}.jar \ + --add-flags -Xmx768m \ + --add-flags org.eclipse.jdt.internal.compiler.batch.Main \ + --add-flags -nowarn + ''; + }; + + classpath099 = stdenv.mkDerivation rec { + pname = "classpath"; + version = "0.99"; + src = fetchzip { + url = "mirror://gnu/classpath/classpath-${version}.tar.gz"; + hash = "sha256-nz+q6rqqAXzLoF0c6afZ7tNis8OFv8c9tWzixwgj/hg="; + }; + buildInputs = [ + ecj-bootstrap + jamvm-1 + fastjar + ]; + configureFlags = [ + "JAVAC=${ecj-bootstrap}/bin/javac" + "JAVA=${jamvm-1}/bin/jamvm" + "--disable-Werror" + "--disable-gmp" + "--disable-gtk-peer" + "--disable-gconf-peer" + "--disable-plugin" + "--disable-dssi" + "--disable-alsa" + "--disable-gjdoc" + "--disable-examples" + ]; + }; + + classpath-devel = stdenv.mkDerivation rec { + pname = "classpath"; + version = "0.99-trunk"; + src = fetchFromSavannah { + repo = "classpath"; + rev = "e7c13ee0cf2005206fbec0eca677f8cf66d5a103"; + hash = "sha256-hEdXkMAcQDGK7uylusK48xk2Z1Ai6PFuFWJwbg7nWew="; + }; + buildInputs = [ + classpath099 # for javah + ecj-bootstrap + jamvm-1 + fastjar + autoconf automake autoconf-archive libtool gettext texinfo + ]; + preConfigure = '' + autoreconf -vif + ''; + configureFlags = [ + "--with-javac=${ecj-bootstrap}/bin/javac" + "JAVA=${jamvm-1}/bin/jamvm" + "--disable-Werror" + "--disable-gmp" + "--disable-gtk-peer" + "--disable-gconf-peer" + "--disable-plugin" + "--disable-dssi" + "--disable-alsa" + "--disable-gjdoc" + "--disable-examples" + ]; + postPatch = '' + substituteInPlace $(grep -l -r '@Override') --replace @Override "" + ''; + }; + + jamvm = stdenv.mkDerivation rec { + pname = "jamvm"; + version = "2.0.0"; + src = fetchzip { + url = "mirror://sourceforge/jamvm/jamvm/JamVM%20${version}/jamvm-${version}.tar.gz"; + hash = "sha256-FSL2x2C3a3RQ88pRokZQ6dbXcgZFbZLiIZ6MfsFY70Y="; + }; + patches = [ + ./patches/jamvm-2.0.0-disable-branch-patching.patch + ./patches/jamvm-2.0.0-opcode-guard.patch + ]; + # Remove precompiled software. + postPatch = '' + rm src/classlib/gnuclasspath/lib/classes.zip + ''; + configureFlags = [ + "--with-classpath-install-dir=${classpath-devel}" + ]; + buildInputs = [ ecj-bootstrap zlib zip ]; + }; + + ecj-bootstrap2 = stdenv.mkDerivation rec { + pname = "ecj-javac-wrapper"; + version = "2"; + dontUnpack = true; + buildInputs = [ makeWrapper ]; + installPhase = '' + mkdir -p $out/bin + makeWrapper ${jamvm}/bin/jamvm $out/bin/javac \ + --prefix CLASSPATH : '.' \ + --prefix CLASSPATH : ${ecj-bootstrap}/share/java/ecj-${ecj-bootstrap.version}.jar \ + --add-flags -Xmx768m \ + --add-flags org.eclipse.jdt.internal.compiler.batch.Main \ + --add-flags -nowarn + ''; + }; + + ecj4-bootstrap = stdenv.mkDerivation rec { + pname = "ecj-bootstrap"; + version = "4.2.1"; + src = fetchurl { + url = "http://archive.eclipse.org/eclipse/downloads/drops4/R-${version}-201209141800/ecjsrc-${version}.jar"; + hash = "sha256-0mGyFY9ZhkDxkjgF0um/R+sh2DM/Ths39Z+EetANSPQ="; + }; + unpackPhase = "gjar xf $src"; + postPatch = '' + # This directive is not supported by our simple bootstrap JDK. + substituteInPlace $(grep -l -r '@Override') --replace @Override "" + + # We can't compile these yet, but we don't need them at this point anyway. + rm org/eclipse/jdt/core/JDTCompilerAdapter.java + rm -r org/eclipse/jdt/internal/antadapter + ''; + buildInputs = [ ecj-bootstrap2 classpath-devel makeWrapper ]; + buildPhase = '' + javac -source 1.5 -target 1.5 -classpath ${jamvm}/lib/rt.jar:${ant-bootstrap}/lib/ant.jar $(find -name '*.java') + ''; + installPhase = '' + mkdir -p $out/{bin,share/java} + gjar cf $out/share/java/ecj-${version}.jar . + makeWrapper ${jamvm}/bin/jamvm $out/bin/javac \ + --prefix CLASSPATH : '.' \ + --prefix CLASSPATH : $out/share/java/ecj-${version}.jar \ + --add-flags -Xmx768m \ + --add-flags org.eclipse.jdt.internal.compiler.batch.Main \ + --add-flags -nowarn + ''; + }; + + jamvm-with-ecj4 = jamvm.overrideAttrs (o: { + buildInputs = (lib.remove ecj-bootstrap o.buildInputs) ++ [ ecj4-bootstrap ]; + }); + + openjdk7 = stdenv.mkDerivation rec { + pname = "openjdk"; + icedteaVersion = "2.6.13"; + version = "1.7.0_171+IcedTea-${icedteaVersion}"; + srcs = [ + (fetchzip { + name = "icedtea"; + url = "http://icedtea.wildebeest.org/download/source/icedtea-${icedteaVersion}.tar.xz"; + hash = "sha256-lOj+rN15jRhnwOgAc4Duw/ppL1aCk1oJAAdHi+5I2Bg="; + }) + (fetchzip rec { + name = "openjdk"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-VrPMBXsczd06tsWi7mLE2lJqLClDd+OZYhvEFuDJx2Y="; + }) + (fetchzip rec { + name = "corba"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-ZHYQhL8Fyd41PGqG71OzQRYx2UVAsbd984JBZeykJTk="; + }) + (fetchzip rec { + name = "jaxp"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-UwrEVYbvF7UxUr5v5xIYSoMP/IsQQfFT29Ix3wepoWk="; + }) + (fetchzip rec { + name = "jaxws"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-yuMM6T3L1JbL/AjPXA0ONyoD2wkq/m1V2/drWT/d+vY="; + }) + (fetchzip rec { + name = "jdk"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-j2GeJZc+tg4+YXgevZ1sLITZktRp0xNrqreoI3GrVG4="; + }) + (fetchzip rec { + name = "langtools"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-NwH8AvipGbsGnJwcip5AlBGLSTNpEqMaxqN+0179p/8="; + }) + (fetchzip rec { + name = "hotspot"; + url = "http://icedtea.classpath.org/download/drops/icedtea7/${icedteaVersion}/${name}.tar.bz2"; + hash = "sha256-BTLrq/bitQFSVVVp0WyO3s8Qur80EksRhck3UzzaVa4="; + }) + ]; + sourceRoot = "."; + prePatch = '' + mv corba jaxp jaxws jdk langtools hotspot openjdk + mv openjdk icedtea + cd icedtea + ''; + patches = [ + ./patches/icedtea7-dont-check-for-wget.patch + ./patches/icedtea7-dont-extract.patch + ./patches/icedtea7-hotspot-pointer-comparison.patch + ./patches/icedtea7-currency-time-bomb.patch + ./patches/icedtea7-NativeCompileRules-fix-cflags.patch + ./patches/icedtea7-dont-install-non-existent-dir.patch + ]; + postPatch = '' + substituteInPlace $(grep -l -r 'attr/xattr[.]h') \ + --replace 'attr/xattr.h' 'sys/xattr.h' + substituteInPlace Makefile.am \ + --replace '$(SYSTEM_JDK_DIR)/jre/lib/rt.jar' \ + '${classpath-devel}/share/classpath/glibj.zip' + substituteInPlace \ + openjdk/jdk/make/common/shared/Defs-utils.gmk \ + openjdk/corba/make/common/shared/Defs-utils.gmk \ + --replace /bin/echo echo + substituteInPlace $(grep -l -r 'sys/sysctl[.]h') \ + --replace 'sys/sysctl.h' 'linux/sysctl.h' + ''; + preConfigure = '' + autoreconf -vfi + ''; + configureFlags = [ + "--disable-system-sctp" + "--enable-system-pcsc" + "--enable-system-lcms" + "--enable-bootstrap" + "--enable-nss" + "--without-rhino" + "--disable-downloading" + "--disable-tests" + "--with-ecj=${ecj4-bootstrap}/bin/javac" + "--with-jdk-home=${classpath-devel}" + "--with-java=${jamvm-with-ecj4}/bin/jamvm" + "--with-jar=${classpath-devel}/bin/gjar" + ]; + makeFlags = [ + "UTILS_COMMAND_PATH=" + "UTILS_USR_BIN_PATH=" + "USRBIN_PATH=" + "REQUIRED_ALSA_VERSION=" + "REQUIRED_FREETYPE_VERSION=" + "DEVTOOLS_PATH=" + "COMPILER_PATH=" + "ALT_CUPS_HEADERS_PATH=${cups.dev}/include" + # They only check for linux up to 4.x + "DISABLE_HOTSPOT_OS_VERSION_CHECK=ok" + "SORT=sort" + ]; + NIX_CFLAGS_COMPILE = [ + # There are conflicting non extern variable declarations in headers all + # over the place, which breaks on recent gcc. + "-fcommon" + ]; + buildInputs = [ + automake + autoconf + ant-bootstrap + classpath-devel + coreutils + diffutils + ecj4-bootstrap + fastjar + gawk + gnugrep + jamvm-with-ecj4 + libtool + pkg-config + which + cpio + zip + unzip + libxslt + perl + nss + zlib + krb5 + pcsclite + xorg.libX11 + xorg.libXt + xorg.libXtst + libjpeg + libpng + giflib + lcms2 + gtk2 + alsa-lib + cups + ]; + + passthru = { + home = "${openjdk7}"; + }; + }; + +in openjdk7 diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/classpath-miscompilation.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/classpath-miscompilation.patch new file mode 100644 index 0000000000000..c3a569ea4f495 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/classpath-miscompilation.patch @@ -0,0 +1,71 @@ +For some reason, the original code gets miscompiled on x86_64, leading +'Java_java_io_VMFile_isFile' to return true when the return value of +'cpio_checkType' is ENOENT (= 2). + +See +and . + +diff --git a/native/jni/java-io/java_io_VMFile.c b/native/jni/java-io/java_io_VMFile.c +index de1320b..6695e1f 100644 +--- a/native/jni/java-io/java_io_VMFile.c ++++ b/native/jni/java-io/java_io_VMFile.c +@@ -240,6 +240,7 @@ Java_java_io_VMFile_exists (JNIEnv * env, + #ifndef WITHOUT_FILESYSTEM + const char *filename; + int result; ++ jboolean exists; + + /* Don't use the JCL convert function because it throws an exception + on failure */ +@@ -250,9 +251,10 @@ Java_java_io_VMFile_exists (JNIEnv * env, + } + + result = cpio_isFileExists (filename); ++ exists = (result == CPNATIVE_OK ? 1 : 0); + (*env)->ReleaseStringUTFChars (env, name, filename); + +- return result == CPNATIVE_OK ? 1 : 0; ++ return exists; + #else /* not WITHOUT_FILESYSTEM */ + return 0; + #endif /* not WITHOUT_FILESYSTEM */ +@@ -278,6 +280,7 @@ Java_java_io_VMFile_isFile (JNIEnv * env, + const char *filename; + int result; + jint entryType; ++ jboolean isfile; + + /* Don't use the JCL convert function because it throws an exception + on failure */ +@@ -288,9 +291,10 @@ Java_java_io_VMFile_isFile (JNIEnv * env, + } + + result = cpio_checkType (filename, &entryType); ++ isfile = (result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0); + (*env)->ReleaseStringUTFChars (env, name, filename); + +- return result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0; ++ return isfile; + #else /* not WITHOUT_FILESYSTEM */ + return 0; + #endif /* not WITHOUT_FILESYSTEM */ +@@ -315,6 +319,7 @@ Java_java_io_VMFile_isDirectory (JNIEnv * env, + const char *filename; + int result; + jint entryType; ++ jboolean isdirectory; + + /* Don't use the JCL convert function because it throws an exception + on failure */ +@@ -325,9 +330,10 @@ Java_java_io_VMFile_isDirectory (JNIEnv * env, + } + + result = cpio_checkType (filename, &entryType); ++ isdirectory = (result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0); + (*env)->ReleaseStringUTFChars (env, name, filename); + +- return result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0; ++ return isdirectory; + #else /* not WITHOUT_FILESYSTEM */ + return 0; + #endif /* not WITHOUT_FILESYSTEM */ diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-NativeCompileRules-fix-cflags.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-NativeCompileRules-fix-cflags.patch new file mode 100644 index 0000000000000..5eac12ac0e884 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-NativeCompileRules-fix-cflags.patch @@ -0,0 +1,25 @@ +There's a bug somewhere deeper that adds a naked -I flag to gcc. That causes it +to consider the next flag as an include path. In this case, it was ignoring the +'-c' flag, and so was trying to link what was supposed to be an object +file. This Überhack is to make sure that that trailing naked -I doesn't consume +an important flag. Instead, feed a non-important flag to it. + +--- a/openjdk/jdk/make/common/internal/NativeCompileRules.gmk ++++ b/openjdk/jdk/make/common/internal/NativeCompileRules.gmk +@@ -72,12 +72,12 @@ + + $(OBJDIR)/%.$(OBJECT_SUFFIX): %.c + @$(prep-target) +- $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< ++ $(COMPILE.c) -I. -c $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< + @$(check-conventions) + + $(OBJDIR)/%.$(OBJECT_SUFFIX): %.cpp + @$(prep-target) +- $(COMPILE.cc) $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< ++ $(COMPILE.cc) -I. -c $(CC_OBJECT_OUTPUT_FLAG)$@ $(CFLAGS_GPROF) $< + @$(check-conventions) + + else + +Diff finished. Sat Mar 2 17:14:35 2024 diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-currency-time-bomb.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-currency-time-bomb.patch new file mode 100644 index 0000000000000..183a31e8c11b0 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-currency-time-bomb.patch @@ -0,0 +1,13 @@ +Fix a time bomb present in the jdk "drop" of IcedTea. + +--- a/openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java ++++ b/openjdk/jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java +@@ -284,7 +284,7 @@ public class GenerateCurrencyData { + 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); ++ System.err.println("note: time is more than 10 years from \"present\": " + time); + } + specialCaseCutOverTimes[specialCaseCount] = time; + specialCaseOldCurrencies[specialCaseCount] = oldCurrency; diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-check-for-wget.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-check-for-wget.patch new file mode 100644 index 0000000000000..cbf7da04d4a27 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-check-for-wget.patch @@ -0,0 +1,12 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -30,7 +30,6 @@ + IT_FIND_TOOLS([TAR], [gtar tar]) + IT_FIND_TOOL([CHMOD], [chmod]) + IT_FIND_TOOLS([SHA256SUM], [gsha256sum sha256sum]) +-IT_FIND_TOOL([WGET], [wget]) + IT_FIND_TOOL([ZIP], [zip]) + IT_FIND_TOOL([UNZIP], [unzip]) + IT_FIND_TOOL([CPIO], [cpio]) + +Diff finished. Fri Mar 1 03:54:35 2024 diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-extract.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-extract.patch new file mode 100644 index 0000000000000..860bedf60f4dc --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-extract.patch @@ -0,0 +1,246 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -1029,10 +1029,7 @@ + + # Download OpenJDK sources. + +-stamps/download.stamp: stamps/download-openjdk.stamp stamps/download-corba.stamp \ +- stamps/download-jaxp.stamp stamps/download-jaxws.stamp stamps/download-jdk.stamp \ +- stamps/download-cacao.stamp stamps/download-jamvm.stamp stamps/download-hotspot.stamp \ +- stamps/download-langtools.stamp ++stamps/download.stamp: + mkdir -p stamps + touch $@ + +@@ -1042,176 +1039,26 @@ + rm -f stamps/download.stamp + + stamps/download-openjdk.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_OPENJDK_SRC_ZIP +- ln -sf $(ALT_OPENJDK_SRC_ZIP) $(OPENJDK_SRC_ZIP) +-endif +- if ! echo "$(OPENJDK_SUM) $(OPENJDK_SRC_ZIP)" \ +- | $(OPENJDK_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ -e $(OPENJDK_SRC_ZIP) ] ; then \ +- mv $(OPENJDK_SRC_ZIP) $(OPENJDK_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(OPENJDK_SRC_ZIP); \ +- if ! echo "$(OPENJDK_SUM) $(OPENJDK_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of OpenJDK root zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK root zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + + stamps/download-corba.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_CORBA_SRC_ZIP +- ln -sf $(ALT_CORBA_SRC_ZIP) $(CORBA_SRC_ZIP) +-endif +- if ! echo "$(CORBA_SUM) $(CORBA_SRC_ZIP)" \ +- | $(CORBA_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ $(CORBA_SRC_ZIP) ] ; then \ +- mv $(CORBA_SRC_ZIP) $(CORBA_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(CORBA_SRC_ZIP); \ +- if ! echo "$(CORBA_SUM) $(CORBA_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of CORBA zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK CORBA zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + + stamps/download-jaxp.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_JAXP_SRC_ZIP +- ln -sf $(ALT_JAXP_SRC_ZIP) $(JAXP_SRC_ZIP) +-endif +- if ! echo "$(JAXP_SUM) $(JAXP_SRC_ZIP)" \ +- | $(JAXP_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ $(JAXP_SRC_ZIP) ] ; then \ +- mv $(JAXP_SRC_ZIP) $(JAXP_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(JAXP_SRC_ZIP); \ +- if ! echo "$(JAXP_SUM) $(JAXP_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of JAXP zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date JAXP root zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + + stamps/download-jaxws.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_JAXWS_SRC_ZIP +- ln -sf $(ALT_JAXWS_SRC_ZIP) $(JAXWS_SRC_ZIP) +-endif +- if ! echo "$(JAXWS_SUM) $(JAXWS_SRC_ZIP)" \ +- | $(JAXWS_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ $(JAXWS_SRC_ZIP) ] ; then \ +- mv $(JAXWS_SRC_ZIP) $(JAXWS_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(JAXWS_SRC_ZIP); \ +- if ! echo "$(JAXWS_SUM) $(JAXWS_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of JAXWS zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK JAXWS zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + + stamps/download-jdk.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_JDK_SRC_ZIP +- ln -sf $(ALT_JDK_SRC_ZIP) $(JDK_SRC_ZIP) +-endif +- if ! echo "$(JDK_SUM) $(JDK_SRC_ZIP)" \ +- | $(JDK_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ $(JDK_SRC_ZIP) ] ; then \ +- mv $(JDK_SRC_ZIP) $(JDK_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(JDK_SRC_ZIP); \ +- if ! echo "$(JDK_SUM) $(JDK_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of JDK zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK JDK zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + + stamps/download-langtools.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_LANGTOOLS_SRC_ZIP +- ln -sf $(ALT_LANGTOOLS_SRC_ZIP) $(LANGTOOLS_SRC_ZIP) +-endif +- if ! echo "$(LANGTOOLS_SUM) $(LANGTOOLS_SRC_ZIP)" \ +- | $(LANGTOOLS_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ $(LANGTOOLS_SRC_ZIP) ] ; then \ +- mv $(LANGTOOLS_SRC_ZIP) $(LANGTOOLS_SRC_ZIP).old ; \ +- fi ; \ +- $(WGET) $(ICEDTEA_URL)/$(LANGTOOLS_SRC_ZIP); \ +- if ! echo "$(LANGTOOLS_SUM) $(LANGTOOLS_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of langtools zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK langtools zip available"; exit -1; \ +- fi ; \ +- fi ; +-endif +-endif + mkdir -p stamps + touch $@ + +@@ -1315,40 +1162,6 @@ + rm -f stamps/download-jamvm.stamp + + stamps/download-hotspot.stamp: +-if OPENJDK_SRC_DIR_FOUND +-else +-if USE_HG +-else +-if USE_ALT_HOTSPOT_SRC_ZIP +- ln -sf $(ALT_HOTSPOT_SRC_ZIP) $(HOTSPOT_SRC_ZIP) +-endif +- echo "Using HotSpot build: ${HSBUILD}" +- if ! echo "$(HOTSPOT_SUM) $(HOTSPOT_SRC_ZIP)" \ +- | $(HOTSPOT_SHA256SUM_BIN) --check ; \ +- then \ +- if test "x$(enable_downloading)" = "xyes"; then \ +- if [ -e $(HOTSPOT_SRC_ZIP) ] ; then \ +- mv $(HOTSPOT_SRC_ZIP) $(HOTSPOT_SRC_ZIP).old ; \ +- fi ; \ +- if test "x$(HS_TYPE)" = "xhg"; then \ +- $(WGET) $(HS_URL)/archive/$(HS_CHANGESET).$(TAR_SUFFIX) -O $(HOTSPOT_SRC_ZIP) ; \ +- else \ +- if test "x$(HSBUILD)" = "xdefault"; then \ +- $(WGET) $(HS_URL)/$(HOTSPOT_SRC_ZIP) ; \ +- else \ +- $(WGET) $(HS_URL)/$(HSBUILD).$(TAR_SUFFIX) -O $(HOTSPOT_SRC_ZIP) ; \ +- fi ; \ +- fi ; \ +- if ! echo "$(HOTSPOT_SUM) $(HOTSPOT_SRC_ZIP)" \ +- | $(SHA256SUM) --check ; then \ +- echo "ERROR: Bad download of HotSpot zip"; false; \ +- fi; \ +- else \ +- echo "ERROR: No up-to-date OpenJDK HotSpot zip available"; exit -1; \ +- fi ; \ +- fi +-endif +-endif + mkdir -p stamps + touch $@ + +@@ -1358,10 +1171,7 @@ + fi + rm -f stamps/download-hotspot.stamp + +-stamps/extract.stamp: stamps/extract-openjdk.stamp stamps/extract-corba.stamp \ +- stamps/extract-jaxp.stamp stamps/extract-jaxws.stamp stamps/extract-jdk.stamp \ +- stamps/extract-cacao.stamp stamps/remove-intree-libraries.stamp stamps/extract-langtools.stamp \ +- stamps/extract-jamvm.stamp stamps/extract-hotspot.stamp stamps/sanitise-openjdk.stamp ++stamps/extract.stamp: + mkdir -p stamps + touch $@ + + +Diff finished. Sat Mar 2 11:42:05 2024 diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-install-non-existent-dir.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-install-non-existent-dir.patch new file mode 100644 index 0000000000000..f13bb8685c714 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-dont-install-non-existent-dir.patch @@ -0,0 +1,15 @@ +Otherwise install phase fails because a directory is not created +--- a/Makefile.am ++++ b/Makefile.am +@@ -3256,9 +3256,6 @@ + for files in $(BUILD_SDK_DIR)/jre/lib/ext/*.jar; do \ + $(call install_file,$${files},$(DESTDIR)${prefix}/jre/lib/ext,$(INSTALL_DATA));\ + done +- for files in $(BUILD_SDK_DIR)/tapset/*.stp; do \ +- $(call install_file,$${files},$(DESTDIR)${prefix}/tapset,$(INSTALL_DATA));\ +- done + $(abs_top_builddir)/pax-mark-vm $(DESTDIR)${prefix} false + + install-data-local: + +Diff finished. Sun Mar 3 17:24:25 2024 diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-hotspot-pointer-comparison.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-hotspot-pointer-comparison.patch new file mode 100644 index 0000000000000..50059ddb50818 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/icedtea7-hotspot-pointer-comparison.patch @@ -0,0 +1,34 @@ +Avoid ordered comparison of pointer with integer to prevent compile error +with GCC 11. + +--- a/openjdk/hotspot/src/share/vm/opto/lcm.cpp ++++ b/openjdk/hotspot/src/share/vm/opto/lcm.cpp +@@ -60,7 +60,7 @@ + // Check whether val is not-null-decoded compressed oop, + // i.e. will grab into the base of the heap if it represents NULL. + static bool accesses_heap_base_zone(Node *val) { +- if (Universe::narrow_oop_base() > 0) { // Implies UseCompressedOops. ++ if (Universe::narrow_oop_base() != NULL) { // Implies UseCompressedOops. + if (val && val->is_Mach()) { + if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) { + // This assumes all Decodes with TypePtr::NotNull are matched to nodes that +--- a/openjdk/hotspot/src/share/vm/runtime/virtualspace.cpp ++++ b/openjdk/hotspot/src/share/vm/runtime/virtualspace.cpp +@@ -527,7 +527,7 @@ ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, + (UseCompressedOops && (Universe::narrow_oop_base() != NULL) && + Universe::narrow_oop_use_implicit_null_checks()) ? + lcm(os::vm_page_size(), alignment) : 0) { +- if (base() > 0) { ++ if (base() != NULL) { + MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); + } + +@@ -546,7 +546,7 @@ ReservedHeapSpace::ReservedHeapSpace(const size_t prefix_size, + (UseCompressedOops && (Universe::narrow_oop_base() != NULL) && + Universe::narrow_oop_use_implicit_null_checks()) ? + lcm(os::vm_page_size(), prefix_align) : 0) { +- if (base() > 0) { ++ if (base() != NULL) { + MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); + } + diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-disable-branch-patching.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-disable-branch-patching.patch new file mode 100644 index 0000000000000..1352ed7803eb5 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-disable-branch-patching.patch @@ -0,0 +1,31 @@ +From d80cfc83325f8e95d35ecd9f15b36b96fa9ed3ee Mon Sep 17 00:00:00 2001 +From: Simon South +Date: Sat, 6 Jun 2020 18:56:56 -0400 +Subject: [PATCH] Disable branch-patching + +This patch disables JamVM's branch-patching optimization, which tends +to make JamVM fail with an "Illegal instruction" error on x86_64 (and +possibly other architectures that use variable-length instructions) +when built using modern versions of gcc and glibc. +--- + src/init.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/init.c b/src/init.c +index 32539cf..38ad54b 100644 +--- a/src/init.c ++++ b/src/init.c +@@ -72,8 +72,8 @@ void setDefaultInitArgs(InitArgs *args) { + #ifdef INLINING + args->replication_threshold = 10; + args->profile_threshold = 10; +- args->branch_patching_dup = TRUE; +- args->branch_patching = TRUE; ++ args->branch_patching_dup = FALSE; ++ args->branch_patching = FALSE; + args->print_codestats = FALSE; + args->join_blocks = TRUE; + args->profiling = TRUE; +-- +2.25.2 + diff --git a/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-opcode-guard.patch b/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-opcode-guard.patch new file mode 100644 index 0000000000000..5415c27a62520 --- /dev/null +++ b/pkgs/development/compilers/openjdk/bootstrap/patches/jamvm-2.0.0-opcode-guard.patch @@ -0,0 +1,35 @@ +From ca11b53896365c948426974cb90e8f71c70d123b Mon Sep 17 00:00:00 2001 +From: Simon South +Date: Sun, 31 May 2020 20:36:43 -0400 +Subject: [PATCH] Guard floating-point opcodes with explicit memory barrier + +--- + src/interp/engine/interp-inlining.h | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/interp/engine/interp-inlining.h b/src/interp/engine/interp-inlining.h +index 3339b0e..4ee5c5a 100644 +--- a/src/interp/engine/interp-inlining.h ++++ b/src/interp/engine/interp-inlining.h +@@ -78,8 +78,17 @@ + 4.3, we need to insert a label, and ensure its address + is taken (to stop it being optimised out). However, + this reduces performance on PowerPC by approx 1 - 2%. ++ ++ With gcc 5 and newer an asm statement with a "memory" ++ clobber argument explicitly sets a memory barrier for the ++ compiler, preventing it from reordering memory accesses ++ in a way that breaks decaching. + */ +-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) ++#if (__GNUC__ > 4) ++#define DEF_GUARD_TABLE(level) /* none */ ++#define GUARD(opcode, level) __asm__("" ::: "memory"); ++#define GUARD_TBLS /* none */ ++#elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) + #define DEF_GUARD_TABLE(level) DEF_HANDLER_TABLE(level, GUARD) + #define GUARD(opcode, level) label(opcode, level, GUARD) + #define GUARD_TBLS , HNDLR_TBLS(GUARD) +-- +2.26.2 + diff --git a/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix b/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix index ba56518e15a62..317c8a80963b8 100644 --- a/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix +++ b/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix @@ -22,7 +22,7 @@ # runtime dependencies for GTK+ Look and Feel # TODO(@sternenseemann): gtk3 fails to evaluate in pkgsCross.ghcjs.buildPackages # which should be fixable, this is a no-rebuild workaround for GHC. -, gtkSupport ? !stdenv.targetPlatform.isGhcjs +, headless ? stdenv.targetPlatform.isGhcjs , cairo , glib , gtk3 @@ -32,7 +32,7 @@ let cpuName = stdenv.hostPlatform.parsed.cpu.name; runtimeDependencies = [ cups - ] ++ lib.optionals gtkSupport [ + ] ++ lib.optionals (!headless) [ cairo glib gtk3 ]; runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies; diff --git a/pkgs/development/compilers/zulu/common.nix b/pkgs/development/compilers/zulu/common.nix index c9056236ea6ad..9c9bdb57ab714 100644 --- a/pkgs/development/compilers/zulu/common.nix +++ b/pkgs/development/compilers/zulu/common.nix @@ -16,7 +16,7 @@ # runtime dependencies , cups # runtime dependencies for GTK+ Look and Feel -, gtkSupport ? stdenv.isLinux +, headless ? !stdenv.isLinux , cairo , glib , gtk2 @@ -42,11 +42,11 @@ let runtimeDependencies = [ cups - ] ++ lib.optionals gtkSupport [ + ] ++ lib.optionals (!headless) [ cairo glib gtk3 - ] ++ lib.optionals (gtkSupport && lib.versionOlder dist.jdkVersion "17") [ + ] ++ lib.optionals ((!headless) && lib.versionOlder dist.jdkVersion "17") [ gtk2 ] ++ lib.optionals (stdenv.isLinux && enableJavaFX) [ ffmpeg.lib diff --git a/pkgs/top-level/java-packages.nix b/pkgs/top-level/java-packages.nix index 2d59c358863b2..cb2b45410c99f 100644 --- a/pkgs/top-level/java-packages.nix +++ b/pkgs/top-level/java-packages.nix @@ -46,13 +46,15 @@ in { mkBootstrap = adoptopenjdk: path: args: /* adoptopenjdk not available for i686, so fall back to our old builds for bootstrapping */ - if !stdenv.hostPlatform.isi686 - then - # only linux has the gtkSupport option - if stdenv.isLinux - then adoptopenjdk.jdk-hotspot.override { gtkSupport = false; } - else adoptopenjdk.jdk-hotspot - else callPackage path args; + if stdenv.isLinux && stdenv.hostPlatform.isi686 + then callPackage path args + # bootstrap from source if possible + else if stdenv.isLinux && stdenv.hostPlatform.isx86_64 + then callPackage path (gnomeArgs // args) + # only linux has the headless option + else if stdenv.isLinux + then adoptopenjdk.jdk-hotspot.override { headless = true; } + else adoptopenjdk.jdk-hotspot; mkOpenjdk = path-linux: path-darwin: args: if stdenv.isLinux @@ -105,86 +107,101 @@ in { ../development/compilers/openjdk/bootstrap.nix { version = "8"; }; + openjdk9-bootstrap = openjdk8; + + openjdk10-bootstrap = openjdk9; + openjdk11-bootstrap = mkBootstrap adoptopenjdk-11 ../development/compilers/openjdk/bootstrap.nix { version = "10"; }; + openjdk12-bootstrap = openjdk11; + openjdk13-bootstrap = mkBootstrap adoptopenjdk-13 - ../development/compilers/openjdk/12.nix + ../development/compilers/openjdk/12 (bootstrapArgs // { - inherit openjdk11-bootstrap; + inherit openjdk12-bootstrap; /* build segfaults with gcc9 or newer, so use gcc8 like Debian does */ stdenv = gcc8Stdenv; }); openjdk14-bootstrap = mkBootstrap adoptopenjdk-14 - ../development/compilers/openjdk/13.nix + ../development/compilers/openjdk/13 (bootstrapArgs // { inherit openjdk13-bootstrap; }); openjdk15-bootstrap = mkBootstrap adoptopenjdk-15 - ../development/compilers/openjdk/14.nix + ../development/compilers/openjdk/14 (bootstrapArgs // { inherit openjdk14-bootstrap; }); openjdk16-bootstrap = mkBootstrap adoptopenjdk-16 - ../development/compilers/openjdk/15.nix + ../development/compilers/openjdk/15 (bootstrapArgs // { inherit openjdk15-bootstrap; }); openjdk17-bootstrap = mkBootstrap adoptopenjdk-17 - ../development/compilers/openjdk/16.nix + ../development/compilers/openjdk/16 (bootstrapArgs // { inherit openjdk16-bootstrap; }); openjdk18-bootstrap = mkBootstrap adoptopenjdk-17 - ../development/compilers/openjdk/17.nix + ../development/compilers/openjdk/17 (bootstrapArgs // { inherit openjdk17-bootstrap; }); openjdk8 = mkOpenjdk - ../development/compilers/openjdk/8.nix + ../development/compilers/openjdk/8 ../development/compilers/zulu/8.nix { }; + openjdk9 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/9 { + inherit openjdk9-bootstrap; + }; + + openjdk10 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/10 { + inherit openjdk10-bootstrap; + }; + openjdk11 = mkOpenjdk - ../development/compilers/openjdk/11.nix + ../development/compilers/openjdk/11 ../development/compilers/zulu/11.nix { openjfx = openjfx11; }; - openjdk12 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/12.nix { + openjdk12 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/12 { /* build segfaults with gcc9 or newer, so use gcc8 like Debian does */ - stdenv = gcc8Stdenv; - openjfx = openjfx11; + stdenv = gcc8Stdenv; + inherit openjdk12-bootstrap; + openjfx = openjfx11; }; - openjdk13 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/13.nix { + openjdk13 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/13 { inherit openjdk13-bootstrap; openjfx = openjfx11; }; - openjdk14 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/14.nix { + openjdk14 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/14 { inherit openjdk14-bootstrap; openjfx = openjfx11; }; - openjdk15 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/15.nix { + openjdk15 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/15 { inherit openjdk15-bootstrap; openjfx = openjfx15; }; - openjdk16 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/16.nix { + openjdk16 = mkOpenjdkLinuxOnly ../development/compilers/openjdk/16 { inherit openjdk16-bootstrap; openjfx = openjfx15; }; openjdk17 = mkOpenjdk - ../development/compilers/openjdk/17.nix + ../development/compilers/openjdk/17 ../development/compilers/zulu/17.nix { inherit openjdk17-bootstrap; @@ -192,7 +209,7 @@ in { }; openjdk18 = mkOpenjdk - ../development/compilers/openjdk/18.nix + ../development/compilers/openjdk/18 ../development/compilers/zulu/18.nix { inherit openjdk18-bootstrap; @@ -200,7 +217,7 @@ in { }; openjdk19 = mkOpenjdk - ../development/compilers/openjdk/19.nix + ../development/compilers/openjdk/19 ../development/compilers/zulu/19.nix { openjdk19-bootstrap = temurin-bin.jdk-19; @@ -208,7 +225,7 @@ in { }; openjdk20 = mkOpenjdk - ../development/compilers/openjdk/20.nix + ../development/compilers/openjdk/20 ../development/compilers/zulu/20.nix { openjdk20-bootstrap = temurin-bin.jdk-20; @@ -216,7 +233,7 @@ in { }; openjdk21 = mkOpenjdk - ../development/compilers/openjdk/21.nix + ../development/compilers/openjdk/21 ../development/compilers/zulu/21.nix { openjdk21-bootstrap = temurin-bin.jdk-21; @@ -224,7 +241,7 @@ in { }; openjdk22 = mkOpenjdk - ../development/compilers/openjdk/22.nix + ../development/compilers/openjdk/22 ../development/compilers/zulu/22.nix { openjdk22-bootstrap = temurin-bin.jdk-21;