commit:     bc697ac1c922fa98ec928659f50ba87fb84bbe19
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 17 09:40:23 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Sun Apr 17 10:49:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc697ac1

media-sound/cava: new package, add 0.8.0

Been using this locally for a while and been getting
more activity / releases this year, let's add it.

Closes: https://bugs.gentoo.org/617084
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 media-sound/cava/Manifest                          |  1 +
 media-sound/cava/cava-0.8.0.ebuild                 | 75 ++++++++++++++++++++++
 .../cava/files/cava-0.8.0-gentoo-iniparser4.patch  | 15 +++++
 media-sound/cava/files/cava-0.8.0-maxed-bars.patch | 17 +++++
 media-sound/cava/metadata.xml                      | 14 ++++
 5 files changed, 122 insertions(+)

diff --git a/media-sound/cava/Manifest b/media-sound/cava/Manifest
new file mode 100644
index 000000000000..4e8b8b36d7cc
--- /dev/null
+++ b/media-sound/cava/Manifest
@@ -0,0 +1 @@
+DIST cava-0.8.0.tar.gz 99198 BLAKE2B 
e9b5c6697aef9e9a1a54bcb928933fbaad68be0ab27f91defdeadd39a0b38d278835c43ed16fd8757d6c57d36924551304e43b8721b7a31dcac3a586041dd0e4
 SHA512 
3072504592f2f2d5b525874eb9bd23fca4beed89425651104a82b8ea5c7e34abd38c4355d712f2c17bb489eb2c8c28a6914fd40a1b1003a9fcce9055290a9794

diff --git a/media-sound/cava/cava-0.8.0.ebuild 
b/media-sound/cava/cava-0.8.0.ebuild
new file mode 100644
index 000000000000..f862363da236
--- /dev/null
+++ b/media-sound/cava/cava-0.8.0.ebuild
@@ -0,0 +1,75 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Console-based Audio Visualizer"
+HOMEPAGE="https://github.com/karlstav/cava/";
+SRC_URI="https://github.com/karlstav/cava/archive/refs/tags/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="alsa +ncurses portaudio pulseaudio sdl sndio"
+
+RDEPEND="
+       dev-libs/iniparser:4
+       sci-libs/fftw:=
+       alsa? ( media-libs/alsa-lib )
+       ncurses? ( sys-libs/ncurses:= )
+       portaudio? ( media-libs/portaudio )
+       pulseaudio? ( media-sound/pulseaudio )
+       sdl? ( media-libs/libsdl2[opengl,video] )
+       sndio? ( media-sound/sndio:= )"
+DEPEND="${RDEPEND}"
+BDEPEND="app-editors/vim-core"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.8.0-gentoo-iniparser4.patch
+       "${FILESDIR}"/${P}-maxed-bars.patch
+)
+
+src_prepare() {
+       default
+
+       # see autogen.sh
+       echo ${PV} > version || die
+       xxd -i example_files/config config_file.h || die
+
+       sed -i 's/-Werror //' Makefile.am || die
+
+       eautoreconf
+}
+
+src_configure() {
+       local econfargs=(
+               $(use_enable alsa input-alsa)
+               $(use_enable portaudio input-portaudio)
+               $(use_enable pulseaudio input-pulse)
+               $(use_enable sndio input-sndio)
+
+               $(use_enable ncurses output-ncurses)
+               $(use_enable sdl output-sdl)
+
+               GENTOO_SYSROOT="${ESYSROOT}" # see iniparser4.patch
+       )
+
+       econf "${econfargs[@]}"
+}
+
+pkg_postinst() {
+       if [[ ! ${REPLACING_VERSIONS} ]]; then
+               elog "A default ~/.config/cava/config will be created after 
initial"
+               elog "use of ${PN}, see it and 
${EROOT}/usr/share/doc/${PF}/README*"
+               elog "for configuring audio inputs and more."
+       fi
+
+       if use !alsa && use !portaudio && use !pulseaudio && use !sndio; then
+               # give a warning given greets with a segfault without proper 
configuration
+               ewarn "All audio backends are disabled, ${PN} will only 
function if first"
+               ewarn "configured to use 'method = fifo' or 'shmem'."
+               ewarn "Tip: fifo is versatile, e.g. mkfifo fifo && jack_capture 
--daemon -ws > fifo"
+       fi
+}

diff --git a/media-sound/cava/files/cava-0.8.0-gentoo-iniparser4.patch 
b/media-sound/cava/files/cava-0.8.0-gentoo-iniparser4.patch
new file mode 100644
index 000000000000..3dcb060c2873
--- /dev/null
+++ b/media-sound/cava/files/cava-0.8.0-gentoo-iniparser4.patch
@@ -0,0 +1,15 @@
+Gentoo uses non-standard naming for slotted iniparser:4 and it
+does not have a pkg-config file (ideally should be unslotted).
+Cava can use iniparser:0 as well but <3.2 forces legacy mode.
+--- a/configure.ac
++++ b/configure.ac
+@@ -259,6 +259,6 @@
+ 
+-AC_CHECK_LIB(iniparser,iniparser_load, have_iniparser=yes, have_iniparser=no)
++AC_CHECK_LIB(iniparser4,iniparser_load, have_iniparser=yes, have_iniparser=no)
+     if [[ $have_iniparser = "yes" ]] ; then
+-    LIBS="$LIBS -liniparser"
+-      CPPFLAGS="$CPPFLAGS -I/usr/include/iniparser"
++    LIBS="$LIBS -liniparser4"
++      CPPFLAGS="$CPPFLAGS -I${GENTOO_SYSROOT}/usr/include/iniparser4"
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iniparser.h>]],

diff --git a/media-sound/cava/files/cava-0.8.0-maxed-bars.patch 
b/media-sound/cava/files/cava-0.8.0-maxed-bars.patch
new file mode 100644
index 000000000000..a685b7a11c3f
--- /dev/null
+++ b/media-sound/cava/files/cava-0.8.0-maxed-bars.patch
@@ -0,0 +1,17 @@
+https://github.com/karlstav/cava/issues/447
+https://github.com/karlstav/cava/commit/6519a027036f2de94728819d215672dc2c0b50b6
+From: karlstav <k...@stavestrand.no>
+Date: Sun, 17 Apr 2022 10:04:14 +0200
+Subject: [PATCH] #447: fix wrong noise reduction default value causing maxed
+ out bars
+--- a/config.c
++++ b/config.c
+@@ -471,7 +471,7 @@ bool load_config(char configPath[PATH_MAX], struct 
config_params *p, bool colors
+     p->integral = iniparser_getdouble(ini, "smoothing:integral", 77);
+     p->gravity = iniparser_getdouble(ini, "smoothing:gravity", 100);
+     p->ignore = iniparser_getdouble(ini, "smoothing:ignore", 0);
+-    p->noise_reduction = iniparser_getdouble(ini, 
"smoothing:noise_reduction", 1);
++    p->noise_reduction = iniparser_getdouble(ini, 
"smoothing:noise_reduction", 0.77);
+ 
+     if (!load_colors(p, ini, error)) {
+         return false;

diff --git a/media-sound/cava/metadata.xml b/media-sound/cava/metadata.xml
new file mode 100644
index 000000000000..7b32cdd182c8
--- /dev/null
+++ b/media-sound/cava/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>io...@gentoo.org</email>
+               <name>Ionen Wolkens</name>
+       </maintainer>
+       <use>
+               <flag name="sndio">Enable support for the 
<pkg>media-sound/sndio</pkg> backend</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">karlstav/cava</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to