git: d5d485cba903 - main - audio/asterisk-espeak: Revert removal as part of commit c46b556a1b8

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Fri, 15 Jul 2022 14:37:22 UTC
The branch main has been updated by se:

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

commit d5d485cba9031ffa4cc9660c6fc476e2c929c73e
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-07-15 13:58:03 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-07-15 14:36:22 +0000

    audio/asterisk-espeak: Revert removal as part of commit c46b556a1b8
    
    The espeak port has been updated and is no longer deprecated.
---
 audio/Makefile                             |  1 +
 audio/asterisk-espeak/Makefile             | 53 ++++++++++++++++++++++++++
 audio/asterisk-espeak/distinfo             |  3 ++
 audio/asterisk-espeak/files/patch-Makefile | 60 ++++++++++++++++++++++++++++++
 audio/asterisk-espeak/pkg-descr            |  6 +++
 audio/asterisk-espeak/pkg-plist            |  2 +
 6 files changed, 125 insertions(+)

diff --git a/audio/Makefile b/audio/Makefile
index 97e8c4d8320f..755d704792d6 100644
--- a/audio/Makefile
+++ b/audio/Makefile
@@ -35,6 +35,7 @@
     SUBDIR += artyfx-lv2
     SUBDIR += asmix
     SUBDIR += asmixer
+    SUBDIR += asterisk-espeak
     SUBDIR += asterisk-flite
     SUBDIR += asunder
     SUBDIR += atunes
diff --git a/audio/asterisk-espeak/Makefile b/audio/asterisk-espeak/Makefile
new file mode 100644
index 000000000000..882098252219
--- /dev/null
+++ b/audio/asterisk-espeak/Makefile
@@ -0,0 +1,53 @@
+PORTNAME=	espeak
+PORTVERSION=	4.0
+DISTVERSIONPREFIX=	v
+PORTREVISION=	3
+CATEGORIES=	audio
+
+MAINTAINER=	madpilot@FreeBSD.org
+COMMENT=	Espeak dialplan application for Asterisk
+
+LICENSE=	GPLv2
+
+DEPRECATED=	Depends on deprecated audio/espeaak
+EXPIRATION_DATE=2022-06-30
+
+LIB_DEPENDS=	libespeak.so:audio/espeak \
+		libsamplerate.so:audio/libsamplerate
+
+FLAVORS=			asterisk18 asterisk16
+FLAVOR?=			${FLAVORS:[1]}
+
+asterisk16_PKGNAMEPREFIX=	asterisk16-
+asterisk16_CONFLICTS_INSTALL=	asterisk13-espeak asterisk18-espeak
+asterisk16_BUILD_DEPENDS=	asterisk:net/asterisk16
+asterisk16_RUN_DEPENDS=		asterisk:net/asterisk16
+
+asterisk18_PKGNAMEPREFIX=	asterisk18-
+asterisk18_CONFLICTS_INSTALL=	asterisk13-espeak asterisk16-espeak
+asterisk18_BUILD_DEPENDS=	asterisk:net/asterisk18
+asterisk18_RUN_DEPENDS=		asterisk:net/asterisk18
+
+USES=		compiler:c11 gmake localbase
+INSTALL_TARGET=	install samples
+
+CONFLICTS_INSTALL=	asterisk*-espeak # etc/asterisk/espeak.conf.sample
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	zaf
+GH_PROJECT=	Asterisk-eSpeak
+
+.include <bsd.port.pre.mk>
+
+.if ${CHOSEN_COMPILER_TYPE} == clang
+CFLAGS+=	-fblocks
+.endif
+
+post-patch:
+	@${REINPLACE_CMD} -e '/ASTERISK_REGISTER_FILE/d' \
+		${WRKSRC}/app_espeak.c
+
+post-install:
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/asterisk/modules/app_espeak.so
+
+.include <bsd.port.post.mk>
diff --git a/audio/asterisk-espeak/distinfo b/audio/asterisk-espeak/distinfo
new file mode 100644
index 000000000000..f1769e752ced
--- /dev/null
+++ b/audio/asterisk-espeak/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1503328653
+SHA256 (zaf-Asterisk-eSpeak-v4.0_GH0.tar.gz) = 29b76b8483e398bde9b3639ebb7d89e86c5ff1bac339e6c5bea7e6b9518dd369
+SIZE (zaf-Asterisk-eSpeak-v4.0_GH0.tar.gz) = 13739
diff --git a/audio/asterisk-espeak/files/patch-Makefile b/audio/asterisk-espeak/files/patch-Makefile
new file mode 100644
index 000000000000..d707f3a69fc9
--- /dev/null
+++ b/audio/asterisk-espeak/files/patch-Makefile
@@ -0,0 +1,60 @@
+--- Makefile.orig	2017-01-08 00:20:52 UTC
++++ Makefile
+@@ -6,31 +6,18 @@
+ # the GNU General Public License Version 2. See the COPYING file
+ # at the top of the source tree.
+ 
+-ASTLIBDIR:=$(shell awk '/moddir/{print $$3}' /etc/asterisk/asterisk.conf 2> /dev/null)
+-ifeq ($(strip $(ASTLIBDIR)),)
+-	MODULES_DIR:=$(INSTALL_PREFIX)/usr/lib/asterisk/modules
+-else
+-	MODULES_DIR:=$(INSTALL_PREFIX)$(ASTLIBDIR)
+-endif
+-ASTETCDIR:=$(INSTALL_PREFIX)/etc/asterisk
++MODULES_DIR=$(PREFIX)/lib/asterisk/modules
++ASTETCDIR=$(PREFIX)/etc/asterisk
+ SAMPLENAME:=espeak.conf.sample
+-CONFNAME:=$(basename $(SAMPLENAME))
++CONFNAME:=$(SAMPLENAME)
+ 
+ INSTALL:=install
+-CC:=gcc
+-OPTIMIZE:=-O2
+-DEBUG:=-g
++CC?=gcc
+ 
+-LIBS+=-lespeak -lsamplerate
++LIBS+=$(LDFLAGS) -lespeak -lsamplerate
+ CFLAGS+=-pipe -fPIC -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -DAST_MODULE_SELF_SYM=__internal_app_espeak_self
+ 
+ all: app_espeak.so
+-	@echo " +-------- app_espeak Build Complete --------+"
+-	@echo " + app_espeak has successfully been built,   +"
+-	@echo " + and can be installed by running:          +"
+-	@echo " +                                           +"
+-	@echo " +               make install                +"
+-	@echo " +-------------------------------------------+"
+ 
+ app_espeak.o: app_espeak.c
+ 	$(CC) $(CFLAGS) $(DEBUG) $(OPTIMIZE) -c -o $@ $*.c
+@@ -44,20 +31,7 @@ clean:
+ install: all
+ 	$(INSTALL) -m 755 -d $(DESTDIR)$(MODULES_DIR)
+ 	$(INSTALL) -m 755 app_espeak.so $(DESTDIR)$(MODULES_DIR)
+-	@echo " +---- app_espeak Installation Complete -----+"
+-	@echo " +                                           +"
+-	@echo " + app_espeak has successfully been installed+"
+-	@echo " + If you would like to install the sample   +"
+-	@echo " + configuration file run:                   +"
+-	@echo " +                                           +"
+-	@echo " +              make samples                 +"
+-	@echo " +-------------------------------------------+"
+ 
+ samples:
+ 	@mkdir -p $(DESTDIR)$(ASTETCDIR)
+-	@if [ -f $(DESTDIR)$(ASTETCDIR)/$(CONFNAME) ]; then \
+-		echo "Backing up previous config file as $(CONFNAME).old";\
+-		mv -f $(DESTDIR)$(ASTETCDIR)/$(CONFNAME) $(DESTDIR)$(ASTETCDIR)/$(CONFNAME).old ; \
+-	fi ;
+ 	$(INSTALL) -m 644 $(SAMPLENAME) $(DESTDIR)$(ASTETCDIR)/$(CONFNAME)
+-	@echo " ------- app_esepak confing Installed --------"
diff --git a/audio/asterisk-espeak/pkg-descr b/audio/asterisk-espeak/pkg-descr
new file mode 100644
index 000000000000..f49fac719a89
--- /dev/null
+++ b/audio/asterisk-espeak/pkg-descr
@@ -0,0 +1,6 @@
+eSpeak For Asterisk provides the "Espeak" dialplan application,
+which allows you to use the Espeak speech synthesizer with Asterisk.
+This module invokes the Espeak TTS engine locally, and uses it to
+render text to speech.
+
+WWW: https://zaf.github.io/Asterisk-eSpeak/
diff --git a/audio/asterisk-espeak/pkg-plist b/audio/asterisk-espeak/pkg-plist
new file mode 100644
index 000000000000..564e0e7c9cd5
--- /dev/null
+++ b/audio/asterisk-espeak/pkg-plist
@@ -0,0 +1,2 @@
+@sample etc/asterisk/espeak.conf.sample
+lib/asterisk/modules/app_espeak.so