git: 92fc8d2fcd5f - main - net/yate: convert AMR codec to opencore one

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Tue, 18 Feb 2025 14:26:37 UTC
The branch main has been updated by fuz:

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

commit 92fc8d2fcd5f4314a6f73faa9afa95b29f972301
Author:     Tatsuki Makino <tatsuki_makino@hotmail.com>
AuthorDate: 2025-02-13 19:18:45 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-02-18 14:16:17 +0000

    net/yate: convert AMR codec to opencore one
    
    This would allow us to sunset audio/libamrnb.
    
    PR:             277803, 277802
---
 net/yate/Makefile                           |  8 ++++----
 net/yate/files/patch-configure.ac           | 24 +++++++++++++++++++++++-
 net/yate/files/patch-modules_amrnbcodec.cpp | 23 +++++++++++++++++++++++
 net/yate/files/patch-modules_efrcodec.cpp   | 23 +++++++++++++++++++++++
 net/yate/pkg-plist                          |  4 ++--
 5 files changed, 75 insertions(+), 7 deletions(-)

diff --git a/net/yate/Makefile b/net/yate/Makefile
index 298bac251beb..fd3599bb6572 100644
--- a/net/yate/Makefile
+++ b/net/yate/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=		yate
 DISTVERSION=		6.4.1
 DISTVERSIONSUFFIX=	-g${GH_TAGNAME}
+PORTREVISION=		1
 CATEGORIES=		net
 
 MAINTAINER=	ports@FreeBSD.org
@@ -49,19 +50,18 @@ GROUPS=		yate
 
 PLIST_SUB=	VERSION="${PORTVERSION}"
 
-OPTIONS_DEFINE=		AMRNB DAHDI DOCS H323 ILBC MYSQL PGSQL SCTP SPANDSP \
+OPTIONS_DEFINE=		AMR DAHDI DOCS H323 ILBC MYSQL PGSQL SCTP SPANDSP \
 			SQLITE
 OPTIONS_DEFAULT=	SCTP
 OPTIONS_SUB=	yes
 
-AMRNB_DESC=	Adaptive Multi-Rate Narrowband support
 DAHDI_DESC=	Dahdi support
 H323_DESC=	H323 software channel/protocol support
 ILBC_DESC=	iLBC narrowband speech codec support
 SCTP_DESC=	Stream Control Transmission Protocol support
 
-AMRNB_LIB_DEPENDS=	libamrnb.so:audio/libamrnb
-AMRNB_CONFIGURE_WITH=	amrnb=${LOCALBASE}
+AMR_CONFIGURE_WITH=	amrnb=${LOCALBASE}
+AMR_LIB_DEPENDS=	libopencore-amrnb.so:audio/opencore-amr
 
 DAHDI_BUILD_DEPENDS=	${LOCALBASE}/include/dahdi/user.h:misc/dahdi \
 			libpri>=1.4.10:misc/libpri
diff --git a/net/yate/files/patch-configure.ac b/net/yate/files/patch-configure.ac
index 980b6363bad9..e85d38d43979 100644
--- a/net/yate/files/patch-configure.ac
+++ b/net/yate/files/patch-configure.ac
@@ -1,6 +1,6 @@
 --- configure.ac.orig	2024-01-15 13:41:34 UTC
 +++ configure.ac
-@@ -113,7 +113,8 @@ AC_MSG_RESULT([$ac_cv_no_overload_virt])
+@@ -113,7 +113,8 @@ if [[ "x$ac_cv_no_overload_virt" = "xyes" ]]; then
  fi
  AC_MSG_RESULT([$ac_cv_no_overload_virt])
  
@@ -10,3 +10,25 @@
  ld_unresolved_symbols=no
  AC_MSG_CHECKING([if ld supports reporting unresolved symbols])
  SAVE_CFLAGS="$CFLAGS"
+@@ -1204,7 +1205,7 @@ AC_SUBST(SPEEX_LIB)
+ 
+ HAVE_AMRNB=no
+ AMRNB_INC=""
+-AMRNB_LIB="-lamrnb"
++AMRNB_LIB="-lopencore-amrnb"
+ AC_ARG_WITH(amrnb,AC_HELP_STRING([--with-amrnb=DIR],[use AMR-NB if available (default)]),[ac_cv_use_amrnb=$withval],[ac_cv_use_amrnb=/usr])
+ if [[ "x$ac_cv_use_amrnb" = "xstatic" ]]; then
+     ac_cv_use_amrnb=/usr
+@@ -1213,9 +1214,9 @@ fi
+ if [[ "x$ac_cv_use_amrnb" != "xno" ]]; then
+ AC_MSG_CHECKING([for AMR-NB in $ac_cv_use_amrnb])
+ local_lib="$ARCHLIB"
+-amrinc="$ac_cv_use_amrnb/include/amrnb"
+-test -f "$ac_cv_use_amrnb/$local_lib/libamrnb.so" || local_lib="lib"
+-if [[ -f "$ac_cv_use_amrnb/$local_lib/libamrnb.so" -a -f "$amrinc/interf_rom.h" ]]; then
++amrinc="$ac_cv_use_amrnb/include/opencore-amrnb"
++test -f "$ac_cv_use_amrnb/$local_lib/libopencore-amrnb.so" || local_lib="lib"
++if [[ -f "$ac_cv_use_amrnb/$local_lib/libopencore-amrnb.so" -a -f "$amrinc/interf_enc.h" ]]; then
+     HAVE_AMRNB=yes
+     AMRNB_LIB="-L$ac_cv_use_amrnb/$local_lib $AMRNB_LIB"
+     AMRNB_INC="-I$amrinc"
diff --git a/net/yate/files/patch-modules_amrnbcodec.cpp b/net/yate/files/patch-modules_amrnbcodec.cpp
new file mode 100644
index 000000000000..f0ac4587c3bb
--- /dev/null
+++ b/net/yate/files/patch-modules_amrnbcodec.cpp
@@ -0,0 +1,23 @@
+--- modules/amrnbcodec.cpp.orig	2017-08-14 12:53:31 UTC
++++ modules/amrnbcodec.cpp
+@@ -30,7 +30,19 @@ extern "C" {
+ }
+ namespace RxTypes {
+ // There is a conflict between encoder and decoder so insulate in a namespace
+-#include <sp_dec.h>
++extern "C" {
++    // copied from ${WRKSRC}/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h of audio/opencore-amr
++    enum RXFrameType { RX_SPEECH_GOOD = 0,
++        RX_SPEECH_DEGRADED,
++        RX_ONSET,
++        RX_SPEECH_BAD,
++        RX_SID_FIRST,
++        RX_SID_UPDATE,
++        RX_SID_BAD,
++        RX_NO_DATA,
++        RX_N_FRAMETYPES     /* number of frame types */
++    };
++}
+ };
+ 
+ // IF1/GP3 is Bandwidth-Efficient Mode
diff --git a/net/yate/files/patch-modules_efrcodec.cpp b/net/yate/files/patch-modules_efrcodec.cpp
new file mode 100644
index 000000000000..f5865f06c209
--- /dev/null
+++ b/net/yate/files/patch-modules_efrcodec.cpp
@@ -0,0 +1,23 @@
+--- modules/efrcodec.cpp.orig	2017-03-28 09:13:48 UTC
++++ modules/efrcodec.cpp
+@@ -31,7 +31,19 @@ extern "C" {
+ }
+ namespace RxTypes {
+ // There is a conflict between encoder and decoder so insulate in a namespace
+-#include <sp_dec.h>
++extern "C" {
++    // copied from ${WRKSRC}/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/frame.h of audio/opencore-amr
++    enum RXFrameType { RX_SPEECH_GOOD = 0,
++        RX_SPEECH_DEGRADED,
++        RX_ONSET,
++        RX_SPEECH_BAD,
++        RX_SID_FIRST,
++        RX_SID_UPDATE,
++        RX_SID_BAD,
++        RX_NO_DATA,
++        RX_N_FRAMETYPES     /* number of frame types */
++    };
++}
+ };
+ 
+ using namespace TelEngine;
diff --git a/net/yate/pkg-plist b/net/yate/pkg-plist
index 8c0e99c8c1d6..31b2e083a15c 100644
--- a/net/yate/pkg-plist
+++ b/net/yate/pkg-plist
@@ -151,8 +151,8 @@ lib/yate/sig/ss7_lnp_ansi.yate
 lib/yate/jabber/jabberserver.yate
 lib/yate/jabber/jbfeatures.yate
 lib/yate/sip/sip_cnam_lnp.yate
-%%AMRNB%%lib/yate/amrnbcodec.yate
-%%AMRNB%%lib/yate/efrcodec.yate
+%%AMR%%lib/yate/amrnbcodec.yate
+%%AMR%%lib/yate/efrcodec.yate
 %%SPANDSP%%lib/yate/faxchan.yate
 %%H323%%lib/yate/h323chan.yate
 %%ILBC%%lib/yate/ilbccodec.yate