media-sound/snapcast: New package
authorChristian Buchinger <cb-gentoo@guya.de>
Fri, 5 Oct 2018 14:02:16 +0000 (16:02 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Sun, 7 Oct 2018 17:01:50 +0000 (19:01 +0200)
Plays audio streams time sychronized on multiple devices over network using
a server and a client component.

Closes: https://bugs.gentoo.org/667710
Signed-off-by: Christian Buchinger <cb-gentoo@guya.de>
Package-Manager: Portage-2.3.50, Repoman-2.3.11
Closes: https://github.com/gentoo/gentoo/pull/10059
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
media-sound/snapcast/Manifest [new file with mode: 0644]
media-sound/snapcast/files/snapcast-options-for-use-flags.patch [new file with mode: 0644]
media-sound/snapcast/files/snapclient.confd [new file with mode: 0644]
media-sound/snapcast/files/snapclient.initd [new file with mode: 0644]
media-sound/snapcast/files/snapserver.confd [new file with mode: 0644]
media-sound/snapcast/files/snapserver.initd [new file with mode: 0644]
media-sound/snapcast/metadata.xml [new file with mode: 0644]
media-sound/snapcast/snapcast-0.15.0.ebuild [new file with mode: 0644]
media-sound/snapcast/snapcast-9999.ebuild [new file with mode: 0644]

diff --git a/media-sound/snapcast/Manifest b/media-sound/snapcast/Manifest
new file mode 100644 (file)
index 0000000..64bd51f
--- /dev/null
@@ -0,0 +1 @@
+DIST snapcast-0.15.0.tar.gz 667452 BLAKE2B 0bf7e28ba52356c8fff8066ded3d741243c2ba88cdc6cefda113c0d6866fe14b2fea6198d7809e564cd61d32a336a2c30ee22f6f5d6ae77368a6f3e254cc5065 SHA512 3751eeaa9be4ffd5c7633b8770f36e87360ab83004f090a8350e377f60a79d9502b92b92c5c9c35f513705e6484d113de9942f0a896824d7c5f806ba0010e84e
diff --git a/media-sound/snapcast/files/snapcast-options-for-use-flags.patch b/media-sound/snapcast/files/snapcast-options-for-use-flags.patch
new file mode 100644 (file)
index 0000000..956d629
--- /dev/null
@@ -0,0 +1,90 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 52fec6e..d068db1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -11,6 +11,11 @@ option(BUILD_TESTS "Build tests (run tests with make test)" ON)
+ option(BUILD_SERVER "Build Snapserver" ON)
+ option(BUILD_CLIENT "Build Snapclient" ON)
++option(BUILD_WITH_FLAC "Build with FLAC support" ON)
++option(BUILD_WITH_VORBIS "Build with VORBIS support" ON)
++option(BUILD_WITH_TREMOR "Build with vorbis using TREMOR" ON)
++option(BUILD_WITH_AVAHI "Build with AVAHI support" ON)
++
+ if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
+     message(FATAL_ERROR "One or both of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be set to ON to build")
+@@ -109,10 +114,12 @@ else()
+         endif (ALSA_FOUND)
+     endif()
+-    pkg_search_module(AVAHI avahi-client)
+-    if (AVAHI_FOUND)
+-        add_definitions(-DHAS_AVAHI)
+-    endif (AVAHI_FOUND)
++    if(BUILD_WITH_AVAHI)
++        pkg_search_module(AVAHI avahi-client)
++        if (AVAHI_FOUND)
++            add_definitions(-DHAS_AVAHI)
++        endif (AVAHI_FOUND)
++    endif(BUILD_WITH_AVAHI)
+     add_definitions(-DHAS_DAEMON)
+@@ -154,29 +161,39 @@ if(NOT HAS_CXX11_STRING_SUPPORT)
+     add_definitions("-DNO_CPP11_STRING")
+ endif()
+-pkg_search_module(FLAC flac)
+-if (FLAC_FOUND)
+-    add_definitions("-DHAS_FLAC")
+-endif (FLAC_FOUND)
++if(BUILD_WITH_FLAC)
++    pkg_search_module(FLAC flac)
++    if (FLAC_FOUND)
++        add_definitions("-DHAS_FLAC")
++    endif (FLAC_FOUND)
++endif()
+-pkg_search_module(OGG ogg)
+-if (OGG_FOUND)
+-    add_definitions("-DHAS_OGG")
+-endif (OGG_FOUND)
++if(BUILD_WITH_VORBIS OR BUILD_WITH_TREMOR)
++    pkg_search_module(OGG ogg)
++    if (OGG_FOUND)
++        add_definitions("-DHAS_OGG")
++    endif (OGG_FOUND)
++endif()
+-pkg_search_module(VORBIS vorbis)
+-if (VORBIS_FOUND)
+-    add_definitions("-DHAS_VORBIS")
+-endif (VORBIS_FOUND)
++if(BUILD_WITH_VORBIS)
++    pkg_search_module(VORBIS vorbis)
++    if (VORBIS_FOUND)
++        add_definitions("-DHAS_VORBIS")
++    endif (VORBIS_FOUND)
++endif()
+-pkg_search_module(TREMOR vorbisidec)
+-if (TREMOR_FOUND)
+-    add_definitions("-DHAS_TREMOR")
+-endif (TREMOR_FOUND)
++if(BUILD_WITH_TREMOR)
++    pkg_search_module(TREMOR vorbisidec)
++    if (TREMOR_FOUND)
++        add_definitions("-DHAS_TREMOR")
++    endif (TREMOR_FOUND)
++endif()
+-pkg_search_module(VORBISENC vorbisenc)
+-if (VORBISENC_FOUND)
+-    add_definitions("-DHAS_VORBISENC")
++if(BUILD_WITH_VORBIS)
++    pkg_search_module(VORBISENC vorbisenc)
++    if (VORBISENC_FOUND)
++        add_definitions("-DHAS_VORBISENC")
++    endif(VORBISENC_FOUND)
+ endif()
diff --git a/media-sound/snapcast/files/snapclient.confd b/media-sound/snapcast/files/snapclient.confd
new file mode 100644 (file)
index 0000000..311cce1
--- /dev/null
@@ -0,0 +1,33 @@
+# conf.d file for snapclient
+
+# Options for running Snapclient as daemon
+#
+#      -s, --soundcard arg (=default)
+#              Index or name of the soundcard
+#
+#      -h, --host arg
+#              Server hostname or ip address
+#
+#      -p, --port arg (=1704)
+#              Server port
+#
+#      -d, --daemon [=arg(=-3)]
+#              Daemonize, optional process priority [-20..19]
+#
+#      --user arg
+#              The user[:group] to run snapclient as when daemonized
+#
+#      --latency arg (=0)
+#              Latency of the soundcard
+#
+#      -i, --instance arg (=1)
+#              Instance id
+#
+#      --hostID arg
+#              Unique host id
+#
+# For all command line options, please see man snapclient
+
+SNAPCLIENT_USER="--user snapclient:audio"
+
+SNAPCLIENT_OPTS="-d"
diff --git a/media-sound/snapcast/files/snapclient.initd b/media-sound/snapcast/files/snapclient.initd
new file mode 100644 (file)
index 0000000..df69eb2
--- /dev/null
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+name=snapclient
+command="/usr/bin/snapclient"
+command_args="$SNAPCLIENT_USER $SNAPCLIENT_OPTS"
+pidfile="/run/snapclient/pid"
+
+depend() {
+       use avahi-daemon
+}
+
+start_pre() {
+       checkpath --directory --owner snapclient:audio --mode 0775 \
+               /run/snapclient
+}
diff --git a/media-sound/snapcast/files/snapserver.confd b/media-sound/snapcast/files/snapserver.confd
new file mode 100644 (file)
index 0000000..9b12f81
--- /dev/null
@@ -0,0 +1,45 @@
+# conf.d file for snapserver
+
+# Options for running Snapserver as daemon
+#
+#      -p, --port arg (=1704)
+#              Server port
+#
+#      --controlPort arg (=1705)
+#              Remote control port
+#
+#      -s, --stream arg (=pipe:///tmp/snapfifo?name=default)
+#              URI of the PCM input stream.
+#              Format: TYPE://host/path?name=NAME
+#              [&codec=CODEC]
+#              [&sampleformat=SAMPLEFORMAT]
+#
+#      --sampleformat arg (=48000:16:2)
+#              Default sample format
+#
+#      -c, --codec arg (=flac)
+#              Default transport codec
+#              (flac|ogg|pcm)[:options]
+#              Type codec:? to get codec specific options
+#
+#      --streamBuffer arg (=20)
+#              Default stream read buffer [ms]
+#
+#      -b, --buffer arg (=1000)
+#              Buffer [ms]
+#
+#      --sendToMuted
+#              Send audio to muted clients
+#
+#      -d, --daemon [=arg(=0)]
+#              Daemonize
+#              Optional process priority [-20..19]
+#
+#      --user arg
+#              The user[:group] to run snapserver as when daemonized
+#
+# For all command line options, please see man snapserver
+
+SNAPSERVER_USER="--user snapserver:snapserver"
+
+SNAPSERVER_OPTS="-d -s pipe:///tmp/snapfifo?name=default"
diff --git a/media-sound/snapcast/files/snapserver.initd b/media-sound/snapcast/files/snapserver.initd
new file mode 100644 (file)
index 0000000..02762c8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+name=snapserver
+command="/usr/bin/snapserver"
+command_args="$SNAPSERVER_USER $SNAPSERVER_OPTS"
+pidfile="/run/snapserver/pid"
+
+depend() {
+       use avahi-daemon
+}
+
+start_pre() {
+       checkpath --directory --owner snapserver:snapserver --mode 0775 \
+               /run/snapserver
+}
diff --git a/media-sound/snapcast/metadata.xml b/media-sound/snapcast/metadata.xml
new file mode 100644 (file)
index 0000000..b0eb43f
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>cb-gentoo@guya.de</email>
+               <name>Christian Buchinger</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <use>
+               <flag name="avahi">Build with avahi support</flag>
+               <flag name="client">Build and install Snapcast client component</flag>
+               <flag name="flac">Build with FLAC compression support</flag>
+               <flag name="server">Build and install Snapcast server component</flag>
+               <flag name="static-libs">Build static libs</flag>
+               <flag name="test">Build and run tests</flag>
+               <flag name="tremor">Build with TREMOR version of vorbis</flag>
+               <flag name="vorbis">Build with libvorbis support</flag>
+       </use>
+       <upstream>
+               <maintainer status="active">
+                       <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>
+       </upstream>
+       <longdescription lang="en">
+               Snapcast plays audio streams time sychronized on multiple devices over 
+               network using a server and a client component. The server picks up an 
+               audio stream from a fifo pipe, thus it can be combined with any audio 
+               source that is able to write to a pipe.
+       </longdescription>
+</pkgmetadata>
diff --git a/media-sound/snapcast/snapcast-0.15.0.ebuild b/media-sound/snapcast/snapcast-0.15.0.ebuild
new file mode 100644 (file)
index 0000000..da8726f
--- /dev/null
@@ -0,0 +1,87 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+DESCRIPTION="Synchronous multi-room audio player"
+HOMEPAGE="https://github.com/badaix/snapcast"
+
+if [[ ${PV} == *9999 ]] ; then
+       inherit user cmake-utils git-r3
+
+       EGIT_REPO_URI="https://github.com/badaix/snapcast.git"
+       EGIT_BRANCH="develop"
+else
+       inherit user cmake-utils
+
+       SRC_URI="https://github.com/badaix/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+       KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="+avahi +client +flac +server static-libs tremor +vorbis"
+
+REQUIRED_USE="|| ( server client )"
+
+RDEPEND="avahi? ( net-dns/avahi[dbus] )
+       client? ( media-libs/alsa-lib )
+       flac? ( media-libs/flac )
+       tremor? ( media-libs/tremor )
+       vorbis? ( media-libs/libvorbis )"
+DEPEND="${RDEPEND}
+       >=dev-cpp/aixlog-1.2.1
+       >=dev-cpp/asio-1.12.1
+       >=dev-cpp/popl-1.2.0"
+
+PATCHES=( "${FILESDIR}/${PN}-options-for-use-flags.patch" )
+
+pkg_preinst() {
+       if use server ; then
+               enewgroup "snapserver"
+               enewuser "snapserver" -1 -1 /var/lib/snapserver snapserver
+       fi
+
+       if use client ; then
+               enewuser "snapclient" -1 -1 /var/lib/snapclient audio
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_WITH_AVAHI=$(usex avahi)
+               -DBUILD_CLIENT=$(usex client)
+               -DBUILD_WITH_FLAC=$(usex flac)
+               -DBUILD_SERVER=$(usex server)
+               -DBUILD_STATIC_LIBS=$(usex static-libs)
+               -DBUILD_TESTS=no
+               -DBUILD_WITH_TREMOR=$(usex tremor)
+               -DBUILD_WITH_VORBIS=$(usex vorbis)
+       )
+
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       for bin in server client ; do
+               if use ${bin} ; then
+                       doman "${bin}/snap${bin}.1"
+
+                       newconfd "${FILESDIR}/snap${bin}.confd" "snap${bin}"
+                       newinitd "${FILESDIR}/snap${bin}.initd" "snap${bin}"
+               fi
+       done
+
+       if use client ; then
+               diropts -m 0770 -o snapclient audio
+               keepdir /var/lib/snapclient
+       fi
+
+       if use server ; then
+               diropts -m 0770 -o snapserver snapserver
+               keepdir /var/lib/snapserver
+       fi
+}
diff --git a/media-sound/snapcast/snapcast-9999.ebuild b/media-sound/snapcast/snapcast-9999.ebuild
new file mode 100644 (file)
index 0000000..da8726f
--- /dev/null
@@ -0,0 +1,87 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+DESCRIPTION="Synchronous multi-room audio player"
+HOMEPAGE="https://github.com/badaix/snapcast"
+
+if [[ ${PV} == *9999 ]] ; then
+       inherit user cmake-utils git-r3
+
+       EGIT_REPO_URI="https://github.com/badaix/snapcast.git"
+       EGIT_BRANCH="develop"
+else
+       inherit user cmake-utils
+
+       SRC_URI="https://github.com/badaix/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+       KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="+avahi +client +flac +server static-libs tremor +vorbis"
+
+REQUIRED_USE="|| ( server client )"
+
+RDEPEND="avahi? ( net-dns/avahi[dbus] )
+       client? ( media-libs/alsa-lib )
+       flac? ( media-libs/flac )
+       tremor? ( media-libs/tremor )
+       vorbis? ( media-libs/libvorbis )"
+DEPEND="${RDEPEND}
+       >=dev-cpp/aixlog-1.2.1
+       >=dev-cpp/asio-1.12.1
+       >=dev-cpp/popl-1.2.0"
+
+PATCHES=( "${FILESDIR}/${PN}-options-for-use-flags.patch" )
+
+pkg_preinst() {
+       if use server ; then
+               enewgroup "snapserver"
+               enewuser "snapserver" -1 -1 /var/lib/snapserver snapserver
+       fi
+
+       if use client ; then
+               enewuser "snapclient" -1 -1 /var/lib/snapclient audio
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_WITH_AVAHI=$(usex avahi)
+               -DBUILD_CLIENT=$(usex client)
+               -DBUILD_WITH_FLAC=$(usex flac)
+               -DBUILD_SERVER=$(usex server)
+               -DBUILD_STATIC_LIBS=$(usex static-libs)
+               -DBUILD_TESTS=no
+               -DBUILD_WITH_TREMOR=$(usex tremor)
+               -DBUILD_WITH_VORBIS=$(usex vorbis)
+       )
+
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       for bin in server client ; do
+               if use ${bin} ; then
+                       doman "${bin}/snap${bin}.1"
+
+                       newconfd "${FILESDIR}/snap${bin}.confd" "snap${bin}"
+                       newinitd "${FILESDIR}/snap${bin}.initd" "snap${bin}"
+               fi
+       done
+
+       if use client ; then
+               diropts -m 0770 -o snapclient audio
+               keepdir /var/lib/snapclient
+       fi
+
+       if use server ; then
+               diropts -m 0770 -o snapserver snapserver
+               keepdir /var/lib/snapserver
+       fi
+}