Clone the Snapcast repository. To do this, you need git.
For Debian derivates (e.g. Raspberry Pi OS, Debian, Ubuntu, Mint):
sudo apt-get install gitFor Arch derivates:
sudo pacman -S gitFor FreeBSD:
sudo pkg install gitClone Snapcast:
git clone https://github.com/badaix/snapcast.gitSnapcast depends on boost 1.70 or higher. Since it depends on header only boost libs, boost does not need to be installed, but the boost include path must be set properly: download and extract the latest boost version and add the include path, e.g. calling make with prepended ADD_CFLAGS: ADD_CFLAGS="-I/path/to/boost_1_7x_0/" make.
For cmake you must add the path to the -DBOOST_ROOT flag: cmake -DBOOST_ROOT=/path/to/boost_1_7x_0
Install the build tools and required libs:
For Debian derivates (e.g. Raspberry Pi OS, Debian, Ubuntu, Mint):
sudo apt-get install build-essential
sudo apt-get install libasound2-dev libpulse-dev libvorbisidec-dev libvorbis-dev libopus-dev libflac-dev libsoxr-dev alsa-utils libavahi-client-dev avahi-daemon libexpat1-devCompilation requires gcc 4.8 or higher, so it's highly recommended to use Debian (Raspbian) Jessie.
For Arch derivates:
sudo pacman -S base-devel
sudo pacman -S alsa-lib avahi libvorbis opus-dev flac libsoxr alsa-utils boost expatFor Fedora (and probably RHEL, CentOS, & Scientific Linux, but untested):
sudo dnf install @development-tools
sudo dnf install alsa-lib-devel avahi-devel gcc-c++ libatomic libvorbis-devel opus-devel pulseaudio-libs-devel flac-devel soxr-devel libstdc++-static expat-devel boost-develcd into the Snapcast src-root directory:
cd <snapcast dir>
makeInstall Snapclient and/or Snapserver:
sudo make installserver
sudo make installclientThis will copy the client and/or server binary to /usr/bin and update init.d/systemd to start the client/server as a daemon.
cd into the Snapclient src-root directory:
cd <snapcast dir>/client
makeInstall Snapclient
sudo make installThis will copy the client binary to /usr/bin and update init.d/systemd to start the client as a daemon.
cd into the Snapserver src-root directory:
cd <snapcast dir>/server
makeInstall Snapserver
sudo make installThis will copy the server binary to /usr/bin and update init.d/systemd to start the server as a daemon.
Debian packages can be made with
sudo apt-get install debhelper
cd <snapcast dir>
fakeroot make -f debian/rules binaryIf you don't have boost installed or in your standard include paths, you can call
fakeroot make -f debian/rules CPPFLAGS="-I/path/to/boost_1_7x_0" binaryInstall the build tools and required libs:
sudo pkg install alsa-lib pulseaudio gmake gcc bash avahi libogg libvorbis opus flac libsoxrcd into the Snapserver src-root directory:
cd <snapcast dir>/server
gmake TARGET=FREEBSDInstall Snapserver
sudo gmake TARGET=FREEBSD installThis will copy the server binary to /usr/local/bin and the startup script to /usr/local/etc/rc.d/snapserver. To enable the Snapserver, add this line to /etc/rc.conf:
snapserver_enable="YES"For additional command line arguments, add in /etc/rc.conf:
snapserver_opts="<your custom options>"Start and stop the server with sudo service snapserver start and sudo service snapserver stop.
Snapcast is available under Gentoo's Portage package management system. Portage utilises USE flags to determine what components are built on compilation. The available options are...
equery u snapcast
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for media-sound/snapcast-9999:
U I
+ - avahi : Build with avahi support
+ + client : Build and install Snapcast client component
+ - flac : Build with FLAC compression support
+ + server : Build and install Snapcast server component
- - static-libs : Build static libs
- - tremor : Build with TREMOR version of vorbis
+ - vorbis : Build with libvorbis supportThese can be set either in the global configuration file /etc/portage/make.conf or on a per-package basis (as root):
if [ ! -d "$DIRECTORY" ]; then
mkdir /etc/portage/package.use/media-sound
fi
echo 'media-sound/snapcast client server flacIf for example you only wish to build the server and not the client then precede the server USE flag with - i.e.
echo 'media-sound/snapcast client -serverOnce USE flags are configured emerge snapcast as root:
emerge -av snapcastStarting the client or server depends on whether you are using systemd or openrc. To start using openrc:
/etc/init.d/snapclient start
/etc/init.d/snapserver startTo enable the serve and client to start under the default run-level:
rc-update add snapserver default
rc-update add snapclient defaultWarning: macOS support is experimental
- Install Xcode from the App Store
- Install Homebrew
- Install the required libs
brew install flac libsoxr libvorbis boost opus
cd into the Snapclient src-root directory:
cd <snapcast dir>/client
make TARGET=MACOSInstall Snapclient
sudo make install TARGET=MACOSThis will copy the client binary to /usr/local/bin and create a Launch Agent to start the client as a daemon.
cd into the Snapserver src-root directory:
cd <snapcast dir>/server
make TARGET=MACOSInstall Snapserver
sudo make install TARGET=MACOSThis will copy the server binary to /usr/local/bin and create a Launch Agent to start the server as a daemon.
Clone Snapdroid, which includes Snapclient as submodule:
git clone https://github.com/badaix/snapdroid.git
cd snapdroid
git submodule update --init --recursiveand execute ./gradlew build, which will cross compile Snapclient and bundle it into the Snapdroid App.
To cross compile for OpenWrt, please follow the OpenWrt flavored SnapOS guide
To integrate Snapcast into Buildroot, please follow the Buildroot flavored SnapOS guide
Prerequisites:
- CMake
- Visual Studio 2017 or 2019 with C++
Set up vcpkg
Install dependencies
vcpkg.exe install libflac libvorbis soxr opus boost-asio --triplet x64-windowsBuild
cd <snapcast dir>
mkdir build
cd build && cmake .. -DCMAKE_TOOLCHAIN_FILE=<vcpkg_dir>/scripts/buildsystems/vcpkg.cmake
cmake --build . --config Release