mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-06 10:09:33 +02:00
Merge pull request #164 from nickaknudson/feature/buildroot
added client compilation support for TARGET=BUILDROOT
This commit is contained in:
commit
98be8a58d9
9 changed files with 112 additions and 0 deletions
|
@ -35,6 +35,7 @@ Please follow this [guide](doc/build.md) to build Snapcast for
|
|||
* [macOS](doc/build.md#macos-native)
|
||||
* [Android](doc/build.md#android-cross-compile)
|
||||
* [OpenWrt](doc/build.md#openwrt-cross-compile)
|
||||
* [Buildroot](doc/build.md#buildroot-cross-compile)
|
||||
|
||||
###Install debian packages
|
||||
Download the debian package for your CPU architecture from the [latest release page](https://github.com/badaix/snapcast/releases/latest), e.g. for Raspberry pi `snapclient_0.x.x_armhf.deb`
|
||||
|
|
1
buildroot/Config.in
Normal file
1
buildroot/Config.in
Normal file
|
@ -0,0 +1 @@
|
|||
source "$BR2_EXTERNAL_SNAPCAST_PATH/package/snapcast/Config.in"
|
1
buildroot/external.desc
Normal file
1
buildroot/external.desc
Normal file
|
@ -0,0 +1 @@
|
|||
name: SNAPCAST
|
1
buildroot/external.mk
Normal file
1
buildroot/external.mk
Normal file
|
@ -0,0 +1 @@
|
|||
include $(sort $(wildcard $(BR2_EXTERNAL_SNAPCAST_PATH)/package/*/*.mk))
|
4
buildroot/package/snapcast/Config.in
Normal file
4
buildroot/package/snapcast/Config.in
Normal file
|
@ -0,0 +1,4 @@
|
|||
config BR2_PACKAGE_SNAPCAST
|
||||
bool "snapcast"
|
||||
help
|
||||
Synchronous multi-room audio player
|
35
buildroot/package/snapcast/S99snapclient
Normal file
35
buildroot/package/snapcast/S99snapclient
Normal file
|
@ -0,0 +1,35 @@
|
|||
#! /bin/sh
|
||||
|
||||
start() {
|
||||
echo -n "Starting snapclient: "
|
||||
start-stop-daemon -S -q -b -x snapclient
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping snapclient: "
|
||||
start-stop-daemon -K -q -x snapclient
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
32
buildroot/package/snapcast/snapcast.mk
Normal file
32
buildroot/package/snapcast/snapcast.mk
Normal file
|
@ -0,0 +1,32 @@
|
|||
################################################################################
|
||||
#
|
||||
# snapcast
|
||||
#
|
||||
################################################################################
|
||||
|
||||
SNAPCAST_VERSION = master
|
||||
SNAPCAST_SITE = https://github.com/badaix/snapcast
|
||||
SNAPCAST_SITE_METHOD = git
|
||||
SNAPCAST_DEPENDENCIES = libogg alsa-lib # libstdcpp libavahi-client libatomic libflac libvorbisidec
|
||||
SNAPCAST_LICENSE = GPLv3
|
||||
SNAPCAST_LICENSE_FILES = COPYING
|
||||
|
||||
# http://lists.busybox.net/pipermail/buildroot/2013-March/069811.html
|
||||
define SNAPCAST_EXTRACT_CMDS
|
||||
rm -rf $(@D)
|
||||
(git clone --depth 1 $(SNAPCAST_SITE) $(@D) && \
|
||||
cd $(@D)/externals && \
|
||||
git submodule update --init --recursive)
|
||||
touch $(@D)/.stamp_downloaded
|
||||
endef
|
||||
|
||||
define SNAPCAST_BUILD_CMDS
|
||||
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/client TARGET=BUILDROOT
|
||||
endef
|
||||
|
||||
define SNAPCAST_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -m 0755 -D $(@D)/client/snapclient $(TARGET_DIR)/usr/sbin/snapclient
|
||||
$(INSTALL) -m 0755 -D $(SNAPCAST_PKGDIR)/S99snapclient $(TARGET_DIR)/etc/init.d/S99snapclient
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
|
@ -36,6 +36,12 @@ CXXFLAGS += -pthread -DNO_CPP11_STRING -DHAS_TREMOR -DHAS_ALSA -DHAS_AVAHI -DHAS
|
|||
LDFLAGS = -lasound -lvorbisidec -logg -lFLAC -lavahi-client -lavahi-common -latomic
|
||||
OBJ += player/alsaPlayer.o browseZeroConf/browseAvahi.o
|
||||
|
||||
else ifeq ($(TARGET), BUILDROOT)
|
||||
|
||||
CXXFLAGS += -pthread -DNO_CPP11_STRING -DHAS_TREMOR -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
LDFLAGS += -lasound -lvorbisidec -logg -lFLAC -lavahi-client -lavahi-common -latomic
|
||||
OBJ += player/alsaPlayer.o browseZeroConf/browseAvahi.o
|
||||
|
||||
else ifeq ($(TARGET), MACOS)
|
||||
|
||||
CXX = /usr/bin/g++
|
||||
|
|
31
doc/build.md
31
doc/build.md
|
@ -200,3 +200,34 @@ Build Snapcast:
|
|||
$ make package/sxx/snapcast/compile
|
||||
|
||||
The packaged `ipk` files are in `<buildroot dir>/bin/ar71xx/packages/base/snap[client|server]_x.x.x_ar71xx.ipk`
|
||||
|
||||
##Buildroot (Cross compile)
|
||||
This example will show you how to add snapcast to [Buildroot](https://buildroot.org/).
|
||||
|
||||
###Buildroot setup
|
||||
Buildroot recommends [keeping customizations outside of the main Buildroot directory](https://buildroot.org/downloads/manual/manual.html#outside-br-custom) which is what this example will walk through.
|
||||
|
||||
Clone Buildroot to some place in your home directory (`<buildroot dir>`):
|
||||
|
||||
$ git clone --branch BUILDROOT_VERSION --depth=1 git://git.buildroot.net/buildroot
|
||||
|
||||
The `<snapcast dir>/buildroot` is currently setup as an external Buildroot folder following the [recommended structure](https://buildroot.org/downloads/manual/manual.html#customize-dir-structure). As of [Buildroot 2016.11](https://git.buildroot.net/buildroot/tag/?h=2016.11) you may specify multiple BR2_EXTERNAL trees. If you are using a version of Buildroot prior to this, then you will need to manually merge `<snapcast dir>/buildroot` with your existing Buildroot external tree.
|
||||
|
||||
Now add the following packages to your Buildroot `.config` file:
|
||||
|
||||
BR2_PACKAGE_FLAC=y
|
||||
BR2_PACKAGE_LIBOGG=y
|
||||
BR2_PACKAGE_TREMOR=y
|
||||
BR2_PACKAGE_SNAPCAST=y
|
||||
|
||||
Or use `menuconfig` to add them graphically:
|
||||
|
||||
$ cd <buildroot dir> && make BR2_EXTERNAL=<snapcast dir>/buildroot menuconfig
|
||||
|
||||
Or if you have another Buildroot external tree (`<buildroot external dir>`):
|
||||
|
||||
$ cd <buildroot dir> && make BR2_EXTERNAL=<snapcast dir>/buildroot:<buildroot external dir> menuconfig
|
||||
|
||||
And finally run the build:
|
||||
|
||||
$ cd <buildroot dir> && make BR2_EXTERNAL=<snapcast dir>/buildroot:<buildroot external dir>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue