Add shairport-sync
authorHugo Villeneuve <hugo@hugovil.com>
Sun, 18 Feb 2024 23:02:12 +0000 (18:02 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Tue, 28 May 2024 19:00:29 +0000 (15:00 -0400)
Add libdaemon to fix this warning at runtime:

    shairport-sync was built without libdaemon, so does not support
    daemonisation using the -d, --daemon, -j or...

recipes-core/images/image-hvmpd-common.inc
recipes-multimedia/shairport-sync/files/0001-yocto-disable-user-group-creation.patch [new file with mode: 0644]
recipes-multimedia/shairport-sync/files/shairport-sync.conf.in [new file with mode: 0644]
recipes-multimedia/shairport-sync/shairport-sync_git.bb [new file with mode: 0644]

index 34a132f..0e901ef 100644 (file)
@@ -24,6 +24,12 @@ IMAGE_INSTALL:append = " \
        mpd \
        mpc \
        ympd \
+       shairport-sync \
+"
+
+# Needed by shairport-sync:
+IMAGE_INSTALL:append = " \
+    avahi-daemon \
 "
 
 IMAGE_INSTALL:append = " \
diff --git a/recipes-multimedia/shairport-sync/files/0001-yocto-disable-user-group-creation.patch b/recipes-multimedia/shairport-sync/files/0001-yocto-disable-user-group-creation.patch
new file mode 100644 (file)
index 0000000..6e35a92
--- /dev/null
@@ -0,0 +1,34 @@
+From e339921792ce7b92d4563a5dd0c675a1bb06e953 Mon Sep 17 00:00:00 2001
+From: Hugo Villeneuve <hugo@hugovil.com>
+Date: Mon, 19 Feb 2024 12:20:43 -0500
+Subject: [PATCH] yocto: disable user/group creation
+
+---
+ Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index d9cfbf6e..c1765489 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -277,7 +277,7 @@ INSTALL_SYSTEMV_TARGET = install-systemv-local
+ # will be stored in a scripts folder in the _build_ folder
+ # which will be the source folder if you're not using a separate build folder
+-$(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync $(INSTALL_USER_TARGET)
++$(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync
+       install -d $(DESTDIR)$(sysconfdir)/init.d
+       [ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0755 scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
+@@ -297,7 +297,7 @@ INSTALL_SYSTEMD_TARGET = install-systemd-local
+ # will be stored in a scripts folder in the _build_ folder
+ # which will be the source folder if you're not using a separate build folder
+-$(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE) $(INSTALL_USER_TARGET)
++$(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE)
+       install -d $(DESTDIR)$(systemdsystemunitdir)
+       [ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
+-- 
+2.39.2
+
diff --git a/recipes-multimedia/shairport-sync/files/shairport-sync.conf.in b/recipes-multimedia/shairport-sync/files/shairport-sync.conf.in
new file mode 100644 (file)
index 0000000..b778852
--- /dev/null
@@ -0,0 +1,29 @@
+// hvmpd Shairport Sync configuration file
+
+general =
+{
+       name = "@AIRPLAY_SERVER_NAME@";
+       interpolation = "basic";
+       mdns_backend = "avahi";
+};
+
+// How to deal with metadata, including artwork
+metadata =
+{
+       enabled = "yes"; // Solicit metadata from the source and to pass it on via a pipe
+       include_cover_art = "no";
+       pipe_name = "/tmp/shairport-sync-metadata";
+};
+
+sessioncontrol =
+{
+       allow_session_interruption = "yes";
+};
+
+// Parameters for the "alsa" audio back end (only back end that supports synchronised audio)
+alsa =
+{
+       //output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
+       //mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
+       //mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
+};
diff --git a/recipes-multimedia/shairport-sync/shairport-sync_git.bb b/recipes-multimedia/shairport-sync/shairport-sync_git.bb
new file mode 100644 (file)
index 0000000..9b3d826
--- /dev/null
@@ -0,0 +1,52 @@
+DESCRIPTION = "AirPlay audio player. Shairport Sync adds multi-room capability with Audio Synchronisation"
+LICENSE="MIT"
+LIC_FILES_CHKSUM = "file://LICENSES;md5=9f329b7b34fcd334fb1f8e2eb03d33ff"
+
+SRCBRANCH = "master"
+SRCREV = "165431a8973d06a5d18fe3e26e2981612ea7701b"
+SRC_URI = "git://github.com/mikebrady/shairport-sync;protocol=https;branch=${SRCBRANCH}"
+
+SRC_URI += " \
+    file://0001-yocto-disable-user-group-creation.patch \
+    file://shairport-sync.conf.in \
+"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = " \
+    --with-alsa \
+    --with-stdout \
+    --with-ssl=openssl \
+    --with-avahi \
+    --with-metadata \
+    --with-libdaemon \
+    --with-systemd \
+"
+
+DEPENDS = " libconfig popt avahi openssl alsa-lib"
+
+inherit autotools pkgconfig systemd
+
+AIRPLAY_SERVER_NAME ?= "%h shairplay-sync"
+
+do_install:append() {
+    sed -e "s/@AIRPLAY_SERVER_NAME@/${AIRPLAY_SERVER_NAME}/" \
+        ${WORKDIR}/shairport-sync.conf.in > ${WORKDIR}/shairport-sync.conf
+    install -d ${D}${sysconfdir}/
+    install -m 0644 ${WORKDIR}/shairport-sync.conf ${D}${sysconfdir}/
+}
+
+SYSTEMD_SERVICE:${PN} = " \
+     shairport-sync.service \
+"
+
+inherit useradd
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = " \
+    --system \
+    --no-create-home \
+    --home ${runstatedir}/shairport-sync \
+    --groups audio \
+    --user-group shairport-sync \
+"