From: Yu Watanabe Date: Mon, 7 Jul 2025 05:11:19 +0000 (+0900) Subject: musl: meson: allow to choose libc implementation X-Git-Tag: v259-rc1~84^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a4c45279a76235f2cc9c298b6a30e3de668cb00b;p=thirdparty%2Fsystemd.git musl: meson: allow to choose libc implementation This also introduces skeleton directories for storing musl specific code. --- diff --git a/meson.build b/meson.build index f0b921879b2..e5fd89e60ce 100644 --- a/meson.build +++ b/meson.build @@ -72,7 +72,10 @@ conf.set10('SD_BOOT', false) # Create a title-less summary section early, so it ends up first in the output. # More items are added later after they have been detected. -summary({'build mode' : get_option('mode')}) +summary({ + 'libc' : get_option('libc'), + 'build mode' : get_option('mode'), +}) ##################################################################### @@ -2069,6 +2072,15 @@ system_includes = [ ), ] +if get_option('libc') == 'musl' + system_include_args = [ + '-isystem', meson.project_build_root() / 'src/include/musl', + '-isystem', meson.project_source_root() / 'src/include/musl', + ] + system_include_args + + system_includes += include_directories('src/include/musl', is_system : true) +endif + basic_includes = [ include_directories( 'src/basic', diff --git a/meson_options.txt b/meson_options.txt index 3cc314eacdb..1d7c4f4bd27 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -402,6 +402,8 @@ option('ima', type : 'boolean', option('ipe', type : 'boolean', description : 'IPE support') +option('libc', type : 'combo', choices : ['glibc', 'musl'], + description : 'libc implementation to be used') option('acl', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' }, description : 'libacl support') option('audit', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' }, diff --git a/src/libc/meson.build b/src/libc/meson.build index eeee98c9d6c..306512ffd70 100644 --- a/src/libc/meson.build +++ b/src/libc/meson.build @@ -16,6 +16,8 @@ libc_wrapper_sources = files( 'xattr.c', ) +subdir('musl') + sources += libc_wrapper_sources libc_wrapper_static = static_library( diff --git a/src/libc/musl/meson.build b/src/libc/musl/meson.build new file mode 100644 index 00000000000..a876230c67f --- /dev/null +++ b/src/libc/musl/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +if get_option('libc') != 'musl' + subdir_done() +endif