git: 69e0cbe8eaa6 - main - multimedia/vapoursynth: Update to R63

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sat, 05 Aug 2023 19:16:58 UTC
The branch main has been updated by diizzy:

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

commit 69e0cbe8eaa6fb6fcb075774c4d8ef7b2a205bba
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-08-05 18:46:22 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-08-05 19:14:21 +0000

    multimedia/vapoursynth: Update to R63
    
    * Plugins are no longer maintained within the main project repo
    * Revert upstream commit 1239124c2d70f32c468326e48bfa7e9362550c36
      as it breaks compatibility with Clang/LLVM with libc++ [1]
    
    1: https://github.com/vapoursynth/vapoursynth/pull/953
    
    Changelog: https://github.com/vapoursynth/vapoursynth/releases/tag/R63
---
 multimedia/vapoursynth/Makefile                    | 117 +++++---------------
 multimedia/vapoursynth/distinfo                    |   6 +-
 multimedia/vapoursynth/files/patch-Makefile.am     |   9 ++
 multimedia/vapoursynth/files/patch-configure.ac    |  13 +++
 .../vapoursynth/files/patch-src_core_expr_expr.cpp | 122 +++++++++++++++++++++
 multimedia/vapoursynth/pkg-plist                   |  38 +++----
 6 files changed, 187 insertions(+), 118 deletions(-)

diff --git a/multimedia/vapoursynth/Makefile b/multimedia/vapoursynth/Makefile
index 01e7a0183990..1487516079e9 100644
--- a/multimedia/vapoursynth/Makefile
+++ b/multimedia/vapoursynth/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	vapoursynth
-DISTVERSION=	R54
-PORTREVISION=	4
+DISTVERSION=	R63
 CATEGORIES=	multimedia
 
 MAINTAINER=	ports@FreeBSD.org
@@ -8,101 +7,45 @@ COMMENT=	Video processing framework with simplicity in mind
 WWW=		https://www.vapoursynth.com/
 
 LICENSE=	LGPL21+
+LICENSE_FILE=	${WRKSRC}/COPYING.LESSER
 
+BUILD_DEPENDS=	${BUILD_DEPENDS_${ARCH}}
+BUILD_DEPENDS_amd64=	nasm:devel/nasm
+LIB_DEPENDS=	libzimg.so:graphics/sekrit-twc-zimg
+
+USES=		autoreconf compiler:c++17-lang gmake libtool localbase pathfix python pkgconfig
+USE_PYTHON=	cython
 USE_GITHUB=	yes
+USE_LDCONFIG=	yes
 
-USES=		autoreconf gmake libtool localbase pathfix pkgconfig
-GNU_CONFIGURE=	yes
+BINARY_ALIAS=	cython=cython-${PYTHON_VER}
 INSTALL_TARGET=	install-strip
-USE_LDCONFIG=	yes
-DATADIR=	${PREFIX}/lib/vapoursynth
 
-OPTIONS_DEFINE=	DEBUG DOCS FRAME_GUARD
-OPTIONS_DEFAULT=${OPTIONS_GROUP_COMPS} ${OPTIONS_GROUP_PLUGINS}
-OPTIONS_SUB=	yes
+GNU_CONFIGURE=	yes
 
-OPTIONS_DEFINE_amd64=	SIMD
-OPTIONS_DEFINE_i386=	SIMD
-OPTIONS_DEFAULT_amd64=	SIMD
+DATADIR=	${PREFIX}/lib/vapoursynth
 
-OPTIONS_GROUP=		COMPS PLUGINS
-COMPS_DESC=		Components
-OPTIONS_GROUP_COMPS=	CORE PYTHON VSPIPE VSSCRIPT
-PLUGINS_DESC=		Plugins
-OPTIONS_GROUP_PLUGINS=	ASS EEDI3 IMAGEMAGICK MISCFILTERS MORPHO TESSERACT \
-			REMOVEGRAIN VINVERSE VIVTC
+CONFIGURE_ARGS=	--disable-static
 
-# General options
+OPTIONS_DEFINE=	DEBUG DOCS FRAME_GUARD
+OPTIONS_SUB=	yes
 
 DEBUG_CONFIGURE_ENABLE=		debug
 
-DOCS_BUILD_DEPENDS=		sphinx-build:textproc/py-sphinx
-DOCS_USES=			makeinfo
-DOCS_INFO=			VapourSynth
+DOCS_BUILD_DEPENDS=		sphinx-build:textproc/py-sphinx \
+				${PYTHON_PKGNAMEPREFIX}sphinx_rtd_theme>0:textproc/py-sphinx_rtd_theme@${PY_FLAVOR}
 DOCS_PORTDOCS=			*
 
 FRAME_GUARD_DESC=		Check integrity after each filter
 FRAME_GUARD_CONFIGURE_ENABLE=	guard-pattern
 
-# VSSCRIPT or REMOVEGRAIN
-SIMD_BUILD_DEPENDS=		nasm:devel/nasm
-SIMD_CONFIGURE_ENABLE=		x86-asm
-
-# COMPS group
-
-CORE_DESC=			Core library
-CORE_BUILD_DEPENDS=		sekrit-twc-zimg>=2.9.3:graphics/sekrit-twc-zimg
-CORE_LIB_DEPENDS=		libzimg.so:graphics/sekrit-twc-zimg
-CORE_USES=			compiler:c++11-lib
-CORE_CONFIGURE_ENABLE=		core
-
-PYTHON_USES=			python
-PYTHON_USE=			python=cython
-PYTHON_VARS=			BINARY_ALIAS=cython=cython-${PYTHON_VER}
-PYTHON_CONFIGURE_ENABLE=	python-module
-PYTHON_IMPLIES=			CORE
-
-VSPIPE_DESC=			Command line interface
-VSPIPE_USES=			compiler:c++11-lib
-VSPIPE_CONFIGURE_ENABLE=	vspipe
-VSPIPE_IMPLIES=			VSSCRIPT
-
-VSSCRIPT_DESC=			Scripting library
-VSSCRIPT_USES=			compiler:c++11-lib python
-VSSCRIPT_CONFIGURE_ENABLE=	vsscript
-
-# PLUGINS group
-
-ASS_DESC=			Subtitles rendering via libass
-ASS_LIB_DEPENDS=		libavcodec.so:multimedia/ffmpeg \
-				libass.so:multimedia/libass
-ASS_USES=			iconv
-ASS_CONFIGURE_ENABLE=		subtext
-
-EEDI3_DESC=			Very slow edge directed interpolation
-EEDI3_CONFIGURE_ENABLE=		eedi3
-
-IMAGEMAGICK_USES=		compiler:c++11-lib magick:7
-IMAGEMAGICK_CONFIGURE_ENABLE=	imwri
-
-TESSERACT_DESC=			Optical Character Recognition via Tesseract
-TESSERACT_LIB_DEPENDS=		libtesseract.so:graphics/tesseract
-TESSERACT_CONFIGURE_ENABLE=	ocr
-
-MISCFILTERS_DESC=		Miscellaneous filters
-MISCFILTERS_CONFIGURE_ENABLE=	miscfilters
-
-MORPHO_DESC=			Morphological filter
-MORPHO_CONFIGURE_ENABLE=	morpho
-
-REMOVEGRAIN_DESC=		3x3 median and convolution denoising
-REMOVEGRAIN_CONFIGURE_ENABLE=	removegrain
-
-VINVERSE_DESC=			Remove residual combing
-VINVERSE_CONFIGURE_ENABLE=	vinverse
+.include <bsd.port.pre.mk>
 
-VIVTC_DESC=			Field matching, inverse telecine and decimation
-VIVTC_CONFIGURE_ENABLE=		vivtc
+.if ${ARCH} == amd64 && defined(MACHINE_CPU) && ${MACHINE_CPU:Mavx2}
+CONFIGURE_ARGS+= --enable-x86-asm
+.else
+CONFIGURE_ARGS+= --disable-x86-asm
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e 's/x86_64/&|amd64/' \
@@ -111,20 +54,10 @@ post-patch:
 		${WRKSRC}/configure.ac
 
 post-build-DOCS-on:
-	@${DO_MAKE_BUILD} html texinfo -C${WRKSRC}/doc
-	@${DO_MAKE_BUILD} info -C${WRKSRC}/doc/_build/texinfo
-	@if [ -n "${PORT_OPTIONS:MVSPIPE}" ]; then \
-		${DO_MAKE_BUILD} man -C${WRKSRC}/doc; \
-	fi
+	@${LOCALBASE}/bin/sphinx-build-${PYTHON_VER} -d ${WRKDIR} ${WRKSRC}/doc ${WRKSRC}/doc/_build/html	
 
 post-install-DOCS-on:
-	${INSTALL_DATA} ${WRKSRC}/doc/_build/texinfo/VapourSynth.info \
-		${STAGEDIR}${PREFIX}/${INFO_PATH}
 	(cd ${WRKSRC}/doc/_build/html && ${COPYTREE_SHARE} \
 		"${PORTDOCS}" ${STAGEDIR}${DOCSDIR})
-	@if [ -n "${PORT_OPTIONS:MVSPIPE}" ]; then \
-		${INSTALL_MAN} -v ${WRKSRC}/doc/_build/man/vspipe.1 \
-			${STAGEDIR}${PREFIX}/share/man/man1; \
-	fi
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/multimedia/vapoursynth/distinfo b/multimedia/vapoursynth/distinfo
index 1991a6620798..4bdd08f95429 100644
--- a/multimedia/vapoursynth/distinfo
+++ b/multimedia/vapoursynth/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1626721847
-SHA256 (vapoursynth-vapoursynth-R54_GH0.tar.gz) = ad0c446adcb3877c253dc8c1372a053ad35022bcf42600889b927d2797c5330b
-SIZE (vapoursynth-vapoursynth-R54_GH0.tar.gz) = 631275
+TIMESTAMP = 1690671648
+SHA256 (vapoursynth-vapoursynth-R63_GH0.tar.gz) = ed909b3c58e79bcbb056d07c5d301222ba8001222b4b40d5c1123be35fea9ae2
+SIZE (vapoursynth-vapoursynth-R63_GH0.tar.gz) = 1869415
diff --git a/multimedia/vapoursynth/files/patch-Makefile.am b/multimedia/vapoursynth/files/patch-Makefile.am
new file mode 100644
index 000000000000..aa7a5ce75ba1
--- /dev/null
+++ b/multimedia/vapoursynth/files/patch-Makefile.am
@@ -0,0 +1,9 @@
+--- Makefile.am.orig	2023-07-30 11:59:40 UTC
++++ Makefile.am
+@@ -1,5 +1,5 @@
+ warningflags = -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-ignored-attributes
+-commoncflags = -O3 -fvisibility=hidden $(warningflags) -I$(srcdir)/include $(DEBUGCFLAGS) $(MFLAGS) $(UNICODECFLAGS) $(STACKREALIGN)
++commoncflags = -fvisibility=hidden $(warningflags) -I$(srcdir)/include $(DEBUGCFLAGS) $(MFLAGS) $(UNICODECFLAGS) $(STACKREALIGN)
+ AM_CXXFLAGS = -std=c++17 $(commoncflags)
+ AM_CFLAGS = -std=c99 $(commoncflags)
+ ACLOCAL_AMFLAGS = -I m4
diff --git a/multimedia/vapoursynth/files/patch-configure.ac b/multimedia/vapoursynth/files/patch-configure.ac
new file mode 100644
index 000000000000..195bf51545e5
--- /dev/null
+++ b/multimedia/vapoursynth/files/patch-configure.ac
@@ -0,0 +1,13 @@
+--- configure.ac.orig	2023-07-30 14:56:15 UTC
++++ configure.ac
+@@ -109,8 +109,8 @@ AS_IF(
+              ]
+        )
+ 
+-       AC_SUBST([MFLAGS], ["-mfpmath=sse -msse2"])
+-       AC_SUBST([AVX2FLAGS], ["-mavx2 -mfma -mtune=haswell"])
++       AC_SUBST([MFLAGS], [""])
++       AC_SUBST([AVX2FLAGS], [""])
+       ]
+ )
+ 
diff --git a/multimedia/vapoursynth/files/patch-src_core_expr_expr.cpp b/multimedia/vapoursynth/files/patch-src_core_expr_expr.cpp
new file mode 100644
index 000000000000..d59277f96e8c
--- /dev/null
+++ b/multimedia/vapoursynth/files/patch-src_core_expr_expr.cpp
@@ -0,0 +1,122 @@
+--- src/core/expr/expr.cpp.orig	2023-06-06 12:15:18 UTC
++++ src/core/expr/expr.cpp
+@@ -20,15 +20,15 @@
+ 
+ #include <algorithm>
+ #include <cassert>
+-#include <charconv>
+ #include <cmath>
++#include <iostream>
++#include <locale>
+ #include <map>
+ #include <memory>
+ #include <set>
+ #include <sstream>
+ #include <stdexcept>
+ #include <string>
+-#include <string_view>
+ #include <unordered_map>
+ #include <unordered_set>
+ #include <vector>
+@@ -136,9 +136,9 @@ bool equalSubTree(const ExpressionTreeNode *lhs, const
+     return true;
+ }
+ 
+-std::vector<std::string_view> tokenize(const std::string &expr)
++std::vector<std::string> tokenize(const std::string &expr)
+ {
+-    std::vector<std::string_view> tokens;
++    std::vector<std::string> tokens;
+     auto it = expr.begin();
+     auto prev = expr.begin();
+ 
+@@ -147,20 +147,20 @@ std::vector<std::string_view> tokenize(const std::stri
+ 
+         if (std::isspace(c)) {
+             if (it != prev)
+-                tokens.push_back({ expr.c_str() + (prev - expr.begin()), static_cast<size_t>(it - prev) });
++                tokens.push_back(expr.substr(prev - expr.begin(), it - prev));
+             prev = it + 1;
+         }
+         ++it;
+     }
+     if (prev != expr.end())
+-        tokens.push_back({ expr.c_str() + (prev - expr.begin()), static_cast<size_t>(expr.end() - prev) });
++        tokens.push_back(expr.substr(prev - expr.begin(), expr.end() - prev));
+ 
+     return tokens;
+ }
+ 
+-ExprOp decodeToken(std::string_view token)
++ExprOp decodeToken(const std::string &token)
+ {
+-    static const std::unordered_map<std::string_view, ExprOp> simple{
++    static const std::unordered_map<std::string, ExprOp> simple{
+         { "+",    { ExprOpType::ADD } },
+         { "-",    { ExprOpType::SUB } },
+         { "*",    { ExprOpType::MUL } },
+@@ -195,26 +195,34 @@ ExprOp decodeToken(std::string_view token)
+         return{ ExprOpType::MEM_LOAD_U8, token[0] >= 'x' ? token[0] - 'x' : token[0] - 'a' + 3 };
+     } else if (token.substr(0, 3) == "dup" || token.substr(0, 4) == "swap") {
+         size_t prefix = token[0] == 'd' ? 3 : 4;
++        size_t count = 0;
+         int idx = -1;
+ 
+-        auto result = std::from_chars(token.data() + prefix, token.data() + token.size(), idx);
+-        if (idx < 0 || result.ptr != token.data() + token.size())
+-            throw std::runtime_error("illegal token: " + std::string{ token });
++        try {
++            idx = std::stoi(token.substr(prefix), &count);
++        } catch (...) {
++            // ...
++        }
++
++        if (idx < 0 || prefix + count != token.size())
++            throw std::runtime_error("illegal token: " + token);
+         return{ token[0] == 'd' ? ExprOpType::DUP : ExprOpType::SWAP, idx };
+     } else {
+         float f;
+-        auto result = std::from_chars(token.data(), token.data() + token.size(), f);
+-        if (result.ec == std::errc::invalid_argument)
+-            throw std::runtime_error("failed to convert '" + std::string{ token } + "' to float");
+-        if (result.ptr != token.data() + token.size())
+-            throw std::runtime_error("failed to convert '" + std::string{ token } + "' to float, not the whole token could be converted");
++        std::string s;
++        std::istringstream numStream(token);
++        numStream.imbue(std::locale::classic());
++        if (!(numStream >> f))
++            throw std::runtime_error("failed to convert '" + token + "' to float");
++        if (numStream >> s)
++            throw std::runtime_error("failed to convert '" + token + "' to float, not the whole token could be converted");
+         return{ ExprOpType::CONSTANT, f };
+     }
+ }
+ 
+ ExpressionTree parseExpr(const std::string &expr, const VSVideoInfo * const srcFormats[], int numInputs)
+ {
+-    static constexpr unsigned char numOperands[] = {
++    constexpr unsigned char numOperands[] = {
+         0, // MEM_LOAD_U8
+         0, // MEM_LOAD_U16
+         0, // MEM_LOAD_F16
+@@ -256,16 +264,16 @@ ExpressionTree parseExpr(const std::string &expr, cons
+     ExpressionTree tree;
+     std::vector<ExpressionTreeNode *> stack;
+ 
+-    for (std::string_view tok : tokens) {
++    for (const std::string &tok : tokens) {
+         ExprOp op = decodeToken(tok);
+ 
+         // Check validity.
+         if (op.type == ExprOpType::MEM_LOAD_U8 && op.imm.i >= numInputs)
+-            throw std::runtime_error("reference to undefined clip: " + std::string{ tok });
++            throw std::runtime_error("reference to undefined clip: " + tok);
+         if ((op.type == ExprOpType::DUP || op.type == ExprOpType::SWAP) && op.imm.u >= stack.size())
+-            throw std::runtime_error("insufficient values on stack: " + std::string{ tok });
++            throw std::runtime_error("insufficient values on stack: " + tok);
+         if (stack.size() < numOperands[static_cast<size_t>(op.type)])
+-            throw std::runtime_error("insufficient values on stack: " + std::string{ tok });
++            throw std::runtime_error("insufficient values on stack: " + tok);
+ 
+         // Rename load operations with the correct data type.
+         if (op.type == ExprOpType::MEM_LOAD_U8) {
diff --git a/multimedia/vapoursynth/pkg-plist b/multimedia/vapoursynth/pkg-plist
index 3d751fc645bf..5bf0d94eaca0 100644
--- a/multimedia/vapoursynth/pkg-plist
+++ b/multimedia/vapoursynth/pkg-plist
@@ -1,23 +1,15 @@
-%%VSPIPE%%bin/vspipe
-%%CORE%%include/vapoursynth/VSHelper.h
-%%CORE%%include/vapoursynth/VSScript.h
-%%CORE%%include/vapoursynth/VapourSynth.h
-%%VSSCRIPT%%lib/libvapoursynth-script.a
-%%VSSCRIPT%%lib/libvapoursynth-script.so
-%%VSSCRIPT%%lib/libvapoursynth-script.so.0
-%%VSSCRIPT%%lib/libvapoursynth-script.so.0.0.0
-%%CORE%%lib/libvapoursynth.a
-%%CORE%%lib/libvapoursynth.so
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/vapoursynth.so
-%%VSSCRIPT%%libdata/pkgconfig/vapoursynth-script.pc
-%%CORE%%libdata/pkgconfig/vapoursynth.pc
-%%EEDI3%%%%DATADIR%%/libeedi3.so
-%%IMAGEMAGICK%%%%DATADIR%%/libimwri.so
-%%MISCFILTERS%%%%DATADIR%%/libmiscfilters.so
-%%MORPHO%%%%DATADIR%%/libmorpho.so
-%%TESSERACT%%%%DATADIR%%/libocr.so
-%%REMOVEGRAIN%%%%DATADIR%%/libremovegrain.so
-%%ASS%%%%DATADIR%%/libsubtext.so
-%%VINVERSE%%%%DATADIR%%/libvinverse.so
-%%VIVTC%%%%DATADIR%%/libvivtc.so
-%%DOCS%%%%VSPIPE%%share/man/man1/vspipe.1.gz
+bin/vspipe
+include/vapoursynth/VSConstants4.h
+include/vapoursynth/VSHelper.h
+include/vapoursynth/VSHelper4.h
+include/vapoursynth/VSScript.h
+include/vapoursynth/VSScript4.h
+include/vapoursynth/VapourSynth.h
+include/vapoursynth/VapourSynth4.h
+lib/libvapoursynth-script.so
+lib/libvapoursynth-script.so.0
+lib/libvapoursynth-script.so.0.0.0
+lib/libvapoursynth.so
+%%PYTHON_SITELIBDIR%%/vapoursynth.so
+libdata/pkgconfig/vapoursynth-script.pc
+libdata/pkgconfig/vapoursynth.pc