git: d091ccbfd381 - main - games/prismlauncher: Build with java 7 compatibility if build with jdk < 20

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sat, 14 Sep 2024 14:52:20 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d091ccbfd3813878c7fb4c39741f10d1f9f1e20f

commit d091ccbfd3813878c7fb4c39741f10d1f9f1e20f
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-09-14 14:41:05 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-09-14 14:41:05 +0000

    games/prismlauncher: Build with java 7 compatibility if build with jdk < 20
    
    Java 20 and above has dropped binary compatibility with Java 7.
    When the Prism Launcher is compiled with Java 20+, the sources are
    patched to be binary compatible with Java 8 instead of Java 7.
    This may cause issues with very old Minecraft versions and/or older
    Forge versions: https://github.com/PolyMC/PolyMC/issues/515.
    If you have problems, install an older Java compiler and recompile
    games/Prismlauncher.
    
    Approved by: Alexander88207@protonmail.com (maintainer, via Discord)
---
 games/prismlauncher/Makefile                                       | 7 +++++++
 ...akeLists.txt => extra-patch-libraries_javacheck_CMakeLists.txt} | 0
 ...MakeLists.txt => extra-patch-libraries_launcher_CMakeLists.txt} | 0
 3 files changed, 7 insertions(+)

diff --git a/games/prismlauncher/Makefile b/games/prismlauncher/Makefile
index 7bc29be57b6c..e0f3bd611c28 100644
--- a/games/prismlauncher/Makefile
+++ b/games/prismlauncher/Makefile
@@ -32,6 +32,13 @@ USE_QT=		5compat base
 CMAKE_ARGS=	-DJAVA_HOME=${JAVA_HOME} -DJava_JAVAC_EXECUTABLE=${JAVAC} \
 		-DLauncher_BUILD_PLATFORM=FreeBSD
 
+.include <bsd.port.pre.mk>
+
+.if ${JAVA_PORT_VERSION} >= 20
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-libraries_javacheck_CMakeLists.txt \
+		${PATCHDIR}/extra-patch-libraries_launcher_CMakeLists.txt
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
 		${WRKSRC}/launcher/minecraft/LaunchProfile.cpp \
diff --git a/games/prismlauncher/files/patch-libraries_javacheck_CMakeLists.txt b/games/prismlauncher/files/extra-patch-libraries_javacheck_CMakeLists.txt
similarity index 100%
rename from games/prismlauncher/files/patch-libraries_javacheck_CMakeLists.txt
rename to games/prismlauncher/files/extra-patch-libraries_javacheck_CMakeLists.txt
diff --git a/games/prismlauncher/files/patch-libraries_launcher_CMakeLists.txt b/games/prismlauncher/files/extra-patch-libraries_launcher_CMakeLists.txt
similarity index 100%
rename from games/prismlauncher/files/patch-libraries_launcher_CMakeLists.txt
rename to games/prismlauncher/files/extra-patch-libraries_launcher_CMakeLists.txt