From 8def946279ab6d1b1b7755e299f50f87b7cf18ff Mon Sep 17 00:00:00 2001 From: "Tobias C. Berner" Date: Tue, 13 Dec 2022 15:29:01 +0100 Subject: [PATCH] devel/jetbrains-clion: use the JAVA_HOME defined in the ports tree bin/clion tries to figure out the proper JAVA_HOME, while giving the user the ability to override it. This can lead to it picking up a too old Java version: > clion java.lang.UnsupportedClassVersionError: com/intellij/util/lang/PathClassLoader has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 To fix this, make the ports tree fill in its JAVA_HOME into bin/clion. Users can still override it to something specific by overriding CLION_JDK: > env CLION_JDK=/some/other/jdk/installation clion --- devel/jetbrains-clion/Makefile | 5 +++++ devel/jetbrains-clion/files/patch-bin_clion.sh | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 devel/jetbrains-clion/files/patch-bin_clion.sh diff --git a/devel/jetbrains-clion/Makefile b/devel/jetbrains-clion/Makefile index a1b37213d77d..da4c5f66fe73 100644 --- a/devel/jetbrains-clion/Makefile +++ b/devel/jetbrains-clion/Makefile @@ -1,5 +1,6 @@ PORTNAME= clion PORTVERSION= 2022.3 +PORTREVISION= 1 CATEGORIES= devel java MASTER_SITES= https://download-cdn.jetbrains.com/cpp/ PKGNAMEPREFIX= jetbrains- @@ -37,6 +38,10 @@ SUB_FILES= ${PORTNAME} ${PORTNAME}.desktop pkg-message WRKSRC= ${WRKDIR}/clion-${PORTVERSION} +post-patch: + ${REINPLACE_CMD} -e 's|%%PORTS_CLION_JDK%%|${JAVA_HOME}|g' \ + ${WRKSRC}/bin/clion.sh + do-install: # Linux/Windows/OS X only so remove them @${RM} -r \ diff --git a/devel/jetbrains-clion/files/patch-bin_clion.sh b/devel/jetbrains-clion/files/patch-bin_clion.sh new file mode 100644 index 000000000000..8fcac1847ecb --- /dev/null +++ b/devel/jetbrains-clion/files/patch-bin_clion.sh @@ -0,0 +1,15 @@ +--- bin/clion.sh.orig 1970-01-20 07:47:33 UTC ++++ bin/clion.sh +@@ -50,6 +50,12 @@ JRE="" + JRE="" + + # shellcheck disable=SC2154 ++# Set the default JDK version to the one defined in the FreeBSD port. ++# Allow the user to override it still by using CLION_JDK. ++if [ -z "${CLION_JDK}" ] ; then ++CLION_JDK="%%PORTS_CLION_JDK%%" ++fi ++ + if [ -n "$CLION_JDK" ] && [ -x "$CLION_JDK/bin/java" ]; then + JRE="$CLION_JDK" + fi -- 2.38.1