git: c29ac867cb6b - main - audio/cardinal: Fix build on 16

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 02:33:14 UTC
The branch main has been updated by yuri:

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

commit c29ac867cb6b08252e93fda1ef2d3beed00e499d
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-09-15 00:11:41 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-09-15 02:33:06 +0000

    audio/cardinal: Fix build on 16
    
    Multiple issues:
    - roundevenf is missing on FreeBSD
    - std::abs<> had to be patched
    - c++14 had to be added to avoid deprecated C++ features
    - old USES=llvm fix had to be removed
    
    Reported by:    fallout
---
 audio/cardinal/Makefile                            | 28 +++++++++++++++++-----
 ...ugins_MindMeldModular_src_ShapeMaster_Shape.hpp | 13 ++++++++++
 audio/cardinal/files/roundevenf-definition.c       |  6 +++++
 3 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/audio/cardinal/Makefile b/audio/cardinal/Makefile
index af5f8eef5009..a13cf42fc3ba 100644
--- a/audio/cardinal/Makefile
+++ b/audio/cardinal/Makefile
@@ -35,10 +35,12 @@ USES=		compiler:c++17-lang gl gmake libarchive localbase:ldflags pkgconfig pytho
 USE_XORG=	x11 xcursor xext xrandr
 USE_GL=		gl
 USE_SDL=	sdl2
+USE_CXXSTD=	c++14 # keep std::random_shuffle that was removed in c++17, see https://github.com/DISTRHO/Cardinal/issues/945
 
 SHEBANG_GLOB=	*.sh
 
 CXXFLAGS+=	-I${LOCALBASE}/include/pffft
+CXXFLAGS+=	-Wno-error=missing-template-arg-list-after-template-kw # workaround for surgext/src/VCO.cpp:1051:28: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
 CXXFLAGS_powerpc64le=	-DNO_WARN_X86_INTRINSICS
 LDFLAGS+=	-lpffft -lexecinfo
 
@@ -62,11 +64,25 @@ LIBLO_BROKEN=		fails to build with liblo, see https://github.com/DISTRHO/Cardina
 LTO_MAKE_ARGS=		WITH_LTO=true
 LTO_BROKEN=		Fails to build with LTO because it is gcc-centered
 
-.include <bsd.port.options.mk>
-
-# workaround for ld: error: undefined symbol: roundevenf
-.if ${OPSYS} == FreeBSD
-USES+=	llvm:max=15
-.endif
+LDFLAGS+=		-Wl,--allow-multiple-definition # for roundevenf fix below: multipl binaries are built with multiple modules, so we add roundevenf and alow multiple definitions of it
+
+post-patch:
+	# inject definition of missing function roundevenf, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298503
+	@cd ${WRKSRC} && \
+		for f in \
+			plugins/ZZC/src/FN.cpp \
+			plugins/Fundamental/src/LFO.cpp \
+			plugins/Biset/src/Igc/Igc.cpp \
+			plugins/ML_modules/src/Quant.cpp \
+			plugins/HetrickCV/src/Bitshift.cpp \
+			plugins/Venom/src/XM_OP.cpp \
+			plugins/Venom/src/PolyOffset.cpp \
+			plugins/MindMeldModular/src/EqMaster/EqMaster.cpp \
+			plugins/AnimatedCircuits/src/Folding/Folding.cpp \
+			plugins/AnimatedCircuits/src/LFold/LFold.cpp \
+			plugins/dBiz/src/Bench.cpp \
+		; do \
+			cat ${FILESDIR}/roundevenf-definition.c $$f > $$f.tmp && mv $$f.tmp $$f; \
+		done
 
 .include <bsd.port.mk>
diff --git a/audio/cardinal/files/patch-plugins_MindMeldModular_src_ShapeMaster_Shape.hpp b/audio/cardinal/files/patch-plugins_MindMeldModular_src_ShapeMaster_Shape.hpp
new file mode 100644
index 000000000000..b8b1403d2335
--- /dev/null
+++ b/audio/cardinal/files/patch-plugins_MindMeldModular_src_ShapeMaster_Shape.hpp
@@ -0,0 +1,13 @@
+-- fix C++ compilation failure
+
+--- plugins/MindMeldModular/src/ShapeMaster/Shape.hpp.orig	2026-09-14 19:57:15 UTC
++++ plugins/MindMeldModular/src/ShapeMaster/Shape.hpp
+@@ -157,7 +157,7 @@ class Shape {	
+ 	T calcY(int p, T _x) {
+ 		// _x is relative to points[p].x
+ 		// do not call on last point
+-		T dx = std::abs<T>((T)points[p + 1].x - (T)points[p].x);
++		T dx = std::abs((T)points[p + 1].x - (T)points[p].x);
+ 		T dy = (T)points[p + 1].y - (T)points[p].y;
+ 		T eval = (T)points[p].y;
+ 		if (type[p] == 0) {
diff --git a/audio/cardinal/files/roundevenf-definition.c b/audio/cardinal/files/roundevenf-definition.c
new file mode 100644
index 000000000000..acf971a21d0b
--- /dev/null
+++ b/audio/cardinal/files/roundevenf-definition.c
@@ -0,0 +1,6 @@
+#include <math.h>
+
+extern "C"
+float roundevenf(float x) {
+  return rintf(x);
+}