about summary refs log tree commit diff
path: root/pkgs/development/compilers/openjdk
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/openjdk')
-rw-r--r--pkgs/development/compilers/openjdk/11.nix6
-rw-r--r--pkgs/development/compilers/openjdk/16.nix11
-rw-r--r--pkgs/development/compilers/openjdk/17.nix6
-rw-r--r--pkgs/development/compilers/openjdk/18.nix9
-rw-r--r--pkgs/development/compilers/openjdk/19.nix12
-rw-r--r--pkgs/development/compilers/openjdk/20.nix6
-rw-r--r--pkgs/development/compilers/openjdk/22.nix422
-rw-r--r--pkgs/development/compilers/openjdk/8.nix6
-rw-r--r--pkgs/development/compilers/openjdk/JavaUpdater.java181
-rw-r--r--pkgs/development/compilers/openjdk/info.json12
-rw-r--r--pkgs/development/compilers/openjdk/meta.nix6
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/11.nix6
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/15.nix2
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/17.nix8
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/19.nix5
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/20.nix23
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/21.nix12
-rw-r--r--pkgs/development/compilers/openjdk/openjfx/22.nix11
18 files changed, 481 insertions, 263 deletions
diff --git a/pkgs/development/compilers/openjdk/11.nix b/pkgs/development/compilers/openjdk/11.nix
index e9b8961d5e599..04df2d28a45ca 100644
--- a/pkgs/development/compilers/openjdk/11.nix
+++ b/pkgs/development/compilers/openjdk/11.nix
@@ -11,8 +11,8 @@
 let
   major = "11";
   minor = "0";
-  update = "19";
-  build = "7";
+  update = "23";
+  build = "9";
 
   # when building a headless jdk, also bootstrap it with a headless jdk
   openjdk-bootstrap = openjdk11-bootstrap.override { gtkSupport = !headless; };
@@ -25,7 +25,7 @@ let
       owner = "openjdk";
       repo = "jdk${major}u";
       rev = "jdk-${version}";
-      sha256 = "sha256-mp8toB1dWcwOtMqNFd7UwRg8pLJckovqD/LD5p9zUoA=";
+      sha256 = "sha256-6y6wge8ZuSKBpb5QNihvAlD4Pv/0d3AQCPOkxUm/sJk=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ];
diff --git a/pkgs/development/compilers/openjdk/16.nix b/pkgs/development/compilers/openjdk/16.nix
index 4b0874a03a415..12ba5c9c16dbb 100644
--- a/pkgs/development/compilers/openjdk/16.nix
+++ b/pkgs/development/compilers/openjdk/16.nix
@@ -11,8 +11,8 @@
 let
   version = {
     feature = "16";
-    interim = "0";
-    build = "36";
+    interim = ".0.2-ga";
+    build = "1";
   };
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -20,13 +20,14 @@ let
 
   openjdk = stdenv.mkDerivation {
     pname = "openjdk" + lib.optionalString headless "-headless";
-    version = "${version.feature}+${version.build}";
+    version = "${version.feature}${version.interim}+${version.build}";
 
     src = fetchFromGitHub {
       owner = "openjdk";
       repo = "jdk${version.feature}u";
-      rev = "jdk-${version.feature}+${version.build}";
-      sha256 = "165nr15dqfcxzsl5z95g4iklln4rlfkgdigdma576mx8813ldi44";
+      rev = "jdk-${version.feature}${version.interim}";
+      # rev = "jdk-${version.feature}${version.interim}+${version.build}";
+      sha256 = "sha256-/8XHNrf9joCCXMCyPncT54JhqlF+KBL7eAf8hUW/BxU=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ];
diff --git a/pkgs/development/compilers/openjdk/17.nix b/pkgs/development/compilers/openjdk/17.nix
index d2c71683c9bfe..1c9aee9af5e95 100644
--- a/pkgs/development/compilers/openjdk/17.nix
+++ b/pkgs/development/compilers/openjdk/17.nix
@@ -11,8 +11,8 @@
 let
   version = {
     feature = "17";
-    interim = ".0.7";
-    build = "7";
+    interim = ".0.11";
+    build = "9";
   };
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -26,7 +26,7 @@ let
       owner = "openjdk";
       repo = "jdk${version.feature}u";
       rev = "jdk-${version.feature}${version.interim}+${version.build}";
-      sha256 = "sha256-S6QOB4Tbi+K1yjvvywTfvwFI2eX8AiqIx5c3zfxcskc=";
+      sha256 = "sha256-aO4iSc9MklW/4q9U86WEfiiWnlq6iZSbxzq2fbsqd0A=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ];
diff --git a/pkgs/development/compilers/openjdk/18.nix b/pkgs/development/compilers/openjdk/18.nix
index 2c496721be070..5ce4ff8f54671 100644
--- a/pkgs/development/compilers/openjdk/18.nix
+++ b/pkgs/development/compilers/openjdk/18.nix
@@ -11,7 +11,8 @@
 let
   version = {
     feature = "18";
-    build = "36";
+    interim = ".0.2.1";
+    build = "1";
   };
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -19,13 +20,13 @@ let
 
   openjdk = stdenv.mkDerivation {
     pname = "openjdk" + lib.optionalString headless "-headless";
-    version = "${version.feature}+${version.build}";
+    version = "${version.feature}${version.interim}+${version.build}";
 
     src = fetchFromGitHub {
       owner = "openjdk";
       repo = "jdk${version.feature}u";
-      rev = "jdk-${version.feature}+${version.build}";
-      sha256 = "sha256-yGPC8VA983Ml6Fv/oiEgRrcVe4oe+Q4oCHbzOmFbZq8=";
+      rev = "jdk-${version.feature}${version.interim}+${version.build}";
+      sha256 = "sha256-L6dsN0kqWcfemM8LBg62qtHQdymwRQoV1ndc8r+0qn8=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ];
diff --git a/pkgs/development/compilers/openjdk/19.nix b/pkgs/development/compilers/openjdk/19.nix
index 51fd0d8eb533f..187d724b57b55 100644
--- a/pkgs/development/compilers/openjdk/19.nix
+++ b/pkgs/development/compilers/openjdk/19.nix
@@ -14,8 +14,8 @@
 let
   version = {
     feature = "19";
-    interim = ".0.2";
-    build = "7";
+    interim = "-ga";
+    build = "";
   };
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -23,13 +23,15 @@ let
 
   openjdk = stdenv.mkDerivation {
     pname = "openjdk" + lib.optionalString headless "-headless";
-    version = "${version.feature}${version.interim}+${version.build}";
+    version = "${version.feature}${version.interim}";
+    # version = "${version.feature}${version.interim}+${version.build}";
 
     src = fetchFromGitHub {
       owner = "openjdk";
       repo = "jdk${version.feature}u";
-      rev = "jdk-${version.feature}${version.interim}+${version.build}";
-      hash = "sha256-pBEHmBtIgG4Czou4C/zpBBYZEDImvXiLoA5CjOzpeyI=";
+      rev = "jdk-${version.feature}${version.interim}";
+      # rev = "jdk-${version.feature}${version.interim}+${version.build}";
+      hash = "sha256-XbYTku/nWF+maBvYz2rJYIUBEgOmqICKjk9wufHqyj0=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ];
diff --git a/pkgs/development/compilers/openjdk/20.nix b/pkgs/development/compilers/openjdk/20.nix
index 2be834a27b58e..bdb7d057f2633 100644
--- a/pkgs/development/compilers/openjdk/20.nix
+++ b/pkgs/development/compilers/openjdk/20.nix
@@ -14,8 +14,8 @@
 let
   version = {
     feature = "20";
-    interim = "";
-    build = "36";
+    interim = ".0.2";
+    build = "9";
   };
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -29,7 +29,7 @@ let
       owner = "openjdk";
       repo = "jdk${version.feature}u";
       rev = "jdk-${version.feature}${version.interim}+${version.build}";
-      hash = "sha256-fXoSO8nq5qpUYbCtbrRr2C46XRdYX77Pxmk7GfmlZV4=";
+      hash = "sha256-CZH2JwR+MrkTlLdcVYuFRB3McdrM0A+1YaSjNpjYwak=";
     };
 
     nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ];
diff --git a/pkgs/development/compilers/openjdk/22.nix b/pkgs/development/compilers/openjdk/22.nix
index bef62b6755a26..97d1a3b3b44df 100644
--- a/pkgs/development/compilers/openjdk/22.nix
+++ b/pkgs/development/compilers/openjdk/22.nix
@@ -3,7 +3,6 @@
 , fetchurl
 , fetchpatch
 , fetchFromGitHub
-, bash
 , pkg-config
 , autoconf
 , cpio
@@ -44,217 +43,234 @@
 , gnome_vfs
 , glib
 , GConf
+, writeShellScript
 }:
 
 let
-  version = {
-    feature = "22";
-    interim = "";
-    build = "36";
-  };
+
+  # Java version format:
+  # $FEATURE.$INTERIM.$UPDATE.$PATCH
+  # See
+  # 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);
+  version = info.version;
 
   # when building a headless jdk, also bootstrap it with a headless jdk
   openjdk-bootstrap = openjdk22-bootstrap.override { gtkSupport = !headless; };
+in
 
-  openjdk = stdenv.mkDerivation {
-    pname = "openjdk" + lib.optionalString headless "-headless";
-    version = "${version.feature}${version.interim}+${version.build}";
-
-    src = fetchFromGitHub {
-      owner = "openjdk";
-      repo = "jdk${version.feature}u";
-      rev = "jdk-${version.feature}${version.interim}+${version.build}";
-      hash = "sha256-itjvIedPwJl/l3a2gIVpNMs1zkbrjioVqbCj1Z1nCJE=";
-    };
-
-    nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ];
-    buildInputs = [
-      cpio
-      file
-      which
-      zip
-      perl
-      zlib
-      cups
-      freetype
-      alsa-lib
-      libjpeg
-      giflib
-      libpng
-      zlib
-      lcms2
-      libX11
-      libICE
-      libXrender
-      libXext
-      libXtst
-      libXt
-      libXtst
-      libXi
-      libXinerama
-      libXcursor
-      libXrandr
-      fontconfig
-      openjdk-bootstrap
-    ] ++ lib.optionals (!headless && enableGnome2) [
-      gtk3
-      gnome_vfs
-      GConf
-      glib
-    ];
-
-    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
-
-      # -Wformat etc. are stricter in newer gccs, per
-      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
-      # so grab the work-around from
-      # https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
-      (fetchurl {
-        url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
-        sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
-      })
-
-      # Fix build for gnumake-4.4.1:
-      #   https://github.com/openjdk/jdk/pull/12992
-      (fetchpatch {
-        name = "gnumake-4.4.1";
-        url = "https://github.com/openjdk/jdk/commit/9341d135b855cc208d48e47d30cd90aafa354c36.patch";
-        hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg=";
-      })
-    ] ++ lib.optionals (!headless && enableGnome2) [
-      ./swing-use-gtk-jdk13.patch
-    ];
-
-    postPatch = ''
-      chmod +x configure
-      patchShebangs --build configure
-    '';
-
-    # JDK's build system attempts to specifically detect
-    # and special-case WSL, and we don't want it to do that,
-    # so pass the correct platform names explicitly
-    configurePlatforms = [ "build" "host" ];
-
-
-    # https://openjdk.org/groups/build/doc/building.html
-    configureFlags = [
-      "--with-boot-jdk=${openjdk-bootstrap.home}"
-      "--with-version-build=${version.build}"
-      "--with-version-opt=nixos"
-      "--with-version-pre="
-      "--enable-unlimited-crypto"
-      "--with-native-debug-symbols=internal"
-      "--with-libjpeg=system"
-      "--with-giflib=system"
-      "--with-libpng=system"
-      "--with-zlib=system"
-      "--with-lcms=system"
-      "--with-stdc++lib=dynamic"
-    ]
-    ++ lib.optional headless "--enable-headless-only"
-    ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}";
-
-    separateDebugInfo = true;
-
-    env.NIX_CFLAGS_COMPILE = "-Wno-error";
-
-    NIX_LDFLAGS = toString (lib.optionals (!headless) [
-      "-lfontconfig"
-      "-lcups"
-      "-lXinerama"
-      "-lXrandr"
-      "-lmagic"
-    ] ++ lib.optionals (!headless && enableGnome2) [
-      "-lgtk-3"
-      "-lgio-2.0"
-      "-lgnomevfs-2"
-      "-lgconf-2"
-    ]);
-
-    # -j flag is explicitly rejected by the build system:
-    #     Error: 'make -jN' is not supported, use 'make JOBS=N'
-    # Note: it does not make build sequential. Build system
-    # still runs in parallel.
-    enableParallelBuilding = false;
-
-    buildFlags = [ "images" ];
-
-    installPhase = ''
-      mkdir -p $out/lib
-
-      mv build/*/images/jdk $out/lib/openjdk
-
-      # Remove some broken manpages.
-      rm -rf $out/lib/openjdk/man/ja*
-
-      # Mirror some stuff in top-level.
-      mkdir -p $out/share
-      ln -s $out/lib/openjdk/include $out/include
-      ln -s $out/lib/openjdk/man $out/share/man
-
-      # IDEs use the provided src.zip to navigate the Java codebase (https://github.com/NixOS/nixpkgs/pull/95081)
-      ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
-
-      # jni.h expects jni_md.h to be in the header search path.
-      ln -s $out/include/linux/*_md.h $out/include/
-
-      # Remove crap from the installation.
-      rm -rf $out/lib/openjdk/demo
-      ${lib.optionalString headless ''
-        rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
-      ''}
-
-      ln -s $out/lib/openjdk/bin $out/bin
-    '';
-
-    preFixup = ''
-      # Propagate the setJavaClassPath setup hook so that any package
-      # that depends on the JDK has $CLASSPATH set up properly.
-      mkdir -p $out/nix-support
-      #TODO or printWords?  cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
-      echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
-
-      # Set JAVA_HOME automatically.
-      mkdir -p $out/nix-support
-      cat <<EOF > $out/nix-support/setup-hook
-      if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
-      EOF
-    '';
-
-    postFixup = ''
-      # Build the set of output library directories to rpath against
-      LIBDIRS=""
-      for output in $(getAllOutputNames); do
-        if [ "$output" = debug ]; then continue; fi
-        LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"
-      done
-      # Add the local library paths to remove dependencies on the bootstrap
-      for output in $(getAllOutputNames); do
-        if [ "$output" = debug ]; then continue; fi
-        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
+stdenv.mkDerivation (finalAttrs: {
+  pname = "openjdk" + lib.optionalString headless "-headless";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "openjdk";
+    repo = info.repo;
+    rev = "jdk-${version}";
+    hash = info.hash;
+  };
+
+  nativeBuildInputs = [ pkg-config autoconf unzip ensureNewerSourcesForZipFilesHook ];
+  buildInputs = [
+    cpio
+    file
+    which
+    zip
+    perl
+    zlib
+    cups
+    freetype
+    alsa-lib
+    libjpeg
+    giflib
+    libpng
+    zlib
+    lcms2
+    libX11
+    libICE
+    libXrender
+    libXext
+    libXtst
+    libXt
+    libXtst
+    libXi
+    libXinerama
+    libXcursor
+    libXrandr
+    fontconfig
+    openjdk-bootstrap
+  ] ++ lib.optionals (!headless && enableGnome2) [
+    gtk3
+    gnome_vfs
+    GConf
+    glib
+  ];
+
+  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
+
+    # -Wformat etc. are stricter in newer gccs, per
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677
+    # so grab the work-around from
+    # https://src.fedoraproject.org/rpms/java-openjdk/pull-request/24
+    (fetchurl {
+      url = "https://src.fedoraproject.org/rpms/java-openjdk/raw/06c001c7d87f2e9fe4fedeef2d993bcd5d7afa2a/f/rh1673833-remove_removal_of_wformat_during_test_compilation.patch";
+      sha256 = "082lmc30x64x583vqq00c8y0wqih3y4r0mp1c4bqq36l22qv6b6r";
+    })
+
+    # Fix build for gnumake-4.4.1:
+    #   https://github.com/openjdk/jdk/pull/12992
+    (fetchpatch {
+      name = "gnumake-4.4.1";
+      url = "https://github.com/openjdk/jdk/commit/9341d135b855cc208d48e47d30cd90aafa354c36.patch";
+      hash = "sha256-Qcm3ZmGCOYLZcskNjj7DYR85R4v07vYvvavrVOYL8vg=";
+    })
+  ] ++ lib.optionals (!headless && enableGnome2) [
+    ./swing-use-gtk-jdk13.patch
+  ];
+
+  postPatch = ''
+    chmod +x configure
+    patchShebangs --build configure
+  '';
+
+  # JDK's build system attempts to specifically detect
+  # and special-case WSL, and we don't want it to do that,
+  # so pass the correct platform names explicitly
+  configurePlatforms = [ "build" "host" ];
+
+
+  # https://openjdk.org/groups/build/doc/building.html
+  configureFlags = [
+    "--with-boot-jdk=${openjdk-bootstrap.home}"
+    "--with-version-string=${version}"
+    "--with-vendor-version-string=(nix)"
+    "--enable-unlimited-crypto"
+    "--with-native-debug-symbols=internal"
+    "--with-libjpeg=system"
+    "--with-giflib=system"
+    "--with-libpng=system"
+    "--with-zlib=system"
+    "--with-lcms=system"
+    "--with-stdc++lib=dynamic"
+  ]
+  ++ lib.optional headless "--enable-headless-only"
+  ++ lib.optional (!headless && enableJavaFX) "--with-import-modules=${openjfx}";
+
+  separateDebugInfo = true;
+
+  env.NIX_CFLAGS_COMPILE = "-Wno-error";
+
+  NIX_LDFLAGS = toString (lib.optionals (!headless) [
+    "-lfontconfig"
+    "-lcups"
+    "-lXinerama"
+    "-lXrandr"
+    "-lmagic"
+  ] ++ lib.optionals (!headless && enableGnome2) [
+    "-lgtk-3"
+    "-lgio-2.0"
+    "-lgnomevfs-2"
+    "-lgconf-2"
+  ]);
+
+  # -j flag is explicitly rejected by the build system:
+  #     Error: 'make -jN' is not supported, use 'make JOBS=N'
+  # Note: it does not make build sequential. Build system
+  # still runs in parallel.
+  enableParallelBuilding = false;
+
+  buildFlags = [ "images" ];
+
+  installPhase = ''
+    mkdir -p $out/lib
+
+    mv build/*/images/jdk $out/lib/openjdk
+
+    # Remove some broken manpages.
+    rm -rf $out/lib/openjdk/man/ja*
+
+    # Mirror some stuff in top-level.
+    mkdir -p $out/share
+    ln -s $out/lib/openjdk/include $out/include
+    ln -s $out/lib/openjdk/man $out/share/man
+
+    # IDEs use the provided src.zip to navigate the Java codebase (https://github.com/NixOS/nixpkgs/pull/95081)
+    ln -s $out/lib/openjdk/lib/src.zip $out/lib/src.zip
+
+    # jni.h expects jni_md.h to be in the header search path.
+    ln -s $out/include/linux/*_md.h $out/include/
+
+    # Remove crap from the installation.
+    rm -rf $out/lib/openjdk/demo
+    ${lib.optionalString headless ''
+      rm $out/lib/openjdk/lib/{libjsound,libfontmanager}.so
+    ''}
+
+    ln -s $out/lib/openjdk/bin $out/bin
+  '';
+
+  preFixup = ''
+    # Propagate the setJavaClassPath setup hook so that any package
+    # that depends on the JDK has $CLASSPATH set up properly.
+    mkdir -p $out/nix-support
+    #TODO or printWords?  cf https://github.com/NixOS/nixpkgs/pull/27427#issuecomment-317293040
+    echo -n "${setJavaClassPath}" > $out/nix-support/propagated-build-inputs
+
+    # Set JAVA_HOME automatically.
+    mkdir -p $out/nix-support
+    cat <<EOF > $out/nix-support/setup-hook
+    if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out/lib/openjdk; fi
+    EOF
+  '';
+
+  postFixup = ''
+    # Build the set of output library directories to rpath against
+    LIBDIRS=""
+    for output in $(getAllOutputNames); do
+      if [ "$output" = debug ]; then continue; fi
+      LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"
+    done
+    # Add the local library paths to remove dependencies on the bootstrap
+    for output in $(getAllOutputNames); do
+      if [ "$output" = debug ]; then continue; fi
+      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
+  '';
+
+  disallowedReferences = [ openjdk-bootstrap ];
 
-    disallowedReferences = [ openjdk-bootstrap ];
+  pos = __curPos;
+  meta = import ./meta.nix lib featureVersion;
 
-    pos = builtins.unsafeGetAttrPos "feature" version;
-    meta = import ./meta.nix lib version.feature;
+  passthru = {
+    updateScript =
+      let
+        java-json = fetchurl {
+          url = "https://search.maven.org/remotecontent?filepath=org/json/json/20240303/json-20240303.jar";
+          hash = "sha256-PPbNaJLjLitMHDng9S9SSKL1s3ZG/fu3mma0a2GEFO0=";
+        };
+      in
+      writeShellScript "update-java" ''
+        ${finalAttrs.finalPackage}/bin/java \
+          -cp ${java-json} \
+          ${./JavaUpdater.java} \
+          22 pkgs/development/compilers/openjdk/info.json
+      '';
 
-    passthru = {
-      architecture = "";
-      home = "${openjdk}/lib/openjdk";
-      inherit gtk3;
-    };
+    home = "${finalAttrs.finalPackage}/lib/openjdk";
+
+    inherit gtk3;
   };
-in
-openjdk
+})
diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix
index aebfceeccb784..70561d83f3088 100644
--- a/pkgs/development/compilers/openjdk/8.nix
+++ b/pkgs/development/compilers/openjdk/8.nix
@@ -20,7 +20,7 @@ let
     powerpc64le-linux = "ppc64le";
   }.${stdenv.system} or (throw "Unsupported platform ${stdenv.system}");
 
-  update = "362";
+  update = "412";
   build = "ga";
 
   # when building a headless jdk, also bootstrap it with a headless jdk
@@ -34,7 +34,7 @@ let
       owner = "openjdk";
       repo = "jdk8u";
       rev = "jdk${version}";
-      sha256 = "sha256-C5dQwfIIpIrLeO3JWERyFCQHUSgG8gARuc3qXAeLkJ4=";
+      sha256 = "sha256-o+H5n5p6JG1giJj9OADgMbQPaoKMzLMFquKH536SHhM=";
     };
     outputs = [ "out" "jre" ];
 
@@ -211,7 +211,7 @@ let
     meta = with lib; {
       homepage = "http://openjdk.java.net/";
       license = licenses.gpl2;
-      description = "The open-source Java Development Kit";
+      description = "Open-source Java Development Kit";
       maintainers = with maintainers; [ edwtjo ];
       platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
       mainProgram = "java";
diff --git a/pkgs/development/compilers/openjdk/JavaUpdater.java b/pkgs/development/compilers/openjdk/JavaUpdater.java
new file mode 100644
index 0000000000000..32dddf2fabc7c
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/JavaUpdater.java
@@ -0,0 +1,181 @@
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.http.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+public class JavaUpdater {
+
+  record GitHubResult(Optional<String> latestVersion, Optional<String> next) {
+  }
+
+  record JsonInfo(String repo, String version, String hash) {
+    public JsonInfo(JSONObject json) {
+      this(json.getString("repo"), json.getString("version"), json.getString("hash"));
+    }
+
+    public String toJsonString(String featureVersion) {
+      return """
+        \s "%s": {
+        \s   "version": "%s",
+        \s   "repo":    "%s",
+        \s   "hash":    "%s"
+        \s }\
+        """.formatted(featureVersion, version, repo, hash);
+    }
+  }
+
+  // Parses the GitHub Link header
+  public static Optional<String> getNextLink(HttpHeaders headers) {
+    var linkHeader = headers.map().get("Link");
+    if (linkHeader == null || linkHeader.isEmpty()) return null;
+
+    var links = linkHeader.getFirst();
+    var linksRegex = Pattern.compile("<(.+)>;\\s*rel=\"next\"");
+    return Pattern.compile(",")
+      .splitAsStream(links)
+      .map(x -> linksRegex.matcher(x).results()
+        .map(g -> g.group(1))
+        .findFirst()
+      )
+      .filter(Optional::isPresent)
+      .map(Optional::orElseThrow)
+      .findFirst();
+  }
+
+  // HTTP request helper, sets GITHUB_TOKEN if present
+  private static HttpRequest NewGithubRequest(String url) {
+    var token = System.getenv().get("GITHUB_TOKEN");
+    var builder = HttpRequest.newBuilder()
+      .uri(URI.create(url));
+    if (token != null)
+      builder.setHeader("Authorization", "Bearer " + token);
+    return builder.build();
+  }
+
+  private static GitHubResult getLatestTag(String url) {
+    var request = NewGithubRequest(url);
+
+    var response =
+      HttpClient.newHttpClient().sendAsync(request, HttpResponse.BodyHandlers.ofString())
+        .join();
+
+    var json = new JSONArray(response.body());
+
+    Optional<String> version = StreamSupport.stream(json.spliterator(), false)
+      .map(JSONObject.class::cast)
+      .map(x -> x.getString("name").replaceFirst("jdk-", ""))
+      .filter(x -> x.contains("-ga"))
+      .max(Comparator.comparing(Runtime.Version::parse));
+
+    return new GitHubResult(version, getNextLink(response.headers()));
+  }
+
+  public String findNewerVersion() {
+    var url = Optional.of("https://api.github.com/repos/openjdk/" + getRepo() + "/tags?per_page=100");
+    String version = getCurrentVersion();
+    do {
+      GitHubResult response = getLatestTag(url.orElseThrow());
+      if (response.latestVersion.isPresent() && response.latestVersion.orElseThrow().equals(version)) {
+        return null;
+      }
+
+      String latestVersion = Stream.of(version, response.latestVersion.orElse(version))
+        .max(Comparator.comparing(Runtime.Version::parse)).orElseThrow();
+
+      if (latestVersion != version)
+        return latestVersion;
+
+      url = response.next;
+    } while (url.isPresent());
+    return null;
+  }
+
+
+  private static String prettyPrint(JSONObject json) {
+
+    Iterable<String> iterable = () -> json.keys();
+
+    return StreamSupport
+      .stream(iterable.spliterator(), false)
+      .sorted(Comparator.reverseOrder())
+      .map(majorVersion -> (new JsonInfo(json.getJSONObject(majorVersion))).toJsonString(majorVersion))
+      .collect(
+        Collectors.joining(",\n", "{\n", "\n}")
+      );
+  }
+
+  public void updateJsonInfo(String newVersion) {
+    try {
+      JSONObject json = getJsonInfo();
+      var info = json.getJSONObject(featureNumber);
+      info.put("version", newVersion);
+      info.put("hash", nixHash(newVersion));
+
+      try (PrintWriter out = new PrintWriter(infoJsonPath)) {
+        out.println(prettyPrint(json));
+      }
+
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private String nixHash(String version) {
+    try {
+      var process = new ProcessBuilder("nix", "flake", "prefetch",
+        "--extra-experimental-features", "'nix-command flakes'",
+        "--json", "github:openjdk/" + getRepo() + "/jdk-" + version).start();
+
+      var json = new JSONObject(new String(process.getInputStream().readAllBytes()));
+      process.waitFor();
+      return json.getString("hash");
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private final String featureNumber;
+  private final String infoJsonPath;
+  private final JSONObject jsonInfo;
+
+  public String getCurrentVersion() {
+    return this.jsonInfo.getJSONObject(this.featureNumber).getString("version");
+  }
+
+  public String getRepo() {
+    return this.jsonInfo.getJSONObject(this.featureNumber).getString("repo");
+  }
+
+  public JSONObject getJsonInfo() {
+    try {
+      String infoStr = Files.readString(Path.of(this.infoJsonPath));
+      return new JSONObject(infoStr);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public JavaUpdater(String featureNumber, String infoJsonPath) {
+    this.featureNumber = featureNumber;
+    this.infoJsonPath = infoJsonPath;
+    this.jsonInfo = getJsonInfo();
+  }
+
+  public static void main(String[] args) {
+    var updater = new JavaUpdater(args[0], args[1]);
+    String newerVersion = updater.findNewerVersion();
+    if (newerVersion != null) {
+      updater.updateJsonInfo(newerVersion);
+    }
+  }
+}
diff --git a/pkgs/development/compilers/openjdk/info.json b/pkgs/development/compilers/openjdk/info.json
new file mode 100644
index 0000000000000..c8f88d7280e4e
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/info.json
@@ -0,0 +1,12 @@
+{
+  "22": {
+    "version": "22-ga",
+    "repo":    "jdk22u",
+    "hash":    "sha256-itjvIedPwJl/l3a2gIVpNMs1zkbrjioVqbCj1Z1nCJE="
+  },
+  "21": {
+    "version": "21.0.3-ga",
+    "repo":    "jdk21u",
+    "hash":    "sha256-zRN16lrc5gtDlTVIQJRRx103w/VbRkatCLeEc9AXWPE="
+  }
+}
diff --git a/pkgs/development/compilers/openjdk/meta.nix b/pkgs/development/compilers/openjdk/meta.nix
index 74383ddef783d..04ed684eefab5 100644
--- a/pkgs/development/compilers/openjdk/meta.nix
+++ b/pkgs/development/compilers/openjdk/meta.nix
@@ -1,11 +1,11 @@
 lib: version: with lib; {
   homepage = "https://openjdk.java.net/";
   license = licenses.gpl2Only;
-  description = "The open-source Java Development Kit";
-  maintainers = with maintainers; [ edwtjo ];
+  description = "Open-source Java Development Kit";
+  maintainers = with maintainers; [ edwtjo infinidoge ];
   platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" "powerpc64le-linux" ];
   mainProgram = "java";
-  knownVulnerabilities = optionals (builtins.elem (versions.major version) [ "12" "13" "14" "15" "16" "18" ]) [
+  knownVulnerabilities = optionals (builtins.elem (versions.major version) [ "12" "13" "14" "15" "16" "18" "19" "20" ]) [
     "This OpenJDK version has reached its end of life."
   ];
 }
diff --git a/pkgs/development/compilers/openjdk/openjfx/11.nix b/pkgs/development/compilers/openjdk/openjfx/11.nix
index 424c41ce3c783..22b844bb1d67c 100644
--- a/pkgs/development/compilers/openjdk/openjfx/11.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/11.nix
@@ -7,7 +7,7 @@
 
 let
   major = "11";
-  update = ".0.18";
+  update = ".0.20";
   build = "1";
   repover = "${major}${update}+${build}";
   gradle_ = (gradle_7.override {
@@ -31,7 +31,7 @@ let
       owner = "openjdk";
       repo = "jfx${major}u";
       rev = repover;
-      sha256 = "sha256-46DjIzcBHkmp5vnhYnLu78CG72bIBRM4A6mgk2OLOko=";
+      sha256 = "sha256-BbBP2DiPZTSn1SBYMCgyiNdF9GD+NqR6YjeVNOQHHn4=";
     };
 
     buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4-headless ];
@@ -129,7 +129,7 @@ in makePackage {
   meta = with lib; {
     homepage = "http://openjdk.java.net/projects/openjfx/";
     license = licenses.gpl2;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = [ "x86_64-linux" ];
   };
diff --git a/pkgs/development/compilers/openjdk/openjfx/15.nix b/pkgs/development/compilers/openjdk/openjfx/15.nix
index 1fb48f460d2fd..77c8e4678d6c9 100644
--- a/pkgs/development/compilers/openjdk/openjfx/15.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/15.nix
@@ -119,7 +119,7 @@ in makePackage {
   meta = with lib; {
     homepage = "http://openjdk.java.net/projects/openjfx/";
     license = licenses.gpl2;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     knownVulnerabilities = [
       "This OpenJFX version has reached its end of life."
diff --git a/pkgs/development/compilers/openjdk/openjfx/17.nix b/pkgs/development/compilers/openjdk/openjfx/17.nix
index c5d6c6aaa597e..00fa6af725e5b 100644
--- a/pkgs/development/compilers/openjdk/openjfx/17.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/17.nix
@@ -7,8 +7,8 @@
 
 let
   major = "17";
-  update = ".0.6";
-  build = "+3";
+  update = ".0.11";
+  build = "-ga";
   repover = "${major}${update}${build}";
   gradle_ = (gradle_7.override {
     java = openjdk17_headless;
@@ -31,7 +31,7 @@ let
       owner = "openjdk";
       repo = "jfx${major}u";
       rev = repover;
-      sha256 = "sha256-9VfXk2EfMebMyVKPohPRP2QXRFf8XemUtfY0JtBCHyw=";
+      sha256 = "sha256-WV8NHlYlt7buGbirLSorLnS2TnyBD17zUquFfwSL3xE=";
     };
 
     buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4-headless ];
@@ -121,7 +121,7 @@ in makePackage {
   meta = with lib; {
     homepage = "http://openjdk.java.net/projects/openjfx/";
     license = licenses.gpl2;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
   };
diff --git a/pkgs/development/compilers/openjdk/openjfx/19.nix b/pkgs/development/compilers/openjdk/openjfx/19.nix
index 6f173db8327c1..38720efaba545 100644
--- a/pkgs/development/compilers/openjdk/openjfx/19.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/19.nix
@@ -138,8 +138,11 @@ in makePackage {
   meta = with lib; {
     homepage = "https://openjdk.org/projects/openjfx/";
     license = licenses.gpl2Classpath;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
+    knownVulnerabilities = [
+      "This OpenJFX version has reached its end of life."
+    ];
   };
 }
diff --git a/pkgs/development/compilers/openjdk/openjfx/20.nix b/pkgs/development/compilers/openjdk/openjfx/20.nix
index 794590dc7e606..0aa7b262e834e 100644
--- a/pkgs/development/compilers/openjdk/openjfx/20.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/20.nix
@@ -1,5 +1,5 @@
-{ stdenv, lib, fetchFromGitHub, fetchpatch, writeText, openjdk17_headless
-, openjdk19_headless, gradle_7, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst
+{ stdenv, lib, fetchFromGitHub, writeText, openjdk17_headless
+, openjdk20_headless, gradle_7, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst
 , libXxf86vm, glib, alsa-lib, ffmpeg_4, python3, ruby, fetchurl, runCommand
 , withMedia ? true
 , withWebKit ? false
@@ -7,8 +7,8 @@
 
 let
   major = "20";
-  update = "";
-  build = "+19";
+  update = ".0.2";
+  build = "-ga";
   repover = "${major}${update}${build}";
   gradle_ = (gradle_7.override {
     # note: gradle does not yet support running on 19
@@ -30,9 +30,9 @@ let
 
     src = fetchFromGitHub {
       owner = "openjdk";
-      repo = "jfx";
+      repo = "jfx20u";
       rev = repover;
-      hash = "sha256-QPPJyl6+XU+m5xqYOFtQKJNNrovqy7ngNE/e7kiEJVU=";
+      hash = "sha256-3Hhz4i8fPU2yowb4roylCXzuO9HkW7ZWF9TMA3HIH9o=";
     };
 
     buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4 ];
@@ -49,7 +49,7 @@ let
 
     config = writeText "gradle.properties" (''
       CONF = Release
-      JDK_HOME = ${openjdk19_headless.home}
+      JDK_HOME = ${openjdk20_headless.home}
     '' + args.gradleProperties or "");
 
     buildPhase = ''
@@ -111,22 +111,25 @@ in makePackage {
 
   postFixup = ''
     # Remove references to bootstrap.
-    export openjdkOutPath='${openjdk19_headless.outPath}'
+    export openjdkOutPath='${openjdk20_headless.outPath}'
     find "$out" -name \*.so | while read lib; do
       new_refs="$(patchelf --print-rpath "$lib" | perl -pe 's,:?\Q$ENV{openjdkOutPath}\E[^:]*,,')"
       patchelf --set-rpath "$new_refs" "$lib"
     done
   '';
 
-  disallowedReferences = [ openjdk17_headless openjdk19_headless ];
+  disallowedReferences = [ openjdk17_headless openjdk20_headless ];
 
   passthru.deps = deps;
 
   meta = with lib; {
     homepage = "https://openjdk.org/projects/openjfx/";
     license = licenses.gpl2Classpath;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
+    knownVulnerabilities = [
+      "This OpenJFX version has reached its end of life."
+    ];
   };
 }
diff --git a/pkgs/development/compilers/openjdk/openjfx/21.nix b/pkgs/development/compilers/openjdk/openjfx/21.nix
index f49dbe3b0e985..d4092a99f363c 100644
--- a/pkgs/development/compilers/openjdk/openjfx/21.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/21.nix
@@ -1,5 +1,5 @@
-{ stdenv, lib, fetchFromGitHub, fetchpatch, writeText, openjdk17_headless
-, openjdk19_headless, gradle_7, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst
+{ stdenv, lib, fetchFromGitHub, writeText, openjdk17_headless
+, openjdk21_headless, gradle_7, pkg-config, perl, cmake, gperf, gtk2, gtk3, libXtst
 , libXxf86vm, glib, alsa-lib, ffmpeg_4, python3, ruby, fetchurl, runCommand
 , withMedia ? true
 , withWebKit ? false
@@ -49,7 +49,7 @@ let
 
     config = writeText "gradle.properties" (''
       CONF = Release
-      JDK_HOME = ${openjdk19_headless.home}
+      JDK_HOME = ${openjdk21_headless.home}
     '' + args.gradleProperties or "");
 
     buildPhase = ''
@@ -111,21 +111,21 @@ in makePackage {
 
   postFixup = ''
     # Remove references to bootstrap.
-    export openjdkOutPath='${openjdk19_headless.outPath}'
+    export openjdkOutPath='${openjdk21_headless.outPath}'
     find "$out" -name \*.so | while read lib; do
       new_refs="$(patchelf --print-rpath "$lib" | perl -pe 's,:?\Q$ENV{openjdkOutPath}\E[^:]*,,')"
       patchelf --set-rpath "$new_refs" "$lib"
     done
   '';
 
-  disallowedReferences = [ openjdk17_headless openjdk19_headless ];
+  disallowedReferences = [ openjdk17_headless openjdk21_headless ];
 
   passthru.deps = deps;
 
   meta = with lib; {
     homepage = "https://openjdk.org/projects/openjfx/";
     license = licenses.gpl2Classpath;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
   };
diff --git a/pkgs/development/compilers/openjdk/openjfx/22.nix b/pkgs/development/compilers/openjdk/openjfx/22.nix
index d585dbdf01413..c34ff04668954 100644
--- a/pkgs/development/compilers/openjdk/openjfx/22.nix
+++ b/pkgs/development/compilers/openjdk/openjfx/22.nix
@@ -1,7 +1,6 @@
 { stdenv
 , lib
 , fetchFromGitHub
-, fetchpatch
 , fetchurl
 , runCommand
 , writeText
@@ -26,8 +25,8 @@
 
 let
   major = "22";
-  update = "";
-  build = "+30";
+  update = ".0.1";
+  build = "-ga";
   repover = "${major}${update}${build}";
 
   icuVersionWithSep = s: "73${s}1";
@@ -45,9 +44,9 @@ let
 
     src = fetchFromGitHub {
       owner = "openjdk";
-      repo = "jfx";
+      repo = "jfx22u";
       rev = repover;
-      hash = "sha256-sZF7ZPC0kgTTxWgtkxmGtOlfroGPGVZcMw0/wSTJUxQ=";
+      hash = "sha256-VoEufSO+LciUCvoAM86MG1iMjCA3FSb60Ik4OP2Rk/Q=";
     };
 
     buildInputs = [ gtk2 gtk3 libXtst libXxf86vm glib alsa-lib ffmpeg_4 ];
@@ -131,7 +130,7 @@ makePackage {
   meta = with lib; {
     homepage = "https://openjdk.org/projects/openjfx/";
     license = licenses.gpl2Classpath;
-    description = "The next-generation Java client toolkit";
+    description = "Next-generation Java client toolkit";
     maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
   };