git: 1c4a5a439be1 - main - java/openjfx14: Move to FFmpeg 4

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Thu, 27 Apr 2023 12:04:01 UTC
The branch main has been updated by diizzy:

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

commit 1c4a5a439be18241f9c356261f3275bc0e68cc1e
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-04-27 09:50:28 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-04-27 12:01:42 +0000

    java/openjfx14: Move to FFmpeg 4
    
    Fails to build with FFmpeg 6
    
    PR:             261302
    Reported by:    antoine (via exp-run)
    Approved by:    portmgr (blanket, build fix)
    Sponsored by:   Blinkinblox
---
 java/openjfx14/Makefile                            |  5 ++-
 ...tive_gstreamer_projects_linux_avplugin_Makefile | 37 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/java/openjfx14/Makefile b/java/openjfx14/Makefile
index 2a7d0e8984d1..05aea99965e4 100644
--- a/java/openjfx14/Makefile
+++ b/java/openjfx14/Makefile
@@ -58,7 +58,7 @@ OPTIONS_SUB=	yes
 MEDIA_DESC=	Media module
 SWT_DESC=	SWT support
 
-MEDIA_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg \
+MEDIA_LIB_DEPENDS=	libavcodec.so.58:multimedia/ffmpeg4 \
 			libsndio.so:audio/sndio
 MEDIA_USES=	gmake
 MEDIA_VARS=	COMPILE_MEDIA=true
@@ -133,6 +133,9 @@ post-patch:
 	@${RM} -r ${WRKSRC}/modules/javafx.web/src/main/native/Source/WTF/icu
 	@cd ${WRKSRC}/modules/javafx.media/src/main/native/gstreamer/3rd_party && \
 		${RM} -r glib libffi
+# Environment variables gets lost so hardcode where we can find FFmpeg 4.x
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		${PATCH_WRKSRC}/modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile
 
 do-configure:
 	@${MKDIR} ${WRKDIR}/gradle-home
diff --git a/java/openjfx14/files/patch-modules_javafx.media_src_main_native_gstreamer_projects_linux_avplugin_Makefile b/java/openjfx14/files/patch-modules_javafx.media_src_main_native_gstreamer_projects_linux_avplugin_Makefile
new file mode 100644
index 000000000000..1d019e231f7a
--- /dev/null
+++ b/java/openjfx14/files/patch-modules_javafx.media_src_main_native_gstreamer_projects_linux_avplugin_Makefile
@@ -0,0 +1,37 @@
+--- modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile.orig	2020-07-17 10:21:33 UTC
++++ modules/javafx.media/src/main/native/gstreamer/projects/linux/avplugin/Makefile
+@@ -41,25 +41,16 @@ endif
+ PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
+ PACKAGES_LIBS     := $(shell pkg-config --libs glib-2.0 gobject-2.0)
+ 
+-INCLUDES= -I../../../plugins                          \
+-          -I../../../plugins/av                       \
+-          -I../../../gstreamer-lite/gstreamer         \
+-          -I../../../gstreamer-lite/gstreamer/libs    \
+-          $(PACKAGES_INCLUDES)
++INCLUDES = -I../../../plugins -I../../../plugins/av -I../../../gstreamer-lite/gstreamer -I../../../gstreamer-lite/gstreamer/libs -I%%LOCALBASE%%/ffmpeg4/include $(PACKAGES_INCLUDES)
++LDFLAGS = -L$(BUILD_DIR) -lgstreamer-lite -L%%LOCALBASE%%/ffmpeg4/lib -lavcodec -lavformat $(PACKAGES_LIBS) -z relro -static-libgcc -static-libstdc++ -Wl,--gc-sections
+ 
+-LDFLAGS = -L$(BUILD_DIR)    \
+-          -lgstreamer-lite  \
+-           $(PACKAGES_LIBS) \
+-          -z relro          \
+-          -static-libgcc -static-libstdc++ -Wl,--gc-sections
+-
+-ifneq ($(strip $(LIBAV_DIR)),)
+-INCLUDES += -I$(LIBAV_DIR)/include
+-LDFLAGS  += -L$(LIBAV_DIR)/lib/ -lavcodec -lavformat
+-else
+-INCLUDES += $(shell pkg-config --cflags libavcodec libavformat)
+-LDFLAGS  += $(shell pkg-config --libs libavcodec libavformat)
+-endif
++# ifneq ($(strip $(LIBAV_DIR)),)
++# INCLUDES += -I$(LIBAV_DIR)/include
++# LDFLAGS  += -L$(LIBAV_DIR)/lib/ -lavcodec -lavformat
++# else
++# INCLUDES += $(shell pkg-config --cflags libavcodec libavformat)
++# LDFLAGS  += $(shell pkg-config --libs libavcodec libavformat)
++# endif
+ 
+ ifeq ($(ARCH), x32)
+     CFLAGS += -m32