git: a6361e08a01a - main - audio/lpcnet: update 20210629 → 0.5

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 15 Nov 2023 02:41:07 UTC
The branch main has been updated by yuri:

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

commit a6361e08a01a0d418615a1f8714d411b1749e400
Author:     takefu <takefu@airport.fm>
AuthorDate: 2023-11-15 02:39:27 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-11-15 02:41:04 +0000

    audio/lpcnet: update 20210629 → 0.5
    
    Uncouple circular build dependency with codec2, ctests reduced to a working set,
    build system maintenance for different machines.
    
    PR:     275098
---
 audio/lpcnet/Makefile                   | 27 +++++++-------
 audio/lpcnet/distinfo                   |  8 ++---
 audio/lpcnet/files/patch-CMakeLists.txt | 62 +++++++++++++++------------------
 audio/lpcnet/pkg-plist                  |  4 +--
 4 files changed, 46 insertions(+), 55 deletions(-)

diff --git a/audio/lpcnet/Makefile b/audio/lpcnet/Makefile
index 9dac2efaaab2..fa520673ebfc 100644
--- a/audio/lpcnet/Makefile
+++ b/audio/lpcnet/Makefile
@@ -1,11 +1,10 @@
 PORTNAME=	lpcnet
-PORTVERSION=	20210629
-PORTREVISION=	1
+DISTVERSIONPREFIX=v
+DISTVERSION=	0.5
+PORTEPOCH=	1
 CATEGORIES=	audio hamradio
-MASTER_SITES=	http://rowetel.com/downloads/deep/:main \
-		GH:sub
-DISTFILES=	lpcnet_191005_v1.0.tgz:main \
-		${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}:sub
+MASTER_SITES=	https://rowetel.com/downloads/deep/:ADD
+DISTFILES=	lpcnet_191005_v1.0.tgz:ADD
 
 MAINTAINER=	hamradio@FreeBSD.org
 COMMENT=	Neural Net speech coding
@@ -13,17 +12,17 @@ WWW=		https://freedv.org/
 
 LICENSE=	LGPL21
 
-LIB_DEPENDS=	libcodec2.so:audio/codec2
-
 USES=		cmake compiler:c++11-lib
-CMAKE_ARGS+=	-DMACHINE_CPU:STRING="${MACHINE_CPU}" \
-				-DWRKDIR:STRING=${WRKDIR}
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	drowe67
 GH_PROJECT=	LPCNet
-GH_TAGNAME=	0dc5935
 
-.include <bsd.port.pre.mk>
-.include <bsd.cpu.mk>
-.include <bsd.port.post.mk>
+CMAKE_ARGS=	-DMACHINE_CPU:STRING="${MACHINE_CPU}" \
+		-DWRKDIR:STRING=${WRKDIR} \
+		-DWRKSRC:STRING=${WRKSRC}
+
+post-extract:
+	@${EXTRACT_CMD} xf ${DISTDIR}/lpcnet_191005_v1.0.tgz -C${WRKSRC}/src
+
+.include <bsd.port.mk>
diff --git a/audio/lpcnet/distinfo b/audio/lpcnet/distinfo
index a0b495a1716d..9544d0b77359 100644
--- a/audio/lpcnet/distinfo
+++ b/audio/lpcnet/distinfo
@@ -1,7 +1,5 @@
-TIMESTAMP = 1641483640
+TIMESTAMP = 1699937082
 SHA256 (lpcnet_191005_v1.0.tgz) = 509440924751fdd87ffaa5683ee3dddd937af5c833b9104ccce65d51614926c8
 SIZE (lpcnet_191005_v1.0.tgz) = 18396516
-SHA256 (lpcnet-20210629.tar.gz) = 31a687ac5e822c6c2cf75fe8e7371a5cd834d692635a802ec8fd33dc340d9cf2
-SIZE (lpcnet-20210629.tar.gz) = 33016759
-SHA256 (drowe67-LPCNet-20210629-0dc5935_GH0.tar.gz) = 31a687ac5e822c6c2cf75fe8e7371a5cd834d692635a802ec8fd33dc340d9cf2
-SIZE (drowe67-LPCNet-20210629-0dc5935_GH0.tar.gz) = 33016759
+SHA256 (drowe67-LPCNet-v0.5_GH0.tar.gz) = 8c01fb69fc5ef1e33b654d811161c3df3759878c7c61c5d66a149751bd680516
+SIZE (drowe67-LPCNet-v0.5_GH0.tar.gz) = 5233217
diff --git a/audio/lpcnet/files/patch-CMakeLists.txt b/audio/lpcnet/files/patch-CMakeLists.txt
index d11722280aa1..6227e8166f39 100644
--- a/audio/lpcnet/files/patch-CMakeLists.txt
+++ b/audio/lpcnet/files/patch-CMakeLists.txt
@@ -1,59 +1,51 @@
---- CMakeLists.txt.orig	2021-06-29 09:04:36 UTC
+--- CMakeLists.txt.orig	2023-05-05 19:42:19 UTC
 +++ CMakeLists.txt
-@@ -87,15 +87,32 @@ message(STATUS "Host system arch is: ${CMAKE_SYSTEM_PR
+@@ -93,15 +93,27 @@ message(STATUS "Host system arch is: ${CMAKE_SYSTEM_PR
  # Detection of available CPU optimizations
  if(NOT DISABLE_CPU_OPTIMIZATION)
      if(UNIX AND NOT APPLE)
 -        message(STATUS "Looking for available CPU optimizations on Linux/BSD system...")
 -        execute_process(COMMAND grep -c "avx2" /proc/cpuinfo
--            OUTPUT_VARIABLE AVX2)
+-            OUTPUT_VARIABLE AVX2_PRESENT)
 -        execute_process(COMMAND grep -c "avx " /proc/cpuinfo
--            OUTPUT_VARIABLE AVX)
+-            OUTPUT_VARIABLE AVX_PRESENT)
 -        execute_process(COMMAND grep -c "sse4_1 " /proc/cpuinfo
--            OUTPUT_VARIABLE SSE)
+-            OUTPUT_VARIABLE SSE_PRESENT)
 -        execute_process(COMMAND grep -c "neon" /proc/cpuinfo
--            OUTPUT_VARIABLE NEON)
+-            OUTPUT_VARIABLE NEON_PRESENT)
 +        if ( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
 +            message(STATUS "Looking for available CPU optimizations on FreeBSD system...")
-+	    message (STATUS "MACHINE_CPU = ${MACHINE_CPU}")
-+            if (MACHINE_CPU MATCHES  "avx")
-+                set(AVX TRUE)
-+           endif()
-+           if (MACHINE_CPU MATCHES "avx2")
-+               set(AVX2 TRUE)
-+           endif()
-+           if (MACHINE_CPU MATCHES "sse")
-+	       set(SSE TRUE)
-+           endif()
-+           if (MACHINE_CPU MATCHES  "neon")
-+               set(NEON TRUE)
-+           endif()
++            execute_process(COMMAND grep -c "AVX," /var/run/dmesg.boot
++                OUTPUT_VARIABLE AVX_PRESENT)
++            execute_process(COMMAND grep -c "AVX2," /var/run/dmesg.boot
++                OUTPUT_VARIABLE AVX2_PRESENT)
++            execute_process(COMMAND grep -c "SSE," /var/run/dmesg.boot
++                OUTPUT_VARIABLE SSE_PRESENT)
++            execute_process(COMMAND grep -c "NEON," /var/run/dmesg.boot
++                OUTPUT_VARIABLE NEON_PRESENT)
 +        else()
 +            message(STATUS "Looking for available CPU optimizations on Linux system...")
 +            execute_process(COMMAND grep -c "avx2" /proc/cpuinfo
-+                OUTPUT_VARIABLE AVX2)
++                OUTPUT_VARIABLE AVX2_PRESENT)
 +            execute_process(COMMAND grep -c "avx " /proc/cpuinfo
-+                OUTPUT_VARIABLE AVX)
++                OUTPUT_VARIABLE AVX_PRESENT)
 +            execute_process(COMMAND grep -c "sse4_1 " /proc/cpuinfo
-+                OUTPUT_VARIABLE SSE)
++                OUTPUT_VARIABLE SSE_PRESENT)
 +            execute_process(COMMAND grep -c "neon" /proc/cpuinfo
-+                OUTPUT_VARIABLE NEON)
++                OUTPUT_VARIABLE NEON_PRESENT)
 +        endif()
      elseif(APPLE)
          if(BUILD_OSX_UNIVERSAL)
-             # Presume AVX/AVX2 are enabled on the x86 side. The ARM side will auto-enable
-@@ -140,36 +157,12 @@ if(${NEON} OR ${NEON} GREATER 0)
+             # Presume AVX and SSE are enabled on the x86 side. (AVX2 is not guaranteed depending
+@@ -164,38 +176,8 @@ elseif(${NEON} AND (${NEON_PRESENT} OR ${NEON_PRESENT}
+     set(LPCNET_C_PROC_FLAGS -mfpu=neon -march=armv8-a -mtune=cortex-a53)
  endif()
  
- # grab latest NN model (or substitute your own)
+-# grab latest NN model (or substitute your own)
 -set(LPCNET_ROOT http://rowetel.com/downloads/deep/)
 -set(LPCNET_FILE lpcnet_191005_v1.0.tgz)
 -set(LPCNET_URL ${LPCNET_ROOT}${LPCNET_FILE})
-+# retrieved by port
-+#set(LPCNET_ROOT http://rowetel.com/downloads/deep/)
-+#set(LPCNET_FILE lpcnet_191005_v1.0.tgz)
-+#set(LPCNET_URL ${LPCNET_ROOT}${LPCNET_FILE})
- 
+-
 -if(EXISTS ${CMAKE_BINARY_DIR}/${LPCNET_FILE})
 -    set(lpcnet_SOURCE_DIR ${CMAKE_BINARY_DIR}/src)
 -    file(MAKE_DIRECTORY ${lpcnet_SOURCE_DIR})
@@ -80,7 +72,9 @@
 -        FetchContent_Populate(lpcnet)
 -    endif()
 -endif()
-+set(lpcnet_SOURCE_DIR ${WRKDIR})
+-
++## grab latest NN model (or substitute your own)
++set(lpcnet_SOURCE_DIR ${WRKSRC}/src)
+ add_subdirectory(src)
  
- # Find codec2
- if(CODEC2_BUILD_DIR)
+ # Ctests ----------------------------------------------------------------------
diff --git a/audio/lpcnet/pkg-plist b/audio/lpcnet/pkg-plist
index 54460bd5512e..3a0e1f106f4e 100644
--- a/audio/lpcnet/pkg-plist
+++ b/audio/lpcnet/pkg-plist
@@ -1,7 +1,7 @@
 bin/lpcnet_dec
 bin/lpcnet_enc
 include/lpcnet/lpcnet_freedv.h
-lib/cmake/lpcnetfreedv/lpcnetfreedv-config-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/lpcnetfreedv/lpcnetfreedv-config-release.cmake
 lib/cmake/lpcnetfreedv/lpcnetfreedv-config.cmake
 lib/liblpcnetfreedv.so
-lib/liblpcnetfreedv.so.0.2
+lib/liblpcnetfreedv.so.0.5