]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - meson.build
networkd: add support to configure IP Rule (#5725)
[thirdparty/systemd.git] / meson.build
index 407d7ea08eff7913e9e87dfcb71faefe61f6e49b..af17035586693a73f0e7a259a1f6e42fb770f88a 100644 (file)
@@ -1,5 +1,5 @@
 project('systemd', 'c',
-        version : '233',
+        version : '234',
         license : 'LGPLv2+',
         default_options: [
                 'c_std=gnu99',
@@ -26,6 +26,14 @@ m4_defines = []
 
 #####################################################################
 
+# Try to install the git pre-commit hook
+git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
+if git_hook.returncode() == 0
+        message(git_hook.stdout().strip())
+endif
+
+#####################################################################
+
 rootprefixdir = get_option('rootprefix')
 if get_option('split-usr')
         conf.set('HAVE_SPLIT_USR', true)
@@ -73,6 +81,7 @@ polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor
 varlogdir = join_paths(localstatedir, 'log')
 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
 rpmmacrosdir = get_option('rpmmacrosdir')
+modprobedir = join_paths(prefixdir, 'lib/modprobe.d')
 
 # Our own paths
 pkgdatadir = join_paths(datadir, 'systemd')
@@ -230,7 +239,8 @@ if cxx.found()
         add_languages('cpp')
 endif
 
-foreach arg : ['-Wundef',
+foreach arg : ['-Wextra',
+               '-Wundef',
                '-Wlogical-op',
                '-Wmissing-include-dirs',
                '-Wold-style-definition',
@@ -275,7 +285,9 @@ endforeach
 foreach arg : ['unused-parameter',
                'missing-field-initializers',
                'unused-result',
-               'format-signedness']
+               'format-signedness',
+               'error=nonnull', # work-around for gcc 7.1 turning this on on its own
+              ]
         if cc.has_argument('-W' + arg)
                 add_project_arguments('-Wno-' + arg, language : 'c')
         endif
@@ -312,7 +324,6 @@ link_test_c = files('tools/meson-link-test.c')
 foreach arg : ['-Wl,-z,relro',
                '-Wl,-z,now',
                '-pie',
-               '-Wl,-fuse-ld=gold',
               ]
 
         have = run_command(check_compilation_sh,
@@ -363,6 +374,7 @@ conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h
 decl_headers = '''
 #include <uchar.h>
 #include <linux/ethtool.h>
+#include <linux/fib_rules.h>
 '''
 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
 
@@ -370,6 +382,7 @@ foreach decl : ['char16_t',
                 'char32_t',
                 'key_serial_t',
                 'struct ethtool_link_settings',
+                'struct fib_rule_uid_range',
                ]
 
         # We get -1 if the size cannot be determined
@@ -398,6 +411,7 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
                 ['IFLA_BR_VLAN_DEFAULT_PVID',        'linux/if_link.h'],
                 ['NDA_IFINDEX',                      'linux/neighbour.h'],
                 ['IFA_FLAGS',                        'linux/if_addr.h'],
+                ['FRA_UID_RANGE',                    'linux/fib_rules.h'],
                 ['LO_FLAGS_PARTSCAN',                'linux/loop.h'],
                ]
         prefix = decl.length() > 2 ? decl[2] : ''
@@ -452,7 +466,6 @@ awk = find_program('awk')
 m4 = find_program('m4')
 stat = find_program('stat')
 git = find_program('git', required : false)
-etags = find_program('etags', required : false)
 
 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
 mkdir_p = 'mkdir -p $DESTDIR/@0@'
@@ -538,6 +551,8 @@ endforeach
 ############################################################
 
 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
+conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
+gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
 
 default_hierarchy = get_option('default-hierarchy')
 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
@@ -603,11 +618,6 @@ kill_user_processes = get_option('default-kill-user-processes')
 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
 
-default_dnssec = get_option('default-dnssec')
-conf.set('DEFAULT_DNSSEC_MODE',
-         'DNSSEC_' + default_dnssec.underscorify().to_upper())
-substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
-
 dns_servers = get_option('dns-servers')
 conf.set_quoted('DNS_SERVERS', dns_servers)
 substs.set('DNS_SERVERS', dns_servers)
@@ -802,23 +812,23 @@ if want_libidn == 'true' and want_libidn2 == 'true'
         error('libidn and libidn2 cannot be requested simultaneously')
 endif
 
-if want_libidn2 != 'false' and want_libidn != 'true'
-        libidn = dependency('libidn2',
-                            required : want_libidn2 == 'true')
-        # libidn is used for both libidn and libidn2 objects
+if want_libidn != 'false' and want_libidn2 != 'true'
+        libidn = dependency('libidn',
+                            required : want_libidn == 'true')
         if libidn.found()
-                conf.set('HAVE_LIBIDN2', true)
-                m4_defines += ['-DHAVE_LIBIDN2']
+                conf.set('HAVE_LIBIDN', true)
+                m4_defines += ['-DHAVE_LIBIDN']
         endif
 else
         libidn = []
 endif
-if not conf.get('HAVE_LIBIDN2', false) and want_libidn != 'false'
-        libidn = dependency('libidn',
-                            required : want_libidn == 'true')
+if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
+        # libidn is used for both libidn and libidn2 objects
+        libidn = dependency('libidn2',
+                            required : want_libidn2 == 'true')
         if libidn.found()
-                conf.set('HAVE_LIBIDN', true)
-                m4_defines += ['-DHAVE_LIBIDN']
+                conf.set('HAVE_LIBIDN2', true)
+                m4_defines += ['-DHAVE_LIBIDN2']
         endif
 endif
 
@@ -843,6 +853,23 @@ else
         libqrencode = []
 endif
 
+want_gcrypt = get_option('gcrypt')
+if want_gcrypt != 'false'
+        libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
+        libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
+
+        have_deps = libgcrypt.found() and libgpg_error.found()
+        conf.set('HAVE_GCRYPT', have_deps)
+        if not have_deps
+                # link to neither of the libs if one is not found
+                libgcrypt = []
+                libgpg_error = []
+        endif
+else
+        libgcrypt = []
+        libgpg_error = []
+endif
+
 want_gnutls = get_option('gnutls')
 if want_gnutls != 'false'
         libgnutls = dependency('gnutls',
@@ -898,6 +925,16 @@ else
         liblz4 = []
 endif
 
+want_xkbcommon = get_option('xkbcommon')
+if want_xkbcommon != 'false'
+        libxkbcommon = dependency('xkbcommon',
+                                  version : '>= 0.3.0',
+                                  required : want_xkbcommon == 'true')
+        conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
+else
+        libxkbcommon = []
+endif
+
 want_glib = get_option('glib')
 if want_glib != 'false'
         libglib =    dependency('glib-2.0',
@@ -916,16 +953,6 @@ else
         libgio = []
 endif
 
-want_xkbcommon = get_option('xkbcommon')
-if want_xkbcommon != 'false'
-        libxkbcommon = dependency('xkbcommon',
-                                  version : '>= 0.3.0',
-                                  required : want_xkbcommon == 'true')
-        conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
-else
-        libxkbcommon = []
-endif
-
 want_dbus = get_option('dbus')
 if want_dbus != 'false'
         libdbus = dependency('dbus-1',
@@ -936,22 +963,14 @@ else
         libdbus = []
 endif
 
-want_gcrypt = get_option('gcrypt')
-if want_gcrypt != 'false'
-        libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
-        libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
-
-        have_deps = libgcrypt.found() and libgpg_error.found()
-        conf.set('HAVE_GCRYPT', have_deps)
-        if not have_deps
-                # link to neither of the libs if one is not found
-                libgcrypt = []
-                libgpg_error = []
-        endif
-else
-        libgcrypt = []
-        libgpg_error = []
+default_dnssec = get_option('default-dnssec')
+if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
+        message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
+        default_dnssec = 'no'
 endif
+conf.set('DEFAULT_DNSSEC_MODE',
+         'DNSSEC_' + default_dnssec.underscorify().to_upper())
+substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
 
 want_importd = get_option('importd')
 if want_importd != 'false'
@@ -1005,11 +1024,12 @@ foreach pair : [['utmp',          'HAVE_UTMP'],
                 ['rfkill',        'ENABLE_RFKILL'],
                 ['ldconfig',      'ENABLE_LDCONFIG'],
                 ['efi',           'ENABLE_EFI'],
-                ['tpm',           'SD_BOOT_LOG_TPM'],
+                ['tpm',           'ENABLE_TPM'],
                 ['ima',           'HAVE_IMA'],
                 ['smack',         'HAVE_SMACK'],
                 ['gshadow',       'ENABLE_GSHADOW'],
                 ['idn',           'ENABLE_IDN'],
+                ['nss-systemd',   'ENABLE_NSS_SYSTEMD'],
                ]
 
         if get_option(pair[0])
@@ -1022,6 +1042,8 @@ want_tests = get_option('tests')
 install_tests = get_option('install-tests')
 tests = []
 
+conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
+
 #####################################################################
 
 if get_option('efi')
@@ -1073,6 +1095,7 @@ includes = include_directories('src/basic',
                                'src/libsystemd/sd-netlink',
                                'src/libsystemd/sd-network',
                                'src/libsystemd-network',
+                               '.',
                               )
 
 add_project_arguments('-include', 'config.h', language : 'c')
@@ -1101,7 +1124,7 @@ libsystemd = shared_library(
         'systemd',
         libsystemd_internal_sources,
         journal_internal_sources,
-        version : '0.18.0',
+        version : '0.19.0',
         include_directories : includes,
         link_args : ['-shared',
                      '-Wl,--version-script=' + libsystemd_sym_path],
@@ -1158,7 +1181,7 @@ test_dlopen = executable(
         dependencies : [libdl])
 
 foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
-                 ['systemd',    ''               ],
+                 ['systemd',    'ENABLE_NSS_SYSTEMD'],
                  ['mymachines', 'ENABLE_MACHINED'],
                  ['resolve',    'ENABLE_RESOLVED']]
 
@@ -2171,6 +2194,7 @@ if conf.get('ENABLE_NETWORKD', false)
                                 libsystemd_network,
                                 libudev_internal,
                                 libshared],
+                   dependencies : [threads],
                    install_rpath : rootlibexecdir,
                    install : true,
                    install_dir : rootlibexecdir)
@@ -2183,18 +2207,17 @@ if conf.get('ENABLE_NETWORKD', false)
                    install_rpath : rootlibexecdir,
                    install : true,
                    install_dir : rootlibexecdir)
-endif
 
-exe = executable('networkctl',
-                 networkctl_sources,
-                 include_directories : includes,
-                 link_with : [libsystemd_network,
+        exe = executable('networkctl',
+                   networkctl_sources,
+                   include_directories : includes,
+                   link_with : [libsystemd_network,
                               libshared],
-                 install_rpath : rootlibexecdir,
-                 install : true,
-                 install_dir : rootbindir)
-public_programs += [exe]
-
+                   install_rpath : rootlibexecdir,
+                   install : true,
+                   install_dir : rootbindir)
+        public_programs += [exe]
+endif
 ############################################################
 
 foreach tuple : tests
@@ -2214,8 +2237,6 @@ foreach tuple : tests
         endif
 
         if condition == '' or conf.get(condition, false)
-                install = install_tests and type == ''
-
                 exe = executable(
                         name,
                         sources,
@@ -2224,8 +2245,8 @@ foreach tuple : tests
                         dependencies : dependencies,
                         c_args : defs,
                         install_rpath : rootlibexecdir,
-                        install : install,
-                        install_dir : testsdir)
+                        install : install_tests,
+                        install_dir : join_paths(testsdir, type))
 
                 if type == 'manual'
                         message('@0@ is a manual test'.format(name))
@@ -2292,6 +2313,8 @@ install_data('xorg/50-systemd-user.sh',
              install_dir : xinitrcdir)
 install_data('system-preset/90-systemd.preset',
              install_dir : systempresetdir)
+install_data('modprobe.d/systemd.conf',
+             install_dir : modprobedir)
 install_data('README',
              'NEWS',
              'CODING_STYLE',
@@ -2318,18 +2341,22 @@ endforeach
 
 ############################################################
 
-if git.found() and etags.found()
+if git.found()
         all_files = run_command(
                 git,
-                ['--git-dir=@0@/.git'.format(meson.source_root()),
+                ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
                  'ls-files',
                  ':/*.[ch]'])
         all_files = files(all_files.stdout().split())
 
-        run_target(
-                'TAGS',
-                input : all_files,
-                command : [etags, '-o', '@0@/TAGS'.format(meson.source_root())] + all_files)
+        custom_target(
+                'tags',
+                output : 'tags',
+                command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
+        custom_target(
+                'ctags',
+                output : 'ctags',
+                command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
 endif
 
 if git.found()
@@ -2342,17 +2369,17 @@ endif
 if git.found()
         git_head = run_command(
                 git,
-                ['--git-dir=@0@/.git'.format(meson.source_root()),
+                ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
                  'rev-parse', 'HEAD']).stdout().strip()
         git_head_short = run_command(
                 git,
-                ['--git-dir=@0@/.git'.format(meson.source_root()),
+                ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
                  'rev-parse', '--short=7', 'HEAD']).stdout().strip()
 
         run_target(
                 'git-snapshot',
                 command : ['git', 'archive',
-                           '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
+                           '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
                                                                  git_head_short),
                            '--prefix', 'systemd-@0@/'.format(git_head),
                            'HEAD'])
@@ -2374,6 +2401,7 @@ status = [
         'PAM modules dir:                   @0@'.format(pamlibdir),
         'PAM configuration dir:             @0@'.format(pamconfdir),
         'RPM macros dir:                    @0@'.format(rpmmacrosdir),
+        'modprobe.d dir:                    @0@'.format(modprobedir),
         'D-Bus policy dir:                  @0@'.format(dbuspolicydir),
         'D-Bus session dir:                 @0@'.format(dbussessionservicedir),
         'D-Bus system dir:                  @0@'.format(dbussystemservicedir),
@@ -2392,6 +2420,7 @@ status = [
         'nobody user name:                  @0@'.format(get_option('nobody-user')),
         'nobody group name:                 @0@'.format(get_option('nobody-group')),
         'fallback hostname:                 @0@'.format(get_option('fallback-hostname')),
+        'symbolic gateway hostnames:        @0@'.format(', '.join(gateway_hostnames)),
 
         'default DNSSEC mode:               @0@'.format(default_dnssec),
         'default cgroup hierarchy:          @0@'.format(default_hierarchy),
@@ -2452,6 +2481,7 @@ foreach tuple : [
         ['idn'],
         ['libidn2'],
         ['libidn'],
+        ['nss-systemd'],
         ['libiptc'],
         ['elfutils'],
         ['binfmt'],
@@ -2515,6 +2545,9 @@ foreach tuple : [
 endforeach
 
 status += [
+        '',
         'enabled features: @0@'.format(', '.join(found)),
-        'disabled features: @0@'.format(', '.join(missing))]
+        '',
+        'disabled features: @0@'.format(', '.join(missing)),
+        '']
 message('\n         '.join(status))