User:Anathonous/Tutorials/Shairport-sync

From Gentoo Wiki
Jump to:navigation Jump to:search

Shairport-sync on Gentoo

Installation

There is no shairport-sync package for Gentoo. You will need to build it from source from their git repo. If you have a base install on a Raspberry PI there are a few dependencies you will need to install.

root #emerge --ask media-sound/pulseaudio dev-libs/libconfig net-dns/avahi

You will also want to enable pulseaudio for alsa by creating a package.use for it.

FILE /etc/portage/package.use/shairport-sync
media-plugins/alsa-plugins pulseaudio

You will also need to create a package.accept_keywords IF you are installing on a Raspberry Pi.

FILE /etc/portage/package.accept_keywords/shairport
dev-libs/libconfig ~arm64
root #dispatch-conf

Try again.

root #emerge --ask media-sound/pulseaudio dev-libs/libconfig net-dns/avahi

If everything worked out you should have your dependencies filled for building.


Now download a copy of the repo from github. If you do not have git installed. You will have to as well.

root #emerge --ask dev-vcs/git
user $cd shairport-sync
user $autoreconf -fi
user $./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-libdaemon --with-pa
root #make install

Now that everything is installed you will need to enable mDNS for devices like iPhone etc.

root #rc-update add avahi-daemon default
root #rc-service avahi-daemon start

If you have no firewall everything should work as expected otherwise you will need to open ports.

CODE Firewall
port 5353 tcp
port 5000:5005 tcp
port 6000:6005 udp

You will need to edit your config file to use pulseaudio , change "alsa" to "pa".

FILE /etc/shairport-sync.conf
output_backend = "alsa";
to
output_backend = "pa";

Now you will need to create an rc init script so shairport-sync loads at boot.

FILE /etc/init.d/shairport-sync
#!/sbin/openrc-run

user="shairport-sync"
start_stop_daemon_args="--user $user"
command="/usr/local/bin/shairport-sync"

command_background=yes
pidfile=/run/shairport-sync.pid

depend() {
    need localmount avahi-daemon
    after bootmisc net*
}

stop() {
    ebegin "Stopping Shairport-sync"
    start-stop-daemon --stop --quiet \
        --exec /usr/local/bin/shairport-sync
    eend $?
}

Change user="shairport-sync" to your username. user="username".

Make it executable.

root #chmod +x /etc/init.d/shairport-sync

Now enable and start the service.

root #rc-update add shairport-sync default
root #rc-service shairport-sync start

Done