musl: meson: allow to choose libc implementation

This also introduces skeleton directories for storing musl specific code.
This commit is contained in:
Yu Watanabe
2025-07-07 14:11:19 +09:00
parent e182d66faa
commit a4c45279a7
4 changed files with 22 additions and 1 deletions

View File

@@ -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',

View File

@@ -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' },

View File

@@ -16,6 +16,8 @@ libc_wrapper_sources = files(
'xattr.c',
)
subdir('musl')
sources += libc_wrapper_sources
libc_wrapper_static = static_library(

View File

@@ -0,0 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if get_option('libc') != 'musl'
subdir_done()
endif