--- /dev/null
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+# updated to work with latest source from abrasive
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=shairport-sync
+PKG_VERSION:=2.1.15
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=git://github.com/mikebrady/shairport-sync.git
+PKG_SOURCE_VERSION:=$(PKG_VERSION)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=COPYING LICENSES shairport.c
+
+PKG_BUILD_PARALLEL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS+= \
+ --with-alsa \
+ --with-avahi \
+ --with-soxr \
+ --with-ssl=openssl
+
+
+define Package/shairport-sync
+ SECTION:=sound
+ CATEGORY:=Sound
+ TITLE:=iPhone/iTunes compatible audio player
+ DEPENDS:= +libpthread +libopenssl +libavahi-client +alsa-lib +libdaemon +libsoxr +libpopt
+ MAINTAINER:=Mike Brady <mikebrady@eircom.net>
+endef
+
+define Package/shairport-sync/description
+ Shairport Sync is server software that implements the Apple-originated RAOP protocol for
+ playback of audio from a compatible remote client such as the iPhone, iTunes, Apple TV, Quicktime Player or forked-daapd.
+ Shairport Sync implements audio synchronisation, supporting multi-room use.
+ Shairport Sync supports audio only.
+endef
+
+define Package/shairport-sync/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport-sync $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/shairport-sync.init $(1)/etc/init.d/shairport-sync
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DATA) ./files/shairport-sync.config $(1)/etc/config/shairport-sync
+endef
+
+$(eval $(call BuildPackage,shairport-sync))
--- /dev/null
+# Uncomment the stanza you want, and make sure to comment out the others, especially duplicate options.
+
+#Arguments and defaults are as follows
+config shairport-sync main
+# option name 'Shairport Sync' #default name, "Shairport Sync on %d"
+# option device default #default soundcard, volume control by software
+ #(Troubleshooting hint: make sure the soundcard's volume is turned up fully -- use alsamixer or amixer)
+# option airplaylatency 88200
+# option ituneslatency 99400
+# option port 5000
+# option stuffing basic #options are 'basic' or 'soxr' if shairport-sync was compiled with soxr support
+# option awaitactioncompletion false #[don't] wait until beforeaction or afteraction completes
+# option beforeaction <action> #action must be a fully qualified program with no arguments. Default no action.
+# option afteraction <action> #action must be a fully qualified program with no arguments. Default no action.
+# option devicetype <devicetype>
+# option volumecontrolname <name>
+
+#Here are some sample stanzas:
+
+#For Raspberry Pi using the built-in soundcard for the headphone jack
+# option device 'hw:0'
+# option devicetype hardware
+# option volumecontrolname Master
+
+#For Raspberry Pi with the "3D Sound" USB Soundcard
+# option name 'Pi'
+# option device 'hw:1'
+# option devicetype hardware
+# option volumecontrolname Speaker
+
+#For Raspberry Pi with the first generation iMic or the Topping TP30 Class T Digital Mini Amplifier
+# option name 'Kitchen'
+# option device 'hw:1'
+# option devicetype hardware
+# option volumecontrolname PCM
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+NAME='shairport-sync'
+START=99
+
+USE_PROCD=1
+
+append_arg() {
+ local cfg="$1"
+ local var="$2"
+ local opt="$3"
+ local def="$4"
+ local val
+
+ config_get val "$cfg" "$var"
+ [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
+}
+
+append_bool() {
+ local cfg="$1"
+ local var="$2"
+ local opt="$3"
+ local def="$4"
+ local val
+
+ config_get_bool val "$cfg" "$var" "$def"
+ [ "$val" = 1 ] && procd_append_param command "$opt"
+}
+
+start_shairport_service() {
+ local cfg=$1
+ local stuffing
+ local device
+
+ procd_open_instance
+
+ procd_set_param command /usr/bin/$NAME
+
+ append_arg "$cfg" name "-a"
+ append_arg "$cfg" port "-p"
+ append_arg "$cfg" airplaylatency "-A"
+ append_arg "$cfg" ituneslatency "-i"
+
+ config_get stuffing "$cfg" stuffing ""
+
+ if [ -n "$stuffing" ] ; then
+ case "x$stuffing" in
+ ( "xbasic" ) procd_append_param command -S basic ;;
+ ( "xsoxr" ) procd_append_param command -S soxr ;;
+ ( * ) logger "bad argument for -S option -- should be \"basic\" or \"soxr\"" ;;
+ esac
+ fi
+
+ append_arg "$cfg" beforeaction "-B"
+ append_arg "$cfg" afteraction "-E"
+ append_bool "$cfg" awaitactioncompletion "-w"
+
+ config_get device "$cfg" device ""
+ if [ -n "$device" ] ; then
+ procd_append_param command "--"
+ append_arg "$cfg" device "-d"
+ append_arg "$cfg" devicetype "-t"
+ append_arg "$cfg" volumecontrolname "-c"
+ fi
+
+ procd_close_instance
+}
+
+service_triggers() {
+ procd_add_reload_trigger $NAME
+}
+
+start_service() {
+ config_load $NAME
+ # Just a single instance
+ start_shairport_service "main"
+}