doc/build.md
To do this, you need git.
For Debian derivates (e.g. Raspberry Pi OS, Debian, Ubuntu, Mint):
sudo apt-get install git
For Arch derivates:
sudo pacman -S git
For FreeBSD:
sudo pkg install git
Clone Snapcast:
git clone https://github.com/snapcast/snapcast.git
Snapcast depends on boost 1.74 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 tell cmake the path using the -DBOOST_ROOT flag: cmake -DBOOST_ROOT=/path/to/boost_1_8x_0.
sudo apt-get install build-essential cmake cmake-format ccache ninja-build
sudo apt-get install alsa-utils avahi-daemon libasound2-dev libavahi-client-dev libboost-dev libexpat1-dev libflac-dev libjack-dev libopus-dev libpulse-dev libsoxr-dev libssl-dev libvorbis-dev libvorbisidec-dev
sudo pacman -S base-devel cmake
sudo pacman -S alsa-lib avahi libvorbis opus-dev flac libsoxr alsa-utils boost expat openssl
sudo dnf install @development-tools gcc-c++ libstdc++-static libatomic cmake ccache ninja-build
sudo dnf install alsa-lib-devel avahi-devel boost-devel expat-devel flac-devel libvorbis-devel openssl-devel opus-devel pipewire-jack-audio-connection-kit-devel pulseaudio-libs-devel soxr-devel
sudo pkg install alsa-lib pulseaudio cmake gmake gcc bash avahi libogg libvorbis opus flac libsoxr pkgconfig
Warning: macOS support is experimental
brew install pkgconfig libsoxr expat flac libvorbis boost opus
Create a build directory in the Snapcast src-root directory (<snapcast dir>) and cd into it:
cd <snapcast dir>
mkdir build
cd build
Build Snapcast. If you haven't installed boost, but downloaded and extracted the sources, you must point cmake to the boost root directoty, otherwise the part starting with -DBOOST_ROOT=... can be omitted.
Other flags that can be passed to cmake:
-DBUILD_CLIENT=<ON|OFF>: build the client: yes or no (default ON)-DBUILD_SERVER=<ON|OFF>: build the server: yes or no (default ON)-DBUILD_WITH_SSL=<ON|OFF>: build server and client with TLS support: yes or no (default ON)-DBUILD_WITH_FLAC=<ON|OFF>: build with FLAC support: yes or no (default ON)-DBUILD_WITH_VORBIS=<ON|OFF>: build with VORBIS support: yes or no (default ON)-DBUILD_WITH_TREMOR=<ON|OFF>: build with vorbis using TREMOR: yes or no (default ON)-DBUILD_WITH_OPUS=<ON|OFF>: build with OPUS support: yes or no (default ON)-DBUILD_WITH_AVAHI=<ON|OFF>: build with AVAHI support: yes or no (default ON)-DBUILD_WITH_EXPAT=<ON|OFF>: build with EXPAT support: yes or no (default ON)-DBUILD_WITH_PULSE=<ON|OFF>: build client with PulseAudio support: yes or no (default OFF)-DBUILD_WITH_JACK=<ON|OFF>: build with JACK support: yes or no (default OFF)-DBUILD_WITH_PIPEWIRE=<ON|OFF>: build with PipeWire support: yes or no (default OFF)cmake .. -DBOOST_ROOT=/path/to/boost_1_8x_0
cmake --build .
Binaries will be created in <snapcast dir>/bin:
<snapcast dir>/bin/snapclient
<snapcast dir>/bin/snapserver
Prerequisites:
Set up vcpkg
Install dependencies
vcpkg.exe install libflac libvorbis soxr opus boost-asio boost-beast --triplet x64-windows
Build
cd <snapcast dir>
mkdir build
cd build && cmake .. -DCMAKE_TOOLCHAIN_FILE=<vcpkg_dir>/scripts/buildsystems/vcpkg.cmake
cmake --build . --config Release
Debian packages can be made with the following steps. You can switch pulse audio support on or off by passing -DBUILD_WITH_PULSE=ON or OFF in the last step:
sudo apt-get install debhelper python3
cd <snapcast dir>
ln -s extras/package/debian debian
debian/changelog_md2deb.py changelog.md > debian/changelog
fakeroot make -f debian/rules CMAKEFLAGS="-DBOOST_ROOT=/path/to/boost/boost_1_8x_0 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_WITH_PULSE=OFF" binary
The resulting debian packages are created in the parent direcory of <snapcast dir>
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 support
These 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 flac
If 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 -server
Once USE flags are configured emerge snapcast as root:
emerge -av snapcast
Starting 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 start
To enable the serve and client to start under the default run-level:
rc-update add snapserver default
rc-update add snapclient default
Clone Snapdroid, which includes Snapclient as submodule:
git clone https://github.com/snapcast/snapdroid.git
cd snapdroid
git submodule update --init --recursive
and 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
To cross compile Snapcast client for LG webOS TVs, you need the webOS SDK and toolchain.
Install the openlgtv buildroot toolchain
Configure the build for webOS target:
mkdir build
cd build
# Configure with webOS toolchain
cmake .. \
-G Ninja \
-DCMAKE_TOOLCHAIN_FILE=/path/to/openlgtv/toolchain.cmake \
-DBUILD_WITH_SDL2=ON \
-DBUILD_SERVER=OFF \
-DBUILD_CLIENT=ON \
-DBUILD_WITH_ALSA=OFF \
-DBUILD_WITH_PULSE=OFF \
-DBUILD_WITH_PIPEWIRE=OFF
Build the client:
cmake --build -j