From cdce1070e8f3d980b05541d6adeef87ca498ba08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Schr=C3=B6der?= Date: Tue, 4 Nov 2025 22:23:34 +0100 Subject: [PATCH 1/2] corretto25: init at 25.0.1.9.1 --- pkgs/development/compilers/corretto/25.nix | 41 +++++++++++++++++++ .../compilers/corretto/mk-corretto.nix | 17 +++++--- ...l_of_wformat_during_test_compilation.patch | 13 ++++++ pkgs/top-level/all-packages.nix | 1 + pkgs/top-level/java-packages.nix | 1 + 5 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/compilers/corretto/25.nix create mode 100644 pkgs/development/compilers/corretto/remove_removal_of_wformat_during_test_compilation.patch diff --git a/pkgs/development/compilers/corretto/25.nix b/pkgs/development/compilers/corretto/25.nix new file mode 100644 index 0000000000000..1b9b5bdf5761a --- /dev/null +++ b/pkgs/development/compilers/corretto/25.nix @@ -0,0 +1,41 @@ +{ + fetchFromGitHub, + gradle_9, + jdk25, + lib, + stdenv, + rsync, + pandoc, + runCommand, + testers, +}: + +let + corretto = import ./mk-corretto.nix rec { + inherit + lib + stdenv + rsync + runCommand + testers + ; + jdk = jdk25; + gradle = gradle_9; + version = "25.0.1.9.1"; + src = fetchFromGitHub { + owner = "corretto"; + repo = "corretto-25"; + rev = version; + hash = "sha256-eAjepqxp5LVQgP/HcxwwdjbXxy5jUOJC4HYntcHNX0o="; + }; + extraNativeBuildInputs = [ pandoc ]; + }; +in +corretto.overrideAttrs ( + final: prev: { + patches = (prev.patches or [ ]) ++ [ + # See patches in openjdk/generic.nix. + ./remove_removal_of_wformat_during_test_compilation.patch + ]; + } +) diff --git a/pkgs/development/compilers/corretto/mk-corretto.nix b/pkgs/development/compilers/corretto/mk-corretto.nix index 9fdc03d3059e3..ecb52296902d3 100644 --- a/pkgs/development/compilers/corretto/mk-corretto.nix +++ b/pkgs/development/compilers/corretto/mk-corretto.nix @@ -6,6 +6,7 @@ stdenv, gradle, extraConfig ? [ ], + extraNativeBuildInputs ? [ ], rsync, runCommand, testers, @@ -29,11 +30,14 @@ jdk.overrideAttrs ( finalAttrs: oldAttrs: { inherit pname version src; - nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ - jdk - gradle - rsync - ]; + nativeBuildInputs = + oldAttrs.nativeBuildInputs + ++ [ + jdk + gradle + rsync + ] + ++ extraNativeBuildInputs; dontConfigure = true; @@ -41,7 +45,8 @@ jdk.overrideAttrs ( let extra_config = builtins.concatStringsSep " " extraConfig; in - '' + (oldAttrs.postPatch or "") + + '' # The rpm/deb task definitions require a Gradle plugin which we don't # have and so the build fails. We'll simply remove them here because # they are not needed anyways. diff --git a/pkgs/development/compilers/corretto/remove_removal_of_wformat_during_test_compilation.patch b/pkgs/development/compilers/corretto/remove_removal_of_wformat_during_test_compilation.patch new file mode 100644 index 0000000000000..077fb2330e96c --- /dev/null +++ b/pkgs/development/compilers/corretto/remove_removal_of_wformat_during_test_compilation.patch @@ -0,0 +1,13 @@ +diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk +index fd1c54eaf..c1e240a19 100644 +--- a/make/common/TestFilesCompilation.gmk ++++ b/make/common/TestFilesCompilation.gmk +@@ -112,7 +112,7 @@ define SetupTestFilesCompilationBody + CXXFLAGS := $$(TEST_CFLAGS) $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \ + LD_SET_ORIGIN := $$($1_LD_SET_ORIGIN), \ + LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \ +- DISABLED_WARNINGS_gcc := format undef unused-but-set-variable \ ++ DISABLED_WARNINGS_gcc := undef unused-but-set-variable \ + unused-const-variable unused-function unused-value \ + unused-variable, \ + DISABLED_WARNINGS_clang := format-nonliteral \ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f64fe70796bc8..88549314f609a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4190,6 +4190,7 @@ with pkgs; corretto11 = javaPackages.compiler.corretto11; corretto17 = javaPackages.compiler.corretto17; corretto21 = javaPackages.compiler.corretto21; + corretto25 = javaPackages.compiler.corretto25; inherit (callPackage ../development/compilers/crystal { }) crystal_1_14 diff --git a/pkgs/top-level/java-packages.nix b/pkgs/top-level/java-packages.nix index 974c4d59611dc..7c222e5f83007 100644 --- a/pkgs/top-level/java-packages.nix +++ b/pkgs/top-level/java-packages.nix @@ -47,6 +47,7 @@ in corretto11 = callPackage ../development/compilers/corretto/11.nix { }; corretto17 = callPackage ../development/compilers/corretto/17.nix { }; corretto21 = callPackage ../development/compilers/corretto/21.nix { }; + corretto25 = callPackage ../development/compilers/corretto/25.nix { }; openjdk8 = mkOpenjdk "8"; openjdk11 = mkOpenjdk "11"; From 0798dd88d03c4ef07f252cb69917353adc18135c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Schr=C3=B6der?= Date: Fri, 16 Jan 2026 10:57:20 +0100 Subject: [PATCH 2/2] correto: fix gradle9/correto25 incompatibilities --- .../compilers/corretto/mk-corretto.nix | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/corretto/mk-corretto.nix b/pkgs/development/compilers/corretto/mk-corretto.nix index ecb52296902d3..df9282fb7abce 100644 --- a/pkgs/development/compilers/corretto/mk-corretto.nix +++ b/pkgs/development/compilers/corretto/mk-corretto.nix @@ -48,9 +48,22 @@ jdk.overrideAttrs ( (oldAttrs.postPatch or "") + '' # The rpm/deb task definitions require a Gradle plugin which we don't - # have and so the build fails. We'll simply remove them here because - # they are not needed anyways. - rm -rf installers/linux/universal/{rpm,deb} + # have and so the build fails. We'll simply empty them here because + # they are not needed anyways. The directories are kept because Gradle + # still expects them. + rm -rf installers/linux/universal/{rpm,deb}/{*,.*} + + # These fixes are necessary as long as we use Gradle 9 to build + # Corretto but upstream is not yet using it. I.e. as long as upstream + # hasn't fixed compatibility with Gradle 9 issues. + find /build/source/installers -type d -exec cp /build/source/version.txt {}/version.txt \; + find /build/source/installers -name 'build.gradle' -exec sed -i '/fileMode =/d' {} \; + for d in source pre-build; do + # These subprojects (see settings.gradle) don't exist. Create them + # here so that Gradle doesn't complain. + mkdir /build/source/$d + cp /build/source/version.txt /build/source/$d/version.txt + done # `/usr/bin/rsync` is invoked to copy the source tree. We don't have that. for file in $(find installers -name "build.gradle"); do @@ -79,6 +92,7 @@ jdk.overrideAttrs ( file=$(find ./installers -name 'amazon-corretto-${version}*.tar.gz') tar -xzf $file -C $dir mv $dir/amazon-corretto-* $dir/jdk + chmod +x $dir/jdk/bin/* '' + oldAttrs.postBuild or "";