]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
musl: meson: allow to choose libc implementation
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jul 2025 05:11:19 +0000 (14:11 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Nov 2025 19:44:00 +0000 (04:44 +0900)
This also introduces skeleton directories for storing musl specific code.

meson.build
meson_options.txt
src/libc/meson.build
src/libc/musl/meson.build [new file with mode: 0644]

index f0b921879b2cd87f6656c7ceb015b8290a16942d..e5fd89e60cec46b267fbceb45011a12b4047b09b 100644 (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',
index 3cc314eacdbe69e4dc8ae36f601e71416cdd1bdf..1d7c4f4bd27f4b760b4e5f07aa777b8fcc3db29e 100644 (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' },
index eeee98c9d6c6d5409cf129ffc8ef726daa762367..306512ffd7002acab9384a358596ca55cc8107a0 100644 (file)
@@ -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 (file)
index 0000000..a876230
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+if get_option('libc') != 'musl'
+        subdir_done()
+endif