diff --git a/meson.build b/meson.build index f0b921879b..e5fd89e60c 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 3cc314eacd..1d7c4f4bd2 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 eeee98c9d6..306512ffd7 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 0000000000..a876230c67 --- /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