From 984d97374661927ba1f43532cedb5cf2c77e6dc3 Mon Sep 17 00:00:00 2001 From: oreo639 Date: Sat, 27 Jan 2024 01:25:29 -0800 Subject: [PATCH] elogind: fix build on musl without basename compatibility decl musl provided a compatibility basename declaration so applications expecting GNU basename could still compile even though musl doesn't provide GNU basename and only POSIX basename. Prevent build failure when this is removed. --- srcpkgs/elogind/patches/musl-basename.patch | 42 +++++++++++++++++++++ srcpkgs/elogind/template | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/elogind/patches/musl-basename.patch diff --git a/srcpkgs/elogind/patches/musl-basename.patch b/srcpkgs/elogind/patches/musl-basename.patch new file mode 100644 index 00000000000..ff04009ffc4 --- /dev/null +++ b/srcpkgs/elogind/patches/musl-basename.patch @@ -0,0 +1,42 @@ +Add missing include for POSIX basename, since systemd-logind expects basename in string.h + +diff -rup src/basic/musl_missing.h.orig src/basic/musl_missing.h +--- a/src/basic/musl_missing.h ++++ b/src/basic/musl_missing.h +@@ -56,6 +54,10 @@ void elogind_set_program_name(const char + } ) ) + #endif + ++/* Poor man's basename */ ++#define basename(path) \ ++ (strrchr(path, '/') ? strrchr(path, '/')+1 : path) ++ + /* getnameinfo(3) glibc extensions are undefined in musl libc */ + #define NI_IDN 0 + #define NI_IDN_USE_STD3_ASCII_RULES 0 +From c8d96ff2b87b8dfb8d521d4c2e6fb57992dbf659 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 21 Dec 2022 16:13:23 +0100 +Subject: [PATCH] tests: we don't actually use basename() anymore + +--- + src/shared/tests.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/src/shared/tests.c b/src/shared/tests.c +index 5a05daa643..9d8bbeea79 100644 +--- a/src/shared/tests.c ++++ b/src/shared/tests.c +@@ -7,12 +7,6 @@ + #include + #include + +-/* When we include libgen.h because we need dirname() we immediately +- * undefine basename() since libgen.h defines it as a macro to the POSIX +- * version which is really broken. We prefer GNU basename(). */ +-#include +-#undef basename +- + #include "sd-bus.h" + + #include "alloc-util.h" diff --git a/srcpkgs/elogind/template b/srcpkgs/elogind/template index 97d129f1f32..ff5315b288f 100644 --- a/srcpkgs/elogind/template +++ b/srcpkgs/elogind/template @@ -1,7 +1,7 @@ # Template file for 'elogind' pkgname=elogind version=252.9 -revision=1 +revision=2 build_style=meson configure_args="-Dcgroup-controller=elogind -Ddefault-hierarchy=legacy -Ddefault-kill-user-processes=false -Dhalt-path=/usr/bin/halt