Add package build sources

This commit is contained in:
badaix 2023-02-12 19:45:27 +01:00
parent 54a3d86200
commit 4fdb4367b5
34 changed files with 1196 additions and 0 deletions

244
.github/workflows/package.yml vendored Normal file
View file

@ -0,0 +1,244 @@
name: Package
on:
workflow_dispatch:
pull_request:
env:
BOOST_VERSION: 1_81_0
VERSION: v0.27.0
jobs:
deb:
strategy:
fail-fast: false
matrix:
image:
- buster
- bullseye
- bookworm
os:
- ubuntu-latest
- self-hosted-rpi4
include:
- os: ubuntu-latest
arch: "amd64"
image_prefix: "debian:"
image_suffix: ""
- os: self-hosted-rpi4
arch: "armhf"
image_prefix: "badaix/raspios-"
image_suffix: "-armhf-lite"
exclude:
- os: self-hosted-rpi4
image: "bookworm"
runs-on: ${{ matrix.os }}
name: deb (${{ matrix.arch }}, ${{ matrix.image }})
timeout-minutes: 240
container:
image: ${{matrix.image_prefix}}${{matrix.image}}${{matrix.image_suffix}}
steps:
- name: Get dependencies
run: apt-get update && apt-get install -yq wget debhelper build-essential cmake git rename libatomic1 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon libexpat1-dev python3 ccache
env:
DEBIAN_FRONTEND: noninteractive
- name: Checkout
uses: actions/checkout@v3
- name: Setup environment
run: |
echo "PARENT_DIR=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
BOOST_DOT_VERSION=$(echo ${BOOST_VERSION} | sed 's/_/./g')
echo "BOOST_DOT_VERSION=$BOOST_DOT_VERSION" >> $GITHUB_ENV
echo "BOOST=boost_${BOOST_VERSION}" >> $GITHUB_ENV
ln -s extras/package/debian debian
- name: Create changelog
run: |
$GITHUB_WORKSPACE/debian/changelog_md2deb.py $GITHUB_WORKSPACE/changelog.md > $GITHUB_WORKSPACE/debian/changelog
cat $GITHUB_WORKSPACE/debian/changelog
- name: Clean up
run: rm -rf ${{env.PARENT_DIR}}/snap*_${{ matrix.arch }}.deb
- name: Cache boost
id: cache-boost
uses: actions/cache@v3
with:
path: ${{env.BOOST}}
key: ${{env.BOOST}}
- name: Get boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
wget https://boostorg.jfrog.io/artifactory/main/release/${{env.BOOST_DOT_VERSION}}/source/${{env.BOOST}}.tar.bz2
tar xjf ${{env.BOOST}}.tar.bz2
- name: cache ccache
id: cache-ccache
uses: actions/cache@v3
with:
# TODO: use environment variable $HOME/.ccache
path: /home/runner/.ccache
key: ${{ matrix.os }}-${{ matrix.image }}-ccache-${{ github.sha }}
restore-keys: ${{ matrix.os }}-${{ matrix.image }}-ccache-
- name: Create deb package
env:
# TODO: use environment variable $HOME/.ccache
CCACHE_DIR: /home/runner/.ccache
run: |
fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DBUILD_WITH_PULSE=OFF" binary
rename 's/_${{ matrix.arch }}/_without-pulse_${{ matrix.arch }}/g' ../snapclient*_${{ matrix.arch }}.deb
fakeroot make -f debian/rules clean
fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }}" binary
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: snapcast_${{ matrix.arch }}-debian-${{matrix.image}}-${{ github.sha }}
path: ${{env.PARENT_DIR}}/snap*_${{ matrix.arch }}.deb
# mac:
# strategy:
# fail-fast: false
# matrix:
# xcode: ['11']
# runs-on: macos-latest
# name: mac (xcode ${{ matrix.xcode }})
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Checkout Snapcast
# uses: actions/checkout@v3
# with:
# repository: badaix/snapcast
# path: src/snapcast
# ref: ${{ env.VERSION }}
# - name: Setup environment
# run: |
# BOOST_DOT_VERSION=$(echo ${BOOST_VERSION} | sed 's/_/./g')
# echo "BOOST_DOT_VERSION=$BOOST_DOT_VERSION" >> $GITHUB_ENV
# echo "BOOST=boost_${BOOST_VERSION}" >> $GITHUB_ENV
# - name: Get dependencies
# run: brew install pkgconfig libsoxr ccache expat
# - name: Cache boost
# id: cache-boost
# uses: actions/cache@v3
# with:
# path: ${{env.BOOST}}
# key: ${{ runner.os }}-boost
# - name: Get boost
# if: steps.cache-boost.outputs.cache-hit != 'true'
# run: |
# wget https://boostorg.jfrog.io/artifactory/main/release/${{env.BOOST_DOT_VERSION}}/source/${{env.BOOST}}.tar.bz2
# tar xjf ${{env.BOOST}}.tar.bz2
# - name: Cache ccache
# id: cache-ccache
# uses: actions/cache@v3
# with:
# path: /Users/runner/.ccache
# key: ${{ runner.os }}-ccache-${{ github.sha }}
# restore-keys: ${{ runner.os }}-ccache-
# #- name: ccache dump config
# # run: ccache -p
# - name: configure
# run: cmake -S $GITHUB_WORKSPACE/src/snapcast -B build -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE=Release -DREVISION=${{ github.sha }} -DWERROR=ON -DBUILD_TESTS=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS="-I/usr/local/include -Wno-deprecated-declarations"
# - name: build
# run: cmake --build build --parallel 3
# rpm:
# if: ${{ false }} # disable for now
# strategy:
# fail-fast: false
# matrix:
# image:
# - 34
# - 35
# os:
# - ubuntu-latest
# - self-hosted-rpi4
# include:
# - os: ubuntu-latest
# arch: "x86_64"
# - os: self-hosted-rpi4
# arch: "armv7hl"
# runs-on: ${{ matrix.os }}
# name: rpm (${{ matrix.arch }}, fedora ${{ matrix.image }})
# container:
# image: fedora:${{matrix.image}}
# steps:
# - name: Get dependencies
# run: dnf -y update && dnf -y install wget git rpm-build gcc-c++ cmake boost-devel alsa-lib-devel avahi-devel libatomic libvorbis-devel opus-devel pulseaudio-libs-devel flac-devel soxr-devel libstdc++-static expat-devel
# - name: Checkout
# uses: actions/checkout@v3
# - name: Checkout Snapcast
# uses: actions/checkout@v3
# with:
# repository: badaix/snapcast
# path: src/snapcast
# ref: ${{ env.VERSION }}
# - name: Create rpm package
# run: |
# mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
# cp rpm/* ~/rpmbuild/SOURCES/
# tar -C $GITHUB_WORKSPACE/src/ -czvf ~/rpmbuild/SOURCES/snapcast.tar.gz snapcast
# rpmbuild --nodebuginfo --define '_reversion ${{ github.sha }}' --define '_version ${{ env.VERSION }}' -bb ~/rpmbuild/SOURCES/snapcast.spec
# - name: Archive artifacts
# uses: actions/upload-artifact@v3
# with:
# name: snapcast_${{ matrix.arch }}-fedora-${{matrix.image}}-${{ github.sha }}
# path: ~/rpmbuild/RPMS/${{ matrix.arch }}/snap*.rpm
win:
runs-on: windows-2019
name: win
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Snapcast
uses: actions/checkout@v3
with:
repository: badaix/snapcast
path: src/snapcast
ref: ${{ env.VERSION }}
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
#path: ${VCPKG_INSTALLATION_ROOT}\installed
path: c:\vcpkg\installed
key: ${{ runner.os }}-dependencies
- name: Get dependenciesenv
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: vcpkg.exe install libflac libvorbis soxr opus boost-asio --triplet x64-windows
- name: configure
run: |
echo vcpkg installation root: $env:VCPKG_INSTALLATION_ROOT
cmake -S . -B build -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows" -DCMAKE_BUILD_TYPE="Release" -DREVISION="${{ github.sha }}" -DWERROR=ON -DBUILD_TESTS=ON
- name: build
run: cmake --build build --config Release --parallel 3 --verbose
- name: installer
run: |
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\FLAC.dll bin\Release\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\ogg.dll bin\Release\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\opus.dll bin\Release\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\vorbis.dll bin\Release\
copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\soxr.dll bin\Release\
copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\v142\vc_redist.x64.exe" bin\Release\
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: snapcast_win64-${{ github.sha }}
path: |
bin\Release\snapclient.exe
bin\Release\FLAC.dll
bin\Release\ogg.dll
bin\Release\opus.dll
bin\Release\vorbis.dll
bin\Release\soxr.dll
bin\Release\vc_redist.x64.exe

2
.gitignore vendored
View file

@ -66,3 +66,5 @@ compile_commands.json
notes.txt notes.txt
sanitizer-suppressions.txt sanitizer-suppressions.txt
snapserver.conf snapserver.conf
extras/package/debian/snap*.debhelper.log

View file

View file

@ -0,0 +1,3 @@
Placeholder for changelog
Content should be created with `changelog_md2deb.py`

View file

@ -0,0 +1,37 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of snapos
# Copyright (C) 2022 Johannes Pohl
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import re
if __name__ == "__main__":
if len(sys.argv) != 2:
print(f"Usage: changelog_md2deb.py <changelog.md file>")
sys.exit(1)
with open(sys.argv[1], 'r') as file:
data = file.read()
data = re.sub('^\s*# Snapcast changelog *\n*', '', data, flags=re.MULTILINE)
data = re.sub('^\s*### ([a-zA-Z]+) *\n', r'\n * \1\n', data, flags=re.MULTILINE)
data = re.sub('^\s*## Version\s+(\S*) *\n', r'snapcast (\1-1) unstable; urgency=medium\n', data, flags=re.MULTILINE)
data = re.sub('^\s*-\s*(.*) *\n', r' -\1\n', data, flags=re.MULTILINE)
data = re.sub('^_(.*)_ *\n', r' -- \1\n\n', data, flags=re.MULTILINE)
print(data)

View file

@ -0,0 +1 @@
10

View file

@ -0,0 +1,45 @@
Source: snapcast
Section: sound
Priority: optional
Maintainer: Johannes Pohl <snapcast@badaix.de>
Build-Depends: debhelper (>= 10~),
libasound2-dev,
libpulse-dev,
libvorbis-dev,
libflac-dev,
libopus-dev,
libavahi-client-dev,
libasio-dev,
libsoxr-dev
Standards-Version: 4.1.4
Homepage: https://github.com/badaix/snapcast
Vcs-Git: https://salsa.debian.org/debian/snapcast.git
Vcs-Browser: https://salsa.debian.org/debian/snapcast
Package: snapclient
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
Recommends: avahi-daemon
Description: Snapcast client
Snapcast is a multiroom client-server audio player, where all clients are
time synchronized with the server to play perfectly synced audio. It's not a
standalone player, but an extension that turns your existing audio player into
a Sonos-like multiroom solution.
.
This package contains the client which connects to the server and plays the
audio.
Package: snapserver
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
Recommends: avahi-daemon
Description: Snapcast server
Snapcast is a multiroom client-server audio player, where all clients are
time synchronized with the server to play perfectly synced audio. It's not a
standalone player, but an extension that turns your existing audio player into
a Sonos-like multiroom solution.
.
The server's audio input is a named pipe `/tmp/snapfifo`. All data that is fed
into this file will be send to the connected clients. One of the most generic
ways to use Snapcast is in conjunction with the music player daemon or Mopidy,
which can be configured to use a named pipe as audio output.

View file

@ -0,0 +1,109 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Snapcast
Upstream-Contact: Johannes Pohl <snapcast@badaix.de>
Source: https://github.com/badaix/snapcast
Files: *
Copyright: 2014-2021 Johannes Pohl
License: GPL-3+
Files: client/browseZeroConf/browseAvahi.cpp
server/publishZeroConf/publishAvahi.cpp
Copyright: avahi developers
License: LGPL-2.1+
Files: server/streamreader/base64.*
Copyright: 2004-2008 René Nyffenegger
License: Zlib
Files: common/json.hpp
Copyright: 2013-2021 Niels Lohmann
2009 Florian Loitsch
License: Expat
Files: common/aixlog.hpp
common/popl.hpp
server/jsonrpcpp.hpp
Copyright: 2015-2019 Johannes Pohl
License: Expat
Files: debian/*
Copyright: 2018 Felix Geyer
2014-2018 Johannes Pohl
License: GPL-3+
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-3'.
License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public
License along with This program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
License: Zlib
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
.
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
.
3. This notice may not be removed or altered from any source distribution.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
extras/package/debian/rules Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/make -f
include /usr/share/dpkg/buildflags.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_OPTIONS = noautodbgsym parallel=3
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export DEB_CPPFLAGS_MAINT_APPEND = -DJSON_HAS_CPP_14
%:
dh $@ --buildsystem=cmake --builddirectory=build
override_dh_auto_configure:
dh_auto_configure -- $(CMAKEFLAGS)

View file

@ -0,0 +1,7 @@
# Start the client, used only by the init.d script
START_SNAPCLIENT=true
# Additional command line options that will be passed to snapclient
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapclient --help"
SNAPCLIENT_OPTS=""

View file

@ -0,0 +1,162 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: snapclient
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Snapclient initscript
# Description: Snapclient - Snapcast client
### END INIT INFO
# Author: Johannes Pohl <snapcast@badaix.de>
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Snapcast client"
NAME=snapclient
USERNAME=snapclient
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME/pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
SNAPCLIENT_OPTS="--daemon --logsink=system --user $USERNAME:$USERNAME $SNAPCLIENT_OPTS"
if [ "$START_SNAPCLIENT" != "true" ] ; then
exit 0
fi
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
PIDDIR=$(dirname "$PIDFILE")
if [ ! -d "$PIDDIR" ]; then
mkdir -m 0755 $PIDDIR
chown $USERNAME:$USERNAME $PIDDIR
fi
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" --test > /dev/null || return 1
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" -- $SNAPCLIENT_OPTS > /dev/null || return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,2 @@
usr/bin/snapclient usr/bin/
usr/share/pixmaps/snapcast.svg usr/share/pixmaps/

View file

@ -0,0 +1 @@
client/snapclient.1

View file

@ -0,0 +1,20 @@
#!/bin/sh
set -e
USERNAME=snapclient
HOMEDIR=/var/lib/snapclient
if [ "$1" = configure ]; then
if ! getent passwd $USERNAME >/dev/null; then
adduser --system --quiet --group --home $HOMEDIR --no-create-home --force-badname $USERNAME
adduser $USERNAME audio
fi
if [ ! -d $HOMEDIR ]; then
mkdir -m 0750 $HOMEDIR
chown $USERNAME:$USERNAME $HOMEDIR
fi
fi
#DEBHELPER#

View file

@ -0,0 +1,18 @@
#!/bin/sh
set -e
#DEBHELPER#
USERNAME=snapclient
HOMEDIR=/var/lib/snapclient
if [ "$1" = "purge" ]; then
rm -r $HOMEDIR
if [ -x "$(command -v deluser)" ]; then
deluser --quiet --system $USERNAME > /dev/null || true
else
echo >&2 "not removing $USERNAME system account because deluser command was not found"
fi
fi

View file

@ -0,0 +1,15 @@
[Unit]
Description=Snapcast client
Documentation=man:snapclient(1)
Wants=avahi-daemon.service
After=network-online.target time-sync.target sound.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/default/snapclient
ExecStart=/usr/bin/snapclient --logsink=system $SNAPCLIENT_OPTS
User=snapclient
Group=snapclient
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
# Start the server, used only by the init.d script
START_SNAPSERVER=true
# Additional command line options that will be passed to snapserver
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapserver --help"
SNAPSERVER_OPTS=""

View file

@ -0,0 +1,2 @@
README.md
doc/player_setup.md

View file

@ -0,0 +1,162 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: snapserver
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Snapserver initscript
# Description: Snapserver - Snapcast server
### END INIT INFO
# Author: Johannes Pohl <snapcast@badaix.de>
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Snapcast server"
NAME=snapserver
USERNAME=snapserver
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME/pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
SNAPSERVER_OPTS="--daemon --logging.sink=system --server.datadir=$USERNAME $SNAPSERVER_OPTS"
if [ "$START_SNAPSERVER" != "true" ] ; then
exit 0
fi
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
PIDDIR=$(dirname "$PIDFILE")
if [ ! -d "$PIDDIR" ]; then
mkdir -m 0755 $PIDDIR
chown $USERNAME:$USERNAME $PIDDIR
fi
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" --test > /dev/null || return 1
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --exec "$DAEMON" -- $SNAPSERVER_OPTS || return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,3 @@
usr/bin/snapserver usr/bin/
usr/share/snapserver usr/share/
etc/snapserver.conf etc/

View file

@ -0,0 +1 @@
server/snapserver.1

View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
USERNAME=snapserver
HOMEDIR=/var/lib/snapserver
if [ "$1" = configure ]; then
if ! getent passwd $USERNAME >/dev/null; then
adduser --system --quiet --group --home $HOMEDIR --no-create-home --force-badname $USERNAME
# adduser $USERNAME audio
fi
adduser --quiet $USERNAME audio > /dev/null || true
if [ ! -d $HOMEDIR ]; then
mkdir -m 0750 $HOMEDIR
chown $USERNAME:$USERNAME $HOMEDIR
fi
fi
#DEBHELPER#

View file

@ -0,0 +1,18 @@
#!/bin/sh
set -e
#DEBHELPER#
USERNAME=snapserver
HOMEDIR=/var/lib/snapserver
if [ "$1" = "purge" ]; then
rm -rf $HOMEDIR
if [ -x "$(command -v deluser)" ]; then
deluser --quiet --system $USERNAME > /dev/null || true
else
echo >&2 "not removing $USERNAME system account because deluser command was not found"
fi
fi

View file

@ -0,0 +1,15 @@
[Unit]
Description=Snapcast server
Documentation=man:snapserver(1)
Wants=avahi-daemon.service
After=network-online.target time-sync.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/default/snapserver
ExecStart=/usr/bin/snapserver --logging.sink=system --server.datadir=${HOME} $SNAPSERVER_OPTS
User=snapserver
Group=snapserver
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1 @@
3.0 (quilt)

View file

@ -0,0 +1,2 @@
unapply-patches
abort-on-upstream-changes

View file

@ -0,0 +1,6 @@
install:
echo macOS
install -s -g wheel -o root $(BIN) $(TARGET_DIR)/local/bin/$(BIN)
install -g wheel -o root $(BIN).1 $(TARGET_DIR)/local/share/man/man1/$(BIN).1
install -g wheel -o root etc/$(BIN).plist /Library/LaunchAgents/de.badaix.snapcast.$(BIN).plist
launchctl load /Library/LaunchAgents/de.badaix.snapcast.$(BIN).plist

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>de.badaix.snapcast.snapclient</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/snapclient</string>
<string>--logsink=system</string>
<!-- <string>-d</string> -->
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,49 @@
-------------------------------------------------------------------
Thu Dec 23 01:33:18 UTC 2021 - abdullah mardini <superppl@gmail.com>
- Remove memory patch, as it has been fixed upstream
-------------------------------------------------------------------
Wed Dec 22 23:52:29 UTC 2021 - abdullah mardini <superppl@gmail.com>
- Updated to v0.26
-------------------------------------------------------------------
Sat Feb 27 20:30:25 UTC 2021 - abdullah mardini <superppl@gmail.com>
- Updated to v0.24
-------------------------------------------------------------------
Wed Jan 13 00:46:04 UTC 2021 - abdullah mardini <superppl@gmail.com>
- Added libpulse-devel to the list of requirements.
-------------------------------------------------------------------
Wed Jan 13 00:38:57 UTC 2021 - abdullah mardini <superppl@gmail.com>
- Updated to v0.23
-------------------------------------------------------------------
Thu Oct 15 18:08:09 UTC 2020 - abdullah mardini <superppl@gmail.com>
- Updated to v.022
-------------------------------------------------------------------
Sun Sep 13 23:17:27 UTC 2020 - abdullah mardini <superppl@gmail.com>
updated to v0.21.-
-------------------------------------------------------------------
Thu Aug 6 18:28:03 UTC 2020 - abdullah mardini <superppl@gmail.com>
Updated .spec to require Boost >= 1.70 - the minimum version required for it compile. Have also added the devel:libraries:c_c++ repo for Leap 15.2 - this will be required for snapcast to run. -
-------------------------------------------------------------------
Wed Aug 5 16:58:47 UTC 2020 - abdullah mardini <superppl@gmail.com>
Created branch, for sole purpose of having less repo's. Updated to v0.20.0.-
-------------------------------------------------------------------
Mon Dec 2 11:48:16 UTC 2019 - Claes Holmerson <opensuse.org@claes.holmerson.net>
Initial packaging version
-

View file

@ -0,0 +1,167 @@
Name: snapcast
Release: 1
License: GPL-3.0
Group: Productivity/Multimedia/Sound/Players
Summary: Snapcast is a multi-room time-synced client-server audio player
Url: https://github.com/badaix/snapcast
Source0: snapcast.tar.gz
Source1: snapserver.service
Source2: snapserver.default
Source3: snapclient.service
Source4: snapclient.default
BuildRequires: alsa-lib-devel
BuildRequires: pulseaudio-libs-devel
BuildRequires: avahi-devel
BuildRequires: libvorbis-devel
BuildRequires: flac-devel
BuildRequires: gcc-c++
BuildRequires: boost-devel >= 1.74
BuildRequires: opus-devel
BuildRequires: soxr-devel
BuildRequires: zlib-devel
#Requires(post): %fillup_prereq
Requires(pre): pwdutils
BuildRequires: systemd
#%if 0%{?suse_version} >= 1210
BuildRequires: systemd-rpm-macros
#%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{!?_reversion: %define _reversion "" }
%{!?_version: %define _version "0.0.0" }
Version: %{_version}
%description
Snapcast is a multi-room client-server audio player, where all clients are time synchronized with the server to play perfectly synced audio. It is not a standalone player, but an extension that turns your existing audio player into a Sonos-like multi-room solution. The server's audio input is a named pipe /tmp/snapfifo. All data that is fed into this file will be send to the connected clients. One of the most generic ways to use Snapcast is in conjunction with the music player daemon (MPD) or Mopidy, which can be configured to use a named pipe as audio output.
%package -n snapserver
Summary: Snapcast server
%description -n snapserver
Snapcast is a multi-room client-server audio player, where all clients are
time synchronized with the server to play perfectly synced audio. It's not a
standalone player, but an extension that turns your existing audio player into
a Sonos-like multi-room solution. The server's audio input is a named
pipe `/tmp/snapfifo`. All data that is fed into this file will be send to
the connected clients. One of the most generic ways to use Snapcast is in
conjunction with the music player daemon, MPD, or Mopidy, which can be configured
to use a named pipe as audio output.
This package contains the server to which clients connect.
%package -n snapclient
Summary: Snapcast client
%description -n snapclient
Snapcast is a multi-room client-server audio player, where all clients are
time synchronized with the server to play perfectly synced audio. It's not a
standalone player, but an extension that turns your existing audio player into
a Sonos-like multi-room solution.
This package contains the client which connects to the server and plays the audio.
%prep
%setup -q -n %{name}
%build
%cmake -DWERROR=ON -DBUILD_TESTS=OFF -DREVISION=%{_reversion}
%cmake_build --parallel 2
%install
%cmake_install
chmod 755 %{buildroot}%{_datadir}/snapserver/plug-ins/meta_mpd.py
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/snapclient.service
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/snapserver.service
install -D -m 0644 %{SOURCE4} %{buildroot}/etc/default/snapserver.default
install -D -m 0644 %{SOURCE2} %{buildroot}/etc/default/snapclient.default
#install -D -m 0644 snapserver.service $RPM_BUILD_ROOT/usr/lib/systemd/system/snapserver.service
#install -D -m 0644 snapclient.service $RPM_BUILD_ROOT/usr/lib/systemd/system/snapclient.service
#install -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}
#install -m 644 %{SOURCE4} %{buildroot}%{_fillupdir}
%pre -n snapclient
getent passwd snapclient >/dev/null || %{_sbindir}/useradd --user-group --system --groups audio snapclient
%if 0%{?suse_version}
%service_add_pre snapclient.service
%endif
%pre -n snapserver
mkdir -p %{_sharedstatedir}/snapserver
getent passwd snapserver >/dev/null || %{_sbindir}/useradd --user-group --system --home-dir %{_sharedstatedir}/snapserver snapserver
chown snapserver %{_sharedstatedir}/snapserver
chgrp snapserver %{_sharedstatedir}/snapserver
%if 0%{?suse_version}
%service_add_pre snapserver.service
%endif
%post -n snapclient
#%{fillup_only -n snapclient snapclient}
#%service_add_post snapclient.service
%if 0%{?suse_version}
%service_add_post snapclient.service
%else
%systemd_post snapclient.service
%endif
%post -n snapserver
#%{fillup_only -n snapserver snapserver}
#%service_add_post snapserver.service
%if 0%{?suse_version}
%service_add_post snapserver.service
%else
%systemd_post snapserver.service
%endif
%preun -n snapclient
%if 0%{?suse_version}
%service_del_preun snapclient.service
%else
%systemd_preun snapclient.service
%endif
%preun -n snapserver
%if 0%{?suse_version}
%service_del_preun snapserver.service
%else
%systemd_preun snapserver.service
%endif
%postun -n snapclient
%if 0%{?suse_version}
%service_del_postun snapclient.service
%else
%systemd_postun_with_restart snapclient.service
%endif
if [ $1 -eq 0 ]; then
userdel --force snapclient 2> /dev/null; true
fi
%postun -n snapserver
%if 0%{?suse_version}
%service_del_postun snapserver.service
%else
%systemd_postun_with_restart snapserver.service
%endif
#%files
#%license LICENSE
#%doc README.md TODO.md doc/*
%files -n snapserver
%{_bindir}/snapserver
#%{_mandir}/man1/snapserver.1.*
%{_datadir}
%config(noreplace) /usr/etc/snapserver.conf
%config(noreplace) /etc/default/snapserver.default
%{_unitdir}/snapserver.service
#%{_fillupdir}/sysconfig.snapserver
%files -n snapclient
%{_bindir}/snapclient
%{_mandir}/man1/snapclient.1.*
%config(noreplace) /etc/default/snapclient.default
%{_unitdir}/snapclient.service
#%{_fillupdir}/sysconfig.snapclient
%changelog

View file

@ -0,0 +1,7 @@
# Start the client, used only by the init.d script
START_SNAPCLIENT=true
# Additional command line options that will be passed to snapclient
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapclient --help"
SNAPCLIENT_OPTS=""

View file

@ -0,0 +1,15 @@
[Unit]
Description=Snapcast client
Documentation=man:snapclient(1)
Wants=avahi-daemon.service
After=network-online.target time-sync.target sound.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/default/snapclient
ExecStart=/usr/bin/snapclient --logsink=system $SNAPCLIENT_OPTS
User=snapclient
Group=snapclient
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,7 @@
# Start the server, used only by the init.d script
START_SNAPSERVER=true
# Additional command line options that will be passed to snapserver
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapserver --help"
SNAPSERVER_OPTS=""

View file

@ -0,0 +1,15 @@
[Unit]
Description=Snapcast server
Documentation=man:snapserver(1)
Wants=avahi-daemon.service
After=network-online.target time-sync.target avahi-daemon.service
[Service]
EnvironmentFile=-/etc/default/snapserver
ExecStart=/usr/bin/snapserver --logging.sink=system --server.datadir=${HOME} $SNAPSERVER_OPTS
User=snapserver
Group=snapserver
Restart=on-failure
[Install]
WantedBy=multi-user.target