git: 9807a6d4946f - main - audio/cava: Update to 0.10.1

From: Joel Bodenmann <jbo_at_FreeBSD.org>
Date: Sat, 10 Feb 2024 21:43:32 UTC
The branch main has been updated by jbo:

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

commit 9807a6d4946fcb63ae15f3b2845bbb6c58bee24d
Author:     bsdcode <bsdcode@disroot.org>
AuthorDate: 2024-02-04 01:33:21 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2024-02-10 21:42:47 +0000

    audio/cava: Update to 0.10.1
    
    Changelogs:
      - 0.10.1: https://github.com/karlstav/cava/releases/tag/0.10.1
      - 0.10.0: https://github.com/karlstav/cava/releases/tag/0.10.0
      -  0.9.1: https://github.com/karlstav/cava/releases/tag/0.9.1
      -  0.9.0: https://github.com/karlstav/cava/releases/tag/0.9.0
      -  0.8.3: https://github.com/karlstav/cava/releases/tag/0.8.3
      -  0.8.2: https://github.com/karlstav/cava/releases/tag/0.8.2
      -  0.8.1: https://github.com/karlstav/cava/releases/tag/0.8.1
      -  0.8.0: https://github.com/karlstav/cava/releases/tag/0.8.0
      -  0.7.5: https://github.com/karlstav/cava/releases/tag/0.7.5
    
    PR:                     276228
    Approved by:            tcberner (mentor), Adam Jimerson <vendion@gmail.com> (maintainer)
    Differential Revision:  https://reviews.freebsd.org/D43750
---
 audio/cava/Makefile                               | 81 ++++++++++---------
 audio/cava/distinfo                               |  6 +-
 audio/cava/files/patch-Makefile.am                | 22 ------
 audio/cava/files/patch-cava.c                     | 96 -----------------------
 audio/cava/files/patch-config.c                   | 34 --------
 audio/cava/files/patch-configure.ac               | 13 ---
 audio/cava/files/patch-example__files_config      | 14 ----
 audio/cava/files/patch-input_sndio.c              | 22 ------
 audio/cava/files/patch-output_terminal__ncurses.c | 16 ----
 audio/cava/pkg-descr                              |  8 +-
 10 files changed, 54 insertions(+), 258 deletions(-)

diff --git a/audio/cava/Makefile b/audio/cava/Makefile
index 06ca027aaafc..395876186052 100644
--- a/audio/cava/Makefile
+++ b/audio/cava/Makefile
@@ -1,11 +1,10 @@
 PORTNAME=	cava
-DISTVERSION=	0.7.4
-PORTREVISION=	2
+DISTVERSION=	0.10.1
 CATEGORIES=	audio
 
 MAINTAINER=	vendion@gmail.com
-COMMENT=	Console-based Audio Visualizer for MPD, PulseAudio, and sndio
-WWW=		https://karlstav.github.io/cava
+COMMENT=	Cross-platform Audio Visualizer
+WWW=		https://github.com/karlstav/cava
 
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
@@ -13,63 +12,75 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 LIB_DEPENDS=	libfftw3.so:math/fftw3 \
 		libiniparser.so:devel/iniparser
 
-USES=		autoreconf compiler:c11 libtool localbase ncurses
+USES=		autoreconf compiler:c11 libtool localbase pkgconfig
 USE_GITHUB=	yes
 GH_ACCOUNT=	karlstav
 
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--disable-input-alsa
-CONFIGURE_ENV=	ac_cv_lib_asound_snd_pcm_open=no \
-		FONT_DIR=${DATADIR}
-
-INSTALL_TARGET=	install-strip
+CONFIGURE_ARGS=	--disable-input-alsa \
+		--disable-input-pipewire
 
 PLIST_FILES=	bin/cava
 PORTDOCS=	README.md
 PORTEXAMPLES=	config
 
-OPTIONS_DEFINE=		DOCS EXAMPLES PORTAUDIO PULSEAUDIO SNDIO VT
-OPTIONS_DEFAULT=	PULSEAUDIO SNDIO VT
-.if !exists(/usr/bin/vtfontcvt)
-OPTIONS_EXCLUDE=	VT
-.endif
+OPTIONS_DEFINE=		DOCS EXAMPLES VT
+OPTIONS_DEFAULT=	GLSL JACK NCURSES OSS PORTAUDIO PULSEAUDIO SDL SNDIO VT
+
+OPTIONS_GROUP=		INPUT OUTPUT
+OPTIONS_GROUP_INPUT=	JACK OSS PORTAUDIO PULSEAUDIO SNDIO
+OPTIONS_GROUP_OUTPUT=	GLSL NCURSES SDL
+
+GLSL_DESC=		Build with GLSL support (implies ${GLSL_IMPLIES})
+GLSL_BUILD_DEPENDS=	${LOCALBASE}/share/aclocal/ax_check_gl.m4:devel/autoconf-archive
+GLSL_USES=		gl
+GLSL_USE=		gl=egl
+GLSL_CONFIGURE_ENABLE=	output-sdl-glsl
+GLSL_IMPLIES=		SDL
+
+JACK_DESC=		Build with JACK support
+JACK_LIB_DEPENDS=	libjack.so:audio/jack
+JACK_CONFIGURE_ENABLE=	input-jack
+
+NCURSES_DESC=			Build with ncurses support
+NCURSES_USES=			ncurses
+NCURSES_CONFIGURE_ENABLE=	output-ncurses
 
-VT_DESC=	Build with vt(4) support (installs custom font)
+OSS_DESC=		Build with OSS support
+OSS_CONFIGURE_ENABLE=	input-oss
 
+PORTAUDIO_DESC=			Build with portaudio support
 PORTAUDIO_LIB_DEPENDS=		libportaudio.so:audio/portaudio
-PORTAUDIO_CONFIGURE_OFF=	--disable-input-portaudio
+PORTAUDIO_CONFIGURE_ENABLE=	input-portaudio
 
+PULSEAUDIO_DESC=		Build with pulseaudio support
 PULSEAUDIO_LIB_DEPENDS=		libpulse-simple.so:audio/pulseaudio \
 				libpulse.so:audio/pulseaudio
-PULSEAUDIO_CONFIGURE_OFF=	--disable-input-pulse
+PULSEAUDIO_CONFIGURE_ENABLE=	input-pulse
 
+SDL_DESC=		Build with SDL support
+SDL_USES=		sdl
+SDL_USE=		sdl=sdl2
+SDL_CONFIGURE_ENABLE=	output-sdl
+
+SNDIO_DESC=		Build with sndio support
 SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
-SNDIO_CONFIGURE_OFF=	--disable-input-sndio
+SNDIO_CONFIGURE_ENABLE=	input-sndio
 
+VT_DESC=		Build and install custom font for vt(4)
 VT_BUILD_DEPENDS=	psf2bdf:x11-fonts/psftools
-VT_MAKE_ARGS_OFF=	cava_font__DATA=""
+VT_CONFIGURE_ENABLE=	cava-font
 VT_PLIST_FILES=		${DATADIR}/cava.fnt
 
-.include <bsd.port.pre.mk>
-
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
-CFLAGS+=	-Wno-error=deprecated-non-prototype
-.endif
-
 pre-configure:
-	@${ECHO_CMD} ${DISTVERSION} > ${WRKSRC}/version
-
-pre-build-VT-on:
-	psf2bdf --fontname="-gnu-cava-medium-r-normal--16-160-75-75-c-80-iso10646-1" \
-		${WRKSRC}/cava.psf > ${WRKSRC}/cava.bdf
-	vtfontcvt ${WRKSRC}/cava.bdf ${WRKSRC}/cava.fnt
+	${ECHO_CMD} ${DISTVERSION} > ${WRKSRC}/version
 
 post-install-DOCS-on:
-	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}
 
 post-install-EXAMPLES-on:
-	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/example_files/config ${STAGEDIR}${EXAMPLESDIR}
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/audio/cava/distinfo b/audio/cava/distinfo
index f7821f226333..ef6d5bd01cc9 100644
--- a/audio/cava/distinfo
+++ b/audio/cava/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1627884520
-SHA256 (karlstav-cava-0.7.4_GH0.tar.gz) = fefd3cc04d41b03ca416630cafadbfda6c75e2ca0869da1f03963dcb13e1ecb7
-SIZE (karlstav-cava-0.7.4_GH0.tar.gz) = 101847
+TIMESTAMP = 1707006507
+SHA256 (karlstav-cava-0.10.1_GH0.tar.gz) = a3a60814326fa34b54e93ce0b1e66460d55f1007e576c5152fd47024d9ceaff9
+SIZE (karlstav-cava-0.10.1_GH0.tar.gz) = 129520
diff --git a/audio/cava/files/patch-Makefile.am b/audio/cava/files/patch-Makefile.am
deleted file mode 100644
index 7d4d996a5040..000000000000
--- a/audio/cava/files/patch-Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-- Remove some flags that gcc 4.2 (on tier 2 archs like powerpc)
-  does not recognize
-- Do not install the Linux-only font
-
---- Makefile.am.orig	2021-05-18 18:13:38 UTC
-+++ Makefile.am
-@@ -22,7 +22,7 @@ if OSX
- else
-     cava_LDFLAGS += -lrt
-     cava_font_dir = @FONT_DIR@
--    cava_font__DATA = cava.psf
-+    cava_font__DATA = cava.fnt
- endif
- 
- if ALSA
-@@ -52,5 +52,6 @@ if !SYSTEM_LIBINIPARSER
-     cava_LDADD += -Liniparser/.libs
-     cava_CPPFLAGS += -Iiniparser/src
- endif
-+
- 
- 
diff --git a/audio/cava/files/patch-cava.c b/audio/cava/files/patch-cava.c
deleted file mode 100644
index d415f642d6d7..000000000000
--- a/audio/cava/files/patch-cava.c
+++ /dev/null
@@ -1,96 +0,0 @@
---- cava.c.orig	2021-05-18 18:13:38 UTC
-+++ cava.c
-@@ -36,13 +36,11 @@
- #include "util.h"
- 
- #ifdef NCURSES
--#include "output/terminal_bcircle.h"
- #include "output/terminal_ncurses.h"
- #include <curses.h>
- #endif
- 
- #include "output/raw.h"
--#include "output/terminal_noncurses.h"
- 
- #include "input/alsa.h"
- #include "input/common.h"
-@@ -92,8 +90,6 @@ void cleanup(void) {
- #else
-         ;
- #endif
--    } else if (output_mode == OUTPUT_NONCURSES) {
--        cleanup_terminal_noncurses();
-     }
- }
- 
-@@ -260,10 +256,10 @@ as of 0.4.0 all options are specified in config file, 
-             if (inAtty) {
-                 // checking if cava psf font is installed in FONTDIR
-                 FILE *font_file;
--                font_file = fopen(FONTDIR "/cava.psf", "r");
-+                font_file = fopen(FONTDIR "/cava.fnt", "r");
-                 if (font_file) {
-                     fclose(font_file);
--                    system("setfont " FONTDIR "/cava.psf  >/dev/null 2>&1");
-+		     system("/usr/sbin/vidcontrol -f " FONTDIR "/cava.fnt > /dev/null 2>&1");
-                 } else {
-                     // if not it might still be available, we dont know, must try
-                     system("setfont cava.psf  >/dev/null 2>&1");
-@@ -532,16 +528,6 @@ as of 0.4.0 all options are specified in config file, 
-                 height = lines * 8;
-                 break;
- #endif
--            case OUTPUT_NONCURSES:
--                get_terminal_dim_noncurses(&width, &lines);
--
--                if (p.xaxis != NONE)
--                    lines--;
--
--                init_terminal_noncurses(inAtty, p.col, p.bgcol, width, lines, p.bar_width);
--                height = lines * 8;
--                break;
--
-             case OUTPUT_RAW:
-                 if (strcmp(p.raw_target, "/dev/stdout") != 0) {
-                     int fptest;
-@@ -787,11 +773,6 @@ as of 0.4.0 all options are specified in config file, 
-             if (p.xaxis != NONE) {
-                 x_axis_info = 1;
-                 double center_frequency;
--                if (output_mode == OUTPUT_NONCURSES) {
--                    printf("\r\033[%dB", lines + 1);
--                    if (remainder)
--                        printf("\033[%dC", remainder);
--                }
-                 for (int n = 0; n < number_of_bars; n++) {
-                     if (p.stereo) {
-                         if (n < number_of_bars / 2)
-@@ -817,16 +798,6 @@ as of 0.4.0 all options are specified in config file, 
-                             mvprintw(lines, n * (p.bar_width + p.bar_spacing) + remainder, "%.1f",
-                                      freq_kilohz);
- #endif
--                    } else if (output_mode == OUTPUT_NONCURSES) {
--                        if (center_frequency < 1000)
--                            printf("%-4d", freq_floor);
--                        else if (center_frequency > 1000 && center_frequency < 10000)
--                            printf("%.2f", freq_kilohz);
--                        else
--                            printf("%.1f", freq_kilohz);
--
--                        if (n < number_of_bars - 1)
--                            printf("\033[%dC", p.bar_width + p.bar_spacing - 4);
-                     }
-                 }
-                 printf("\r\033[%dA", lines + 1);
-@@ -1142,11 +1113,6 @@ as of 0.4.0 all options are specified in config file, 
-                                                p.gradient, x_axis_info);
-                     break;
- #endif
--                case OUTPUT_NONCURSES:
--                    rc = draw_terminal_noncurses(inAtty, lines, width, number_of_bars, p.bar_width,
--                                                 p.bar_spacing, remainder, bars, previous_frame,
--                                                 x_axis_info);
--                    break;
-                 case OUTPUT_RAW:
-                     rc = print_raw_out(number_of_bars, fp, p.is_bin, p.bit_format, p.ascii_range,
-                                        p.bar_delim, p.frame_delim, bars);
diff --git a/audio/cava/files/patch-config.c b/audio/cava/files/patch-config.c
deleted file mode 100644
index 6d35fe5f5497..000000000000
--- a/audio/cava/files/patch-config.c
+++ /dev/null
@@ -1,34 +0,0 @@
-Remove noncurses output method which only produces a garbled mess
-on terminals.
-
---- config.c.orig	2021-08-02 22:27:47 UTC
-+++ config.c
-@@ -181,10 +181,6 @@ bool validate_config(struct config_params *p, struct e
-         return false;
- #endif
-     }
--    if (strcmp(outputMethod, "noncurses") == 0) {
--        p->output = OUTPUT_NONCURSES;
--        p->bgcol = 0;
--    }
-     if (strcmp(outputMethod, "raw") == 0) { // raw:
-         p->output = OUTPUT_RAW;
-         p->bar_spacing = 0;
-@@ -220,7 +216,7 @@ bool validate_config(struct config_params *p, struct e
- #ifndef NCURSES
-         write_errorf(
-             error,
--            "output method %s is not supported, supported methods are: 'noncurses' and 'raw'\n",
-+            "output method %s is not supported, supported methods are: 'raw'\n",
-             outputMethod);
-         return false;
- #endif
-@@ -228,7 +224,7 @@ bool validate_config(struct config_params *p, struct e
- #ifdef NCURSES
-         write_errorf(error,
-                      "output method %s is not supported, supported methods are: 'ncurses', "
--                     "'noncurses' and 'raw'\n",
-+                     "and 'raw'\n",
-                      outputMethod);
-         return false;
- #endif
diff --git a/audio/cava/files/patch-configure.ac b/audio/cava/files/patch-configure.ac
deleted file mode 100644
index 9c60535a724c..000000000000
--- a/audio/cava/files/patch-configure.ac
+++ /dev/null
@@ -1,13 +0,0 @@
-Neuter gratuitous OS check that is not used for anything at all.
-
---- configure.ac.orig	2020-05-26 20:29:47 UTC
-+++ configure.ac
-@@ -294,7 +294,7 @@ case "${host_os}" in
-         build_mac=yes
-         ;;
-     *)
--        AC_MSG_ERROR(["OS $host_os is not supported"])
-+        AC_MSG_NOTICE([I'm a teapot])
-         ;;
- esac
- 
diff --git a/audio/cava/files/patch-example__files_config b/audio/cava/files/patch-example__files_config
deleted file mode 100644
index 5a810485fe9f..000000000000
--- a/audio/cava/files/patch-example__files_config
+++ /dev/null
@@ -1,14 +0,0 @@
---- example_files/config.orig	2020-10-29 12:41:35 UTC
-+++ example_files/config
-@@ -73,10 +73,7 @@
- 
- [output]
- 
--# Output method. Can be 'ncurses', 'noncurses' or 'raw'.
--# 'noncurses' uses a custom framebuffer technique and draws only changes
--# from frame to frame. 'ncurses' is default if supported
--#
-+# Output method. Can be 'ncurses' or 'raw'.
- # 'raw' is an 8 or 16 bit (configurable via the 'bit_format' option) data
- # stream of the bar heights that can be used to send to other applications.
- # 'raw' defaults to 200 bars, which can be adjusted in the 'bars' option above.
diff --git a/audio/cava/files/patch-input_sndio.c b/audio/cava/files/patch-input_sndio.c
deleted file mode 100644
index 38737e10450e..000000000000
--- a/audio/cava/files/patch-input_sndio.c
+++ /dev/null
@@ -1,22 +0,0 @@
-Stop using uninitialized variable after lazy refactoring upstream
-
---- input/sndio.c.orig	2020-10-29 12:44:33 UTC
-+++ input/sndio.c
-@@ -14,7 +14,7 @@ void *input_sndio(void *data) {
-     par.bits = 16;
-     par.le = 1;
-     par.rate = 44100;
--    par.rchan = 2;
-+    par.rchan = audio->channels;
-     par.appbufsz = sizeof(buf) / par.rchan;
- 
-     if ((hdl = sio_open(audio->source, SIO_REC, 0)) == NULL) {
-@@ -33,7 +33,7 @@ void *input_sndio(void *data) {
-         exit(EXIT_FAILURE);
-     }
- 
--    uint16_t frames = (sizeof(buf) / sizeof(buf[0])) / 2;
-+    uint16_t frames = (sizeof(buf) / sizeof(buf[0])) / audio->channels;
-     while (audio->terminate != 1) {
-         if (sio_read(hdl, buf, sizeof(buf)) == 0) {
-             fprintf(stderr, __FILE__ ": sio_read() failed: %s\n", strerror(errno));
diff --git a/audio/cava/files/patch-output_terminal__ncurses.c b/audio/cava/files/patch-output_terminal__ncurses.c
deleted file mode 100644
index c6a1e8fb503d..000000000000
--- a/audio/cava/files/patch-output_terminal__ncurses.c
+++ /dev/null
@@ -1,16 +0,0 @@
---- output/terminal_ncurses.c.orig	2020-10-29 12:36:59 UTC
-+++ output/terminal_ncurses.c
-@@ -267,9 +267,13 @@ int draw_terminal_ncurses(int is_tty, int terminal_hei
- // general: cleanup
- void cleanup_terminal_ncurses(void) {
-     echo();
-+#ifdef __FreeBSD__
-+    system("/usr/sbin/vidcontrol -f >/dev/null 2>&1");
-+#else
-     system("setfont  >/dev/null 2>&1");
-     system("setfont /usr/share/consolefonts/Lat2-Fixed16.psf.gz  >/dev/null 2>&1");
-     system("setterm -blank 10  >/dev/null 2>&1");
-+#endif
-     /*for(int i = 0; i < gradient_size; ++i) {
-             if(the_color_redefinitions[i].color) {
-                     init_color(the_color_redefinitions[i].color,
diff --git a/audio/cava/pkg-descr b/audio/cava/pkg-descr
index fd0c180b0c3c..63e424c00eac 100644
--- a/audio/cava/pkg-descr
+++ b/audio/cava/pkg-descr
@@ -1,5 +1,7 @@
-C.A.V.A. is a bar spectrum audio visualizer for the terminal using
-PulseAudio, sndio or fifo buffer for input.
+CAVA (Cross-platform Audio Visualizer) is a bar spectrum audio visualizer for
+the terminal (ncurses) or desktop (SDL). It also provides a GLSL shader output
+backend which can enhance the desktop experience even more. The supported input
+backends include OSS, sndio, JACK, portaudio, pulseaudio and fifo.
 
-This program is not intended for scientific use.  It's written to look
+This program is not intended for scientific use. It's written to look
 responsive and aesthetic when used to visualize music.