diff --git a/pkgs/by-name/op/openjfx/package.nix b/pkgs/by-name/op/openjfx/package.nix index 2a2f5cfd8f49..d8521cfc1268 100644 --- a/pkgs/by-name/op/openjfx/package.nix +++ b/pkgs/by-name/op/openjfx/package.nix @@ -6,7 +6,6 @@ pkgs, gradle_8, - gradle_7, perl, pkg-config, cmake, @@ -23,6 +22,7 @@ ffmpeg_7, ffmpeg_7-headless, + fetchpatch2, writeText, _experimental-update-script-combinators, @@ -54,8 +54,6 @@ let atLeast21 = lib.versionAtLeast featureVersion "21"; atLeast23 = lib.versionAtLeast featureVersion "23"; - - gradle_openjfx = if atLeast21 then gradle_8 else gradle_7; in assert lib.assertMsg (lib.pathExists sourceFile) @@ -76,11 +74,28 @@ stdenv.mkDerivation { [ ./17/patches/backport-ffmpeg-6-support-jfx11.patch ./17/patches/backport-ffmpeg-7-support-jfx11.patch + + # Build with Gradle 8 + (fetchpatch2 { + # Yes, this patch taken from the jfx21u repo is intended to be + # applied to jfx17. + url = "https://github.com/openjdk/jfx21u/commit/7f704c24c2238f9d7bb744a20667a8c1337decc6.patch?full_index=1"; + excludes = [ + # The patch fails to apply to these files, but with the exception + # of build.properties (which is patched in postPatch), none of them + # matter. + "build.properties" + "gradle/legal/gradle.md" + "gradle/wrapper/gradle-wrapper.properties" + "gradlew" + ]; + hash = "sha256-WuJtzPy0IV4xvn+i5xeDqekWO0VR2GIfsYKkEmh8KKU="; + }) ] ); nativeBuildInputs = [ - gradle_openjfx + gradle_8 perl pkg-config cmake @@ -99,7 +114,7 @@ stdenv.mkDerivation { (if atLeast21 then ffmpeg_7 else ffmpeg_7-headless) ]; - mitmCache = gradle_openjfx.fetchDeps { + mitmCache = gradle_8.fetchDeps { attrPath = "openjfx${featureVersion}"; pkg = pkgs."openjfx${featureVersion}".override { withWebKit = true; }; data = ./. + "/${featureVersion}/deps.json"; @@ -132,6 +147,10 @@ stdenv.mkDerivation { modules/javafx.web/src/main/native/Source/bmalloc/bmalloc/IsoSharedPageInlines.h '' + + lib.optionalString (!atLeast21) '' + substituteInPlace build.properties \ + --replace-fail jfx.gradle.version=7.3 jfx.gradle.version=8.4 + '' + '' ln -s $config gradle.properties ''; @@ -156,7 +175,7 @@ stdenv.mkDerivation { disallowedReferences = [ jdk-bootstrap - gradle_openjfx.jdk + gradle_8.jdk ]; passthru.updateScript = _experimental-update-script-combinators.sequence [