media-sound/snapcast: add 0.34.0

update github repo badaix->snapcast

add optional alsa, pipewire, soxr, ssl
boost is headers-only, add boost[context] for jack

unbundle dev-cpp/nlohmann_json
use vendored aixlog and popl, both are already used, single-file header,
up-to-date and from the author of snapcast

handle python plugins (python-single-r1 and optfeature)

use new initd with unprivileged user
use new confd w/o stream.source (-s) already defined in config-file
use systemd service provided by upstream

Closes: https://bugs.gentoo.org/959109
Closes: https://bugs.gentoo.org/969033
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/45458
Closes: https://github.com/gentoo/gentoo/pull/45458
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2026-01-23 09:35:14 +02:00
committed by Joonas Niilola
parent af2533e903
commit 2f7d4cff62
10 changed files with 239 additions and 2 deletions
+1
View File
@@ -1 +1,2 @@
DIST snapcast-0.31.0.tar.gz 1128037 BLAKE2B 82444e9fc75e82b5f57e3e115a8bfbde2a5839bc68e25db47df0f25675cf73a836f2e8b09afb077410bd3c36917abb17ce302c18b67b440567c55b673301e7f5 SHA512 9c3eef7a18aaf6479a96810aeb58d11cc87654021d8d07b29f9b623c70bd7fd9aa08f5dee430c11de72abafa1a1b5abe500b93eef4b17b7c56df55c2f2a29867
DIST snapcast-0.34.0.tar.gz 1173157 BLAKE2B e141c7fe264801ba598e09edad41cc543811e36ee51c02597dc180bd79370b6693aeaed919ce4c56749064f6034c26409c6aa7273a01b33fdc265315d501f76d SHA512 509c76432f71c1f08975740f7e633289254d157d2676f0c20d4a2578515e5ed5bb0036706df35fd2d4cba091881fc6c84d870c80e6cf7c6923392daf9c1cfbb1
@@ -0,0 +1,13 @@
We don't want any automagic lint probing.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,9 +98,6 @@ else()
endif()
include(GNUInstallDirs)
-include(${CMAKE_SOURCE_DIR}/cmake/clang-tidy.cmake)
-include(${CMAKE_SOURCE_DIR}/cmake/cppcheck.cmake)
-include(${CMAKE_SOURCE_DIR}/cmake/reformat.cmake)
if(NOT WIN32)
option(BUILD_SERVER "Build Snapserver" ON) # no Windows server for now
@@ -0,0 +1,19 @@
avoid automagic for soxr
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,12 +256,10 @@ if(NOT WIN32 AND NOT ANDROID)
endif()
endif()
- pkg_search_module(SOXR soxr)
- if(SOXR_FOUND)
+ if(BUILD_WITH_SOXR)
+ pkg_search_module(SOXR REQUIRED soxr)
add_compile_definitions(HAS_SOXR)
- else()
- message(STATUS "soxr not found")
- endif(SOXR_FOUND)
+ endif()
if(BUILD_WITH_FLAC)
pkg_search_module(FLAC REQUIRED flac)
@@ -0,0 +1,11 @@
--- a/extras/package/rpm/snapclient.service
+++ b/extras/package/rpm/snapclient.service
@@ -8,7 +8,7 @@ After=network-online.target time-sync.target sound.target avahi-daemon.service
EnvironmentFile=-/etc/default/snapclient
ExecStart=/usr/bin/snapclient --logsink=system $SNAPCLIENT_OPTS
User=snapclient
-Group=snapclient
+Group=audio
Restart=on-failure
[Install]
@@ -0,0 +1,7 @@
# conf.d file for snapclient
SNAPCLIENT_USER="snapclient:audio"
# snapclient [options...] [url]
# For all command line options, please see `man snapclient.1`
# if ’url’ is not configured, snapclient defaults to ’tcp://_snapcast._tcp’
SNAPCLIENT_OPTS="--logsink=system"
@@ -0,0 +1,14 @@
#!/sbin/openrc-run
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
name=snapclient
command="/usr/bin/snapclient"
command_args="${SNAPCLIENT_OPTS}"
command_user="${SNAPCLIENT_USER:-snapclient:audio}"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
use avahi-daemon
}
@@ -0,0 +1,5 @@
# conf.d file for snapserver
SNAPSERVER_USER="snapserver:snapserver"
# For all command line options, please see `snapserver -hh`
SNAPSERVER_OPTS="--logging.sink=system --server.datadir=/var/lib/snapserver"
@@ -0,0 +1,14 @@
#!/sbin/openrc-run
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
name=snapserver
command="/usr/bin/snapserver"
command_args="${SNAPSERVER_OPTS}"
command_user="${SNAPSERVER_USER:-snapserver:snapserver}"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
use avahi-daemon
}
+4 -2
View File
@@ -4,7 +4,9 @@
<!-- maintainer-needed -->
<use>
<flag name="client">Build and install Snapcast client component</flag>
<flag name="pipewire">Build with PipeWire support</flag>
<flag name="server">Build and install Snapcast server component</flag>
<flag name="soxr">Build with audio resampler support with <pkg>media-libs/soxr</pkg></flag>
<flag name="tremor">Build with TREMOR version of vorbis</flag>
</use>
<upstream>
@@ -12,8 +14,8 @@
<name>Johannes Pohl</name>
<email>github@badaix.de</email>
</maintainer>
<bugs-to>https://github.com/badaix/snapcast/issues</bugs-to>
<remote-id type="github">badaix/snapcast</remote-id>
<bugs-to>https://github.com/snapcast/snapcast/issues</bugs-to>
<remote-id type="github">snapcast/snapcast</remote-id>
</upstream>
<longdescription lang="en">
Snapcast plays audio streams time sychronized on multiple devices over
+151
View File
@@ -0,0 +1,151 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..14} )
inherit cmake edo optfeature python-single-r1 systemd
DESCRIPTION="Synchronous multi-room audio player"
HOMEPAGE="https://github.com/snapcast/snapcast"
SRC_URI="https://github.com/snapcast/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~riscv ~x86"
IUSE="alsa +client +expat +flac jack +opus pipewire python +server soxr ssl test tremor +vorbis +zeroconf"
REQUIRED_USE="
|| ( server client )
server? (
python? ( ${PYTHON_REQUIRED_USE} )
)
"
RESTRICT="!test? ( test )"
RDEPEND="
alsa? ( media-libs/alsa-lib )
client? (
acct-user/snapclient
tremor? (
media-libs/libogg
media-libs/tremor
)
)
flac? ( media-libs/flac:= )
jack? ( virtual/jack )
opus? ( media-libs/opus )
pipewire? ( media-video/pipewire:= )
server? (
acct-group/snapserver
>=acct-user/snapserver-0-r3
expat? ( dev-libs/expat )
python? ( ${PYTHON_DEPS} )
)
soxr? ( media-libs/soxr )
ssl? ( dev-libs/openssl:= )
vorbis? (
media-libs/libogg
media-libs/libvorbis
)
zeroconf? ( net-dns/avahi[dbus] )
"
DEPEND="
${RDEPEND}
dev-cpp/nlohmann_json
dev-libs/boost:=
jack? ( dev-libs/boost:=[context] )
test? (
>=dev-cpp/catch-3:0
dev-libs/openssl
)
"
PATCHES=(
"${FILESDIR}"/${PN}-0.34.0-snapclient_group.patch
"${FILESDIR}"/${PN}-0.34.0-opt_soxr.patch
"${FILESDIR}"/${PN}-0.34.0-drop-lint.patch
)
pkg_setup() {
use server && use python && python-single-r1_pkg_setup
}
src_prepare() {
# 3rd-party
rm common/json.hpp || die
sed -e 's@"common/json.hpp"@<nlohmann/json.hpp>@' \
-i common/message/json_message.hpp \
-i common/stream_uri.hpp \
-i server/control_server.cpp \
-i server/streamreader/metadata.hpp \
-i server/streamreader/pcm_stream.hpp \
-i server/streamreader/properties.hpp \
-i server/config.hpp \
-i server/jsonrpcpp.hpp \
-i server/jwt.hpp || die
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DBUILD_CLIENT=$(usex client)
-DBUILD_SERVER=$(usex server)
-DBUILD_STATIC_LIBS=no
-DBUILD_TESTS=$(usex test)
-DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}/etc"
-DBUILD_WITH_ALSA=$(usex alsa)
-DBUILD_WITH_AVAHI=$(usex zeroconf)
-DBUILD_WITH_EXPAT=$(usex expat)
-DBUILD_WITH_FLAC=$(usex flac)
-DBUILD_WITH_JACK=$(usex jack)
-DBUILD_WITH_OPUS=$(usex opus)
-DBUILD_WITH_PIPEWIRE=$(usex pipewire)
-DBUILD_WITH_SOXR=$(usex soxr)
-DBUILD_WITH_SSL=$(usex ssl)
-DBUILD_WITH_TREMOR=$(usex tremor)
-DBUILD_WITH_VORBIS=$(usex vorbis)
)
cmake_src_configure
}
src_test() {
edo "${S}"/bin/snapcast_test
}
src_install() {
cmake_src_install
local bin
for bin in server client ; do
if use ${bin} ; then
doman ${bin}/snap${bin}.1
newconfd "${FILESDIR}"/snap${bin}.confd-r1 snap${bin}
newinitd "${FILESDIR}"/snap${bin}.initd-r1 snap${bin}
systemd_dounit extras/package/rpm/snap${bin}.service
fi
done
if use server; then
if use python; then
python_fix_shebang "${ED}"/usr/share/snapserver/plug-ins
else
rm "${ED}"/usr/share/snapserver/plug-ins/*.py || die
fi
fi
}
pkg_postinst() {
if use client && ! use zeroconf; then
ewarn "zeroconf is disabled but the url by default is 'tcp://_snapcast._tcp'."
ewarn "Please define an url in SNAPCLIENT_OPTS into ${EROOT}/etc/conf.d/snapclient"
fi
if use server && use python; then
optfeature "librespot stream plugin" dev-python/websocket-client dev-python/requests
optfeature "mopidy stream plugin" dev-python/websocket-client
optfeature "mpd stream plugin" dev-python/dbus-python dev-python/musicbrainzngs
optfeature "mpd stream plugin" dev-python/pygobject dev-python/python-mpd2
fi
}