Airplay speaker @ Arch linux

Today I’ll explain you guys how to install Shairport on a arch linux box. Shairport it’s a very cool project that allow you to create an Airplay server (speaker) to use it as an speaker for you iOS device or iTunes. I didn’t find a tutorial to install on arch so i share it and it’s awesome!!

To install and use it you should have first all required packages to build this project:

root# pacman -S libao perl-crypt-openssl-rsa perl-io-socket-inet6 perl-libwww avahi openssl

Then clone of the git repository for get the source code:

git clone https://github.com/albertz/shairport.git

Now that you have the source code enter in the Shairport directory(I decide that the best place to allocate it was on /usr/lib ) and build it:

root# make
cc -O2 -Wall   -c alac.c -o alac.o
cc -O2 -Wall   -DHAIRTUNES_STANDALONE hairtunes.c alac.o -o hairtunes -lm -lpthread -lssl -lcrypto -lao
cc -O2 -Wall   -c socketlib.c -o socketlib.o
cc -O2 -Wall   -c shairport.c -o shairport.o
cc -O2 -Wall   -c hairtunes.c -o hairtunes.o
cc -O2 -Wall   socketlib.o shairport.o alac.o hairtunes.o -o shairport -lm -lpthread -lssl -lcrypto -lao

Now its important to start some service before start running the perl script.

root# /etc/rc.d/dbus start[root@(none) shairport]
root# /etc/rc.d/avahi-daemon start

Now we want to name the Airplay Speaker, so we need to edit shairport.pl that’s in Shairport directory. You need to replace

my $apname = "ShairPort $$ on " . `hostname`;

with

my $apname = "GEORGE'S ROOM";

We’re ready to go and run Shairpoint!!

root# perl shairport.pl

Notes:
If you want to start Airplay Speaker when your boot you machine it’s important to edit the /etc/rc.conf and add dbus and avahi-daemon services at boot. Also you need to convert the perl script in a service but I’ll cover that later.