From: Michael Tremer Date: Mon, 26 Jan 2026 17:49:46 +0000 (+0000) Subject: mpd: Fix build against glibc >= 2.43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d358d10c0788bf8eb09f0afba711c4e5cb4ed224;p=ipfire-2.x.git mpd: Fix build against glibc >= 2.43 Signed-off-by: Michael Tremer --- diff --git a/lfs/mpd b/lfs/mpd index f78152623..a5a3cd357 100644 --- a/lfs/mpd +++ b/lfs/mpd @@ -34,7 +34,7 @@ DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/${THISAPP} TARGET = $(DIR_INFO)/$(THISAPP) PROG = mpd -PAK_VER = 48 +PAK_VER = 49 # SUP_ARCH = aarch64 x86_64 DEPS = alsa avahi faad2 ffmpeg flac lame libmad libshout libogg libid3tag libvorbis opus soxr fmt @@ -82,6 +82,7 @@ $(subst %,%_BLAKE2,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mpd-0.24.5-openat2.patch $(UPDATE_AUTOMAKE) cd $(DIR_APP) && meson setup \ --prefix=/usr \ diff --git a/src/patches/mpd-0.24.5-openat2.patch b/src/patches/mpd-0.24.5-openat2.patch new file mode 100644 index 000000000..2963d7d6a --- /dev/null +++ b/src/patches/mpd-0.24.5-openat2.patch @@ -0,0 +1,60 @@ +From 8caeedac3ed17491cd77240211ed13be80072a15 Mon Sep 17 00:00:00 2001 +From: Max Kellermann +Date: Mon, 26 Jan 2026 14:18:53 +0100 +Subject: [PATCH] system/linux: detect native openat2() support at configure + time + +The Linux man-pages notes about openat2(): "glibc provides no wrapper +for openat2(), necessitating the use of syscall(2)" + +.. but glibc 2.43 finally added a wrapper which caused a conflict with +our existing definition. + +Closes https://github.com/MusicPlayerDaemon/MPD/issues/2417 +--- + src/system/linux/meson.build | 6 +++++- + src/system/linux/openat2.h | 11 ++++++++++- + +diff --git a/src/system/linux/meson.build b/src/system/linux/meson.build +index 36a98f2127..4a0d6267ad 100644 +--- a/src/system/linux/meson.build ++++ b/src/system/linux/meson.build +@@ -1,7 +1,11 @@ + system_linux_features = configuration_data() + + if host_machine.system() == 'linux' +- system_linux_features.set('HAVE_OPENAT2', compiler.has_header('linux/openat2.h')) ++ have_native_openat2 = compiler.has_header_symbol('fcntl.h', 'openat2') ++ # openat2() support was added to glibc 2.43 ++ system_linux_features.set('HAVE_NATIVE_OPENAT2', have_native_openat2) ++ # if not provided by the C library, we roll our own using syscall() ++ system_linux_features.set('HAVE_OPENAT2', have_native_openat2 or compiler.has_header('linux/openat2.h')) + endif + + configure_file(output: 'Features.h', configuration: system_linux_features) +diff --git a/src/system/linux/openat2.h b/src/system/linux/openat2.h +index fdf3820983..807df97cb3 100644 +--- a/src/system/linux/openat2.h ++++ b/src/system/linux/openat2.h +@@ -4,7 +4,14 @@ + + #pragma once + +-#include // for O_* ++#include "system/linux/Features.h" // for HAVE_NATIVE_OPENAT2 ++ ++#include ++ ++#ifndef HAVE_NATIVE_OPENAT2 ++/* if the C library does not provide an openat2() wrappper, we roll ++ our own */ ++ + #include // for RESOLVE_* + #include + #include +@@ -15,3 +22,5 @@ openat2(int dirfd, const char *pathname, + { + return syscall(__NR_openat2, dirfd, pathname, how, size); + } ++ ++#endif // !HAVE_NATIVE_OPENAT2