Skip to content

Commit e5a64aa

Browse files
xabolcsbadaixdavidandreolettihunterzero99
authored andcommitted
snapcast: add Snapcast from badaix/snapos as is
Add Snapcast package files as is from https://github.com/badaix/snapos/tree/29a5daebb0513faa825b12474125c0c2dd66c2ee/openwrt/snapcast Co-authored-by: badaix <johannes.pohl@badaix.de> Co-authored-by: David Andreoletti <david@andreoletti.net> Co-authored-by: luciferin <40036150+hunterzero99@users.noreply.github.com> Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
1 parent c2c210f commit e5a64aa

3 files changed

Lines changed: 179 additions & 0 deletions

File tree

sound/snapcast/Makefile

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#
2+
# Copyright (C) 2015 OpenWrt.org
3+
#
4+
# This is free software, licensed under the GNU General Public License v2.
5+
# See /LICENSE for more information.
6+
#
7+
8+
include $(TOPDIR)/rules.mk
9+
10+
PKG_NAME := snapcast
11+
PKG_VERSION := 0.27.0
12+
PKG_RELEASE := $(PKG_SOURCE_VERSION)
13+
PKG_USE_MIPS16 := 0
14+
15+
# PKG_MIRROR_HASH=skip
16+
PKG_SOURCE_PROTO:=git
17+
PKG_SOURCE_URL:=https://github.com/badaix/snapcast.git
18+
PKG_SOURCE_VERSION:=v0.27.0
19+
PKG_BUILD_DIR:=$(BUILD_DIR)/snapcast-$(PKG_VERSION)
20+
21+
include $(INCLUDE_DIR)/package.mk
22+
include $(INCLUDE_DIR)/cmake.mk
23+
24+
CMAKE_OPTIONS += -DBUILD_TESTS=OFF
25+
26+
define Package/snapcast/Default
27+
SECTION := sound
28+
CATEGORY := Sound
29+
TITLE := Synchronous multiroom audio player
30+
DEPENDS := +AUDIO_SUPPORT:alsa-lib +libstdcpp +libavahi-client +libatomic +libogg +libflac +libopus +boost +libsoxr
31+
URL := https://github.com/badaix/snapcast
32+
endef
33+
34+
define Package/snapcast/description/Default
35+
Synchronous audio player
36+
endef
37+
38+
define Package/snapcast
39+
$(call Package/snapcast/Default)
40+
TITLE += packages
41+
endef
42+
43+
define Package/snapcast/description
44+
$(call Package/snapcast/description/Default)
45+
Snapcast is a multi-room client-server audio player,
46+
where all clients are time synchronized with the server
47+
to play perfectly synced audio
48+
endef
49+
50+
define Package/snapserver
51+
$(call Package/snapcast/Default)
52+
TITLE += Snapserver
53+
DEPENDS += +AUDIO_SUPPORT:alsa-lib +libvorbis +libsoxr
54+
HIDDEN := 1
55+
endef
56+
57+
define Package/snapclient
58+
$(call Package/snapcast/Default)
59+
TILE += Snapclient
60+
DEPENDS += +libvorbisidec +libsoxr
61+
HIDDEN := 1
62+
endef
63+
64+
define Package/snapserver/description
65+
$(call Package/snapcast/description/Default)
66+
Snapcast server
67+
endef
68+
69+
define Package/snapclient/description
70+
$(call Package/snapcast/description/Default)
71+
Snapcast client
72+
endef
73+
74+
define Package/snapcast/config
75+
menu "Select Snapcast Options"
76+
depends on PACKAGE_snapcast
77+
comment "Choose server or client"
78+
config PACKAGE_snapserver
79+
prompt "Snapserver"
80+
help
81+
Snapcast server
82+
default n
83+
84+
config PACKAGE_snapclient
85+
prompt "Snapclient"
86+
help
87+
Snapcast client
88+
default y
89+
endmenu
90+
endef
91+
92+
define Package/snapcast/Default/install
93+
true
94+
endef
95+
96+
define Package/snapserver/install
97+
$(INSTALL_DIR) $(1)/usr/bin
98+
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/snapserver $(1)/usr/bin/
99+
$(INSTALL_DIR) $(1)/etc/init.d
100+
$(INSTALL_BIN) ./files/snapserver.init $(1)/etc/init.d/snapserver
101+
$(INSTALL_DIR) $(1)/etc/default
102+
$(INSTALL_BIN) $(CURDIR)/../../debian/snapserver.default $(1)/etc/default/snapserver
103+
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server/etc/snapserver.conf $(1)/etc/snapserver.conf
104+
endef
105+
106+
define Package/snapclient/install
107+
$(INSTALL_DIR) $(1)/usr/bin
108+
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/snapclient $(1)/usr/bin/
109+
$(INSTALL_DIR) $(1)/etc/init.d
110+
$(INSTALL_BIN) ./files/snapclient.init $(1)/etc/init.d/snapclient
111+
$(INSTALL_DIR) $(1)/etc/default
112+
$(INSTALL_BIN) $(CURDIR)/../../debian/snapclient.default $(1)/etc/default/snapclient
113+
endef
114+
115+
$(eval $(call BuildPackage,snapserver))
116+
$(eval $(call BuildPackage,snapclient))
117+
$(eval $(call BuildPackage,snapcast))
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh /etc/rc.common
2+
# Author: Johannes Pohl <johannes.pohl@badaix.de>
3+
START=90
4+
5+
USE_PROCD=1
6+
7+
NAME=snapclient
8+
PROG=/usr/bin/$NAME
9+
PID_FILE=/var/run/$NAME.pid
10+
CONFIG_FILE=/etc/default/$NAME
11+
12+
13+
start_service()
14+
{
15+
local autostart opts
16+
17+
autostart=$(grep ^START_SNAPCLIENT $CONFIG_FILE |cut -d= -f2)
18+
[ "$autostart" != "true" ] && logger -t $NAME "Not starting due to START_SNAPCLIENT" && exit 0
19+
20+
opts=$(grep ^SNAPCLIENT_OPTS $CONFIG_FILE |cut -d "\"" -f2)
21+
opts="--logsink system $opts"
22+
23+
procd_open_instance
24+
procd_set_param command $PROG
25+
procd_append_param command $opts
26+
procd_set_param pidfile $PID_FILE
27+
procd_set_param respawn # use the defaults for respawing crashed process
28+
procd_set_param stderr 1
29+
procd_set_param stdout 1
30+
procd_close_instance
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh /etc/rc.common
2+
# Author: Johannes Pohl <johannes.pohl@badaix.de>
3+
START=90
4+
5+
USE_PROCD=1
6+
7+
NAME=snapserver
8+
PROG=/usr/bin/$NAME
9+
PID_FILE=/var/run/$NAME.pid
10+
CONFIG_FILE=/etc/default/$NAME
11+
12+
13+
start_service()
14+
{
15+
local autostart opts
16+
17+
autostart=$(grep ^START_SNAPSERVER $CONFIG_FILE |cut -d= -f2)
18+
[ "$autostart" != "true" ] && logger -t $NAME "Not starting due to START_SNAPSERVER" && exit 0
19+
20+
opts=$(grep ^SNAPSERVER_OPTS $CONFIG_FILE |cut -d "\"" -f2)
21+
opts="--logging.sink system $opts"
22+
23+
procd_open_instance
24+
procd_set_param command $PROG
25+
procd_append_param command $opts
26+
procd_set_param pidfile $PID_FILE
27+
procd_set_param respawn # use the defaults for respawing crashed process
28+
procd_set_param stderr 1
29+
procd_set_param stdout 1
30+
procd_close_instance
31+
}

0 commit comments

Comments
 (0)