From: Yu Watanabe Date: Sat, 21 Jun 2025 17:16:25 +0000 (+0900) Subject: musl: meson: gracefully disable gshadow, nss, and idn support X-Git-Tag: v259-rc1~84^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7dad0db2ee5a52d7ef7aca70f4d97ffd70212b12;p=thirdparty%2Fsystemd.git musl: meson: gracefully disable gshadow, nss, and idn support - musl does not support gshadow, and does not provide gshadow.h, - musl does not support nss, and does not provide nss.h which is necessary for each nss modules, - musl does not provide NI_IDN. --- diff --git a/meson.build b/meson.build index a7c7a0a8109..599d2a3217d 100644 --- a/meson.build +++ b/meson.build @@ -708,6 +708,8 @@ foreach header : [ endforeach foreach header : [ + 'gshadow.h', + 'nss.h', 'sys/sdt.h', 'threads.h', 'valgrind/memcheck.h', @@ -718,6 +720,20 @@ foreach header : [ cc.has_header(header)) endforeach +foreach ident : [ + ['NI_IDN', 'netdb.h'] + ] + + if meson.version().version_compare('>=1.3.0') + have = cc.has_define(ident[0], + prefix : '''#include <@0@>'''.format(ident[1]), + args : '-D_GNU_SOURCE') + else + have = cc.has_header_symbol(ident[1], ident[0]) + endif + conf.set10('HAVE_' + ident[0], have) +endforeach + ##################################################################### fallback_hostname = get_option('fallback-hostname') @@ -1627,52 +1643,60 @@ conf.set10('ENABLE_NSPAWN', feature.allowed()) conf.set10('DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES', get_option('default-mountfsd-trusted-directories')) -foreach term : ['analyze', - 'backlight', - 'binfmt', - 'compat-mutable-uid-boundaries', - 'coredump', - 'efi', - 'environment-d', - 'firstboot', - 'gshadow', - 'hibernate', - 'hostnamed', - 'hwdb', - 'idn', - 'ima', - 'ipe', - 'initrd', - 'kernel-install', - 'ldconfig', - 'localed', - 'logind', - 'machined', - 'mountfsd', - 'networkd', - 'nsresourced', - 'nss-myhostname', - 'nss-systemd', - 'oomd', - 'portabled', - 'pstore', - 'quotacheck', - 'randomseed', - 'resolve', - 'rfkill', - 'smack', - 'sysext', - 'sysusers', - 'timedated', - 'timesyncd', - 'tmpfiles', - 'tpm', - 'userdb', - 'utmp', - 'vconsole', - 'xdg-autostart'] - have = get_option(term) - name = 'ENABLE_' + term.underscorify().to_upper() +foreach tuple : [ + ['analyze'], + ['backlight'], + ['binfmt'], + ['compat-mutable-uid-boundaries'], + ['coredump'], + ['efi'], + ['environment-d'], + ['firstboot'], + ['gshadow', conf.get('HAVE_GSHADOW_H') == 1, 'gshadow.h not found'], + ['hibernate'], + ['hostnamed'], + ['hwdb'], + ['idn', conf.get('HAVE_NI_IDN') == 1, 'NI_IDN is not defined'], + ['ima'], + ['ipe'], + ['initrd'], + ['kernel-install'], + ['ldconfig'], + ['localed'], + ['logind'], + ['machined'], + ['mountfsd'], + ['networkd'], + ['nsresourced'], + ['nss-myhostname', conf.get('HAVE_NSS_H') == 1, 'nss.h not found'], + ['nss-systemd', conf.get('HAVE_NSS_H') == 1, 'nss.h not found'], + ['oomd'], + ['portabled'], + ['pstore'], + ['quotacheck'], + ['randomseed'], + ['resolve'], + ['rfkill'], + ['smack'], + ['sysext'], + ['sysusers'], + ['timedated'], + ['timesyncd'], + ['tmpfiles'], + ['tpm'], + ['utmp'], + ['userdb'], + ['vconsole'], + ['xdg-autostart'], + ] + + have = get_option(tuple[0]) + if have and tuple.length() >= 3 and not tuple[1] + warning('@0@ support is requested but @1@, disabling it'.format(tuple[0], tuple[2])) + have = false + endif + + name = 'ENABLE_' + tuple[0].underscorify().to_upper() conf.set10(name, have) endforeach @@ -1681,11 +1705,16 @@ enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1 foreach tuple : [['nss-mymachines', 'machined'], ['nss-resolve', 'resolve']] want = get_option(tuple[0]) - if want.allowed() - have = get_option(tuple[1]) - if want.enabled() and not have + if want.enabled() + if conf.get('HAVE_NSS_H') != 1 + error('@0@ is requested but nss.h not found'.format(tuple[0])) + endif + if not get_option(tuple[1]) error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1])) endif + have = true + elif want.allowed() + have = get_option(tuple[1]) and conf.get('HAVE_NSS_H') == 1 else have = false endif