]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - meson.build
mkosi: set file permissions in copy of source tree (#8370)
[thirdparty/systemd.git] / meson.build
index d4af95a44a9b2c0e3448663aa721cec7e543a7ed..a381db8ebf6849c3abade38cd6fc57044c6d135e 100644 (file)
@@ -16,7 +16,7 @@
 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
 
 project('systemd', 'c',
-        version : '237',
+        version : '238',
         license : 'LGPLv2+',
         default_options: [
                 'c_std=gnu99',
@@ -27,8 +27,8 @@ project('systemd', 'c',
         meson_version : '>= 0.41',
        )
 
-libsystemd_version = '0.21.0'
-libudev_version = '1.6.9'
+libsystemd_version = '0.22.0'
+libudev_version = '1.6.10'
 
 # We need the same data in three different formats, ugh!
 # Also, for hysterical reasons, we use different variable
@@ -54,13 +54,26 @@ endif
 
 #####################################################################
 
-split_usr = get_option('split-usr')
-conf.set10('HAVE_SPLIT_USR', split_usr)
+if get_option('split-usr') == 'auto'
+        split_usr = run_command('test', '-L', '/bin').returncode() != 0
+else
+        split_usr = get_option('split-usr') == 'true'
+endif
+conf.set10('HAVE_SPLIT_USR', split_usr,
+           description : '/usr/bin and /bin directories are separate')
+
+if get_option('split-bin') == 'auto'
+        split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
+else
+        split_bin = get_option('split-bin') == 'true'
+endif
+conf.set10('HAVE_SPLIT_BIN', split_bin,
+           description : 'bin and sbin directories are separate')
 
 rootprefixdir = get_option('rootprefix')
 # Unusual rootprefixdir values are used by some distros
 # (see https://github.com/systemd/systemd/pull/7461).
-rootprefix_default = get_option('split-usr') ? '/' : '/usr'
+rootprefix_default = split_usr ? '/' : '/usr'
 if rootprefixdir == ''
         rootprefixdir = rootprefix_default
 endif
@@ -87,6 +100,7 @@ datadir = join_paths(prefixdir, get_option('datadir'))
 localstatedir = join_paths('/', get_option('localstatedir'))
 
 rootbindir = join_paths(rootprefixdir, 'bin')
+rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
 
 rootlibdir = get_option('rootlibdir')
@@ -181,6 +195,9 @@ conf.set_quoted('SYSTEM_SYSVINIT_PATH',                       sysvinit_path)
 conf.set_quoted('SYSTEM_SYSVRCND_PATH',                       sysvrcnd_path)
 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START',                 get_option('rc-local'))
 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP',                  get_option('halt-local'))
+
+conf.set('ANSI_OK_COLOR',                                     'ANSI_' + get_option('ok-color').underscorify().to_upper())
+
 conf.set_quoted('USER_CONFIG_UNIT_PATH',                      join_paths(pkgsysconfdir, 'user'))
 conf.set_quoted('USER_DATA_UNIT_PATH',                        userunitdir)
 conf.set_quoted('CERTIFICATE_ROOT',                           get_option('certificate-root'))
@@ -220,7 +237,7 @@ conf.set_quoted('VENDOR_KEYRING_PATH',                        join_paths(rootlib
 conf.set_quoted('USER_KEYRING_PATH',                          join_paths(pkgsysconfdir, 'import-pubring.gpg'))
 conf.set_quoted('DOCUMENT_ROOT',                              join_paths(pkgdatadir, 'gatewayd'))
 conf.set('MEMORY_ACCOUNTING_DEFAULT',                         memory_accounting_default ? 'true' : 'false')
-conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_ON_OFF',           memory_accounting_default ? 'on' : 'off')
+conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO',           memory_accounting_default ? 'yes' : 'no')
 
 conf.set_quoted('ABS_BUILD_DIR',                              meson.build_root())
 conf.set_quoted('ABS_SRC_DIR',                                meson.source_root())
@@ -395,20 +412,6 @@ foreach arg : ['-Wl,-z,relro',
         endif
 endforeach
 
-# Check if various sanitizers are supported
-sanitizers = []
-foreach arg : ['address']
-
-        have = run_command(check_compilation_sh,
-                           cc.cmd_array(), '-x', 'c',
-                           '-fsanitize=@0@'.format(arg),
-                           '-include', link_test_c).returncode() == 0
-        message('@0@ sanitizer supported: @1@'.format(arg, have ? 'yes' : 'no'))
-        if have
-                sanitizers += arg
-        endif
-endforeach
-
 if get_option('buildtype') != 'debug'
         foreach arg : ['-ffunction-sections',
                        '-fdata-sections']
@@ -521,10 +524,11 @@ foreach ident : [
                                  #include <unistd.h>'''],
         ['bpf',               '''#include <sys/syscall.h>
                                  #include <unistd.h>'''],
-        ['explicit_bzero' ,   '''#include <string.h>'''],
         ['statx',             '''#include <sys/types.h>
                                  #include <sys/stat.h>
                                  #include <unistd.h>'''],
+        ['explicit_bzero' ,   '''#include <string.h>'''],
+        ['reallocarray',      '''#include <malloc.h>'''],
 ]
 
         have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
@@ -586,7 +590,7 @@ endforeach
 conf.set_quoted('TELINIT', get_option('telinit-path'))
 
 if run_command('ln', '--relative', '--help').returncode() != 0
-        error('ln does not support --relative')
+        error('ln does not support --relative (added in coreutils 8.16)')
 endif
 
 ############################################################
@@ -778,6 +782,7 @@ substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
 
 kill_user_processes = get_option('default-kill-user-processes')
 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
+conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
 
 dns_servers = get_option('dns-servers')
@@ -825,8 +830,7 @@ if not libcap.found()
 endif
 
 libmount = dependency('mount',
-                      version : '>= 2.30',
-                      required : not fuzzer_build)
+                      version : fuzzer_build ? '>= 0' : '>= 2.30')
 
 want_seccomp = get_option('seccomp')
 if want_seccomp != 'false' and not fuzzer_build
@@ -1452,6 +1456,10 @@ executable('systemd',
            install : true,
            install_dir : rootlibexecdir)
 
+meson.add_install_script(meson_make_symlink,
+                         join_paths(rootlibexecdir, 'systemd'),
+                         join_paths(rootsbindir, 'init'))
+
 exe = executable('systemd-analyze',
                  systemd_analyze_sources,
                  include_directories : includes,
@@ -1610,6 +1618,10 @@ if conf.get('ENABLE_RESOLVE') == 1
                          install_rpath : rootlibexecdir,
                          install : true)
         public_programs += [exe]
+
+        meson.add_install_script(meson_make_symlink,
+                         join_paths(bindir, 'systemd-resolve'),
+                         join_paths(rootsbindir, 'resolvconf'))
 endif
 
 if conf.get('ENABLE_LOGIND') == 1
@@ -1711,6 +1723,12 @@ exe = executable('systemctl', 'src/systemctl/systemctl.c',
                  install_dir : rootbindir)
 public_programs += [exe]
 
+foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
+        meson.add_install_script(meson_make_symlink,
+                                 join_paths(rootbindir, 'systemctl'),
+                                 join_paths(rootsbindir, alias))
+endforeach
+
 if conf.get('ENABLE_BACKLIGHT') == 1
         executable('systemd-backlight',
                    'src/backlight/backlight.c',
@@ -2372,6 +2390,7 @@ executable('systemd-shutdown',
            systemd_shutdown_sources,
            include_directories : includes,
            link_with : [libshared],
+           dependencies : [libmount],
            install_rpath : rootlibexecdir,
            install : true,
            install_dir : rootlibexecdir)
@@ -2595,15 +2614,17 @@ install_data('xorg/50-systemd-user.sh',
              install_dir : xinitrcdir)
 install_data('modprobe.d/systemd.conf',
              install_dir : modprobedir)
-install_data('README',
-             'NEWS',
-             'CODING_STYLE',
-             'DISTRO_PORTING',
-             'ENVIRONMENT.md',
-             'LICENSE.GPL2',
+install_data('LICENSE.GPL2',
              'LICENSE.LGPL2.1',
-             'TRANSIENT-SETTINGS.md',
-             'UIDS-GIDS.md',
+             'NEWS',
+             'README',
+             'doc/CODING_STYLE',
+             'doc/DISTRO_PORTING',
+             'doc/ENVIRONMENT.md',
+             'doc/HACKING',
+             'doc/TRANSIENT-SETTINGS.md',
+             'doc/TRANSLATORS',
+             'doc/UIDS-GIDS.md',
              'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
              install_dir : docdir)
 
@@ -2623,48 +2644,56 @@ endforeach
 
 ############################################################
 
-prev = ''
-foreach p : fuzz_regression_tests
-        a = p.split('/')[-3]
-        b = p.split('/')[-2]
-        c = p.split('/')[-1]
-
-        if a == 'address'
-                build = sanitize_address
-        else
-                error('unknown sanitizer @0@'.format(a))
-        endif
+# Enable tests for all supported sanitizers
+foreach tuple : sanitizers
+        sanitizer = tuple[0]
+        build = tuple[1]
 
-        name = '@1@:@0@'.format(a, b)
-
-        if name != prev
-                if want_tests == 'false'
-                        message('Not compiling @0@ because tests is set to false'.format(name))
-                elif not sanitizers.contains(a)
-                        message('Not compiling @0@ because @1@ sanitizer is not available'.format(name, a))
-                elif slow_tests
-                        exe = custom_target(
-                                name,
-                                output : name,
-                                depends : build,
-                                command : [env, 'ln', '-fs',
-                                           join_paths(build.full_path(), b),
-                                           '@OUTPUT@'],
-                                build_by_default : true)
-                else
-                        message('Not compiling @0@ because slow-tests is set to false'.format(name))
-                endif
-        endif
-        prev = name
+        have = run_command(check_compilation_sh,
+                           cc.cmd_array(), '-x', 'c',
+                           '-fsanitize=@0@'.format(sanitizer),
+                           '-include', link_test_c).returncode() == 0
+        message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
 
-        if want_tests != 'false' and slow_tests
-                test(c, env, args : [exe.full_path(),
-                                     join_paths(meson.source_root(),
-                                                'test/fuzz-regressions',
-                                                p)])
+        if have
+                prev = ''
+                foreach p : fuzz_regression_tests
+                        b = p.split('/')[-2]
+                        c = p.split('/')[-1]
+
+                        name = '@0@:@1@'.format(b, sanitizer)
+
+                        if name != prev
+                                if want_tests == 'false'
+                                        message('Not compiling @0@ because tests is set to false'.format(name))
+                                elif slow_tests
+                                        exe = custom_target(
+                                                name,
+                                                output : name,
+                                                depends : build,
+                                                command : [env, 'ln', '-fs',
+                                                           join_paths(build.full_path(), b),
+                                                           '@OUTPUT@'],
+                                                build_by_default : true)
+                                else
+                                        message('Not compiling @0@ because slow-tests is set to false'.format(name))
+                                endif
+                        endif
+                        prev = name
+
+                        if want_tests != 'false' and slow_tests
+                                test('@0@:@1@:@2@'.format(b, c, sanitizer),
+                                     env,
+                                     args : [exe.full_path(),
+                                             join_paths(meson.source_root(),
+                                                        'test/fuzz-regressions',
+                                                        p)])
+                        endif
+                endforeach
         endif
 endforeach
 
+
 ############################################################
 
 if git.found()
@@ -2724,6 +2753,8 @@ run_target(
 status = [
         '@0@ @1@'.format(meson.project_name(), meson.project_version()),
 
+        'split /usr:                        @0@'.format(split_usr),
+        'split bin-sbin:                    @0@'.format(split_bin),
         'prefix directory:                  @0@'.format(prefixdir),
         'rootprefix directory:              @0@'.format(rootprefixdir),
         'sysconf directory:                 @0@'.format(sysconfdir),
@@ -2860,7 +2891,6 @@ foreach tuple : [
         ['man pages',        want_man],
         ['html pages',       want_html],
         ['man page indices', want_man and have_lxml],
-        ['split /usr',       conf.get('HAVE_SPLIT_USR') == 1],
         ['SysV compat'],
         ['utmp'],
         ['ldconfig'],
@@ -2872,8 +2902,9 @@ foreach tuple : [
         ['debug mmap cache'],
 ]
 
-        cond = tuple.get(1, '')
-        if cond == ''
+        if tuple.length() >= 2
+                cond = tuple[1]
+        else
                 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
                 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
                 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1