git: 8ae71fbb3355 - main - graphics/osg*: Move to FFmpeg 4

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

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

commit 8ae71fbb335508c140898af9da2d50e8a19cfce0
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-04-27 09:40:57 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-04-27 12:01:42 +0000

    graphics/osg*: Move to FFmpeg 4
    
    Fails to build with FFmpeg 6
    
    PR:             270207
    Approved by:    portmgr (blanket, build fix)
    Sponsored by:   Blinkinblox
---
 graphics/osg/Makefile                                    |  4 +++-
 graphics/osg/files/patch-CMakeModules_FindFFmpeg.cmake   | 10 ++++++++++
 graphics/osg34/Makefile                                  |  6 ++++--
 graphics/osg34/files/patch-CMakeModules_FindFFmpeg.cmake | 10 ++++++++++
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/graphics/osg/Makefile b/graphics/osg/Makefile
index e169534ec600..e9672246f0f3 100644
--- a/graphics/osg/Makefile
+++ b/graphics/osg/Makefile
@@ -54,7 +54,7 @@ COLLADA_DESC=		COLLADA (dae) format support
 CURL_LIB_DEPENDS=	libcurl.so:ftp/curl
 CURL_VARS=		FORCE_REQUIRE+=CURL
 CURL_VARS_OFF=		FORCE_IGNORE+=CURL
-FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg
+FFMPEG_LIB_DEPENDS=	libavcodec.so.58:multimedia/ffmpeg4
 FFMPEG_VARS=		FORCE_REQUIRE+=FFmpeg
 FFMPEG_VARS_OFF=	FORCE_IGNORE+=FFmpeg
 FREETYPE_LIB_DEPENDS=	libfreetype.so:print/freetype2
@@ -148,6 +148,8 @@ post-patch:
 		${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g'
 	@${REINPLACE_CMD} -e '/FIND_LIBRARY.*DL_LIBRARY/ d; \
 		s|-pedantic||' ${WRKSRC}/CMakeLists.txt
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		${PATCH_WRKSRC}/CMakeModules/FindFFmpeg.cmake
 .for p in ${FORCE_REQUIRE}
 	@${REINPLACE_CMD} -e '/FIND_PACKAGE.*${p}/ s|)$$| REQUIRED&|' \
 		${WRKSRC}/CMakeLists.txt
diff --git a/graphics/osg/files/patch-CMakeModules_FindFFmpeg.cmake b/graphics/osg/files/patch-CMakeModules_FindFFmpeg.cmake
new file mode 100644
index 000000000000..21ea506f30a7
--- /dev/null
+++ b/graphics/osg/files/patch-CMakeModules_FindFFmpeg.cmake
@@ -0,0 +1,10 @@
+--- CMakeModules/FindFFmpeg.cmake.orig	2023-04-24 09:16:25 UTC
++++ CMakeModules/FindFFmpeg.cmake
+@@ -21,6 +21,7 @@
+ #                                                       (in new version case, use by ffmpeg header) 
+ #and ${FFMPEG_libname_INCLUDE_DIRS/libname}             (in new version case, use by osg plugin code)
+ 
++set(CMAKE_PREFIX_PATH "%%LOCALBASE%%/ffmpeg4;%%LOCALBASE%%/ffmpeg4/libexec")
+ 
+ # Macro to find header and lib directories
+ # example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
diff --git a/graphics/osg34/Makefile b/graphics/osg34/Makefile
index 51ba61a83cbf..b6d2e29baacd 100644
--- a/graphics/osg34/Makefile
+++ b/graphics/osg34/Makefile
@@ -23,7 +23,7 @@ GH_PROJECT=	OpenSceneGraph
 
 CONFLICTS_INSTALL=osg
 
-USES=		alias cmake compiler:c++11-lang gl jpeg pkgconfig xorg
+USES=		alias cmake compiler:c++11-lang gl jpeg localbase pkgconfig xorg
 USE_GL=		gl glu
 USE_XORG=	x11
 USE_LDCONFIG=	yes
@@ -54,7 +54,7 @@ OPTIONS_SUB=	yes
 CURL_LIB_DEPENDS=	libcurl.so:ftp/curl
 CURL_VARS=		FORCE_REQUIRE+=CURL
 CURL_VARS_OFF=		FORCE_IGNORE+=CURL
-FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg
+FFMPEG_LIB_DEPENDS=	libavcodec.so.58:multimedia/ffmpeg4
 FFMPEG_VARS=		FORCE_REQUIRE+=FFmpeg
 FFMPEG_VARS_OFF=	FORCE_IGNORE+=FFmpeg
 FREETYPE_LIB_DEPENDS=	libfreetype.so:print/freetype2
@@ -138,6 +138,8 @@ post-patch:
 		${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g'
 	@${REINPLACE_CMD} -e '/FIND_LIBRARY.*DL_LIBRARY/ d' \
 		${WRKSRC}/CMakeLists.txt
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		${PATCH_WRKSRC}/CMakeModules/FindFFmpeg.cmake
 .for p in ${FORCE_REQUIRE}
 	@${REINPLACE_CMD} -e '/FIND_PACKAGE.*${p}/ s|)$$| REQUIRED&|' \
 		${WRKSRC}/CMakeLists.txt
diff --git a/graphics/osg34/files/patch-CMakeModules_FindFFmpeg.cmake b/graphics/osg34/files/patch-CMakeModules_FindFFmpeg.cmake
new file mode 100644
index 000000000000..8877dac1de45
--- /dev/null
+++ b/graphics/osg34/files/patch-CMakeModules_FindFFmpeg.cmake
@@ -0,0 +1,10 @@
+--- CMakeModules/FindFFmpeg.cmake.orig	2023-04-24 09:18:12 UTC
++++ CMakeModules/FindFFmpeg.cmake
+@@ -21,6 +21,7 @@
+ #                                                       (in new version case, use by ffmpeg header) 
+ #and ${FFMPEG_libname_INCLUDE_DIRS/libname}             (in new version case, use by osg plugin code)
+ 
++set(CMAKE_PREFIX_PATH "%%LOCALBASE%%/ffmpeg4;%%LOCALBASE%%/ffmpeg4/libexec")
+ 
+ # Macro to find header and lib directories
+ # example: FFMPEG_FIND(AVFORMAT avformat avformat.h)