commit:     0ef37beab8dd53a9badc9a4a953093fdef1fc757
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 11 23:30:45 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 12 02:03:39 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ef37bea

media-sound/mt-daapd: update EAPI 7 -> 8; fix musl; fix clang 16

- EAPI 8
- Fix musl build
- Fix Clang 16 compat
- Use tmpfiles for /var/cache

Closes: https://bugs.gentoo.org/875011
Closes: https://bugs.gentoo.org/860879
Closes: https://bugs.gentoo.org/520582
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../mt-daapd/files/mt-daapd-0.2.4.2-clang16.patch  | 80 ++++++++++++++++++
 .../mt-daapd/files/mt-daapd-0.2.4.2-musl.patch     | 32 ++++++++
 media-sound/mt-daapd/files/mt-daapd.tmpfiles       |  1 +
 media-sound/mt-daapd/mt-daapd-0.2.4.2-r2.ebuild    | 95 ++++++++++++++++++++++
 4 files changed, 208 insertions(+)

diff --git a/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-clang16.patch 
b/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-clang16.patch
new file mode 100644
index 000000000000..3380cc0da44a
--- /dev/null
+++ b/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-clang16.patch
@@ -0,0 +1,80 @@
+https://bugs.gentoo.org/860879
+https://bugs.gentoo.org/875011
+--- a/configure.in
++++ b/configure.in
+@@ -21,6 +21,9 @@ CPPFLAGS="${CPPFLAGS} -g"
+ 
+ AM_MAINTAINER_MODE
+ 
++# For strcasestr
++AC_USE_SYSTEM_EXTENSIONS
++
+ dnl fix freebsd's broken (?) libpthread
+ AC_CHECK_LIB(c_r,pthread_creat,THREAD_LIBS="-lc_r", [
+   AC_CHECK_LIB(pthread,pthread_create,THREAD_LIBS="-lpthread") ])
+--- a/src/configfile.c
++++ b/src/configfile.c
+@@ -48,6 +48,7 @@
+ #include <sys/wait.h>
+ 
+ #include "configfile.h"
++#include "db-memory.h"
+ #include "err.h"
+ 
+ #ifndef WITHOUT_MDNS
+--- a/src/dynamic-art.c
++++ b/src/dynamic-art.c
+@@ -32,6 +32,7 @@
+ #include <sys/stat.h>
+ 
+ #include "configfile.h"
++#include "dynamic-art.h"
+ #include "err.h"
+ #include "playlist.h"
+ #include "restart.h"
+--- a/src/mp3-scanner.h
++++ b/src/mp3-scanner.h
+@@ -74,5 +74,6 @@ extern void make_composite_tags(MP3FILE *song);
+ 
+ /* this should be refactored out of here... */
+ extern off_t aac_drilltoatom(FILE *aac_fp, char *atom_path, unsigned int 
*atom_length);
++extern long scan_aac_findatom(FILE *fin, long max_offset, char *which_atom, 
int *atom_size);
+ 
+ #endif /* _MP3_SCANNER_H_ */
+--- a/src/parser.y
++++ b/src/parser.y
+@@ -26,11 +26,14 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <time.h>
+ #include "playlist.h"
+ 
++#define YYPARSE_PARAM
+ #define YYERROR_VERBOSE 1
+ 
+ extern int yyerror(char *msg);
++extern int yylex(void);
+ 
+ /* Forwards */
+ 
+--- a/src/query.c
++++ b/src/query.c
+@@ -2,6 +2,7 @@
+ #include "config.h"
+ #endif
+ 
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+--- a/src/webserver.c
++++ b/src/webserver.c
+@@ -41,6 +41,7 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ 
++#include "configfile.h"
+ #include "err.h"
+ #include "webserver.h"
+ 

diff --git a/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-musl.patch 
b/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-musl.patch
new file mode 100644
index 000000000000..707b7ac3b828
--- /dev/null
+++ b/media-sound/mt-daapd/files/mt-daapd-0.2.4.2-musl.patch
@@ -0,0 +1,32 @@
+https://bugs.gentoo.org/716010
+--- a/src/mp3-scanner.c
++++ b/src/mp3-scanner.c
+@@ -378,7 +378,7 @@ int scan_init(char *path) {
+  */
+ int scan_path(char *path) {
+     DIR *current_dir;
+-    char de[sizeof(struct dirent) + MAXNAMLEN + 1]; /* overcommit for solaris 
*/
++    char de[sizeof(struct dirent) + NAME_MAX + 1]; /* overcommit for solaris 
*/
+     struct dirent *pde;
+     int err;
+     char mp3_path[PATH_MAX];
+--- a/src/webserver.c
++++ b/src/webserver.c
+@@ -1029,14 +1029,14 @@ int ws_returnerror(WS_CONNINFO *pwsc,int error, char 
*description) {
+  * and serves it up
+  */
+ void ws_defaulthandler(WS_PRIVATE *pwsp, WS_CONNINFO *pwsc) {
+-    char path[MAXPATHLEN];
+-    char resolved_path[MAXPATHLEN];
++    char path[PATH_MAX];
++    char resolved_path[PATH_MAX];
+     int file_fd;
+     off_t len;
+ 
+     DPRINTF(E_SPAM,L_WS,"Entering ws_defaulthandler\n");
+ 
+-    snprintf(path,MAXPATHLEN,"%s/%s",pwsp->wsconfig.web_root,pwsc->uri);
++    snprintf(path,PATH_MAX,"%s/%s",pwsp->wsconfig.web_root,pwsc->uri);
+     if(!realpath(path,resolved_path)) {
+         pwsc->error=errno;
+         DPRINTF(E_WARN,L_WS,"Exiting ws_defaulthandler: Cannot resolve 
%s\n",path);

diff --git a/media-sound/mt-daapd/files/mt-daapd.tmpfiles 
b/media-sound/mt-daapd/files/mt-daapd.tmpfiles
new file mode 100644
index 000000000000..e0923ac06d7c
--- /dev/null
+++ b/media-sound/mt-daapd/files/mt-daapd.tmpfiles
@@ -0,0 +1 @@
+d /var/cache/mt-daapd 0755 root root -

diff --git a/media-sound/mt-daapd/mt-daapd-0.2.4.2-r2.ebuild 
b/media-sound/mt-daapd/mt-daapd-0.2.4.2-r2.ebuild
new file mode 100644
index 000000000000..1ef6c391d0db
--- /dev/null
+++ b/media-sound/mt-daapd/mt-daapd-0.2.4.2-r2.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools tmpfiles
+
+DESCRIPTION="A multi-threaded implementation of Apple's DAAP server"
+HOMEPAGE="https://sourceforge.net/projects/mt-daapd/";
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="vorbis"
+
+RDEPEND="
+       media-libs/libid3tag:=
+       net-dns/avahi[dbus]
+       sys-libs/gdbm:=
+       sys-libs/zlib:=
+       vorbis? (
+               media-libs/libvorbis
+               media-libs/libogg
+       )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       app-alternatives/yacc
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.2.3-sparc.patch
+       "${FILESDIR}"/${PN}-0.2.4.1-libsorder.patch
+       "${FILESDIR}"/${PN}-0.2.4.1-pidfile.patch
+       "${FILESDIR}"/${P}-maintainer-mode.patch
+       "${FILESDIR}"/${P}-oggvorbis.patch
+       "${FILESDIR}"/${P}-clang16.patch
+       "${FILESDIR}"/${P}-musl.patch
+)
+
+src_prepare() {
+       default
+
+       # parser.y is fixed by the clang16 patch, force regeneration
+       rm src/parser.c || die
+
+       mv configure.{in,ac} || die
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable vorbis oggvorbis) \
+               --disable-maintainer-mode \
+               --enable-avahi \
+               --disable-mdns
+}
+
+src_install() {
+       default
+
+       insinto /etc
+       newins contrib/mt-daapd.conf mt-daapd.conf.example
+       doins contrib/mt-daapd.playlist
+
+       newinitd "${FILESDIR}"/${PN}.init.2 ${PN}
+
+       keepdir /etc/mt-daapd.d
+
+       newtmpfiles "${FILESDIR}"/mt-daapd.tmpfiles mt-daapd.conf
+}
+
+pkg_postinst() {
+       tmpfiles_process mt-daapd.conf
+
+       elog
+       elog "You have to configure your mt-daapd.conf following"
+       elog "${EROOT}/etc/mt-daapd.conf.example file."
+       elog
+
+       if use vorbis; then
+               elog
+               elog "You need to edit you extensions list in 
${EROOT}/etc/mt-daapd.conf"
+               elog "if you want your mt-daapd to serve ogg files."
+               elog
+       fi
+
+       elog
+       elog "If you want to start more than one ${PN} service, symlink"
+       elog "${EROOT}/etc/init.d/${PN} to ${EROOT}/etc/init.d/${PN}.<name>, 
and it will"
+       elog "load the data from ${EROOT}/etc/${PN}.d/<name>.conf."
+       elog "Make sure that you have different cache directories for them."
+       elog
+}

Reply via email to