From 61698e7488a9e6f3cc16911882047e0552aa1bc7 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 6 Jul 2024 11:30:27 +0200 Subject: media-sound/owntone: initial commit, ebuild by me Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio. Signed-off-by: Fabian Groffen --- media-sound/owntone/Manifest | 1 + .../files/owntone-28.9-stream-support.patch | 22 ++++++ media-sound/owntone/files/owntone.confd | 9 +++ media-sound/owntone/files/owntone.initd | 40 ++++++++++ media-sound/owntone/metadata.xml | 13 ++++ media-sound/owntone/owntone-28.9.ebuild | 85 ++++++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 media-sound/owntone/Manifest create mode 100644 media-sound/owntone/files/owntone-28.9-stream-support.patch create mode 100644 media-sound/owntone/files/owntone.confd create mode 100644 media-sound/owntone/files/owntone.initd create mode 100644 media-sound/owntone/metadata.xml create mode 100644 media-sound/owntone/owntone-28.9.ebuild (limited to 'media-sound/owntone') diff --git a/media-sound/owntone/Manifest b/media-sound/owntone/Manifest new file mode 100644 index 000000000000..24e735e127d1 --- /dev/null +++ b/media-sound/owntone/Manifest @@ -0,0 +1 @@ +DIST owntone-28.9.tar.xz 1066248 BLAKE2B 68ba46e6ff2e406d54ccfe387191a67d4eb7590db3039d87ffcd5eabf7417059084997f0d6be810d164616cd663b2e4143714ef4ac31acb7d91e254ccd342465 SHA512 29f42a4a8c9501a038ecc5026fc4bce9d777dee722937b89a55523cd68f001c821017d09f32b704a0c331879f7049d7d087d8e6899c82924f45401b012c65e95 diff --git a/media-sound/owntone/files/owntone-28.9-stream-support.patch b/media-sound/owntone/files/owntone-28.9-stream-support.patch new file mode 100644 index 000000000000..9206c3ff5298 --- /dev/null +++ b/media-sound/owntone/files/owntone-28.9-stream-support.patch @@ -0,0 +1,22 @@ +Mimick MPDs httpd plugin, while owntone doesn't listen for port 8000 for +this, a proxy in front could map that to stream.mp3 easily. + +diff --git a/src/mpd.c b/src/mpd.c +index 10645409..0ac30867 100644 +--- a/src/mpd.c ++++ b/src/mpd.c +@@ -3753,6 +3753,14 @@ speaker_enum_cb(struct player_speaker_info *spk, void *arg) + static int + mpd_command_outputs(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, struct mpd_client_ctx *ctx) + { ++ /* emulate MPDs output for http stream, as "httpd" plugin, which some ++ * clients look for to ascertain there is stream playback support */ ++ evbuffer_add_printf(evbuf, ++ "outputid: 65536\n" /* USHRT_MAX + 1 */ ++ "outputname: MP3 stream\n" ++ "plugin: httpd\n" ++ "outputenabled: 1\n"); ++ + player_speaker_enumerate(speaker_enum_cb, evbuf); + + return 0; diff --git a/media-sound/owntone/files/owntone.confd b/media-sound/owntone/files/owntone.confd new file mode 100644 index 000000000000..5f69b10aa6ae --- /dev/null +++ b/media-sound/owntone/files/owntone.confd @@ -0,0 +1,9 @@ +# Copyright 1999-2024 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# user and group to run owntone as +#USER=owntone +#GROUP=audio + +# any options to use when starting owntone +#EXTRA_OPTS= diff --git a/media-sound/owntone/files/owntone.initd b/media-sound/owntone/files/owntone.initd new file mode 100644 index 000000000000..ee99dae982b6 --- /dev/null +++ b/media-sound/owntone/files/owntone.initd @@ -0,0 +1,40 @@ +#!/sbin/openrc-run +# Copyright 1999-2024 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="DAAP/DACP (iTunes), RSP and MPD server." + +command="/usr/sbin/owntone" +pidfile="/run/owntone/${SVCNAME}.pid" +conffile="/etc/${SVCNAME}.conf" +user=${USER:-owntone} +group=${GROUP:-audio} + +depend() { + need net avahi-daemon + use dns +} + +start_pre() { + mkdir -p "${pidfile%/*}" + chown ${user}:${group} "${pidfile%/*}" +} + +stop_post() { + rm -f "${pidfile}" +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile "${pidfile}" \ + --user ${user} --group ${group} \ + --exec ${command} -- -P "${pidfile}" -c "${conffile}" \ + ${EXTRA_OPTS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec ${command} --pidfile "${pidfile}" + eend $? +} diff --git a/media-sound/owntone/metadata.xml b/media-sound/owntone/metadata.xml new file mode 100644 index 000000000000..600501543b2d --- /dev/null +++ b/media-sound/owntone/metadata.xml @@ -0,0 +1,13 @@ + + + + + grobian@gentoo.org + + + build and install Chromecast support + + + owntone/owntone-server + + diff --git a/media-sound/owntone/owntone-28.9.ebuild b/media-sound/owntone/owntone-28.9.ebuild new file mode 100644 index 000000000000..f18018075487 --- /dev/null +++ b/media-sound/owntone/owntone-28.9.ebuild @@ -0,0 +1,85 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="DAAP (iTunes) and MPD media server" +HOMEPAGE="https://owntone.github.io/owntone-server" +SRC_URI="https://github.com/owntone/owntone-server/releases/download/${PV}/${P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="+alsa +chromecast" + +RDEPEND=" + app-pda/libplist + dev-db/sqlite:3 + dev-libs/confuse + dev-libs/json-c + dev-libs/libevent + dev-libs/libgcrypt + dev-libs/libsodium + dev-libs/libunistring + dev-libs/libxml2 + dev-libs/mxml:0 + dev-libs/protobuf-c + media-libs/alsa-lib + media-video/ffmpeg + net-dns/avahi + net-libs/libwebsockets + net-misc/curl + sys-devel/gettext + sys-libs/zlib + acct-group/audio + acct-user/owntone + alsa? ( media-libs/alsa-lib ) + chromecast? ( net-libs/gnutls media-video/ffmpeg[opus] ) +" +DEPEND="${RDEPEND} + dev-util/gperf + sys-apps/gawk + sys-devel/bison + sys-devel/flex + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${PN}-28.9-stream-support.patch +) + +src_prepare() { + default + + # fix log path, and enable songs/cache databases + sed -i \ + -e "/logfile = /s:= .*$:= ${EPREFIX}/var/log/owntone/owntone.log:" \ + -e "/\(db_path\|cache_path\) =/s:/cache/:/:" \ + -e "/\(db_path\|cache_path\) =/s:^#::" \ + owntone.conf.in || die +} + +src_configure() { + econf \ + --without-pulseaudio \ + --with-libwebsockets \ + --with-avahi \ + --with-user=owntone \ + --with-group=audio \ + $(use_with alsa) \ + $(use_enable chromecast) || die +} + +src_install() { + default + + rm -Rf "${ED}"/var/lib # all empty dirs + find "${ED}" -name "*.la" -delete + + keepdir /var/lib/owntone + keepdir /var/log/owntone + fowners owntone /var/log/owntone + + newinitd "${FILESDIR}"/${PN}.initd ${PN} + newconfd "${FILESDIR}"/${PN}.confd ${PN} +} -- cgit v1.2.3-65-gdbad