Skip to content

Commit

Permalink
3.3 release candidate 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrady committed Mar 4, 2019
2 parents 9adf8be + 704352a commit 89340f2
Show file tree
Hide file tree
Showing 51 changed files with 6,628 additions and 2,949 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ shairport-sync.core
/org.gnome.ShairportSync.service
/dbus-interface.*
/mpris-interface.*
/lib_*.*

# Some eclipse project files
.cproject
Expand Down
99 changes: 69 additions & 30 deletions CYGWIN.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
Installing to Cygwin
Installing Shairport Sync into Cygwin
====

This guide is based on installing onto a fresh installation of Cygwin 2.895 (64-bit installation) running in Windows 10
inside VMWare Fusion on a Mac.

The end result is a new Windows Service called `CYGWIN Shairport Sync`, providing an AirPlay service by which iOS devices or other AirPlay sources on the network can play audio through the Windows device.

Windows Firewall
----
While getting everything working, it is suggested that you temporarily disable the Windows Firewall. Shairport Sync uses port 5000 for TCP and uses three ports for UDP, so you should leave a minimum of three, and preferably at least 10, open from 6001 upwards. The Bonjour Service, used in conjunction with the Avahi daemon, advertises Shairport Sync over a number of further ports. Once everything is working, the firewall can be re-enabled gradually.

Setting up Windows
----
Set up Windows 10 and install all updates. Install the `Bonjour Service`, available from Apple in an installer called "Bonjour Print Services for Windows v2.0.2".

* Download and run `Bonjour Print Services for Windows v2.0.2`
* After accepting conditions and clicking the `Install` button, the installer will do a preliminary installation, installing just the Bonjour Service. It will then pause, inviting you to install Bonjour Print Services. You can decline this, as the Bonjour Service will have been installed during the first part of the installation.

* Check Bonjour Service is running. In Windows, open the `Services` desktop application and ensure that you can see `Bonjour Service` running.

Setting up Cygwin
----
* Download the Cygwin installer from the [official website](https://cygwin.com/install.html). Save the installer in the Downloads folder.

This is based on installing onto a fresh default installation of Cygwin 2.4.1 (64-bit installation) running in Windows 10
inside VMWare Fusion on a Mac.

Note: to enable Cygwin to resolve domain names, it was found necessary to go to Windows `Control Panel` > `Network and Internet` > `Network Connections` >
`Ethernet0` > `Properties` > `Internet Protocol Version 4 (TCP/IPv4)` > `Properties`, select `Use the following DNS server addresses`
and enter valid DNS server addresses, e.g. `8.8.8.8`.

* Use `Cygwin Setup` to install the following packages:
* `pkg-config`
* `autoconf`
* `automake`
* `clang`
* `libdaemon-devel`
* `popt-devel`
* `make`
* `libao-devel`
* `openssl-devel`
* `libtool`
* `git`
* `wget` for convenience,
* `flex` for compiling `libconfig`
* `bison` for compiling `libconfig`

Assuming the Cygwin setup program (`setup-x86_64.exe` in this case) is in your Downloads directory and the default directory is your home directory, the following command should work:
```
.\Downloads\setup-x86_64.exe -P pkg-config,autoconf,automake,clang,libdaemon-devel,popt-devel,make,libao-devel,openssl-devel,libtool,git,wget,flex,bison
* Open a Windows `Command Prompt` window and enter the following multi-line command, omitting the `C:\Users\mike>` prompt:
```
C:\Users\mike> Downloads\setup-x86_64.exe -P cygrunsrv,dbus,avahi,avahi-tools,gnome-keyring,libavahi-client-devel,^
libglib2.0-devel,openssl,pkg-config,autoconf,automake,clang,libdaemon-devel,popt-devel,^
make,libao-devel,openssl-devel,libtool,git,wget,flex,bison
```
This will do a complete installation of Cygwin and all necessary packages.
* Set up the D-Bus and Avahi Services:

Open a `Cygwin64 Terminal` window in Administrator mode. Enter the following command:
```
$ messagebus-config
```
Answer `yes` to all queries. Open the Windows `Services` desktop application (if it's already open, refresh the screen contents: `Actions > Refresh`) and look for the `CYGWIN D-Bus system service`. Open it and start it.

Next, open (or return to) a `Cygwin64 Terminal` window in Administrator mode. Enter the following command:
```
$ /usr/sbin/avahi-daemon-config
```
Answer `yes` to all queries. Open the Windows `Services` desktop application (if it's already open, refresh the screen contents: `Actions > Refresh`) and look for the `CYGWIN Avahi service`. Open it and start it.

The `libconfig` Library
----
Shairport Sync relies on a library – `libconfig` – that is not a Cygwin package, so it must be downloaded, compiled and installed:
* Download, configure, compile and install `libconfig`:
```
$ git clone https://github.com/hyperrealm/libconfig.git
Expand All @@ -39,13 +57,34 @@ $ make
$ make install
$ cd ..
```
* Next, download, configure and compile Shairport Sync:

Shairport Sync
----
* Download, configure and compile Shairport Sync:
```
$ git clone https://github.com/mikebrady/shairport-sync.git
$ cd shairport-sync
$ git checkout development // this is temporary
$ autoreconf -fi
$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-ao --with-ssl=openssl --with-tinysvcmdns
$ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-ao --with-ssl=openssl \
--with-avahi --with-dbus-interface --sysconfdir=/etc --with-cygwin-service
$ make
$ make install
```
* That's it. There should be a `shairport-sync.exe` file in your directory.
* The last step above installs the `shairport-sync` application into `/usr/local/bin` and also installs a configuration file, a service configuration script and two D-Bus policy files.

Shairport Sync Service
----
* To install Shairport Sync as a Cygwin Service, open (or return to) a `Cygwin64 Terminal` window in Administrator mode. Enter the following command:
```
$ shairport-sync-config
```
Answer `yes` to all queries. Open the Windows `Services` desktop application (if it's already open, refresh the screen contents: `Actions > Refresh`) and look for the `CYGWIN Shairport Sync` service. Open it and start it.

An AirPlay player on the local network should now be able to see an AirPlay output device bearing the computer's Device Name, e.g. `DESKTOP-0RHGN0`. You can set a different name by changing the settings in the Shairport Sync configuration file, installed at `/etc/shairport-sync.conf`.

Since Shairport Sync is now a Cygwin Service, you do not need to open Cygwin to launch it – it should launch automatically when Windows is booted up.

Known Issues
----
* Shairport Sync cannot access the D-Bus system bus to make its D-Bus interface available. The cause of this problem is unknown. (While the Avahi daemon can access the D-Bus system bus, Shairport Sync can not. The two applications use different D-Bus libraries, so perhaps the issue lies there.)
7 changes: 3 additions & 4 deletions FFTConvolver/convolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include <sndfile.h>
#include "FFTConvolver.h"
#include "Utilities.h"
extern "C" {
#include "../common.h"
}

extern "C" void die(const char *format, ...);
extern "C" void debug(int level, const char *format, ...);

static fftconvolver::FFTConvolver convolver_l;
static fftconvolver::FFTConvolver convolver_r;
Expand Down Expand Up @@ -40,7 +39,7 @@ void convolver_init(const char* filename, int max_length)
float buffer_l[size];
float buffer_r[size];

int i;
unsigned int i;
for (i=0; i<size; ++i)
{
buffer_l[i] = buffer[2*i+0];
Expand Down
65 changes: 51 additions & 14 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
SUBDIRS = man
ARFLAGS = cr
lib_dbus_interface_a_CFLAGS = -pthread
lib_mpris_interface_a_CFLAGS = -pthread


bin_PROGRAMS = shairport-sync

# See below for the flags for the test client program

shairport_sync_SOURCES = shairport.c rtsp.c mdns.c mdns_external.c common.c rtp.c player.c alac.c audio.c loudness.c
shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c

AM_CFLAGS = -Wno-multichar -Wall -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
if BUILD_FOR_FREEBSD
AM_CPPFLAGS = -I/usr/local/include -Wno-multichar -DSYSCONFDIR=\"$(sysconfdir)\" -O2
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
else
if BUILD_FOR_OPENBSD
AM_CPPFLAGS = -I/usr/local/include -Wno-multichar -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
else
AM_CPPFLAGS = -Wno-multichar -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CXXFLAGS = -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
endif
endif

Expand All @@ -34,10 +40,18 @@ if USE_TINYSVCMDNS
shairport_sync_SOURCES += mdns_tinysvcmdns.c tinysvcmdns.c
endif

if USE_EXTERNAL_MDNS
shairport_sync_SOURCES += mdns_external.c
endif

if USE_ALSA
shairport_sync_SOURCES += audio_alsa.c
endif

if USE_JACK
shairport_sync_SOURCES += audio_jack.c
endif

if USE_SNDIO
shairport_sync_SOURCES += audio_sndio.c
endif
Expand Down Expand Up @@ -68,7 +82,7 @@ endif

if USE_CONVOLUTION
shairport_sync_SOURCES += FFTConvolver/AudioFFT.cpp FFTConvolver/FFTConvolver.cpp FFTConvolver/Utilities.cpp FFTConvolver/convolver.cpp
AM_CXXFLAGS = -std=c++11
AM_CXXFLAGS += -std=c++11
endif

if USE_DNS_SD
Expand All @@ -86,43 +100,57 @@ endif
BUILT_SOURCES =
noinst_HEADERS =
CLEANFILES =
shairport_sync_LDADD =
noinst_LIBRARIES =

if USE_DBUS
shairport_sync_SOURCES += dbus-service.c dbus-interface.c
shairport_sync_LDADD += lib_dbus_interface.a
noinst_LIBRARIES += lib_dbus_interface.a
lib_dbus_interface_a_SOURCES = dbus-interface.c
shairport_sync_SOURCES += dbus-service.c
BUILT_SOURCES += dbus-interface.h dbus-interface.c
# We don't want to install this header
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)

dbus-interface.h dbus-interface.c: org.gnome.ShairportSync.xml
dbus-interface.c: org.gnome.ShairportSync.xml
gdbus-codegen --interface-prefix org.gnome --generate-c-code dbus-interface org.gnome.ShairportSync.xml
dbus-interface.h: dbus-interface.c
touch dbus-interface.h
endif

if USE_MPRIS
shairport_sync_SOURCES += mpris-service.c mpris-interface.c
shairport_sync_LDADD += lib_mpris_interface.a
noinst_LIBRARIES += lib_mpris_interface.a
lib_mpris_interface_a_SOURCES = mpris-interface.c
shairport_sync_SOURCES += mpris-service.c
BUILT_SOURCES += mpris-interface.h mpris-interface.c
# We don't want to install this header
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)

mpris-interface.h mpris-interface.c: org.mpris.MediaPlayer2.xml
mpris-interface.c: org.mpris.MediaPlayer2.xml
gdbus-codegen --interface-prefix org.mpris --generate-c-code mpris-interface org.mpris.MediaPlayer2.xml
mpris-interface.h: mpris-interface.c
touch mpris-interface.h
endif

noinst_PROGRAMS =

if USE_DBUS_CLIENT
#Make it, but don't install it anywhere
noinst_PROGRAMS += shairport-sync-dbus-test-client
shairport_sync_dbus_test_client_SOURCES = dbus-interface.c dbus-interface.h shairport-sync-dbus-test-client.c
shairport_sync_dbus_test_client_SOURCES = shairport-sync-dbus-test-client.c
shairport_sync_dbus_test_client_LDADD = lib_dbus_interface.a
endif

if USE_MPRIS_CLIENT
#Make it, but don't install it anywhere
noinst_PROGRAMS += shairport-sync-mpris-test-client
shairport_sync_mpris_test_client_SOURCES = mpris-interface.c mpris-interface.h shairport-sync-mpris-test-client.c
shairport_sync_mpris_test_client_SOURCES = shairport-sync-mpris-test-client.c
shairport_sync_mpris_test_client_LDADD = lib_mpris_interface.a
endif

install-exec-hook:
Expand All @@ -131,17 +159,23 @@ if INSTALL_CONFIG_FILES
cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
[ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
if USE_DBUS
if INSTALL_CYGWIN_SERVICE
cp scripts/shairport-sync-dbus-policy-cygwin.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
else
cp scripts/shairport-sync-dbus-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
endif
endif
if USE_MPRIS
if INSTALL_CYGWIN_SERVICE
cp scripts/shairport-sync-mpris-policy-cygwin.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
else
cp scripts/shairport-sync-mpris-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-mpris.conf
endif
endif
endif
if INSTALL_SYSTEMV
getent group shairport-sync &>/dev/null || groupadd -r shairport-sync >/dev/null
getent passwd shairport-sync &> /dev/null || useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
[ -e /var/run/shairport-sync ] || mkdir -p /var/run/shairport-sync
chown shairport-sync:shairport-sync /var/run/shairport-sync
[ -e $(DESTDIR)$(sysconfdir)/init.d ] || mkdir -p $(DESTDIR)$(sysconfdir)/init.d
[ -f $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d/
endif
Expand All @@ -159,3 +193,6 @@ if INSTALL_FREEBSD_SERVICE
[ -f /usr/local/etc/rc.d/shairport_sync ] || cp scripts/shairport-sync.freebsd /usr/local/etc/rc.d/shairport_sync
chmod 555 /usr/local/etc/rc.d/shairport_sync
endif
if INSTALL_CYGWIN_SERVICE
cp scripts/shairport-sync-config /usr/local/bin
endif
Loading

0 comments on commit 89340f2

Please sign in to comment.