git: 1bd57a8e0bd2 - main - graphics/synfig*: Define later versions of deps and fix build with FFmpeg 6

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

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

commit 1bd57a8e0bd26122c811d13c3573df974f4bf77c
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-04-27 11:08:31 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-04-27 12:01:45 +0000

    graphics/synfig*: Define later versions of deps and fix build with FFmpeg 6
    
    - Bump MLT and ImageMagick dependencies to 7
    - Import patch from Debian to fix build FFmpeg 6 (synfig only)
    - Rework ports to better follow Porters Handbook
    
    PR:             270701
    Approved by:    portmgr (maintainer timeout, 2+ weeks)
---
 graphics/synfig/Makefile                           | 24 +++++-----
 graphics/synfig/distinfo                           |  3 +-
 .../patch-src_modules_mod__libavcodec_trgt__av.cpp | 51 ++++++++++++++++++++++
 graphics/synfigstudio/Makefile                     | 25 ++++++-----
 graphics/synfigstudio/distinfo                     |  3 +-
 5 files changed, 80 insertions(+), 26 deletions(-)

diff --git a/graphics/synfig/Makefile b/graphics/synfig/Makefile
index 43989cb47327..083c5b60da7c 100644
--- a/graphics/synfig/Makefile
+++ b/graphics/synfig/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	synfig
-PORTVERSION=	1.4.4
-DISTVERSIONPREFIX=v
-PORTREVISION=	3
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.4.4
+PORTREVISION=	4
 CATEGORIES=	graphics devel multimedia
 
 MAINTAINER=	portmaster@BSDforge.com
@@ -26,22 +26,24 @@ LIB_DEPENDS=	libImath.so:math/Imath \
 		libpng.so:graphics/png \
 		libtiff.so:graphics/tiff
 
-PORTSCOUT=	limitw:1,even
-
 USES=		autoreconf compiler:c++11-lang gmake gnome iconv jpeg \
-		libtool localbase magick:6 mlt:6 pathfix pkgconfig
+		libtool localbase magick:7 mlt:7 pathfix pkgconfig
 USE_CXXSTD=	c++11
 USE_GITHUB=	yes
 USE_GNOME=	cairo glibmm intltool libxml++26 pango
+USE_LDCONFIG=	yes
+
+PORTSCOUT=	limitw:1,even
+
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	${ICONV_CONFIGURE_ARG}
-CONFIGURE_ENV+=	ac_cv_path_SED=${LOCALBASE}/bin/gsed
-# Other spurious uses of direct sed have popped up
-BINARY_ALIAS=	sed=${LOCALBASE}/bin/gsed
 INSTALL_TARGET=	install-strip
-USE_LDCONFIG=	yes
 WRKSRC_SUBDIR=	synfig-core
 
+BINARY_ALIAS=	sed=${LOCALBASE}/bin/gsed
+
+CONFIGURE_ENV+=	ac_cv_path_SED=${LOCALBASE}/bin/gsed
+CONFIGURE_ARGS=	${ICONV_CONFIGURE_ARG}
+
 OPTIONS_DEFINE=	DOCS NLS
 OPTIONS_SUB=	yes
 
diff --git a/graphics/synfig/distinfo b/graphics/synfig/distinfo
index d3ccbfa9733b..30c6d8a6d569 100644
--- a/graphics/synfig/distinfo
+++ b/graphics/synfig/distinfo
@@ -1,4 +1,3 @@
-TIMESTAMP = 1673053271
+TIMESTAMP = 1680950793
 SHA256 (synfig-synfig-v1.4.4_GH0.tar.gz) = 83357c3282ecb4e6be46771fde1688662ca184eab8901cef66fe2bf000b99519
-SHA512 (synfig-synfig-v1.4.4_GH0.tar.gz) = 1b0ef61cae21130c6d8068212cacf6d6a2d6264a06fa5275f50384a45ae1e75b2df21c11c920de42588bc924e385de5ce2b4f7565ab85026bf835c13eddb9eb5
 SIZE (synfig-synfig-v1.4.4_GH0.tar.gz) = 12943798
diff --git a/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp b/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp
new file mode 100644
index 000000000000..1cab65ab6bbb
--- /dev/null
+++ b/graphics/synfig/files/patch-src_modules_mod__libavcodec_trgt__av.cpp
@@ -0,0 +1,51 @@
+--- src/modules/mod_libavcodec/trgt_av.cpp.orig	2022-12-24 14:01:41 UTC
++++ src/modules/mod_libavcodec/trgt_av.cpp
+@@ -38,6 +38,7 @@
+ extern "C"
+ {
+ #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
++#	include <libavcodec/avcodec.h>
+ #	include <libavformat/avformat.h>
+ #elif defined(HAVE_AVFORMAT_H)
+ #	include <avformat.h>
+@@ -234,12 +235,14 @@ class Target_LibAVCodec::Internal (public)
+ 		close();
+ 
+ 		if (!av_registered) {
+-			av_register_all();
++#if LIBAVCODEC_VERSION_MAJOR < 59
++ 			av_register_all();
++#endif
+ 			av_registered = true;
+ 		}
+ 
+ 		// guess format
+-		AVOutputFormat *format = av_guess_format(NULL, filename.c_str(), NULL);
++		const AVOutputFormat *format = av_guess_format(NULL, filename.c_str(), NULL);
+ 		if (!format) {
+ 			synfig::warning("Target_LibAVCodec: unable to guess the output format, defaulting to MPEG");
+ 			format = av_guess_format("mpeg", NULL, NULL);
+@@ -254,7 +257,7 @@ class Target_LibAVCodec::Internal (public)
+ 		context = avformat_alloc_context();
+ 		assert(context);
+ 		context->oformat = format;
+-		if (filename.size() + 1 > sizeof(context->filename)) {
++		/*if (filename.size() + 1 > sizeof(context->filename)) {
+ 			synfig::error(
+ 				"Target_LibAVCodec: filename too long, max length is %d, filename is '%s'",
+ 				sizeof(context->filename) - 1,
+@@ -262,7 +265,13 @@ class Target_LibAVCodec::Internal (public)
+ 			close();
+ 			return false;
+ 		}
+-		memcpy(context->filename, filename.c_str(), filename.size() + 1);
++		memcpy(context->filename, filename.c_str(), filename.size() + 1);*/
++		context->url = av_strndup(filename.c_str(), filename.size());
++		if (!context->url) {
++			synfig::error("Target_LibAVCodec: cannot allocate space for filename");
++			close();
++			return false;
++		}
+ 
+ 		packet = av_packet_alloc();
+ 		assert(packet);
diff --git a/graphics/synfigstudio/Makefile b/graphics/synfigstudio/Makefile
index 51b15e01ca94..df960fecdfe9 100644
--- a/graphics/synfigstudio/Makefile
+++ b/graphics/synfigstudio/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	synfigstudio
-PORTVERSION=	1.4.4
-DISTVERSIONPREFIX=v
-PORTREVISION=	4
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.4.4
+PORTREVISION=	5
 CATEGORIES=	graphics multimedia
 
 MAINTAINER=	portmaster@BSDforge.com
@@ -24,22 +24,25 @@ LIB_DEPENDS=	libImath.so:math/Imath \
 		libsynfig.so:graphics/synfig
 RUN_DEPENDS=	xdg-open:devel/xdg-utils
 
-PORTSCOUT=	limitw:1,even
-
-USES=		autoreconf compiler:c++11-lang desktop-file-utils \
-		gmake gnome libtool localbase magick:6 mlt:6 pathfix pkgconfig \
+USES=		autoreconf compiler:c++11-lang desktop-file-utils gmake \
+		gnome libtool localbase magick:7 mlt:7 pathfix pkgconfig \
 		shared-mime-info
+USE_CXXSTD=	c++11
 USE_GITHUB=	yes
 GH_ACCOUNT=	synfig
 GH_PROJECT=	synfig
-WRKSRC_SUBDIR=	synfig-studio
-USE_CXXSTD=	c++11
 USE_GNOME=	gdkpixbuf2 gtkmm30 intltool
+USE_LDCONFIG=	yes
+
+PORTSCOUT=	limitw:1,even
+
 GNU_CONFIGURE=	yes
+INSTALL_TARGET=	install-strip
+WRKSRC_SUBDIR=	synfig-studio
+
 BINARY_ALIAS=	sed=${LOCALBASE}/bin/gsed
+
 CONFIGURE_ARGS=	--disable-update-mimedb
-INSTALL_TARGET=	install-strip
-USE_LDCONFIG=	yes
 
 OPTIONS_DEFINE=	DOCS JACK NLS
 OPTIONS_SUB=	yes
diff --git a/graphics/synfigstudio/distinfo b/graphics/synfigstudio/distinfo
index e790156deeab..db253a958263 100644
--- a/graphics/synfigstudio/distinfo
+++ b/graphics/synfigstudio/distinfo
@@ -1,4 +1,3 @@
-TIMESTAMP = 1673068380
+TIMESTAMP = 1680950823
 SHA256 (synfig-synfig-v1.4.4_GH0.tar.gz) = 83357c3282ecb4e6be46771fde1688662ca184eab8901cef66fe2bf000b99519
-SHA512 (synfig-synfig-v1.4.4_GH0.tar.gz) = 1b0ef61cae21130c6d8068212cacf6d6a2d6264a06fa5275f50384a45ae1e75b2df21c11c920de42588bc924e385de5ce2b4f7565ab85026bf835c13eddb9eb5
 SIZE (synfig-synfig-v1.4.4_GH0.tar.gz) = 12943798