diff --git a/.dir-locals.el b/.dir-locals.el index 3e1b2d76c0..5ef7e11634 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -20,4 +20,8 @@ (eval . (c-set-offset 'arglist-intro '++)) (eval . (c-set-offset 'arglist-close 0)))) (nxml-mode . ((nxml-child-indent . 2) - (fill-column . 119)))) + (fill-column . 119))) + (meson-mode . ((meson-indent-basic . 8))) + (sh-mode . ((sh-basic-offset . 8) + (sh-indentation . 8))) + (awk-mode . ((c-basic-offset . 8)))) diff --git a/.gitignore b/.gitignore index 01cb6e7db7..7cbf0a9e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ /TAGS /ata_id /bootctl -/build-aux +/build* /busctl /cdrom_id /collect diff --git a/Makefile.am b/Makefile.am index b8db4f12ae..8339625a62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3077,8 +3077,8 @@ CLEANFILES += $(stub_objects) $(stub_solib) $(stub) # ------------------------------------------------------------------------------ CLEANFILES += test-efi-disk.img -test-efi-disk.img: $(systemd_boot) $(stub) test/test-efi-create-disk.sh - $(AM_V_GEN)test/test-efi-create-disk.sh +test-efi-disk.img: $(systemd_boot) $(stub) test/splash.bmp test/test-efi-create-disk.sh + $(AM_V_GEN)test/test-efi-create-disk.sh $@ $(systemd_boot) $(stub) test/splash.bmp test-efi: test-efi-disk.img $(QEMU) -machine accel=kvm -m 1024 -bios $(QEMU_BIOS) -snapshot test-efi-disk.img @@ -4556,10 +4556,8 @@ libsystemd_journal_internal_la_SOURCES += \ libsystemd_journal_internal_la_LIBADD += \ $(GCRYPT_LIBS) -# fsprg.c is a drop-in file using void pointer arithmetic libsystemd_journal_internal_la_CFLAGS += \ - $(GCRYPT_CFLAGS) \ - -Wno-pointer-arith + $(GCRYPT_CFLAGS) endif noinst_LTLIBRARIES += \ @@ -6607,18 +6605,8 @@ dist-check-includes: $(public_headers) done; exit $$res .PHONY: hwdb-update -hwdb-update: - ( cd $(top_srcdir)/hwdb && \ - wget -O usb.ids 'http://www.linux-usb.org/usb.ids' && \ - wget -O pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids' && \ - wget -O ma-large.txt 'http://standards.ieee.org/develop/regauth/oui/oui.txt' && \ - wget -O ma-medium.txt 'http://standards.ieee.org/develop/regauth/oui28/mam.txt' && \ - wget -O ma-small.txt 'http://standards.ieee.org/develop/regauth/oui36/oui36.txt' && \ - wget -O pnp_id_registry.html 'http://www.uefi.org/uefi-pnp-export' && \ - wget -O acpi_id_registry.html 'http://www.uefi.org/uefi-acpi-export' && \ - ./ids-update.pl && \ - ./acpi-update.py > 20-acpi-vendor.hwdb.base && \ - patch -p0 -o- 20-acpi-vendor.hwdb.base < 20-acpi-vendor.hwdb.patch > 20-acpi-vendor.hwdb ) +hwdb-update: tools/meson-hwdb-update.sh + $< $(top_srcdir)/hwdb .PHONY: built-sources built-sources: $(BUILT_SOURCES) diff --git a/README b/README index 260668c8db..d7477510a9 100644 --- a/README +++ b/README @@ -156,21 +156,47 @@ REQUIREMENTS: dracut (optional) PolicyKit (optional) - When building from git, the following tools are needed: + Two build systems are supported: meson + ninja-build and autools + make. + + The following tools are needed with both systems: pkg-config - docbook-xsl - xsltproc + gperf >= 3.1 + docbook-xsl (optional, required for documentation) + xsltproc (optional, required for documentation) + python-lxml (optional, required to build the indices) + + When building with meson, python and ninja-build are required. + + To build in directory build/: + meson build/ && ninja -C build + + Any configuration options can be specfied as -Darg=value... arguments + to meson. After the build directory is initially configured, meson will + refuse to run again, and options must be changed with: + mesonconf -Darg=value... + mesonconf without any arguments will print out available options and + their current values. + + Useful commands: + ninja -v some/target + ninja test + sudo ninja install + DESTDIR=... ninja install + + When building with autotools, the following tools are needed: + automake autoconf libtool intltool - gperf >= 3.1 python (optional) - python-lxml (optional, but required to build the indices) - The build system is initialized with ./autogen.sh. A tar ball - can be created with: + The build system is initialized with ./autogen.sh and the usual + ./configure && make + should be used. + + A tar ball can be created with: git archive --format=tar --prefix=systemd-222/ v222 | xz > systemd-222.tar.xz When systemd-hostnamed is used, it is strongly recommended to diff --git a/catalog/meson.build b/catalog/meson.build new file mode 100644 index 0000000000..6d205b1d42 --- /dev/null +++ b/catalog/meson.build @@ -0,0 +1,28 @@ +in_files = ''' + systemd.bg.catalog + systemd.be.catalog + systemd.be@latin.catalog + systemd.fr.catalog + systemd.it.catalog + systemd.pl.catalog + systemd.pt_BR.catalog + systemd.ru.catalog + systemd.zh_CN.catalog + systemd.zh_TW.catalog + systemd.catalog +'''.split() + +support_url = get_option('support-url') +support_sed = 's~%SUPPORT_URL%~@0@~'.format(support_url) +build_catalog_dir = meson.current_build_dir() + +foreach file : in_files + custom_target( + file, + input : file + '.in', + output: file, + command : [sed, support_sed, '@INPUT@'], + capture : true, + install : true, + install_dir : catalogdir) +endforeach diff --git a/docs/sysvinit/meson.build b/docs/sysvinit/meson.build new file mode 100644 index 0000000000..36b2f6f98c --- /dev/null +++ b/docs/sysvinit/meson.build @@ -0,0 +1,6 @@ +file = configure_file( + input : 'README.in', + output : 'README', + configuration : substs) +install_data(file, + install_dir : sysvinit_path) diff --git a/docs/var-log/meson.build b/docs/var-log/meson.build new file mode 100644 index 0000000000..43078c40e9 --- /dev/null +++ b/docs/var-log/meson.build @@ -0,0 +1,6 @@ +file = configure_file( + input : 'README.in', + output : 'README', + configuration : substs) +install_data(file, + install_dir : varlogdir) diff --git a/hwdb/meson.build b/hwdb/meson.build new file mode 100644 index 0000000000..68a23e0afe --- /dev/null +++ b/hwdb/meson.build @@ -0,0 +1,42 @@ +hwdb_files = files(''' + 20-pci-vendor-model.hwdb + 20-pci-classes.hwdb + 20-usb-vendor-model.hwdb + 20-usb-classes.hwdb + 20-sdio-vendor-model.hwdb + 20-sdio-classes.hwdb + 20-bluetooth-vendor-product.hwdb + 20-acpi-vendor.hwdb + 20-OUI.hwdb + 20-net-ifname.hwdb + 60-evdev.hwdb + 60-keyboard.hwdb + 60-sensor.hwdb + 70-mouse.hwdb + 70-pointingstick.hwdb + 70-touchpad.hwdb +'''.split()) + +if conf.get('ENABLE_HWDB', 0) == 1 + install_data(hwdb_files, + install_dir : udevhwdbdir) + + meson.add_install_script('sh', '-c', + mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d'))) + + meson.add_install_script('sh', '-c', + 'test -n "$DESTDIR" || @0@/systemd-hwdb update' + .format(rootbindir)) +endif + +############################################################ + +parse_hwdb_py = find_program('parse_hwdb.py') +test('parse-hwdb', + parse_hwdb_py) + +############################################################ + +run_target( + 'update', + command : [hwdb_update_sh, meson.current_source_dir()]) diff --git a/man/custom-entities.ent.in b/man/custom-entities.ent.in new file mode 100644 index 0000000000..0257c2a94f --- /dev/null +++ b/man/custom-entities.ent.in @@ -0,0 +1,7 @@ + + + + + + + diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 0000000000..9cdb560c4c --- /dev/null +++ b/man/meson.build @@ -0,0 +1,168 @@ +# This is lame, I know, but meson has no other include mechanism +subdir('rules') + +want_man = get_option('man') +want_html = get_option('html') +xsltproc = find_program('xsltproc', + required : want_man == 'true' or want_html == 'true') +want_man = want_man != 'false' and xsltproc.found() +want_html = want_html != 'false' and xsltproc.found() + +xsltproc_flags = [ + '--nonet', + '--xinclude', + '--stringparam', 'man.output.quietly', '1', + '--stringparam', 'funcsynopsis.style', 'ansi', + '--stringparam', 'man.authors.section.enabled', '0', + '--stringparam', 'man.copyright.section.enabled', '0', + '--stringparam', 'systemd.version', '@0@'.format(meson.project_version()), + '--path', + '@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())] + +custom_man_xsl = files('custom-man.xsl') +custom_html_xsl = files('custom-html.xsl') +xslt_cmd = [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + +custom_entities_ent = configure_file( + input : 'custom-entities.ent.in', + output : 'custom-entities.ent', + configuration : conf) + +man_pages = [] +html_pages = [] +source_xml_files = [] +foreach tuple : manpages + stem = tuple[0] + section = tuple[1] + aliases = tuple[2] + condition = tuple[3] + + xml = stem + '.xml' + html = stem + '.html' + man = stem + '.' + section + + manaliases = [] + htmlaliases = [] + foreach alias : aliases + manaliases += [alias + '.' + section] + htmlaliases += [alias + '.html'] + endforeach + + mandirn = join_paths(get_option('mandir'), 'man' + section) + + if condition == '' or conf.get(condition, 0) == 1 + p1 = custom_target( + man, + input : xml, + output : [man] + manaliases, + command : xslt_cmd + [custom_man_xsl, '@INPUT@'], + depend_files : custom_entities_ent, + install : want_man, + install_dir : mandirn) + man_pages += [p1] + + p2 = custom_target( + html, + input : xml, + output : [html] + htmlaliases, + command : xslt_cmd + [custom_html_xsl, '@INPUT@'], + depend_files : custom_entities_ent, + install : want_html, + install_dir : join_paths(docdir, 'html')) + html_pages += [p2] + + source_xml_files += files(tuple[0] + '.xml') + else + message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition)) + endif +endforeach + +############################################################ + +have_lxml = run_command(xml_helper_py).returncode() == 0 +if not have_lxml + message('python-lxml not available, not making man page indices') +endif + +systemd_directives_xml = custom_target( + 'systemd.directives.xml', + input : source_xml_files, + output : 'systemd.directives.xml', + command : [make_directive_index_py, '@OUTPUT@'] + source_xml_files) + +nonindex_xml_files = source_xml_files + [systemd_directives_xml] +systemd_index_xml = custom_target( + 'systemd.index.xml', + input : nonindex_xml_files, + output : 'systemd.index.xml', + command : [make_man_index_py, '@OUTPUT@'] + nonindex_xml_files) + +foreach tuple : [['systemd.directives', '7', systemd_directives_xml], + ['systemd.index', '7', systemd_index_xml]] + stem = tuple[0] + section = tuple[1] + xml = tuple[2] + + html = stem + '.html' + man = stem + '.' + section + + mandirn = join_paths(get_option('mandir'), 'man' + section) + + p1 = custom_target( + man, + input : xml, + output : man, + command : xslt_cmd + [custom_man_xsl, '@INPUT@'], + install : want_man and have_lxml, + install_dir : mandirn) + man_pages += [p1] + + p2 = custom_target( + html, + input : xml, + output : html, + command : xslt_cmd + [custom_html_xsl, '@INPUT@'], + install : want_html and have_lxml, + install_dir : join_paths(docdir, 'html')) + html_pages += [p2] +endforeach + +# cannot use run_target until https://github.com/mesonbuild/meson/issues/1644 is resolved +man = custom_target( + 'man', + output : 'man', + depends : man_pages, + command : ['echo']) + +html = run_target( + 'html', + depends : html_pages, + output : 'html', + command : ['echo']) + +run_target( + 'doc-sync', + depends : man_pages + html_pages, + command : ['rsync', '-rlv', + '--delete-excluded', + '--include=man', + '--include=*.html', + '--exclude=*', + '--omit-dir-times', + meson.current_build_dir(), + get_option('www-target')]) + +############################################################ + +if git.found() + run_target( + 'update-man-rules', + # slightly strange syntax because of + # https://github.com/mesonbuild/meson/issues/1643 + # and https://github.com/mesonbuild/meson/issues/1512 + command : ['sh', '-c', + 'cd @0@ && '.format(meson.build_root()) + + 'python3 @0@/tools/make-man-rules.py --meson `git ls-files ":/man/*.xml"` >t && '.format(meson.source_root()) + + 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())], + depend_files : custom_entities_ent) +endif diff --git a/man/rules/meson.build b/man/rules/meson.build new file mode 100644 index 0000000000..00a1413325 --- /dev/null +++ b/man/rules/meson.build @@ -0,0 +1,763 @@ +# Do not edit. Generated by make-man-rules.py. +manpages = [ +['binfmt.d', '5', [], 'ENABLE_BINFMT'], + ['bootctl', '1', [], 'ENABLE_EFI'], + ['bootup', '7', [], ''], + ['busctl', '1', [], ''], + ['coredump.conf', '5', ['coredump.conf.d'], 'ENABLE_COREDUMP'], + ['coredumpctl', '1', [], 'ENABLE_COREDUMP'], + ['crypttab', '5', [], 'HAVE_LIBCRYPTSETUP'], + ['daemon', '7', [], ''], + ['dnssec-trust-anchors.d', + '5', + ['systemd.negative', 'systemd.positive'], + 'ENABLE_RESOLVED'], + ['environment.d', '5', [], ''], + ['file-hierarchy', '7', [], ''], + ['halt', '8', ['poweroff', 'reboot'], ''], + ['hostname', '5', [], ''], + ['hostnamectl', '1', [], 'ENABLE_HOSTNAMED'], + ['hwdb', '7', [], 'ENABLE_HWDB'], + ['journal-remote.conf', '5', ['journal-remote.conf.d'], 'HAVE_MICROHTTPD'], + ['journal-upload.conf', '5', ['journal-upload.conf.d'], 'HAVE_MICROHTTPD'], + ['journalctl', '1', [], ''], + ['journald.conf', '5', ['journald.conf.d'], ''], + ['kernel-command-line', '7', [], ''], + ['kernel-install', '8', [], ''], + ['libudev', '3', [], ''], + ['locale.conf', '5', [], ''], + ['localectl', '1', [], 'ENABLE_LOCALED'], + ['localtime', '5', [], ''], + ['loginctl', '1', [], 'ENABLE_LOGIND'], + ['logind.conf', '5', ['logind.conf.d'], 'ENABLE_LOGIND'], + ['machine-id', '5', [], ''], + ['machine-info', '5', [], ''], + ['machinectl', '1', [], 'ENABLE_MACHINED'], + ['modules-load.d', '5', [], 'HAVE_KMOD'], + ['networkctl', '1', [], 'ENABLE_NETWORKD'], + ['networkd.conf', '5', ['networkd.conf.d'], 'ENABLE_NETWORKD'], + ['nss-myhostname', '8', ['libnss_myhostname.so.2'], 'HAVE_MYHOSTNAME'], + ['nss-mymachines', '8', ['libnss_mymachines.so.2'], 'ENABLE_MACHINED'], + ['nss-resolve', '8', ['libnss_resolve.so.2'], 'ENABLE_RESOLVED'], + ['nss-systemd', '8', ['libnss_systemd.so.2'], ''], + ['os-release', '5', [], ''], + ['pam_systemd', '8', [], 'HAVE_PAM'], + ['resolved.conf', '5', ['resolved.conf.d'], 'ENABLE_RESOLVED'], + ['runlevel', '8', [], 'HAVE_UTMP'], + ['sd-bus-errors', + '3', + ['SD_BUS_ERROR_ACCESS_DENIED', + 'SD_BUS_ERROR_ADDRESS_IN_USE', + 'SD_BUS_ERROR_AUTH_FAILED', + 'SD_BUS_ERROR_BAD_ADDRESS', + 'SD_BUS_ERROR_DISCONNECTED', + 'SD_BUS_ERROR_FAILED', + 'SD_BUS_ERROR_FILE_EXISTS', + 'SD_BUS_ERROR_FILE_NOT_FOUND', + 'SD_BUS_ERROR_INCONSISTENT_MESSAGE', + 'SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED', + 'SD_BUS_ERROR_INVALID_ARGS', + 'SD_BUS_ERROR_INVALID_SIGNATURE', + 'SD_BUS_ERROR_IO_ERROR', + 'SD_BUS_ERROR_LIMITS_EXCEEDED', + 'SD_BUS_ERROR_MATCH_RULE_INVALID', + 'SD_BUS_ERROR_MATCH_RULE_NOT_FOUND', + 'SD_BUS_ERROR_NAME_HAS_NO_OWNER', + 'SD_BUS_ERROR_NOT_SUPPORTED', + 'SD_BUS_ERROR_NO_MEMORY', + 'SD_BUS_ERROR_NO_NETWORK', + 'SD_BUS_ERROR_NO_REPLY', + 'SD_BUS_ERROR_NO_SERVER', + 'SD_BUS_ERROR_PROPERTY_READ_ONLY', + 'SD_BUS_ERROR_SERVICE_UNKNOWN', + 'SD_BUS_ERROR_TIMEOUT', + 'SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN', + 'SD_BUS_ERROR_UNKNOWN_INTERFACE', + 'SD_BUS_ERROR_UNKNOWN_METHOD', + 'SD_BUS_ERROR_UNKNOWN_OBJECT', + 'SD_BUS_ERROR_UNKNOWN_PROPERTY'], + ''], + ['sd-bus', '3', [], ''], + ['sd-daemon', + '3', + ['SD_ALERT', + 'SD_CRIT', + 'SD_DEBUG', + 'SD_EMERG', + 'SD_ERR', + 'SD_INFO', + 'SD_NOTICE', + 'SD_WARNING'], + ''], + ['sd-event', '3', [], ''], + ['sd-id128', + '3', + ['SD_ID128_CONST_STR', + 'SD_ID128_FORMAT_STR', + 'SD_ID128_FORMAT_VAL', + 'SD_ID128_MAKE', + 'SD_ID128_MAKE_STR', + 'SD_ID128_NULL', + 'sd_id128_equal', + 'sd_id128_is_null', + 'sd_id128_t'], + ''], + ['sd-journal', '3', [], ''], + ['sd-login', '3', [], 'HAVE_PAM'], + ['sd_booted', '3', [], ''], + ['sd_bus_add_match', '3', [], ''], + ['sd_bus_creds_get_pid', + '3', + ['sd_bus_creds_get_audit_login_uid', + 'sd_bus_creds_get_audit_session_id', + 'sd_bus_creds_get_cgroup', + 'sd_bus_creds_get_cmdline', + 'sd_bus_creds_get_comm', + 'sd_bus_creds_get_description', + 'sd_bus_creds_get_egid', + 'sd_bus_creds_get_euid', + 'sd_bus_creds_get_exe', + 'sd_bus_creds_get_fsgid', + 'sd_bus_creds_get_fsuid', + 'sd_bus_creds_get_gid', + 'sd_bus_creds_get_owner_uid', + 'sd_bus_creds_get_ppid', + 'sd_bus_creds_get_selinux_context', + 'sd_bus_creds_get_session', + 'sd_bus_creds_get_sgid', + 'sd_bus_creds_get_slice', + 'sd_bus_creds_get_suid', + 'sd_bus_creds_get_supplementary_gids', + 'sd_bus_creds_get_tid', + 'sd_bus_creds_get_tid_comm', + 'sd_bus_creds_get_tty', + 'sd_bus_creds_get_uid', + 'sd_bus_creds_get_unique_name', + 'sd_bus_creds_get_unit', + 'sd_bus_creds_get_user_slice', + 'sd_bus_creds_get_user_unit', + 'sd_bus_creds_get_well_known_names', + 'sd_bus_creds_has_bounding_cap', + 'sd_bus_creds_has_effective_cap', + 'sd_bus_creds_has_inheritable_cap', + 'sd_bus_creds_has_permitted_cap'], + ''], + ['sd_bus_creds_new_from_pid', + '3', + ['sd_bus_creds_get_augmented_mask', + 'sd_bus_creds_get_mask', + 'sd_bus_creds_ref', + 'sd_bus_creds_unref', + 'sd_bus_creds_unrefp'], + ''], + ['sd_bus_default', + '3', + ['sd_bus_default_system', + 'sd_bus_default_user', + 'sd_bus_open', + 'sd_bus_open_system', + 'sd_bus_open_system_machine', + 'sd_bus_open_system_remote', + 'sd_bus_open_user'], + ''], + ['sd_bus_error', + '3', + ['SD_BUS_ERROR_MAKE_CONST', + 'SD_BUS_ERROR_NULL', + 'sd_bus_error_copy', + 'sd_bus_error_free', + 'sd_bus_error_get_errno', + 'sd_bus_error_has_name', + 'sd_bus_error_is_set', + 'sd_bus_error_set', + 'sd_bus_error_set_const', + 'sd_bus_error_set_errno', + 'sd_bus_error_set_errnof', + 'sd_bus_error_set_errnofv', + 'sd_bus_error_setf'], + ''], + ['sd_bus_error_add_map', + '3', + ['SD_BUS_ERROR_END', 'SD_BUS_ERROR_MAP', 'sd_bus_error_map'], + ''], + ['sd_bus_get_fd', '3', [], ''], + ['sd_bus_message_append', '3', [], ''], + ['sd_bus_message_append_array', + '3', + ['sd_bus_message_append_array_iovec', + 'sd_bus_message_append_array_memfd', + 'sd_bus_message_append_array_space'], + ''], + ['sd_bus_message_append_basic', '3', [], ''], + ['sd_bus_message_append_string_memfd', + '3', + ['sd_bus_message_append_string_iovec', 'sd_bus_message_append_string_space'], + ''], + ['sd_bus_message_append_strv', '3', [], ''], + ['sd_bus_message_get_cookie', '3', ['sd_bus_message_get_reply_cookie'], ''], + ['sd_bus_message_get_monotonic_usec', + '3', + ['sd_bus_message_get_realtime_usec', 'sd_bus_message_get_seqnum'], + ''], + ['sd_bus_message_read_basic', '3', [], ''], + ['sd_bus_negotiate_fds', + '3', + ['sd_bus_negotiate_creds', 'sd_bus_negotiate_timestamp'], + ''], + ['sd_bus_new', '3', ['sd_bus_ref', 'sd_bus_unref', 'sd_bus_unrefp'], ''], + ['sd_bus_path_encode', + '3', + ['sd_bus_path_decode', 'sd_bus_path_decode_many', 'sd_bus_path_encode_many'], + ''], + ['sd_bus_process', '3', [], ''], + ['sd_bus_request_name', '3', ['sd_bus_release_name'], ''], + ['sd_bus_track_add_name', + '3', + ['sd_bus_track_add_sender', + 'sd_bus_track_contains', + 'sd_bus_track_count', + 'sd_bus_track_count_name', + 'sd_bus_track_count_sender', + 'sd_bus_track_first', + 'sd_bus_track_next', + 'sd_bus_track_remove_name', + 'sd_bus_track_remove_sender'], + ''], + ['sd_bus_track_new', + '3', + ['sd_bus_track_get_bus', + 'sd_bus_track_get_recursive', + 'sd_bus_track_get_userdata', + 'sd_bus_track_ref', + 'sd_bus_track_set_recursive', + 'sd_bus_track_set_userdata', + 'sd_bus_track_unref', + 'sd_bus_track_unrefp'], + ''], + ['sd_event_add_child', + '3', + ['sd_event_child_handler_t', 'sd_event_source_get_child_pid'], + ''], + ['sd_event_add_defer', + '3', + ['sd_event_add_exit', 'sd_event_add_post', 'sd_event_handler_t'], + ''], + ['sd_event_add_io', + '3', + ['sd_event_io_handler_t', + 'sd_event_source', + 'sd_event_source_get_io_events', + 'sd_event_source_get_io_fd', + 'sd_event_source_get_io_revents', + 'sd_event_source_set_io_events', + 'sd_event_source_set_io_fd'], + ''], + ['sd_event_add_signal', + '3', + ['sd_event_signal_handler_t', 'sd_event_source_get_signal'], + ''], + ['sd_event_add_time', + '3', + ['sd_event_source_get_time', + 'sd_event_source_get_time_accuracy', + 'sd_event_source_get_time_clock', + 'sd_event_source_set_time', + 'sd_event_source_set_time_accuracy', + 'sd_event_time_handler_t'], + ''], + ['sd_event_exit', '3', ['sd_event_get_exit_code'], ''], + ['sd_event_get_fd', '3', [], ''], + ['sd_event_new', + '3', + ['sd_event', + 'sd_event_default', + 'sd_event_get_tid', + 'sd_event_ref', + 'sd_event_unref', + 'sd_event_unrefp'], + ''], + ['sd_event_now', '3', [], ''], + ['sd_event_run', '3', ['sd_event_loop'], ''], + ['sd_event_set_watchdog', '3', ['sd_event_get_watchdog'], ''], + ['sd_event_source_get_event', '3', [], ''], + ['sd_event_source_get_pending', '3', [], ''], + ['sd_event_source_set_description', + '3', + ['sd_event_source_get_description'], + ''], + ['sd_event_source_set_enabled', + '3', + ['SD_EVENT_OFF', + 'SD_EVENT_ON', + 'SD_EVENT_ONESHOT', + 'sd_event_source_get_enabled'], + ''], + ['sd_event_source_set_prepare', '3', [], ''], + ['sd_event_source_set_priority', + '3', + ['SD_EVENT_PRIORITY_IDLE', + 'SD_EVENT_PRIORITY_IMPORTANT', + 'SD_EVENT_PRIORITY_NORMAL', + 'sd_event_source_get_priority'], + ''], + ['sd_event_source_set_userdata', '3', ['sd_event_source_get_userdata'], ''], + ['sd_event_source_unref', + '3', + ['sd_event_source_ref', 'sd_event_source_unrefp'], + ''], + ['sd_event_wait', + '3', + ['SD_EVENT_ARMED', + 'SD_EVENT_EXITING', + 'SD_EVENT_FINISHED', + 'SD_EVENT_INITIAL', + 'SD_EVENT_PENDING', + 'SD_EVENT_PREPARING', + 'SD_EVENT_RUNNING', + 'sd_event_dispatch', + 'sd_event_get_iteration', + 'sd_event_get_state', + 'sd_event_prepare'], + ''], + ['sd_get_seats', + '3', + ['sd_get_machine_names', 'sd_get_sessions', 'sd_get_uids'], + 'HAVE_PAM'], + ['sd_id128_get_machine', + '3', + ['sd_id128_get_boot', + 'sd_id128_get_invocation', + 'sd_id128_get_machine_app_specific'], + ''], + ['sd_id128_randomize', '3', [], ''], + ['sd_id128_to_string', '3', ['sd_id128_from_string'], ''], + ['sd_is_fifo', + '3', + ['sd_is_mq', + 'sd_is_socket', + 'sd_is_socket_inet', + 'sd_is_socket_sockaddr', + 'sd_is_socket_unix', + 'sd_is_special'], + ''], + ['sd_journal_add_match', + '3', + ['sd_journal_add_conjunction', + 'sd_journal_add_disjunction', + 'sd_journal_flush_matches'], + ''], + ['sd_journal_enumerate_fields', + '3', + ['SD_JOURNAL_FOREACH_FIELD', 'sd_journal_restart_fields'], + ''], + ['sd_journal_get_catalog', '3', ['sd_journal_get_catalog_for_message_id'], ''], + ['sd_journal_get_cursor', '3', ['sd_journal_test_cursor'], ''], + ['sd_journal_get_cutoff_realtime_usec', + '3', + ['sd_journal_get_cutoff_monotonic_usec'], + ''], + ['sd_journal_get_data', + '3', + ['SD_JOURNAL_FOREACH_DATA', + 'sd_journal_enumerate_data', + 'sd_journal_get_data_threshold', + 'sd_journal_restart_data', + 'sd_journal_set_data_threshold'], + ''], + ['sd_journal_get_fd', + '3', + ['SD_JOURNAL_APPEND', + 'SD_JOURNAL_INVALIDATE', + 'SD_JOURNAL_NOP', + 'sd_journal_get_events', + 'sd_journal_get_timeout', + 'sd_journal_process', + 'sd_journal_reliable_fd', + 'sd_journal_wait'], + ''], + ['sd_journal_get_realtime_usec', '3', ['sd_journal_get_monotonic_usec'], ''], + ['sd_journal_get_usage', '3', [], ''], + ['sd_journal_has_runtime_files', '3', ['sd_journal_has_persistent_files'], ''], + ['sd_journal_next', + '3', + ['SD_JOURNAL_FOREACH', + 'SD_JOURNAL_FOREACH_BACKWARDS', + 'sd_journal_next_skip', + 'sd_journal_previous', + 'sd_journal_previous_skip'], + ''], + ['sd_journal_open', + '3', + ['SD_JOURNAL_CURRENT_USER', + 'SD_JOURNAL_LOCAL_ONLY', + 'SD_JOURNAL_OS_ROOT', + 'SD_JOURNAL_RUNTIME_ONLY', + 'SD_JOURNAL_SYSTEM', + 'sd_journal', + 'sd_journal_close', + 'sd_journal_open_directory', + 'sd_journal_open_directory_fd', + 'sd_journal_open_files', + 'sd_journal_open_files_fd'], + ''], + ['sd_journal_print', + '3', + ['SD_JOURNAL_SUPPRESS_LOCATION', + 'sd_journal_perror', + 'sd_journal_printv', + 'sd_journal_send', + 'sd_journal_sendv'], + ''], + ['sd_journal_query_unique', + '3', + ['SD_JOURNAL_FOREACH_UNIQUE', + 'sd_journal_enumerate_unique', + 'sd_journal_restart_unique'], + ''], + ['sd_journal_seek_head', + '3', + ['sd_journal_seek_cursor', + 'sd_journal_seek_monotonic_usec', + 'sd_journal_seek_realtime_usec', + 'sd_journal_seek_tail'], + ''], + ['sd_journal_stream_fd', '3', [], ''], + ['sd_listen_fds', + '3', + ['SD_LISTEN_FDS_START', 'sd_listen_fds_with_names'], + ''], + ['sd_login_monitor_new', + '3', + ['sd_login_monitor', + 'sd_login_monitor_flush', + 'sd_login_monitor_get_events', + 'sd_login_monitor_get_fd', + 'sd_login_monitor_get_timeout', + 'sd_login_monitor_unref', + 'sd_login_monitor_unrefp'], + 'HAVE_PAM'], + ['sd_machine_get_class', '3', ['sd_machine_get_ifindices'], ''], + ['sd_notify', + '3', + ['sd_notifyf', 'sd_pid_notify', 'sd_pid_notify_with_fds', 'sd_pid_notifyf'], + ''], + ['sd_pid_get_session', + '3', + ['sd_peer_get_cgroup', + 'sd_peer_get_machine_name', + 'sd_peer_get_owner_uid', + 'sd_peer_get_session', + 'sd_peer_get_slice', + 'sd_peer_get_unit', + 'sd_peer_get_user_slice', + 'sd_peer_get_user_unit', + 'sd_pid_get_cgroup', + 'sd_pid_get_machine_name', + 'sd_pid_get_owner_uid', + 'sd_pid_get_slice', + 'sd_pid_get_unit', + 'sd_pid_get_user_slice', + 'sd_pid_get_user_unit'], + 'HAVE_PAM'], + ['sd_seat_get_active', + '3', + ['sd_seat_can_graphical', + 'sd_seat_can_multi_session', + 'sd_seat_can_tty', + 'sd_seat_get_sessions'], + 'HAVE_PAM'], + ['sd_session_is_active', + '3', + ['sd_session_get_class', + 'sd_session_get_desktop', + 'sd_session_get_display', + 'sd_session_get_remote_host', + 'sd_session_get_remote_user', + 'sd_session_get_seat', + 'sd_session_get_service', + 'sd_session_get_state', + 'sd_session_get_tty', + 'sd_session_get_type', + 'sd_session_get_uid', + 'sd_session_get_vt', + 'sd_session_is_remote'], + 'HAVE_PAM'], + ['sd_uid_get_state', + '3', + ['sd_uid_get_display', + 'sd_uid_get_seats', + 'sd_uid_get_sessions', + 'sd_uid_is_on_seat'], + 'HAVE_PAM'], + ['sd_watchdog_enabled', '3', [], ''], + ['shutdown', '8', [], ''], + ['sysctl.d', '5', [], ''], + ['systemctl', '1', [], ''], + ['systemd-analyze', '1', [], ''], + ['systemd-ask-password-console.service', + '8', + ['systemd-ask-password-console.path', + 'systemd-ask-password-wall.path', + 'systemd-ask-password-wall.service'], + ''], + ['systemd-ask-password', '1', [], ''], + ['systemd-backlight@.service', '8', ['systemd-backlight'], 'ENABLE_BACKLIGHT'], + ['systemd-binfmt.service', '8', ['systemd-binfmt'], 'ENABLE_BINFMT'], + ['systemd-cat', '1', [], ''], + ['systemd-cgls', '1', [], ''], + ['systemd-cgtop', '1', [], ''], + ['systemd-coredump', + '8', + ['systemd-coredump.socket', 'systemd-coredump@.service'], + 'ENABLE_COREDUMP'], + ['systemd-cryptsetup-generator', '8', [], 'HAVE_LIBCRYPTSETUP'], + ['systemd-cryptsetup@.service', + '8', + ['systemd-cryptsetup'], + 'HAVE_LIBCRYPTSETUP'], + ['systemd-debug-generator', '8', [], ''], + ['systemd-delta', '1', [], ''], + ['systemd-detect-virt', '1', [], ''], + ['systemd-environment-d-generator', + '8', + ['30-systemd-environment-d-generator'], + ''], + ['systemd-escape', '1', [], ''], + ['systemd-firstboot', '1', ['systemd-firstboot.service'], 'ENABLE_FIRSTBOOT'], + ['systemd-fsck@.service', + '8', + ['systemd-fsck', 'systemd-fsck-root.service'], + ''], + ['systemd-fstab-generator', '8', [], ''], + ['systemd-getty-generator', '8', [], ''], + ['systemd-gpt-auto-generator', '8', [], ''], + ['systemd-halt.service', + '8', + ['systemd-kexec.service', + 'systemd-poweroff.service', + 'systemd-reboot.service', + 'systemd-shutdown'], + ''], + ['systemd-hibernate-resume-generator', '8', [], ''], + ['systemd-hibernate-resume@.service', '8', ['systemd-hibernate-resume'], ''], + ['systemd-hostnamed.service', '8', ['systemd-hostnamed'], 'ENABLE_HOSTNAMED'], + ['systemd-hwdb', '8', [], 'ENABLE_HWDB'], + ['systemd-importd.service', '8', ['systemd-importd'], 'ENABLE_IMPORTD'], + ['systemd-inhibit', '1', [], ''], + ['systemd-initctl.service', + '8', + ['systemd-initctl', 'systemd-initctl.socket'], + ''], + ['systemd-journal-gatewayd.service', + '8', + ['systemd-journal-gatewayd', 'systemd-journal-gatewayd.socket'], + 'HAVE_MICROHTTPD'], + ['systemd-journal-remote', '8', [], 'HAVE_MICROHTTPD'], + ['systemd-journal-upload', '8', [], 'HAVE_MICROHTTPD'], + ['systemd-journald.service', + '8', + ['systemd-journald', + 'systemd-journald-audit.socket', + 'systemd-journald-dev-log.socket', + 'systemd-journald.socket'], + ''], + ['systemd-localed.service', '8', ['systemd-localed'], 'ENABLE_LOCALED'], + ['systemd-logind.service', '8', ['systemd-logind'], 'ENABLE_LOGIND'], + ['systemd-machine-id-commit.service', '8', [], ''], + ['systemd-machine-id-setup', '1', [], ''], + ['systemd-machined.service', '8', ['systemd-machined'], 'ENABLE_MACHINED'], + ['systemd-modules-load.service', '8', ['systemd-modules-load'], 'HAVE_KMOD'], + ['systemd-mount', '1', ['systemd-umount'], ''], + ['systemd-networkd-wait-online.service', + '8', + ['systemd-networkd-wait-online'], + 'ENABLE_NETWORKD'], + ['systemd-networkd.service', '8', ['systemd-networkd'], 'ENABLE_NETWORKD'], + ['systemd-notify', '1', [], ''], + ['systemd-nspawn', '1', [], ''], + ['systemd-path', '1', [], ''], + ['systemd-quotacheck.service', + '8', + ['systemd-quotacheck'], + 'ENABLE_QUOTACHECK'], + ['systemd-random-seed.service', + '8', + ['systemd-random-seed'], + 'ENABLE_RANDOMSEED'], + ['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''], + ['systemd-resolve', '1', [], ''], + ['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVED'], + ['systemd-rfkill.service', + '8', + ['systemd-rfkill', 'systemd-rfkill.socket'], + 'ENABLE_RFKILL'], + ['systemd-run', '1', [], ''], + ['systemd-sleep.conf', '5', ['sleep.conf.d'], ''], + ['systemd-socket-activate', '1', [], ''], + ['systemd-socket-proxyd', '8', [], ''], + ['systemd-suspend.service', + '8', + ['systemd-hibernate.service', + 'systemd-hybrid-sleep.service', + 'systemd-sleep'], + ''], + ['systemd-sysctl.service', '8', ['systemd-sysctl'], ''], + ['systemd-system-update-generator', '8', [], ''], + ['systemd-system.conf', + '5', + ['system.conf.d', 'systemd-user.conf', 'user.conf.d'], + ''], + ['systemd-sysusers', '8', ['systemd-sysusers.service'], ''], + ['systemd-sysv-generator', '8', [], 'HAVE_SYSV_COMPAT'], + ['systemd-timedated.service', '8', ['systemd-timedated'], 'ENABLE_TIMEDATED'], + ['systemd-timesyncd.service', '8', ['systemd-timesyncd'], 'ENABLE_TIMESYNCD'], + ['systemd-tmpfiles', + '8', + ['systemd-tmpfiles-clean.service', + 'systemd-tmpfiles-clean.timer', + 'systemd-tmpfiles-setup-dev.service', + 'systemd-tmpfiles-setup.service'], + ''], + ['systemd-tty-ask-password-agent', '1', [], ''], + ['systemd-udevd.service', + '8', + ['systemd-udevd', + 'systemd-udevd-control.socket', + 'systemd-udevd-kernel.socket'], + ''], + ['systemd-update-done.service', '8', ['systemd-update-done'], ''], + ['systemd-update-utmp.service', + '8', + ['systemd-update-utmp', 'systemd-update-utmp-runlevel.service'], + 'HAVE_UTMP'], + ['systemd-user-sessions.service', '8', ['systemd-user-sessions'], 'HAVE_PAM'], + ['systemd-vconsole-setup.service', + '8', + ['systemd-vconsole-setup'], + 'ENABLE_VCONSOLE'], + ['systemd-veritysetup-generator', '8', [], 'HAVE_LIBCRYPTSETUP'], + ['systemd-veritysetup@.service', + '8', + ['systemd-veritysetup'], + 'HAVE_LIBCRYPTSETUP'], + ['systemd-volatile-root.service', '8', ['systemd-volatile-root'], ''], + ['systemd', '1', ['init'], ''], + ['systemd.automount', '5', [], ''], + ['systemd.device', '5', [], ''], + ['systemd.environment-generator', '7', [], ''], + ['systemd.exec', '5', [], ''], + ['systemd.generator', '7', [], ''], + ['systemd.journal-fields', '7', [], ''], + ['systemd.kill', '5', [], ''], + ['systemd.link', '5', [], ''], + ['systemd.mount', '5', [], ''], + ['systemd.netdev', '5', [], 'ENABLE_NETWORKD'], + ['systemd.network', '5', [], 'ENABLE_NETWORKD'], + ['systemd.nspawn', '5', [], ''], + ['systemd.offline-updates', '7', [], ''], + ['systemd.path', '5', [], ''], + ['systemd.preset', '5', [], ''], + ['systemd.resource-control', '5', [], ''], + ['systemd.scope', '5', [], ''], + ['systemd.service', '5', [], ''], + ['systemd.slice', '5', [], ''], + ['systemd.socket', '5', [], ''], + ['systemd.special', '7', [], ''], + ['systemd.swap', '5', [], ''], + ['systemd.target', '5', [], ''], + ['systemd.time', '7', [], ''], + ['systemd.timer', '5', [], ''], + ['systemd.unit', '5', [], ''], + ['sysusers.d', '5', [], 'ENABLE_SYSUSERS'], + ['telinit', '8', [], ''], + ['timedatectl', '1', [], 'ENABLE_TIMEDATED'], + ['timesyncd.conf', '5', ['timesyncd.conf.d'], 'ENABLE_TIMESYNCD'], + ['tmpfiles.d', '5', [], ''], + ['udev', '7', [], ''], + ['udev.conf', '5', [], ''], + ['udev_device_get_syspath', + '3', + ['udev_device_get_action', + 'udev_device_get_devnode', + 'udev_device_get_devnum', + 'udev_device_get_devpath', + 'udev_device_get_devtype', + 'udev_device_get_driver', + 'udev_device_get_is_initialized', + 'udev_device_get_parent', + 'udev_device_get_parent_with_subsystem_devtype', + 'udev_device_get_subsystem', + 'udev_device_get_sysname', + 'udev_device_get_sysnum', + 'udev_device_get_udev'], + ''], + ['udev_device_has_tag', + '3', + ['udev_device_get_devlinks_list_entry', + 'udev_device_get_properties_list_entry', + 'udev_device_get_property_value', + 'udev_device_get_sysattr_list_entry', + 'udev_device_get_sysattr_value', + 'udev_device_get_tags_list_entry', + 'udev_device_set_sysattr_value'], + ''], + ['udev_device_new_from_syspath', + '3', + ['udev_device_new_from_device_id', + 'udev_device_new_from_devnum', + 'udev_device_new_from_environment', + 'udev_device_new_from_subsystem_sysname', + 'udev_device_ref', + 'udev_device_unref'], + ''], + ['udev_enumerate_add_match_subsystem', + '3', + ['udev_enumerate_add_match_is_initialized', + 'udev_enumerate_add_match_parent', + 'udev_enumerate_add_match_property', + 'udev_enumerate_add_match_sysattr', + 'udev_enumerate_add_match_sysname', + 'udev_enumerate_add_match_tag', + 'udev_enumerate_add_nomatch_subsystem', + 'udev_enumerate_add_nomatch_sysattr'], + ''], + ['udev_enumerate_new', + '3', + ['udev_enumerate_ref', 'udev_enumerate_unref'], + ''], + ['udev_enumerate_scan_devices', + '3', + ['udev_enumerate_add_syspath', + 'udev_enumerate_get_list_entry', + 'udev_enumerate_get_udev', + 'udev_enumerate_scan_subsystems'], + ''], + ['udev_list_entry', + '3', + ['udev_list_entry_get_by_name', + 'udev_list_entry_get_name', + 'udev_list_entry_get_next', + 'udev_list_entry_get_value'], + ''], + ['udev_monitor_filter_update', + '3', + ['udev_monitor_filter_add_match_subsystem_devtype', + 'udev_monitor_filter_add_match_tag', + 'udev_monitor_filter_remove'], + ''], + ['udev_monitor_new_from_netlink', + '3', + ['udev_monitor_ref', 'udev_monitor_unref'], + ''], + ['udev_monitor_receive_device', + '3', + ['udev_monitor_enable_receiving', + 'udev_monitor_get_fd', + 'udev_monitor_get_udev', + 'udev_monitor_set_receive_buffer_size'], + ''], + ['udev_new', '3', ['udev_ref', 'udev_unref'], ''], + ['udevadm', '8', [], ''], + ['vconsole.conf', '5', [], 'ENABLE_VCONSOLE'] +] +# Really, do not edit. diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000..71cc431157 --- /dev/null +++ b/meson.build @@ -0,0 +1,2354 @@ +project('systemd', 'c', + version : '233', + license : 'LGPLv2+', + default_options: [ + 'c_std=gnu99', + 'prefix=/usr', + 'sysconfdir=/etc', + 'localstatedir=/var', + ], + meson_version : '>= 0.40', + ) + +# We need the same data in three different formats, ugh! +# Also, for hysterical reasons, we use different variable +# names, sometimes. Not all variables are included in every +# set. Ugh, ugh, ugh! +conf = configuration_data() +conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version()) +conf.set_quoted('PACKAGE_VERSION', meson.project_version()) + +substs = configuration_data() +substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd') +substs.set('PACKAGE_VERSION', meson.project_version()) + +m4_defines = [] + +##################################################################### + +rootprefixdir = get_option('rootprefix') +if get_option('split-usr') + conf.set('HAVE_SPLIT_USR', 1) + rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/' +else + rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr' +endif + +sysvinit_path = get_option('sysvinit-path') +sysvrcnd_path = get_option('sysvrcnd-path') +if sysvinit_path != '' or sysvrcnd_path != '' + conf.set('HAVE_SYSV_COMPAT', 1, + description : 'SysV init scripts and rcN.d links are supported') + m4_defines += ['-DHAVE_SYSV_COMPAT'] +endif + +# join_paths ignore the preceding arguments if an absolute component is +# encountered, so this should canonicalize various paths when they are +# absolute or relative. +prefixdir = get_option('prefix') +if not prefixdir.startswith('/') + error('Prefix is not absolute: "@0@"'.format(prefixdir)) +endif +bindir = join_paths(prefixdir, get_option('bindir')) +libdir = join_paths(prefixdir, get_option('libdir')) +sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) +includedir = join_paths(prefixdir, get_option('includedir')) +datadir = join_paths(prefixdir, get_option('datadir')) +localstatedir = join_paths('/', get_option('localstatedir')) + +rootbindir = join_paths(rootprefixdir, 'bin') +rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd') + +rootlibdir = get_option('rootlibdir') +if rootlibdir == '' + rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) +endif + +# Dirs of external packages +pkgconfigdatadir = join_paths(datadir, 'pkgconfig') +pkgconfiglibdir = join_paths(libdir, 'pkgconfig') +polkitpolicydir = join_paths(datadir, 'polkit-1/actions') +polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d') +polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d') +varlogdir = join_paths(localstatedir, 'log') +xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d') +rpmmacrosdir = get_option('rpmmacrosdir') + +# Our own paths +pkgdatadir = join_paths(datadir, 'systemd') +environmentdir = join_paths(prefixdir, 'lib/environment.d') +pkgsysconfdir = join_paths(sysconfdir, 'systemd') +userunitdir = join_paths(prefixdir, 'lib/systemd/user') +userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset') +tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d') +sysusersdir = join_paths(prefixdir, 'lib/sysusers.d') +sysctldir = join_paths(prefixdir, 'lib/sysctl.d') +binfmtdir = join_paths(prefixdir, 'lib/binfmt.d') +modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d') +networkdir = join_paths(rootprefixdir, 'lib/systemd/network') +pkgincludedir = join_paths(includedir, 'systemd') +systemgeneratordir = join_paths(rootlibexecdir, 'system-generators') +usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators') +systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators') +userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators') +systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown') +systemsleepdir = join_paths(rootlibexecdir, 'system-sleep') +systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system') +systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset') +udevlibexecdir = join_paths(rootprefixdir, 'lib/udev') +udevhomedir = udevlibexecdir +udevrulesdir = join_paths(udevlibexecdir, 'rules.d') +udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d') +catalogdir = join_paths(prefixdir, 'lib/systemd/catalog') +kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d') +factorydir = join_paths(datadir, 'factory') +docdir = join_paths(datadir, 'doc/systemd') +bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi') +testsdir = join_paths(prefixdir, 'lib/systemd/tests') +systemdstatedir = join_paths(localstatedir, 'lib/systemd') +catalogstatedir = join_paths(systemdstatedir, 'catalog') +randomseeddir = join_paths(localstatedir, 'lib/systemd') + +dbuspolicydir = get_option('dbuspolicydir') +if dbuspolicydir == '' + dbuspolicydir = join_paths(datadir, 'dbus-1/system.d') +endif + +dbussessionservicedir = get_option('dbussessionservicedir') +if dbussessionservicedir == '' + dbussessionservicedir = join_paths(datadir, 'dbus-1/services') +endif + +dbussystemservicedir = get_option('dbussystemservicedir') +if dbussystemservicedir == '' + dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services') +endif + +pamlibdir = get_option('pamlibdir') +if pamlibdir == '' + pamlibdir = join_paths(rootlibdir, 'security') +endif + +pamconfdir = get_option('pamconfdir') +if pamconfdir == '' + pamconfdir = join_paths(sysconfdir, 'pam.d') +endif + +conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) +conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system')) +conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir) +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_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')) +conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database')) +conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent')) +conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd')) +conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck')) +conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown')) +conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep')) +conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl')) +conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent')) +conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge')) +conf.set_quoted('ROOTPREFIX', rootprefixdir) +conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) +conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) +conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup')) +conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir) +conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir) +conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir) +conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir) +conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) +conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) +conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) +conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) +conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) +conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) +conf.set_quoted('LIBDIR', libdir) +conf.set_quoted('ROOTLIBDIR', rootlibdir) +conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) +conf.set_quoted('BOOTLIBDIR', bootlibdir) +conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull')) +conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import')) +conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export')) +conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg')) +conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg')) +conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd')) + +conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) +conf.set_quoted('ABS_SRC_DIR', meson.source_root()) + +substs.set('prefix', prefixdir) +substs.set('exec_prefix', prefixdir) +substs.set('libdir', libdir) +substs.set('rootlibdir', rootlibdir) +substs.set('includedir', includedir) +substs.set('pkgsysconfdir', pkgsysconfdir) +substs.set('bindir', bindir) +substs.set('rootbindir', rootbindir) +substs.set('rootlibexecdir', rootlibexecdir) +substs.set('systemunitdir', systemunitdir) +substs.set('userunitdir', userunitdir) +substs.set('systempresetdir', systempresetdir) +substs.set('userpresetdir', userpresetdir) +substs.set('udevhwdbdir', udevhwdbdir) +substs.set('udevrulesdir', udevrulesdir) +substs.set('udevlibexecdir', udevlibexecdir) +substs.set('catalogdir', catalogdir) +substs.set('tmpfilesdir', tmpfilesdir) +substs.set('sysusersdir', sysusersdir) +substs.set('sysctldir', sysctldir) +substs.set('binfmtdir', binfmtdir) +substs.set('modulesloaddir', modulesloaddir) +substs.set('systemgeneratordir', systemgeneratordir) +substs.set('usergeneratordir', usergeneratordir) +substs.set('systemenvgeneratordir', systemenvgeneratordir) +substs.set('userenvgeneratordir', userenvgeneratordir) +substs.set('systemshutdowndir', systemshutdowndir) +substs.set('systemsleepdir', systemsleepdir) +substs.set('VARLOGDIR', varlogdir) +substs.set('CERTIFICATEROOT', get_option('certificate-root')) +substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl')) +substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) +substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path) +substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) +substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local')) +substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) + +##################################################################### + +cc = meson.get_compiler('c') +pkgconfig = import('pkgconfig') +check_compilation_sh = find_program('tools/meson-check-compilation.sh') + +foreach arg : ['-Wundef', + '-Wlogical-op', + '-Wmissing-include-dirs', + '-Wold-style-definition', + '-Wpointer-arith', + '-Winit-self', + '-Wdeclaration-after-statement', + '-Wfloat-equal', + '-Wsuggest-attribute=noreturn', + '-Werror=missing-prototypes', + '-Werror=implicit-function-declaration', + '-Werror=missing-declarations', + '-Werror=return-type', + '-Werror=incompatible-pointer-types', + '-Werror=format=2', + '-Wstrict-prototypes', + '-Wredundant-decls', + '-Wmissing-noreturn', + '-Wshadow', + '-Wendif-labels', + '-Wstrict-aliasing=2', + '-Wwrite-strings', + '-Wno-unused-parameter', + '-Wno-missing-field-initializers', + '-Wno-unused-result', + '-Wno-format-signedness', + '-Werror=overflow', + '-Wdate-time', + '-Wnested-externs', + '-ffast-math', + '-fno-common', + '-fdiagnostics-show-option', + '-fno-strict-aliasing', + '-fvisibility=hidden', + '-fstack-protector', + '-fstack-protector-strong', + '-fPIE', + '--param=ssp-buffer-size=4', + ] + if cc.has_argument(arg) + add_project_arguments(arg, language : 'c') + endif +endforeach + +if cc.compiles(' + #include + #include + typedef uint64_t usec_t; + usec_t now(clockid_t clock); + int main(void) { + struct timespec now; + return 0; + } +', name : '-Werror=shadow with local shadowing') + add_project_arguments('-Werror=shadow', language : 'c') +endif + +if cc.get_id() == 'clang' + foreach arg : ['-Wno-typedef-redefinition', + '-Wno-gnu-variable-sized-type-not-at-end', + ] + if cc.has_argument(arg, + name : '@0@ is supported'.format(arg)) + add_project_arguments(arg, language : 'c') + endif + endforeach +endif + +link_test_c = files('tools/meson-link-test.c') + +# --as-needed and --no-undefined are provided by meson by default, +# run mesonconf to see what is enabled +foreach arg : ['-Wl,-z,relro', + '-Wl,-z,now', + '-pie', + '-Wl,-fuse-ld=gold', + ] + + have = run_command(check_compilation_sh, + cc.cmd_array(), '-x', 'c', arg, + '-include', link_test_c).returncode() == 0 + message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no')) + if have + add_project_link_arguments(arg, language : 'c') + endif +endforeach + +if get_option('buildtype') != 'debug' + foreach arg : ['-ffunction-sections', + '-fdata-sections'] + if cc.has_argument(arg, + name : '@0@ is supported'.format(arg)) + add_project_arguments(arg, language : 'c') + endif + endforeach + + foreach arg : ['-Wl,--gc-sections'] + have = run_command(check_compilation_sh, + cc.cmd_array(), '-x', 'c', arg, + '-include', link_test_c).returncode() == 0 + message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no')) + if have + add_project_link_arguments(arg, language : 'c') + endif + endforeach +endif + +cpp = ' '.join(cc.cmd_array()) + ' -E' + +##################################################################### +# compilation result tests + +conf.set('_GNU_SOURCE', 1) +conf.set('__SANE_USERSPACE_TYPES__', 1) + +conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include ')) +conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include ')) +conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include ')) +conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include ')) +conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include ')) +conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include ')) +conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include ')) + +decl_headers = ''' +#include +#include +''' +# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail + +foreach decl : ['char16_t', + 'char32_t', + 'key_serial_t', + 'struct ethtool_link_settings', + ] + if cc.sizeof(decl, prefix : decl_headers) > 0 + # We get -1 if the size cannot be determined + conf.set('HAVE_' + decl.underscorify().to_upper(), 1) + endif +endforeach + +foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], + ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], + ['IFLA_VRF_TABLE', 'linux/if_link.h'], + ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'], + ['IFLA_IPVLAN_MODE', 'linux/if_link.h'], + ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'], + ['IFLA_BOND_AD_INFO', 'linux/if_link.h'], + ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'], + ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'], + ['IFLA_VXLAN_GPE', 'linux/if_link.h'], + # if_tunnel.h is buggy and cannot be included on its own + ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include '], + ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include '], + ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include '], + ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'], + ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'], + ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'], + ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'], + ['NDA_IFINDEX', 'linux/neighbour.h'], + ['IFA_FLAGS', 'linux/if_addr.h'], + ['LO_FLAGS_PARTSCAN', 'linux/loop.h'], + ] + prefix = decl.length() > 2 ? decl[2] : '' + have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix) + conf.set10('HAVE_DECL_' + decl[0], have) +endforeach + +skip = false +foreach ident : ['secure_getenv', '__secure_getenv'] + if not skip and cc.has_function(ident) + conf.set('HAVE_' + ident.to_upper(), 1) + skip = true + endif +endforeach + +foreach ident : [ + ['memfd_create', '''#include '''], + ['gettid', '''#include '''], + ['pivot_root', '''#include '''], # no known header declares pivot_root + ['name_to_handle_at', '''#define _GNU_SOURCE + #include + #include + #include '''], + ['setns', '''#define _GNU_SOURCE + #include '''], + ['renameat2', '''#include '''], + ['kcmp', '''#include '''], + ['keyctl', '''#include + #include '''], + ['copy_file_range', '''#include + #include '''], + ['explicit_bzero' , '''#include '''], +] + + have = cc.has_function(ident[0], prefix : ident[1]) + conf.set10('HAVE_DECL_' + ident[0].to_upper(), have) +endforeach + +if cc.has_function('getrandom', prefix : '''#include ''') + conf.set('USE_SYS_RANDOM_H', 1) + conf.set10('HAVE_DECL_GETRANDOM', 1) +else + have = cc.has_function('getrandom', prefix : '''#include ''') + conf.set10('HAVE_DECL_GETRANDOM', have) +endif + +##################################################################### + +sed = find_program('sed') +grep = find_program('grep') +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@' +test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh') +splash_bmp = files('test/splash.bmp') + +# if -Dxxx-path option is found, use that. Otherwise, check in $PATH, +# /usr/sbin, /sbin, and fall back to the default from middle column. +progs = [['telinit', '/lib/sysvinit/telinit'], + ['quotaon', '/usr/sbin/quotaon' ], + ['quotacheck', '/usr/sbin/quotacheck' ], + ['kill', '/usr/bin/kill' ], + ['kmod', '/usr/bin/kmod' ], + ['kexec', '/usr/sbin/kexec' ], + ['sulogin', '/usr/sbin/sulogin' ], + ['mount', '/usr/bin/mount', 'MOUNT_PATH'], + ['umount', '/usr/bin/umount', 'UMOUNT_PATH'], + ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'], + ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'], + ] +foreach prog : progs + path = get_option(prog[0] + '-path') + if path != '' + message('Using @1@ for @0@'.format(prog[0], path)) + else + exe = find_program(prog[0], + '/usr/sbin/' + prog[0], + '/sbin/' + prog[0], + required: false) + path = exe.found() ? exe.path() : prog[1] + endif + name = prog.length() > 2 ? prog[2] : prog[0].to_upper() + conf.set_quoted(name, path) + substs.set(name, path) +endforeach + +if run_command('ln', '--relative', '--help').returncode() != 0 + error('ln does not support --relative') +endif + +############################################################ + +gperf = find_program('gperf') + +gperf_test_format = ''' +#include +const char * in_word_set(const char *, @0@); +@1@ +''' +gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C' +gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path())) +gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) +if cc.compiles(gperf_test) + gperf_len_type = 'size_t' +else + gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout()) + if cc.compiles(gperf_test) + gperf_len_type = 'unsigned' + else + error('unable to determine gperf len type') + endif +endif +message('gperf len type is @0@'.format(gperf_len_type)) +conf.set('GPERF_LEN_TYPE', gperf_len_type, + description : 'The type of gperf "len" parameter') + +############################################################ + +if not cc.has_header('sys/capability.h') + error('POSIX caps headers not found') +endif +foreach header : ['linux/btrfs.h', + 'linux/memfd.h', + 'linux/vm_sockets.h', + 'valgrind/memcheck.h', + 'valgrind/valgrind.h', + ] + if cc.has_header(header) + conf.set('HAVE_' + header.underscorify().to_upper(), 1) + endif +endforeach + +############################################################ + +conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname')) + +default_hierarchy = get_option('default-hierarchy') +conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy, + description : 'default cgroup hierarchy as string') +if default_hierarchy == 'legacy' + conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE') +elif default_hierarchy == 'hybrid' + conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD') +else + conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL') +endif + +time_epoch = get_option('time-epoch') +if time_epoch == '' + NEWS = files('NEWS') + time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout() +endif +time_epoch = time_epoch.to_int() +conf.set('TIME_EPOCH', time_epoch) + +system_uid_max = get_option('system-uid-max') +if system_uid_max == '' + system_uid_max = run_command( + awk, + 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }', + '/etc/login.defs').stdout() +endif +system_uid_max = system_uid_max.to_int() +conf.set('SYSTEM_UID_MAX', system_uid_max) +substs.set('systemuidmax', system_uid_max) +message('maximum system UID is @0@'.format(system_uid_max)) + +conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user')) +conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group')) + +system_gid_max = get_option('system-gid-max') +if system_gid_max == '' + system_gid_max = run_command( + awk, + 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }', + '/etc/login.defs').stdout() +endif +system_gid_max = system_gid_max.to_int() +conf.set('SYSTEM_GID_MAX', system_gid_max) +substs.set('systemgidmax', system_gid_max) +message('maximum system GID is @0@'.format(system_gid_max)) + +tty_gid = get_option('tty-gid') +conf.set('TTY_GID', tty_gid) +substs.set('TTY_GID', tty_gid) + +if get_option('adm-group') + m4_defines += ['-DENABLE_ADM_GROUP'] +endif + +if get_option('wheel-group') + m4_defines += ['-DENABLE_WHEEL_GROUP'] +endif + +substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode')) + +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) + +conf.set_quoted('DNS_SERVERS', get_option('dns-servers')) +substs.set('DNS_SERVERS', get_option('dns-servers')) + +conf.set_quoted('NTP_SERVERS', get_option('ntp-servers')) +substs.set('NTP_SERVERS', get_option('ntp-servers')) + +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) + +substs.set('SUSHELL', get_option('debug-shell')) +substs.set('DEBUGTTY', get_option('debug-tty')) + +##################################################################### + +threads = dependency('threads') +librt = cc.find_library('rt') +libm = cc.find_library('m') +libdl = cc.find_library('dl') +libcrypt = cc.find_library('crypt') + +libcap = dependency('libcap') +libmount = dependency('mount', + version : '>= 2.27') + +want_seccomp = get_option('seccomp') +if want_seccomp != 'false' + libseccomp = dependency('libseccomp', + required : want_seccomp == 'true') + if libseccomp.found() + conf.set('HAVE_SECCOMP', 1) + m4_defines += ['-DHAVE_SECCOMP'] + endif +else + libseccomp = [] +endif + +want_selinux = get_option('selinux') +if want_selinux != 'false' + libselinux = dependency('libselinux', + version : '>= 2.1.9', + required : want_selinux == 'true') + if libselinux.found() + conf.set('HAVE_SELINUX', 1) + m4_defines += ['-DHAVE_SELINUX'] + endif +else + libselinux = [] +endif + +want_apparmor = get_option('apparmor') +if want_apparmor != 'false' + libapparmor = dependency('libapparmor', + required : want_apparmor == 'true') + if libapparmor.found() + conf.set('HAVE_APPARMOR', 1) + m4_defines += ['-DHAVE_APPARMOR'] + endif +else + libapparmor = [] +endif + +smack_run_label = get_option('smack-run-label') +if smack_run_label != '' + conf.set_quoted('SMACK_RUN_LABEL', smack_run_label) + m4_defines += ['-DHAVE_SMACK_RUN_LABEL'] +endif + +want_polkit = get_option('polkit') +install_polkit = false +install_polkit_pkla = false +if want_polkit != 'false' + conf.set('ENABLE_POLKIT', 1) + install_polkit = true + + libpolkit = dependency('polkit-gobject-1', + required : false) + if libpolkit.found() and libpolkit.version().version_compare('< 0.106') + message('Old polkit detected, will install pkla files') + install_polkit_pkla = true + endif +endif + +want_acl = get_option('acl') +if want_acl != 'false' + libacl = cc.find_library('acl', required : want_acl == 'true') + if libacl.found() + conf.set('HAVE_ACL', 1) + m4_defines += ['-DHAVE_ACL'] + endif +else + libacl = [] +endif + +want_audit = get_option('audit') +if want_audit != 'false' + libaudit = dependency('audit', required : want_audit == 'true') + if libaudit.found() + conf.set('HAVE_AUDIT', 1) + endif +else + libaudit = [] +endif + +want_blkid = get_option('blkid') +if want_blkid != 'false' + libblkid = dependency('blkid', required : want_blkid == 'true') + if libblkid.found() + conf.set('HAVE_BLKID', 1) + endif +else + libblkid = [] +endif + +want_kmod = get_option('kmod') +if want_kmod != 'false' + libkmod = dependency('libkmod', + version : '>= 15', + required : want_kmod == 'true') + if libkmod.found() + conf.set('HAVE_KMOD', 1) + endif +else + libkmod = [] +endif + +want_pam = get_option('pam') +if want_pam != 'false' + libpam = cc.find_library('pam', required : want_pam == 'true') + libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') + if libpam.found() and libpam_misc.found() + conf.set('HAVE_PAM', 1) + m4_defines += ['-DHAVE_PAM'] + endif +else + libpam = [] + libpam_misc = [] +endif + +want_microhttpd = get_option('microhttpd') +if want_microhttpd != 'false' + libmicrohttpd = dependency('libmicrohttpd', + version : '>= 0.9.33', + required : want_microhttpd == 'true') + if libmicrohttpd.found() + conf.set('HAVE_MICROHTTPD', 1) + m4_defines += ['-DHAVE_MICROHTTPD'] + endif +else + libmicrohttpd = [] +endif + +want_libcryptsetup = get_option('libcryptsetup') +if want_libcryptsetup != 'false' + libcryptsetup = dependency('libcryptsetup', + version : '>= 1.6.0', + required : want_libcryptsetup == 'true') + if libcryptsetup.found() + conf.set('HAVE_LIBCRYPTSETUP', 1) + endif +else + libcryptsetup = [] +endif + +want_libcurl = get_option('libcurl') +if want_libcurl != 'false' + libcurl = dependency('libcurl', + version : '>= 7.32.0', + required : want_libcurl == 'true') + if libcurl.found() + conf.set('HAVE_LIBCURL', 1) + m4_defines += ['-DHAVE_LIBCURL'] + endif +else + libcurl = [] +endif + +want_libidn = get_option('libidn') +if want_libidn != 'false' + libidn = dependency('libidn', + required : want_libidn == 'true') + if libidn.found() + conf.set('HAVE_LIBIDN', 1) + m4_defines += ['-DHAVE_LIBIDN'] + endif +else + libidn = [] +endif + +want_libiptc = get_option('libiptc') +if want_libiptc != 'false' + libiptc = dependency('libiptc', + required : want_libiptc == 'true') + if libiptc.found() + conf.set('HAVE_LIBIPTC', 1) + m4_defines += ['-DHAVE_LIBIPTC'] + endif +else + libiptc = [] +endif + +want_qrencode = get_option('qrencode') +if want_qrencode != 'false' + libqrencode = dependency('libqrencode', + required : want_qrencode == 'true') + if libqrencode.found() + conf.set('HAVE_QRENCODE', 1) + endif +else + libqrencode = [] +endif + +want_gnutls = get_option('gnutls') +if want_gnutls != 'false' + libgnutls = dependency('gnutls', + version : '>= 3.1.4', + required : want_gnutls == 'true') + if libgnutls.found() + conf.set('HAVE_GNUTLS', 1) + endif +else + libgnutls = [] +endif + +want_elfutils = get_option('elfutils') +if want_elfutils != 'false' + libdw = dependency('libdw', + required : want_elfutils == 'true') + if libdw.found() + conf.set('HAVE_ELFUTILS', 1) + endif +else + libdw = [] +endif + +want_zlib = get_option('zlib') +if want_zlib != 'false' + libz = dependency('zlib', + required : want_zlib == 'true') + if libz.found() + conf.set('HAVE_ZLIB', 1) + endif +else + libz = [] +endif + +want_bzip2 = get_option('bzip2') +if want_bzip2 != 'false' + libbzip2 = cc.find_library('bz2', + required : want_bzip2 == 'true') + if libbzip2.found() + conf.set('HAVE_BZIP2', 1) + endif +else + libbzip2 = [] +endif + +want_xz = get_option('xz') +if want_xz != 'false' + libxz = dependency('liblzma', + required : want_xz == 'true') + if libxz.found() + conf.set('HAVE_XZ', 1) + endif +else + libxz = [] +endif + +want_lz4 = get_option('lz4') +if want_lz4 != 'false' + liblz4 = dependency('liblz4', + required : want_lz4 == 'true') + if liblz4.found() + conf.set('HAVE_LZ4', 1) + endif +else + liblz4 = [] +endif + +want_glib = get_option('glib') +if want_glib != 'false' + libglib = dependency('glib-2.0', + version : '>= 2.22.0', + required : want_glib == 'true') + libgobject = dependency('gobject-2.0', + version : '>= 2.22.0', + required : want_glib == 'true') + libgio = dependency('gio-2.0', + required : want_glib == 'true') + if libglib.found() and libgobject.found() and libgio.found() + conf.set('HAVE_GLIB', 1) + endif +else + libglib = [] + libgobject = [] + libgio = [] +endif + +want_xkbcommon = get_option('xkbcommon') +if want_xkbcommon != 'false' + libxkbcommon = dependency('xkbcommon', + version : '>= 0.3.0', + required : want_xkbcommon == 'true') + if libxkbcommon.found() + conf.set('HAVE_XKBCOMMON', 1) + endif +else + libxkbcommon = [] +endif + +want_dbus = get_option('dbus') +if want_dbus != 'false' + libdbus = dependency('dbus-1', + version : '>= 1.3.2', + required : want_dbus == 'true') + if libdbus.found() + conf.set('HAVE_DBUS', 1) + endif +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') + + if libgcrypt.found() and libgpg_error.found() + conf.set('HAVE_GCRYPT', 1) + else + # link to neither of the libs if one is not found + libgcrypt = [] + libgpg_error = [] + endif +else + libgcrypt = [] + libgpg_error = [] +endif + +want_importd = get_option('importd') +if want_importd != 'false' + have_deps = (conf.get('HAVE_LIBCURL', 0) == 1 and + conf.get('HAVE_ZLIB', 0) == 1 and + conf.get('HAVE_BZIP2', 0) == 1 and + conf.get('HAVE_XZ', 0) == 1 and + conf.get('HAVE_GCRYPT', 0) == 1) + if have_deps + conf.set('ENABLE_IMPORTD', 1) + elif want_importd == 'true' + error('importd support was requested, but dependencies are not available') + endif +endif + +want_remote = get_option('remote') +if want_remote != 'false' + have_deps = [conf.get('HAVE_MICROHTTPD', 0) == 1, + conf.get('HAVE_LIBCURL', 0) == 1] + # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so + # it's possible to build one without the other. Complain only if + # support was explictly requested. The auxiliary files like sysusers + # config should be installed when any of the programs are built. + if want_remote == 'true' and not (have_deps[0] and have_deps[1]) + error('remote support was requested, but dependencies are not available') + endif + if have_deps[0] or have_deps[1] + conf.set('ENABLE_REMOTE', 1) + endif +endif + +foreach pair : [['utmp', 'HAVE_UTMP'], + ['hibernate', 'ENABLE_HIBERNATE'], + ['environment-d', 'ENABLE_ENVIRONMENT_D'], + ['binfmt', 'ENABLE_BINFMT'], + ['coredump', 'ENABLE_COREDUMP'], + ['resolve', 'ENABLE_RESOLVED'], + ['logind', 'ENABLE_LOGIND'], + ['hostnamed', 'ENABLE_HOSTNAMED'], + ['localed', 'ENABLE_LOCALED'], + ['machined', 'ENABLE_MACHINED'], + ['networkd', 'ENABLE_NETWORKD'], + ['timedated', 'ENABLE_TIMEDATED'], + ['timesyncd', 'ENABLE_TIMESYNCD'], + ['myhostname', 'HAVE_MYHOSTNAME'], + ['firstboot', 'ENABLE_FIRSTBOOT'], + ['randomseed', 'ENABLE_RANDOMSEED'], + ['backlight', 'ENABLE_BACKLIGHT'], + ['vconsole', 'ENABLE_VCONSOLE'], + ['quotacheck', 'ENABLE_QUOTACHECK'], + ['sysusers', 'ENABLE_SYSUSERS'], + ['tmpfiles', 'ENABLE_TMPFILES'], + ['hwdb', 'ENABLE_HWDB'], + ['rfkill', 'ENABLE_RFKILL'], + ['ldconfig', 'ENABLE_LDCONFIG'], + ['efi', 'ENABLE_EFI'], + ['tpm', 'SD_BOOT_LOG_TPM'], + ['ima', 'HAVE_IMA'], + ['smack', 'HAVE_SMACK'], + ] + + if get_option(pair[0]) + conf.set(pair[1], 1) + m4_defines += ['-D' + pair[1]] + endif +endforeach + +want_tests = get_option('tests') +install_tests = get_option('install-tests') +tests = [] + +##################################################################### + +if get_option('efi') + efi_arch = host_machine.cpu_family() + + if efi_arch == 'x86' + EFI_MACHINE_TYPE_NAME = 'ia32' + gnu_efi_arch = 'ia32' + elif efi_arch == 'x86_64' + EFI_MACHINE_TYPE_NAME = 'x64' + gnu_efi_arch = 'x86_64' + elif efi_arch == 'arm' + EFI_MACHINE_TYPE_NAME = 'arm' + gnu_efi_arch = 'arm' + elif efi_arch == 'aarch64' + EFI_MACHINE_TYPE_NAME = 'aa64' + gnu_efi_arch = 'aarch64' + else + EFI_MACHINE_TYPE_NAME = '' + gnu_efi_arch = '' + endif + + conf.set('ENABLE_EFI', 1) + conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) + + conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int()) +endif + +##################################################################### + +config_h = configure_file( + output : 'config.h', + configuration : conf) + +includes = include_directories('src/basic', + 'src/shared', + 'src/systemd', + 'src/journal', + 'src/resolve', + 'src/timesync', + 'src/login', + 'src/udev', + 'src/libudev', + 'src/core', + 'src/libsystemd/sd-bus', + 'src/libsystemd/sd-device', + 'src/libsystemd/sd-hwdb', + 'src/libsystemd/sd-id128', + 'src/libsystemd/sd-netlink', + 'src/libsystemd/sd-network', + 'src/libsystemd-network', + ) + +add_project_arguments('-include', 'config.h', language : 'c') + +gcrypt_util_sources = files('src/shared/gcrypt-util.h', + 'src/shared/gcrypt-util.c') + +subdir('po') +subdir('catalog') +subdir('src/systemd') +subdir('src/basic') +subdir('src/libsystemd') +subdir('src/libsystemd-network') +subdir('src/journal') +subdir('src/login') + +libjournal_core = static_library( + 'journal-core', + libjournal_core_sources, + journald_gperf_c, + include_directories : includes, + install : false) + +libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym) +libsystemd = shared_library( + 'systemd', + libsystemd_internal_sources, + journal_internal_sources, + version : '0.18.0', + include_directories : includes, + link_args : ['-shared', + '-Wl,--version-script=' + libsystemd_sym_path], + link_with : [libbasic], + dependencies : [threads, + libgcrypt, + librt, + libxz, + liblz4], + link_depends : libsystemd_sym, + install : true, + install_dir : rootlibdir) + +############################################################ + +# binaries that have --help and are intended for use by humans, +# usually, but not always, installed in /bin. +public_programs = [] + +subdir('src/libudev') +subdir('src/shared') +subdir('src/core') +subdir('src/udev') +subdir('src/network') + +subdir('src/analyze') +subdir('src/journal-remote') +subdir('src/coredump') +subdir('src/hostname') +subdir('src/import') +subdir('src/kernel-install') +subdir('src/locale') +subdir('src/machine') +subdir('src/nspawn') +subdir('src/resolve') +subdir('src/timedate') +subdir('src/timesync') +subdir('src/vconsole') +subdir('src/sulogin-shell') +subdir('src/boot/efi') + +subdir('src/test') +subdir('test') + +############################################################ + +# only static linking apart from libdl, to make sure that the +# module is linked to all libraries that it uses. +test_dlopen = executable( + 'test-dlopen', + test_dlopen_c, + include_directories : includes, + link_with : [libbasic], + dependencies : [libdl]) + +foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []], + ['systemd', '', []], + ['mymachines', 'ENABLE_MACHINED', []], + ['resolve', 'ENABLE_RESOLVED', [libdl]]] + + condition = tuple[1] == '' or conf.get(tuple[1], 0) == 1 + if condition + module = tuple[0] + extra_deps = tuple[2] + + sym = 'src/nss-@0@/nss-@0@.sym'.format(module) + version_script_arg = join_paths(meson.current_source_dir(), sym) + + nss = shared_library( + 'nss_' + module, + 'src/nss-@0@/nss-@0@.c'.format(module), + version : '2', + include_directories : includes, + link_args : ['-shared', + '-Wl,--version-script=' + version_script_arg, + '-Wl,--undefined'], + link_with : [libsystemd_internal, + libbasic], + dependencies : [threads, + librt] + extra_deps, + link_depends : sym, + install : true, + install_dir : rootlibdir) + + # We cannot use shared_module because it does not support version suffix. + # Unfortunately shared_library insists on creating the symlink… + meson.add_install_script('sh', '-c', + 'rm $DESTDIR@0@/libnss_@1@.so' + .format(rootlibdir, module)) + + test('dlopen-nss_' + module, + test_dlopen, + args : [nss.full_path()]) # path to dlopen must include a slash + endif +endforeach + +############################################################ + +executable('systemd', + systemd_sources, + include_directories : includes, + link_with : [libcore, + libshared, + libudev], + dependencies : [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-analyze', + systemd_analyze_sources, + include_directories : includes, + link_with : [libcore, + libudev, + libshared], + dependencies : [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +executable('systemd-journald', + systemd_journald_sources, + include_directories : includes, + link_with : [libjournal_core, + libshared, + libudev], + dependencies : [threads, + libxz, + liblz4, + libselinux], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-cat', + systemd_cat_sources, + include_directories : includes, + link_with : [libjournal_core, + libshared, + libudev], + dependencies : [threads], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('journalctl', + journalctl_sources, + include_directories : includes, + link_with : [libshared, + libudev], + dependencies : [threads, + libqrencode, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +executable('systemd-getty-generator', + 'src/getty-generator/getty-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + +executable('systemd-debug-generator', + 'src/debug-generator/debug-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + +executable('systemd-fstab-generator', + 'src/fstab-generator/fstab-generator.c', + 'src/core/mount-setup.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + +if conf.get('ENABLE_ENVIRONMENT_D', 0) == 1 + executable('30-systemd-environment-d-generator', + 'src/environment-d-generator/environment-d-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : userenvgeneratordir) + + meson.add_install_script(meson_make_symlink, + join_paths(sysconfdir, 'environment'), + join_paths(environmentdir, '99-environment.conf')) +endif + +if conf.get('ENABLE_HIBERNATE', 0) == 1 + executable('systemd-hibernate-resume-generator', + 'src/hibernate-resume/hibernate-resume-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + + executable('systemd-hibernate-resume', + 'src/hibernate-resume/hibernate-resume.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('HAVE_BLKID', 0) == 1 + executable('systemd-gpt-auto-generator', + 'src/gpt-auto-generator/gpt-auto-generator.c', + 'src/basic/blkid-util.h', + include_directories : includes, + link_with : [libshared, + libudev], + dependencies : libblkid, + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + + exe = executable('systemd-dissect', + 'src/dissect/dissect.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + public_programs += [exe] +endif + +if conf.get('ENABLE_RESOLVED', 0) == 1 + executable('systemd-resolved', + systemd_resolved_sources, + gcrypt_util_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libgcrypt, + libgpg_error, + libm, + libidn], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('systemd-resolve', + systemd_resolve_sources, + gcrypt_util_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libgcrypt, + libgpg_error, + libm, + libidn], + install_rpath : rootlibexecdir, + install : true) + public_programs += [exe] +endif + +if conf.get('ENABLE_LOGIND', 0) == 1 + executable('systemd-logind', + systemd_logind_sources, + include_directories : includes, + link_with : [liblogind_core, + libshared, + libudev], + dependencies : [threads, + libacl], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('loginctl', + loginctl_sources, + include_directories : includes, + link_with : [libshared, + libudev], + dependencies : [threads, + liblz4, + libxz], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + public_programs += [exe] + + exe = executable('systemd-inhibit', + 'src/login/inhibit.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + public_programs += [exe] + + if conf.get('HAVE_PAM', 0) == 1 + version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym) + pam_systemd = shared_library( + 'pam_systemd', + pam_systemd_c, + name_prefix : '', + include_directories : includes, + link_args : ['-shared', + '-Wl,--version-script=' + version_script_arg], + link_with : [libsystemd_internal, + libshared_static], + dependencies : [threads, + libpam, + libpam_misc], + link_depends : pam_systemd_sym, + install : true, + install_dir : pamlibdir) + + test('dlopen-pam_systemd', + test_dlopen, + args : [pam_systemd.full_path()]) # path to dlopen must include a slash + endif +endif + +if conf.get('HAVE_PAM', 0) == 1 + executable('systemd-user-sessions', + 'src/user-sessions/user-sessions.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('ENABLE_EFI', 0) == 1 and conf.get('HAVE_BLKID', 0) == 1 + exe = executable('bootctl', + 'src/boot/bootctl.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libblkid], + install_rpath : rootlibexecdir, + install : true) + public_programs += [exe] +endif + +exe = executable('systemd-socket-activate', 'src/activate/activate.c', + include_directories : includes, + link_with : [libshared], + dependencies : [threads], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemctl', 'src/systemctl/systemctl.c', + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libcap, + libselinux, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +if conf.get('ENABLE_BACKLIGHT', 0) == 1 + executable('systemd-backlight', + 'src/backlight/backlight.c', + include_directories : includes, + link_with : [libshared, + libudev], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('ENABLE_RFKILL', 0) == 1 + executable('systemd-rfkill', + 'src/rfkill/rfkill.c', + include_directories : includes, + link_with : [libshared, + libudev], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +executable('systemd-system-update-generator', + 'src/system-update-generator/system-update-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + +if conf.get('HAVE_LIBCRYPTSETUP', 0) == 1 + executable('systemd-cryptsetup', + 'src/cryptsetup/cryptsetup.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libcryptsetup], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + executable('systemd-cryptsetup-generator', + 'src/cryptsetup/cryptsetup-generator.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libcryptsetup], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + + executable('systemd-veritysetup', + 'src/veritysetup/veritysetup.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libcryptsetup], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + executable('systemd-veritysetup-generator', + 'src/veritysetup/veritysetup-generator.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libcryptsetup], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) +endif + +if conf.get('HAVE_SYSV_COMPAT', 0) == 1 + executable('systemd-sysv-generator', + 'src/sysv-generator/sysv-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) + + executable('systemd-rc-local-generator', + 'src/rc-local-generator/rc-local-generator.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : systemgeneratordir) +endif + +if conf.get('ENABLE_HOSTNAMED', 0) == 1 + executable('systemd-hostnamed', + 'src/hostname/hostnamed.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('hostnamectl', + 'src/hostname/hostnamectl.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) + public_programs += [exe] +endif + +if conf.get('ENABLE_LOCALED', 0) == 1 + if conf.get('HAVE_XKBCOMMON', 0) == 1 + # logind will load libxkbcommon.so dynamically on its own + deps = [libdl] + else + deps = [] + endif + + executable('systemd-localed', + systemd_localed_sources, + include_directories : includes, + link_with : [libshared], + dependencies : deps, + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('localectl', + localectl_sources, + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) + public_programs += [exe] +endif + +if conf.get('ENABLE_TIMEDATED', 0) == 1 + executable('systemd-timedated', + 'src/timedate/timedated.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('timedatectl', + 'src/timedate/timedatectl.c', + include_directories : includes, + install_rpath : rootlibexecdir, + link_with : [libshared], + install : true) + public_programs += [exe] +endif + +if conf.get('ENABLE_TIMESYNCD', 0) == 1 + executable('systemd-timesyncd', + systemd_timesyncd_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libm], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('ENABLE_MACHINED', 0) == 1 + executable('systemd-machined', + systemd_machined_sources, + include_directories : includes, + link_with : [libmachine_core, + libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('machinectl', + 'src/machine/machinectl.c', + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + public_programs += [exe] +endif + +if conf.get('ENABLE_IMPORTD', 0) == 1 + executable('systemd-importd', + systemd_importd_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + systemd_pull = executable('systemd-pull', + systemd_pull_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [libcurl, + libz, + libbzip2, + libxz, + libgcrypt], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + systemd_import = executable('systemd-import', + systemd_import_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [libcurl, + libz, + libbzip2, + libxz], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + systemd_export = executable('systemd-export', + systemd_export_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [libcurl, + libz, + libbzip2, + libxz], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + public_programs += [systemd_pull, systemd_import, systemd_export] +endif + +if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_LIBCURL', 0) == 1 + exe = executable('systemd-journal-upload', + systemd_journal_upload_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libcurl, + libgnutls, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + public_programs += [exe] +endif + +if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_MICROHTTPD', 0) == 1 + s_j_remote = executable('systemd-journal-remote', + systemd_journal_remote_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libmicrohttpd, + libgnutls, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + s_j_gatewayd = executable('systemd-journal-gatewayd', + systemd_journal_gatewayd_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libmicrohttpd, + libgnutls, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + public_programs += [s_j_remote, s_j_gatewayd] +endif + +if conf.get('ENABLE_COREDUMP', 0) == 1 + executable('systemd-coredump', + systemd_coredump_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libacl, + libdw, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + exe = executable('coredumpctl', + coredumpctl_sources, + include_directories : includes, + link_with : [libshared], + dependencies : [threads, + libxz, + liblz4], + install_rpath : rootlibexecdir, + install : true) + public_programs += [exe] +endif + +if conf.get('ENABLE_BINFMT', 0) == 1 + exe = executable('systemd-binfmt', + 'src/binfmt/binfmt.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + public_programs += [exe] + + meson.add_install_script('sh', '-c', + mkdir_p.format(binfmtdir)) + meson.add_install_script('sh', '-c', + mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) +endif + +if conf.get('ENABLE_VCONSOLE', 0) == 1 + executable('systemd-vconsole-setup', + 'src/vconsole/vconsole-setup.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('ENABLE_RANDOMSEED', 0) == 1 + executable('systemd-random-seed', + 'src/random-seed/random-seed.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +if conf.get('ENABLE_FIRSTBOOT', 0) == 1 + executable('systemd-firstboot', + 'src/firstboot/firstboot.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libcrypt], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +endif + +executable('systemd-remount-fs', + 'src/remount-fs/remount-fs.c', + 'src/core/mount-setup.c', + 'src/core/mount-setup.h', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +executable('systemd-machine-id-setup', + 'src/machine-id-setup/machine-id-setup-main.c', + 'src/core/machine-id-setup.c', + 'src/core/machine-id-setup.h', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + +executable('systemd-fsck', + 'src/fsck/fsck.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +executable('systemd-sleep', + 'src/sleep/sleep.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-sysctl', + 'src/sysctl/sysctl.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +public_programs += [exe] + +executable('systemd-ac-power', + 'src/ac-power/ac-power.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-detect-virt', + 'src/detect-virt/detect-virt.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemd-delta', + 'src/delta/delta.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemd-escape', + 'src/escape/escape.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +exe = executable('systemd-notify', + 'src/notify/notify.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +executable('systemd-volatile-root', + 'src/volatile-root/volatile-root.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +executable('systemd-cgroups-agent', + 'src/cgroups-agent/cgroups-agent.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-path', + 'src/path/path.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemd-ask-password', + 'src/ask-password/ask-password.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +executable('systemd-reply-password', + 'src/reply-password/reply-password.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-tty-ask-password-agent', + 'src/tty-ask-password-agent/tty-ask-password-agent.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +exe = executable('systemd-cgls', + 'src/cgls/cgls.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemd-cgtop', + 'src/cgtop/cgtop.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +executable('systemd-initctl', + 'src/initctl/initctl.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +exe = executable('systemd-mount', + 'src/mount/mount-tool.c', + include_directories : includes, + link_with : [libshared, + libudev], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +meson.add_install_script(meson_make_symlink, + 'systemd-mount', join_paths(bindir, 'systemd-umount')) + +exe = executable('systemd-run', + 'src/run/run.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('systemd-stdio-bridge', + 'src/stdio-bridge/stdio-bridge.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +exe = executable('busctl', + 'src/busctl/busctl.c', + 'src/busctl/busctl-introspect.c', + 'src/busctl/busctl-introspect.h', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +if conf.get('ENABLE_SYSUSERS', 0) == 1 + exe = executable('systemd-sysusers', + 'src/sysusers/sysusers.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + public_programs += [exe] +endif + +if conf.get('ENABLE_TMPFILES', 0) == 1 + exe = executable('systemd-tmpfiles', + 'src/tmpfiles/tmpfiles.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libacl], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) + public_programs += [exe] +endif + +if conf.get('ENABLE_HWDB', 0) == 1 + exe = executable('systemd-hwdb', + 'src/hwdb/hwdb.c', + 'src/libsystemd/sd-hwdb/hwdb-internal.h', + include_directories : includes, + link_with : [libudev_internal], + install_rpath : udev_rpath, + install : true, + install_dir : rootbindir) + public_programs += [exe] +endif + +if conf.get('ENABLE_QUOTACHECK', 0) == 1 + executable('systemd-quotacheck', + 'src/quotacheck/quotacheck.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +exe = executable('systemd-socket-proxyd', + 'src/socket-proxy/socket-proxyd.c', + include_directories : includes, + link_with : [libshared], + dependencies : [threads], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +public_programs += [exe] + +exe = executable('systemd-udevd', + systemd_udevd_sources, + include_directories : includes, + link_with : [libudev_core, + libsystemd_network, + libudev_internal], + dependencies : [threads, + libkmod, + libidn, + libacl, + libblkid], + install_rpath : udev_rpath, + install : true, + install_dir : rootlibexecdir) +public_programs += [exe] + +exe = executable('udevadm', + udevadm_sources, + include_directories : includes, + link_with : [libudev_core, + libsystemd_network, + libudev_internal], + dependencies : [threads, + libkmod, + libidn, + libacl, + libblkid], + install_rpath : udev_rpath, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +executable('systemd-shutdown', + systemd_shutdown_sources, + include_directories : includes, + link_with : [libshared, + libudev], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +executable('systemd-update-done', + 'src/update-done/update-done.c', + include_directories : includes, + link_with : [libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +executable('systemd-update-utmp', + 'src/update-utmp/update-utmp.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libaudit], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + +if conf.get('HAVE_KMOD', 0) == 1 + executable('systemd-modules-load', + 'src/modules-load/modules-load.c', + include_directories : includes, + link_with : [libshared], + dependencies : [libkmod], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + meson.add_install_script('sh', '-c', + mkdir_p.format(modulesloaddir)) + meson.add_install_script('sh', '-c', + mkdir_p.format(join_paths(sysconfdir, 'modules-load.d'))) +endif + +exe = executable('systemd-nspawn', + systemd_nspawn_sources, + 'src/core/mount-setup.c', # FIXME: use a variable? + 'src/core/mount-setup.h', + 'src/core/loopback-setup.c', + 'src/core/loopback-setup.h', + include_directories : [includes, include_directories('src/nspawn')], + link_with : [libfirewall, + libshared, + libudev], + dependencies : [libacl, + libblkid, + libseccomp, + libselinux], + install_rpath : rootlibexecdir, + install : true) +public_programs += [exe] + +if conf.get('ENABLE_NETWORKD', 0) == 1 + executable('systemd-networkd', + systemd_networkd_sources, + include_directories : includes, + link_with : [libnetworkd_core, + libfirewall, + libsystemd_network, + libudev_internal, + libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) + + executable('systemd-networkd-wait-online', + systemd_networkd_wait_online_sources, + include_directories : includes, + link_with : [libnetworkd_core, + libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootlibexecdir) +endif + +exe = executable('networkctl', + networkctl_sources, + include_directories : includes, + link_with : [libsystemd_network, + libshared], + install_rpath : rootlibexecdir, + install : true, + install_dir : rootbindir) +public_programs += [exe] + +############################################################ + +foreach tuple : tests + sources = tuple[0] + link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] + dependencies = tuple[2] + condition = tuple.length() >= 4 ? tuple[3] : '' + type = tuple.length() >= 5 ? tuple[4] : '' + defs = tuple.length() >= 6 ? tuple[5] : [] + incs = tuple.length() >= 7 ? tuple[6] : includes + timeout = 30 + + name = sources[0].split('/')[-1].split('.')[0] + if type.startswith('timeout=') + timeout = type.split('=')[1].to_int() + type = '' + endif + + if condition == '' or conf.get(condition, 0) == 1 + install = install_tests and type == '' + + exe = executable( + name, + sources, + include_directories : incs, + link_with : link_with, + dependencies : dependencies, + c_args : defs, + install_rpath : rootlibexecdir, + install : install, + install_dir : testsdir) + + if type == 'manual' + message('@0@ is a manual test'.format(name)) + elif type == 'unsafe' and want_tests != 'unsafe' + message('@0@ is an unsafe test'.format(name)) + else + test(name, exe, + env : test_env, + timeout : timeout) + endif + else + message('Not compiling @0@ because @1@ is not true'.format(name, condition)) + endif +endforeach + +test_libsystemd_sym = executable( + 'test-libsystemd-sym', + test_libsystemd_sym_c, + include_directories : includes, + link_with : [libsystemd], + install : install_tests, + install_dir : testsdir) +test('test-libsystemd-sym', + test_libsystemd_sym) + +test_libudev_sym = executable( + 'test-libudev-sym', + test_libudev_sym_c, + include_directories : includes, + c_args : ['-Wno-deprecated-declarations'], + link_with : [libudev], + install : install_tests, + install_dir : testsdir) +test('test-libudev-sym', + test_libudev_sym) + +############################################################ + +make_directive_index_py = find_program('tools/make-directive-index.py') +make_man_index_py = find_program('tools/make-man-index.py') +xml_helper_py = find_program('tools/xml_helper.py') +hwdb_update_sh = find_program('tools/meson-hwdb-update.sh') + +subdir('units') +subdir('sysctl.d') +subdir('sysusers.d') +subdir('tmpfiles.d') +subdir('rules') +subdir('hwdb') +subdir('network') +subdir('man') +subdir('shell-completion/bash') +subdir('shell-completion/zsh') +subdir('docs/sysvinit') +subdir('docs/var-log') + +# FIXME: figure out if the warning is true: +# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir +install_subdir('factory/etc', + install_dir : factorydir) + + +install_data('xorg/50-systemd-user.sh', + install_dir : xinitrcdir) +install_data('system-preset/90-systemd.preset', + install_dir : systempresetdir) +install_data('README', + 'NEWS', + 'CODING_STYLE', + 'DISTRO_PORTING', + 'ENVIRONMENT.md', + 'LICENSE.GPL2', + 'LICENSE.LGPL2.1', + 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION', + install_dir : docdir) + +meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) +meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) + +############################################################ + +meson_check_help = find_program('tools/meson-check-help.sh') + +foreach exec : public_programs + name = exec.full_path().split('/')[-1] + test('check-help-' + name, + meson_check_help, + args : [exec.full_path()]) +endforeach + +############################################################ + +if git.found() and etags.found() + all_files = run_command( + git, + ['--git-dir=@0@/.git'.format(meson.source_root()), + 'ls-files', + ':/*.[ch]']) + all_files = files(all_files.stdout().split()) + + custom_target( + 'TAGS', + output : 'TAGS', + input : all_files, + command : [etags, '-o', '@OUTPUT@'] + all_files) +endif + +if git.found() + meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh') + run_target( + 'git-contrib', + command : [meson_git_contrib_sh]) +endif + +if git.found() + git_head = run_command( + git, + ['--git-dir=@0@/.git'.format(meson.source_root()), + 'rev-parse', 'HEAD']).stdout().strip() + git_head_short = run_command( + git, + ['--git-dir=@0@/.git'.format(meson.source_root()), + 'rev-parse', '--short=7', 'HEAD']).stdout().strip() + + run_target( + 'git-snapshot', + command : ['git', 'archive', + '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(), + git_head_short), + '--prefix', 'systemd-@0@/'.format(git_head), + 'HEAD']) +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000..6d40c3f806 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,246 @@ +# -*- mode: meson -*- + +option('split-usr', type : 'boolean', value : false, + description : '''assume that /bin, /sbin aren't symlinks into /usr''') +option('rootlibdir', type : 'string', + description : '''[/usr]/lib/x86_64-linux-gnu or such''') +option('rootprefix', type : 'string', + description : '''override the root prefix''') +option('link-udev-shared', type : 'boolean', + description : 'link systemd-udev and its helpers to libsystemd-shared.so') + +option('sysvinit-path', type : 'string', value : '/etc/init.d', + description : 'the directory where the SysV init scripts are located') +option('sysvrcnd-path', type : 'string', value : '/etc/rc.d', + description : 'the base directory for SysV rcN.d directories') +option('telinit-path', type : 'string', description : 'path to telinit') +option('rc-local', type : 'string', + value : '/etc/rc.local') +option('halt-local', type : 'string', + value : '/usr/sbin/halt.local') + +option('quotaon-path', type : 'string', description : 'path to quotaon') +option('quotacheck-path', type : 'string', description : 'path to quotacheck') +option('kill-path', type : 'string', description : 'path to kill') +option('kmod-path', type : 'string', description : 'path to kmod') +option('kexec-path', type : 'string', description : 'path to kexec') +option('sulogin-path', type : 'string', description : 'path to sulogin') +option('mount-path', type : 'string', description : 'path to mount') +option('umount-path', type : 'string', description : 'path to umount') +option('loadkeys-path', type : 'string', description : 'path to loadkeys') +option('setfont-path', type : 'string', description : 'path to setfont') + +option('debug-shell', type : 'string', value : '/bin/sh', + description : 'path to debug shell binary') +option('debug-tty', type : 'string', value : '/dev/tty9', + description : 'specify the tty device for debug shell') + +option('utmp', type : 'boolean', + description : 'support for utmp/wtmp log handling') +option('hibernate', type : 'boolean', + description : 'support for hibernation') +option('ldconfig', type : 'boolean', + description : 'support for dynamic linker cache creation') +option('resolve', type : 'boolean', + description : 'systemd-resolved stack') +option('efi', type : 'boolean', + description : 'enable systemd-boot and bootctl') +option('tpm', type : 'boolean', value : false, + description : 'TPM should be used to log events and extend the registers') +option('environment-d', type : 'boolean', + description : 'support for environment.d') +option('binfmt', type : 'boolean', + description : 'support for custom binary formats') +option('coredump', type : 'boolean', + description : 'install the coredump handler') +option('logind', type : 'boolean', + description : 'install the systemd-logind stack') +option('hostnamed', type : 'boolean', + description : 'install the systemd-hostnamed stack') +option('localed', type : 'boolean', + description : 'install the systemd-localed stack') +option('machined', type : 'boolean', + description : 'install the systemd-machined stack') +option('networkd', type : 'boolean', + description : 'install the systemd-networkd stack') +option('timedated', type : 'boolean', + description : 'install the systemd-timedated daemon') +option('timesyncd', type : 'boolean', + description : 'install the systemd-timesyncd daemon') +option('remote', type : 'boolean', + description : 'support for "journal over the network"') +option('myhostname', type : 'boolean', + description : 'nss-myhostname support') +option('firstboot', type : 'boolean', + description : 'support for firstboot mechanism') +option('randomseed', type : 'boolean', + description : 'support for restoring random seed') +option('backlight', type : 'boolean', + description : 'support for restoring backlight state') +option('vconsole', type : 'boolean', + description : 'support for vconsole configuration') +option('quotacheck', type : 'boolean', + description : 'support for the quotacheck tools') +option('sysusers', type : 'boolean', + description : 'support for the sysusers configuration') +option('tmpfiles', type : 'boolean', + description : 'support for tmpfiles.d') +option('importd', type : 'boolean', + description : 'install the systemd-importd daemon') +option('hwdb', type : 'boolean', + description : 'support for the hardware database') +option('rfkill', type : 'boolean', + description : 'support for the rfkill tools') +option('man', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'build and install man pages') +option('html', type : 'combo', choices : ['auto', 'true', 'false'], + value : 'false', + description : 'build and install html pages') + +option('certificate-root', type : 'string', value : '/etc/ssl', + description : 'the prefix for TLS certificates') +option('dbuspolicydir', type : 'string', + description : 'D-Bus policy directory') +option('dbussessionservicedir', type : 'string', + description : 'D-Bus session service directory') +option('dbussystemservicedir', type : 'string', + description : 'D-Bus system service directory') +option('pkgconfigdatadir', type : 'string', value : 'share/pkgconfig', + description : 'directory for ') +option('pkgconfiglibdir', type : 'string', value : '', + description : 'directory for ') +option('rpmmacrosdir', type : 'string', value : 'lib/rpm/macros.d', + description : 'directory for rpm macros ["no" disables]') +option('pamlibdir', type : 'string', + description : 'directory for PAM modules') +option('pamconfdir', type : 'string', + description : 'directory for PAM configuration ["no" disables]') + +option('fallback-hostname', type : 'string', value : 'localhost', + description : 'the hostname used if none configured') +option('default-hierarchy', type : 'combo', + choices : ['legacy', 'hybrid', 'unified'], value : 'hybrid', + description : 'default cgroup hierarchy') +option('time-epoch', type : 'string', + description : 'time epoch for time clients') +option('system-uid-max', type : 'string', + description : 'maximum system UID') +option('system-gid-max', type : 'string', + description : 'maximum system GID') +option('tty-gid', type : 'string', + description : 'the numeric GID of the "tty" group', + value : '5') +option('adm-group', type : 'boolean', + description : 'the ACL for adm group should be added') +option('wheel-group', type : 'boolean', + description : 'the ACL for wheel group should be added') +option('nobody-user', type : 'string', + description : 'The name of the nobody user (the one with UID 65534)', + value : 'nobody') +option('nobody-group', type : 'string', + description : 'The name of the nobody group (the one with GID 65534)', + value : 'nobody') +option('dev-kvm-mode', type : 'string', value : '0660', + description : '/dev/kvm access mode') +option('default-kill-user-processes', type : 'boolean', + description : 'the default value for KillUserProcesses= setting') + +option('default-dnssec', type : 'combo', + description : 'default DNSSEC mode', + choices : ['yes', 'allow-downgrade', 'no'], + value : 'allow-downgrade') +option('dns-servers', type : 'string', + description : 'space-separated list of default DNS servers', + value : '8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844') +option('ntp-servers', type : 'string', + description : 'space-separated list of default NTP servers', + value : 'time1.google.com time2.google.com time3.google.com time4.google.com') +option('support-url', type : 'string', + description : 'the support URL to show in catalog entries included in systemd', + value : 'https://lists.freedesktop.org/mailman/listinfo/systemd-devel') +option('www-target', type : 'string', + description : 'the address and dir to upload docs too', + value : 'www.freedesktop.org:/srv/www.freedesktop.org/www/software/systemd') + +option('seccomp', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'SECCOMP support') +option('selinux', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'SELinux support') +option('apparmor', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'AppArmor support') +option('smack', type : 'boolean', + description : 'SMACK support') +option('smack-run-label', type : 'string', + description : 'run systemd --system itself with a specific SMACK label') +option('polkit', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'PolicyKit support') +option('ima', type : 'boolean', + description : 'IMA support') + +option('acl', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libacl support') +option('audit', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libaudit support') +option('blkid', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libblkid support') +option('kmod', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'support for loadable modules') +option('pam', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'PAM support') +option('microhttpd', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libµhttpd support') +option('libcryptsetup', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libcryptsetup support') +option('libcurl', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libcurl support') +option('libidn', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libidn support') +option('libiptc', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libiptc support') +option('qrencode', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libqrencode support') +option('gcrypt', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'gcrypt support') +option('gnutls', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'gnutls support') +option('elfutils', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'elfutils support') +option('zlib', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'zlib compression support') +option('bzip2', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'bzip2 compression support') +option('xz', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'xz compression support') +option('lz4', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'lz4 compression support') +option('xkbcommon', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'xkbcommon keymap support') +option('glib', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libglib support (for tests only)') +option('dbus', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'libdbus support (for tests only)') + +option('gnu-efi', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'gnu-efi support for sd-boot') +option('efi-cc', type : 'string', value : 'gcc', + description : 'the compiler to use for EFI modules') +option('efi-ld', type : 'string', value : 'ld', + description : 'the linker to use for EFI modules') +option('efi-libdir', type : 'string', + description : 'path to the EFI lib directory') +option('efi-ldsdir', type : 'string', + description : 'path to the EFI lds directory') +option('efi-includedir', type : 'string', value : '/usr/include/efi', + description : 'path to the EFI header directory') +option('tpm-pcrindex', type : 'string', value : '8', + description : 'TPM PCR register number to use') + +option('bashcompletiondir', type : 'string', + description : 'directory for bash completion scripts ["no" disables]') +option('zshcompletiondir', type : 'string', + description : 'directory for zsh completion scripts ["no" disables]') + +option('tests', type : 'combo', choices : ['true', 'unsafe'], + description : 'enable extra tests with =unsafe') +option('install-tests', type : 'boolean', value : 'false', + description : 'install test executables') diff --git a/network/meson.build b/network/meson.build new file mode 100644 index 0000000000..f7d73f2db0 --- /dev/null +++ b/network/meson.build @@ -0,0 +1,12 @@ +if conf.get('ENABLE_NETWORKD', 0) == 1 + install_data('80-container-host0.network', + '80-container-ve.network', + '80-container-vz.network', + install_dir : networkdir) + + meson.add_install_script('sh', '-c', + mkdir_p.format(join_paths(sysconfdir, 'systemd/network'))) +endif + +install_data('99-default.link', + install_dir : networkdir) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000000..f89291bfc4 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,12 @@ +i18n = import('i18n') +i18n.gettext(meson.project_name()) + +##################################################################### + +intltool_merge = find_program('intltool-merge') +po_dir = meson.current_source_dir() + +intltool_cache = join_paths(meson.current_build_dir(), 'intltool-merge-cache') +intltool_command = [intltool_merge, '-x', '-u', + '-c', intltool_cache, + po_dir, '@INPUT@', '@OUTPUT@'] diff --git a/rules/meson.build b/rules/meson.build new file mode 100644 index 0000000000..1cd37f3cf3 --- /dev/null +++ b/rules/meson.build @@ -0,0 +1,38 @@ +rules = files(''' + 60-block.rules + 60-cdrom_id.rules + 60-drm.rules + 60-evdev.rules + 60-persistent-alsa.rules + 60-persistent-input.rules + 60-persistent-storage.rules + 60-persistent-storage-tape.rules + 60-persistent-v4l.rules + 60-sensor.rules + 60-serial.rules + 64-btrfs.rules + 70-mouse.rules + 70-touchpad.rules + 75-net-description.rules + 75-probe_mtd.rules + 78-sound-card.rules + 80-drivers.rules + 80-net-setup-link.rules +'''.split()) + +install_data(rules, + install_dir : udevrulesdir) + +rules_in = ''' + 50-udev-default.rules + 99-systemd.rules +'''.split() + +foreach file : rules_in + gen = configure_file( + input : file + '.in', + output : file, + configuration : substs) + install_data(gen, + install_dir : udevrulesdir) +endforeach diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build new file mode 100644 index 0000000000..8c2eada6cb --- /dev/null +++ b/shell-completion/bash/meson.build @@ -0,0 +1,50 @@ +bashcompletiondir = get_option('bashcompletiondir') +if bashcompletiondir == '' + bash_completion = dependency('bash-completion', required : false) + if bash_completion.found() + bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir') + else + bashcompletiondir = join_paths(datadir, 'bash-completion/completions') + endif + + message('bash completions: @0@'.format(bashcompletiondir)) +endif + +if bashcompletiondir != 'no' + bash_systemctl = configure_file( + input : 'systemctl.in', + output : 'systemctl', + configuration : substs) + + items = [['busctl', ''], + ['journalctl', ''], + ['systemd-analyze', ''], + ['systemd-cat', ''], + ['systemd-cgls', ''], + ['systemd-cgtop', ''], + ['systemd-delta', ''], + ['systemd-detect-virt', ''], + ['systemd-nspawn', ''], + ['systemd-path', ''], + ['systemd-run', ''], + ['udevadm', ''], + ['kernel-install', ''], + [bash_systemctl, ''], + ['bootctl', 'ENABLE_EFI'], + ['coredumpctl', 'ENABLE_COREDUMP'], + ['hostnamectl', 'ENABLE_HOSTNAMED'], + ['localectl', 'ENABLE_LOCALED'], + ['loginctl', 'ENABLE_LOGIND'], + ['machinectl', 'ENABLE_MACHINED'], + ['networkctl', 'ENABLE_NETWORKD'], + ['systemd-resolve', 'ENABLE_RESOLVED'], + ['timedatectl', 'ENABLE_TIMEDATED'], + ] + + foreach item : items + if item[1] == '' or conf.get(item[1], 0) == 1 + install_data(item[0], + install_dir : bashcompletiondir) + endif + endforeach +endif diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build new file mode 100644 index 0000000000..ed1513ed25 --- /dev/null +++ b/shell-completion/zsh/meson.build @@ -0,0 +1,47 @@ +zshcompletiondir = get_option('zshcompletiondir') +if zshcompletiondir == '' + zshcompletiondir = join_paths(datadir, 'zsh/site-functions') + + message('zsh completions: @0@'.format(zshcompletiondir)) +endif + +if zshcompletiondir != 'no' + zsh_systemctl = configure_file( + input : '_systemctl.in', + output : '_systemctl', + configuration : substs) + + items = [['_busctl', ''], + ['_journalctl', ''], + ['_systemd-analyze', ''], + ['_systemd-delta', ''], + ['_systemd-nspawn', ''], + ['_systemd', ''], + ['_systemd-run', ''], + ['_udevadm', ''], + ['_kernel-install', ''], + ['_sd_hosts_or_user_at_host', ''], + ['_sd_outputmodes', ''], + ['_sd_unit_files', ''], + ['_sd_machines', ''], + [zsh_systemctl, ''], + ['_bootctl', 'ENABLE_EFI'], + ['_coredumpctl', 'ENABLE_COREDUMP'], + ['_hostnamectl', 'ENABLE_HOSTNAMED'], + ['_localectl', 'ENABLE_LOCALED'], + ['_loginctl', 'ENABLE_LOGIND'], + ['_machinectl', 'ENABLE_MACHINED'], + ['_networkctl', 'ENABLE_NETWORKD'], + ['_systemd-inhibit', 'ENABLE_LOGIND'], + ['_systemd-resolve', 'ENABLE_RESOLVED'], + ['_systemd-tmpfiles', 'ENABLE_TMPFILES'], + ['_timedatectl', 'ENABLE_TIMEDATED'], + ] + + foreach item : items + if item[1] == '' or conf.get(item[1], 0) == 1 + install_data(item[0], + install_dir : zshcompletiondir) + endif + endforeach +endif diff --git a/src/analyze/meson.build b/src/analyze/meson.build new file mode 100644 index 0000000000..fcbd814233 --- /dev/null +++ b/src/analyze/meson.build @@ -0,0 +1,5 @@ +systemd_analyze_sources = files(''' + analyze.c + analyze-verify.c + analyze-verify.h +'''.split()) diff --git a/src/basic/af-to-name.awk b/src/basic/af-to-name.awk new file mode 100644 index 0000000000..18d0a89728 --- /dev/null +++ b/src/basic/af-to-name.awk @@ -0,0 +1,9 @@ +BEGIN{ + print "static const char* const af_names[] = { " +} +!/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { + printf " [%s] = \"%s\",\n", $1, $1 +} +END{ + print "};" +} diff --git a/src/basic/arphrd-to-name.awk b/src/basic/arphrd-to-name.awk new file mode 100644 index 0000000000..5a35673e2c --- /dev/null +++ b/src/basic/arphrd-to-name.awk @@ -0,0 +1,9 @@ +BEGIN{ + print "static const char* const arphrd_names[] = { " +} +!/CISCO/ { + printf " [ARPHRD_%s] = \"%s\",\n", $1, $1 +} +END{ + print "};" +} diff --git a/src/basic/cap-to-name.awk b/src/basic/cap-to-name.awk new file mode 100644 index 0000000000..402a782024 --- /dev/null +++ b/src/basic/cap-to-name.awk @@ -0,0 +1,9 @@ +BEGIN{ + print "static const char* const capability_names[] = { " +} +{ + printf " [%s] = \"%s\",\n", $1, tolower($1) +} +END{ + print "};" +} diff --git a/src/basic/errno-to-name.awk b/src/basic/errno-to-name.awk new file mode 100644 index 0000000000..0878abacbd --- /dev/null +++ b/src/basic/errno-to-name.awk @@ -0,0 +1,9 @@ +BEGIN{ + print "static const char* const errno_names[] = { " +} +!/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { + printf " [%s] = \"%s\",\n", $1, $1 +} +END{ + print "};" +} diff --git a/src/basic/generate-af-list.sh b/src/basic/generate-af-list.sh new file mode 100755 index 0000000000..8d9cdd1836 --- /dev/null +++ b/src/basic/generate-af-list.sh @@ -0,0 +1,5 @@ +#!/bin/sh -eu + +$1 -E -dM -include sys/socket.h - ') +for header in sys.argv[2:]: + print('#include "{}"'.format(header.split('/')[-1])) + +print(''' +void* functions[] = {''') + +for line in open(sys.argv[1]): + match = re.search('^ +([a-zA-Z0-9_]+);', line) + if match: + print(' {},'.format(match.group(1))) + +print('''}; + +int main(void) { + unsigned i; + for (i = 0; i < sizeof(functions)/sizeof(void*); i++) + printf("%p\\n", functions[i]); + return 0; +}''') diff --git a/src/test/meson.build b/src/test/meson.build new file mode 100644 index 0000000000..6c0fd4dca9 --- /dev/null +++ b/src/test/meson.build @@ -0,0 +1,895 @@ +awkscript = 'test-hashmap-ordered.awk' +test_hashmap_ordered_c = custom_target( + 'test-hashmap-ordered.c', + input : [awkscript, 'test-hashmap-plain.c'], + output : 'test-hashmap-ordered.c', + command : [awk, '-f', '@INPUT0@', '@INPUT1@'], + capture : true) + +test_include_dir = include_directories('.') + +path = run_command('sh', ['-c', 'echo "$PATH"']).stdout() +test_env = environment() +test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map) +test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map) +test_env.set('PATH', path) +test_env.prepend('PATH', meson.build_root()) + +############################################################ + +generate_sym_test_py = find_program('generate-sym-test.py') + +test_libsystemd_sym_c = custom_target( + 'test-libsystemd-sym.c', + input : [libsystemd_sym_path] + systemd_headers, + output : 'test-libsystemd-sym.c', + command : [generate_sym_test_py, libsystemd_sym_path] + systemd_headers, + capture : true) + +test_libudev_sym_c = custom_target( + 'test-libudev-sym.c', + input : [libudev_sym_path, libudev_h_path], + output : 'test-libudev-sym.c', + command : [generate_sym_test_py, '@INPUT0@', '@INPUT1@'], + capture : true) + +test_dlopen_c = files('test-dlopen.c') + +############################################################ + +tests += [ + [['src/test/test-device-nodes.c'], + [], + []], + + [['src/test/test-engine.c'], + [libcore, + libudev, + libsystemd_internal], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-job-type.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-ns.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid], + '', 'manual'], + + [['src/test/test-loopback.c'], + [libcore, + libshared], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-hostname.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid], + '', 'unsafe'], + + [['src/test/test-dns-domain.c'], + [libcore, + libsystemd_network], + []], + + [['src/test/test-boot-timestamps.c'], + [], + [], + 'ENABLE_EFI'], + + [['src/test/test-unit-name.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-unit-file.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-utf8.c'], + [], + []], + + [['src/test/test-capability.c'], + [], + [libcap]], + + [['src/test/test-async.c'], + [], + []], + + [['src/test/test-locale-util.c'], + [], + []], + + [['src/test/test-copy.c'], + [libshared_static], + []], + + [['src/test/test-sigbus.c'], + [], + []], + + [['src/test/test-condition.c'], + [], + []], + + [['src/test/test-fdset.c'], + [], + []], + + [['src/test/test-fstab-util.c'], + [], + []], + + [['src/test/test-ratelimit.c'], + [], + []], + + [['src/test/test-util.c'], + [], + []], + + [['src/test/test-mount-util.c'], + [], + []], + + [['src/test/test-exec-util.c'], + [], + []], + + [['src/test/test-hexdecoct.c'], + [], + []], + + [['src/test/test-alloc-util.c'], + [], + []], + + [['src/test/test-xattr-util.c'], + [], + []], + + [['src/test/test-io-util.c'], + [], + []], + + [['src/test/test-glob-util.c'], + [], + []], + + [['src/test/test-fs-util.c'], + [], + []], + + [['src/test/test-proc-cmdline.c'], + [], + []], + + [['src/test/test-fd-util.c'], + [], + []], + + [['src/test/test-web-util.c'], + [], + []], + + [['src/test/test-cpu-set-util.c'], + [], + []], + + [['src/test/test-stat-util.c'], + [], + []], + + [['src/test/test-escape.c'], + [], + []], + + [['src/test/test-string-util.c'], + [], + []], + + [['src/test/test-extract-word.c'], + [], + []], + + [['src/test/test-parse-util.c'], + [], + []], + + [['src/test/test-user-util.c'], + [], + []], + + [['src/test/test-hostname-util.c'], + [], + []], + + [['src/test/test-process-util.c'], + [], + []], + + [['src/test/test-terminal-util.c'], + [], + []], + + [['src/test/test-path-lookup.c'], + [], + []], + + [['src/test/test-uid-range.c'], + [], + []], + + [['src/test/test-cap-list.c', + generated_gperf_headers], + [], + [libcap]], + + [['src/test/test-socket-util.c'], + [], + []], + + [['src/test/test-barrier.c'], + [], + []], + + [['src/test/test-tmpfiles.c'], + [], + []], + + [['src/test/test-namespace.c'], + [libcore, + libshared, + libudev], + [threads, + libblkid]], + + [['src/test/test-verbs.c'], + [], + []], + + [['src/test/test-install-root.c'], + [], + []], + + [['src/test/test-acl-util.c'], + [], + [], + 'HAVE_ACL'], + + [['src/test/test-seccomp.c'], + [], + [libseccomp], + 'HAVE_SECCOMP'], + + [['src/test/test-rlimit-util.c'], + [], + []], + + [['src/test/test-ask-password-api.c'], + [], + [], + '', 'manual'], + + [['src/test/test-dissect-image.c'], + [], + [libblkid], + '', 'manual'], + + [['src/test/test-signal-util.c'], + [], + []], + + [['src/test/test-selinux.c'], + [], + []], + + [['src/test/test-sizeof.c'], + [libbasic], + []], + + [['src/test/test-hashmap.c', + 'src/test/test-hashmap-plain.c', + test_hashmap_ordered_c], + [], + [], + '', 'timeout=90'], + + [['src/test/test-set.c'], + [], + []], + + [['src/test/test-bitmap.c'], + [], + []], + + [['src/test/test-xml.c'], + [], + []], + + [['src/test/test-list.c'], + [], + []], + + [['src/test/test-unaligned.c'], + [], + []], + + [['src/test/test-tables.c', + 'src/shared/test-tables.h', + 'src/journal/journald-server.c', + 'src/journal/journald-server.h'], + [libcore, + libjournal_core, + libudev_core, + libudev_internal, + libsystemd_network, + libshared], + [threads, + libseccomp, + libmount, + libxz, + liblz4, + libblkid], + '', '', [], libudev_core_includes], + + [['src/test/test-prioq.c'], + [], + []], + + [['src/test/test-fileio.c'], + [], + []], + + [['src/test/test-time.c'], + [], + []], + + [['src/test/test-clock.c'], + [], + []], + + [['src/test/test-architecture.c'], + [], + []], + + [['src/test/test-log.c'], + [], + []], + + [['src/test/test-ipcrm.c'], + [], + [], + '', 'unsafe'], + + [['src/test/test-btrfs.c'], + [], + [], + '', 'manual'], + + + [['src/test/test-firewall-util.c'], + [libfirewall, + libshared], + [], + 'HAVE_LIBIPTC'], + + [['src/test/test-netlink-manual.c'], + [], + [libkmod], + 'HAVE_KMOD', 'manual'], + + [['src/test/test-ellipsize.c'], + [], + []], + + [['src/test/test-date.c'], + [], + []], + + [['src/test/test-sleep.c'], + [], + []], + + [['src/test/test-replace-var.c'], + [], + []], + + [['src/test/test-calendarspec.c'], + [], + []], + + [['src/test/test-strip-tab-ansi.c'], + [], + []], + + [['src/test/test-daemon.c'], + [], + []], + + [['src/test/test-cgroup.c'], + [], + [], + '', 'manual'], + + + [['src/test/test-cgroup-mask.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-cgroup-util.c'], + [], + []], + + [['src/test/test-env-util.c'], + [], + []], + + [['src/test/test-strbuf.c'], + [], + []], + + [['src/test/test-strv.c'], + [], + []], + + [['src/test/test-path-util.c'], + [], + []], + + [['src/test/test-path.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-execute.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-siphash24.c'], + [], + []], + + [['src/test/test-strxcpyx.c'], + [], + []], + + [['src/test/test-install.c'], + [libcore, + libshared], + [], + '', 'manual'], + + [['src/test/test-watchdog.c'], + [], + []], + + [['src/test/test-sched-prio.c'], + [libcore, + libshared, + libudev], + [threads, + librt, + libseccomp, + libselinux, + libmount, + libblkid]], + + [['src/test/test-conf-files.c'], + [], + []], + + [['src/test/test-conf-parser.c'], + [], + []], + + [['src/test/test-af-list.c', + generated_gperf_headers], + [], + []], + + [['src/test/test-arphrd-list.c', + generated_gperf_headers], + [], + []], + + [['src/test/test-journal-importer.c'], + [], + []], + + [['src/test/test-libudev.c'], + [libshared, + libudev], + []], + + [['src/test/test-udev.c'], + [libudev_core, + libudev_internal, + libsystemd_network, + libshared], + [threads, + librt, + libblkid, + libkmod, + libacl], + '', 'manual'], + + [['src/test/test-id128.c'], + [], + []], + + [['src/test/test-hash.c'], + [], + []], + + [['src/test/test-nss.c'], + [], + [libdl], + '', 'manual'], +] + +############################################################ + +# define some tests here, because the link_with deps were not defined earlier + +tests += [ + [['src/journal/test-journal.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-send.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-syslog.c'], + [libjournal_core, + libshared, + libudev], + [threads, + libxz, + liblz4, + libselinux]], + + [['src/journal/test-journal-match.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-enum.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-stream.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-flush.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-init.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-verify.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-journal-interleaving.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-mmap-cache.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4]], + + [['src/journal/test-catalog.c'], + [libjournal_core, + libshared], + [threads, + libxz, + liblz4], + '', '', '-DCATALOG_DIR="@0@"'.format(build_catalog_dir)], + + [['src/journal/test-compress.c'], + [libjournal_core, + libshared], + [liblz4, + libxz]], + + [['src/journal/test-compress-benchmark.c'], + [libjournal_core, + libshared], + [liblz4, + libxz], + '', 'timeout=90'], + + [['src/journal/test-audit-type.c'], + [libjournal_core, + libshared], + [liblz4, + libxz]], +] + +############################################################ + +tests += [ + [['src/libsystemd/sd-bus/test-bus-marshal.c'], + [], + [threads, + libglib, + libgobject, + libgio, + libdbus]], + + [['src/libsystemd/sd-bus/test-bus-signature.c'], + [], + [threads]], + + [['src/libsystemd/sd-bus/test-bus-chat.c'], + [], + [threads]], + + [['src/libsystemd/sd-bus/test-bus-cleanup.c'], + [], + [threads, + libseccomp]], + + [['src/libsystemd/sd-bus/test-bus-error.c'], + [libshared_static, + libsystemd_internal], + []], + + [['src/libsystemd/sd-bus/test-bus-track.c'], + [], + [libseccomp]], + + [['src/libsystemd/sd-bus/test-bus-server.c'], + [], + [threads]], + + [['src/libsystemd/sd-bus/test-bus-objects.c'], + [], + [threads]], + + [['src/libsystemd/sd-bus/test-bus-gvariant.c'], + [], + [libglib, + libgobject, + libgio]], + + [['src/libsystemd/sd-bus/test-bus-creds.c'], + [], + []], + + [['src/libsystemd/sd-bus/test-bus-match.c'], + [], + []], + + [['src/libsystemd/sd-bus/test-bus-kernel.c'], + [], + []], + + [['src/libsystemd/sd-bus/test-bus-kernel-bloom.c'], + [], + []], + + [['src/libsystemd/sd-bus/test-bus-benchmark.c'], + [], + [threads]], + + [['src/libsystemd/sd-bus/test-bus-zero-copy.c'], + [], + []], + + [['src/libsystemd/sd-bus/test-bus-introspect.c'], + [], + []], + + [['src/libsystemd/sd-event/test-event.c'], + [], + []], + + [['src/libsystemd/sd-netlink/test-netlink.c'], + [], + []], + + [['src/libsystemd/sd-netlink/test-local-addresses.c'], + [], + []], + + [['src/libsystemd/sd-resolve/test-resolve.c'], + [], + [threads]], + + [['src/libsystemd/sd-login/test-login.c'], + [], + [], + '', 'manual'], +] + +############################################################ + +tests += [ + [['src/libsystemd-network/test-dhcp-option.c', + 'src/libsystemd-network/dhcp-protocol.h', + 'src/libsystemd-network/dhcp-internal.h'], + [libshared, + libsystemd_network], + []], + + [['src/libsystemd-network/test-dhcp-client.c', + 'src/libsystemd-network/dhcp-protocol.h', + 'src/libsystemd-network/dhcp-internal.h', + 'src/systemd/sd-dhcp-client.h'], + [libshared, + libsystemd_network, + libudev], + []], + + [['src/libsystemd-network/test-dhcp-server.c'], + [libshared, + libsystemd_network], + []], + + [['src/libsystemd-network/test-ipv4ll.c', + 'src/libsystemd-network/arp-util.h', + 'src/systemd/sd-ipv4ll.h'], + [libshared, + libsystemd_network], + []], + + [['src/libsystemd-network/test-ipv4ll-manual.c', + 'src/systemd/sd-ipv4ll.h'], + [libshared, + libsystemd_network], + [], + '', 'manual'], + + [['src/libsystemd-network/test-acd.c', + 'src/systemd/sd-ipv4acd.h'], + [libshared, + libsystemd_network], + [], + '', 'manual'], + + [['src/libsystemd-network/test-ndisc-rs.c', + 'src/libsystemd-network/dhcp-identifier.h', + 'src/libsystemd-network/dhcp-identifier.c', + 'src/libsystemd-network/icmp6-util.h', + 'src/systemd/sd-dhcp6-client.h', + 'src/systemd/sd-ndisc.h'], + [libshared, + libsystemd_network, + libudev], + []], + + [['src/libsystemd-network/test-dhcp6-client.c', + 'src/libsystemd-network/dhcp-identifier.h', + 'src/libsystemd-network/dhcp-identifier.c', + 'src/libsystemd-network/dhcp6-internal.h', + 'src/systemd/sd-dhcp6-client.h'], + [libshared, + libsystemd_network, + libudev], + []], + + [['src/libsystemd-network/test-lldp.c'], + [libshared, + libsystemd_network], + []], +] + +############################################################ + +tests += [ + [['src/login/test-login-shared.c'], + [], + []], + + [['src/login/test-inhibit.c'], + [], + [], + '', 'manual'], + + [['src/login/test-login-tables.c'], + [liblogind_core, + libshared, + libudev], + [threads]], +] diff --git a/src/test/test-dlopen.c b/src/test/test-dlopen.c new file mode 100644 index 0000000000..9f5343a7ea --- /dev/null +++ b/src/test/test-dlopen.c @@ -0,0 +1,32 @@ +/*** + This file is part of systemd. + + Copyright 2016 Zbigniew Jędrzejewski-Szmek + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include +#include + +#include "macro.h" + +int main(int argc, char **argv) { + void *handle; + + assert_se((handle = dlopen(argv[1], RTLD_NOW))); + assert_se(dlclose(handle) == 0); + + return EXIT_SUCCESS; +} diff --git a/src/test/test-hashmap-ordered.awk b/src/test/test-hashmap-ordered.awk new file mode 100644 index 0000000000..10f4386fa4 --- /dev/null +++ b/src/test/test-hashmap-ordered.awk @@ -0,0 +1,11 @@ +BEGIN { + print "/* GENERATED FILE */"; + print "#define ORDERED" +} +{ + if (!match($0, "^#include")) + gsub(/hashmap/, "ordered_hashmap"); + gsub(/HASHMAP/, "ORDERED_HASHMAP"); + gsub(/Hashmap/, "OrderedHashmap"); + print +} diff --git a/src/test/test-nss.c b/src/test/test-nss.c index b59cb7aa69..b4cb3f0d37 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -71,9 +71,11 @@ static void* open_handle(const char* dir, const char* module, int flags) { const char *path; void *handle; - if (dir) - path = strjoina(dir, "/.libs/libnss_", module, ".so.2"); - else + if (dir) { + path = strjoina(dir, "/libnss_", module, ".so.2"); + if (access(path, F_OK) < 0) + path = strjoina(dir, "/.libs/libnss_", module, ".so.2"); + } else path = strjoina("libnss_", module, ".so.2"); handle = dlopen(path, flags); diff --git a/src/timedate/meson.build b/src/timedate/meson.build new file mode 100644 index 0000000000..2e74245f66 --- /dev/null +++ b/src/timedate/meson.build @@ -0,0 +1,14 @@ +if conf.get('ENABLE_TIMEDATED', 0) == 1 + install_data('org.freedesktop.timedate1.conf', + install_dir : dbuspolicydir) + install_data('org.freedesktop.timedate1.service', + install_dir : dbussystemservicedir) + + custom_target( + 'org.freedesktop.timedate1.policy', + input : 'org.freedesktop.timedate1.policy.in', + output : 'org.freedesktop.timedate1.policy', + command : intltool_command, + install : install_polkit, + install_dir : polkitpolicydir) +endif diff --git a/src/timesync/meson.build b/src/timesync/meson.build new file mode 100644 index 0000000000..dece39ea10 --- /dev/null +++ b/src/timesync/meson.build @@ -0,0 +1,26 @@ +systemd_timesyncd_sources = files(''' + timesyncd.c + timesyncd-manager.c + timesyncd-manager.h + timesyncd-conf.c + timesyncd-conf.h + timesyncd-server.c + timesyncd-server.h +'''.split()) + +timesyncd_gperf_c = custom_target( + 'timesyncd-gperf.c', + input : 'timesyncd-gperf.gperf', + output : 'timesyncd-gperf.c', + command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@']) + +systemd_timesyncd_sources += [timesyncd_gperf_c] + +if conf.get('ENABLE_TIMESYNCD', 0) == 1 + timesyncd_conf = configure_file( + input : 'timesyncd.conf.in', + output : 'timesyncd.conf', + configuration : substs) + install_data(timesyncd_conf, + install_dir : pkgsysconfdir) +endif diff --git a/src/udev/generate-keyboard-keys-list.sh b/src/udev/generate-keyboard-keys-list.sh new file mode 100755 index 0000000000..479e493182 --- /dev/null +++ b/src/udev/generate-keyboard-keys-list.sh @@ -0,0 +1,4 @@ +#!/bin/sh -eu + +$1 -dM -include linux/input.h - mnt/cmdline.txt +echo -n "foo=yes bar=no root=/dev/fakeroot debug rd.break=initqueue" >mnt/cmdline.txt objcopy \ - --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \ - --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \ - --add-section .splash=test/splash.bmp --change-section-vma .splash=0x40000 \ - --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \ - --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \ - linuxx64.efi.stub mnt/EFI/Linux/linux-test.efi + --add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \ + --add-section .cmdline=mnt/cmdline.txt --change-section-vma .cmdline=0x30000 \ + --add-section .splash="$splash_bmp" --change-section-vma .splash=0x40000 \ + --add-section .linux=/boot/$(cat /etc/machine-id)/$(uname -r)/linux --change-section-vma .linux=0x2000000 \ + --add-section .initrd=/boot/$(cat /etc/machine-id)/$(uname -r)/initrd --change-section-vma .initrd=0x3000000 \ + "$boot_stub" mnt/EFI/Linux/linux-test.efi # install entries mkdir -p mnt/loader/entries diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build new file mode 100644 index 0000000000..dfbe04a976 --- /dev/null +++ b/tmpfiles.d/meson.build @@ -0,0 +1,43 @@ +enable_tmpfiles = conf.get('ENABLE_TMPFILES', 0) == 1 + +tmpfiles = [['home.conf', ''], + ['journal-nocow.conf', ''], + ['systemd-nologin.conf', ''], + ['systemd-nspawn.conf', ''], + ['systemd-remote.conf', 'ENABLE_REMOTE'], + ['tmp.conf', ''], + ['var.conf', ''], + ['x11.conf', ''], + ['legacy.conf', 'HAVE_SYSV_COMPAT'], + ] + +foreach pair : tmpfiles + if not enable_tmpfiles + # do nothing + elif pair[1] == '' or conf.get(pair[1], 0) == 1 + install_data(pair[0], install_dir : tmpfilesdir) + else + message('Not installing tmpfiles.d/@0@ because @1@ is @2@' + .format(pair[0], pair[1], conf.get(pair[1], 0))) + endif +endforeach + +m4_files = ['etc.conf', + 'systemd.conf'] + +foreach file : m4_files + custom_target( + 'tmpfiles.d/' + file, + input : file + '.m4', + output: file, + command : [m4, '-P'] + m4_defines + ['@INPUT@'], + capture : true, + install : enable_tmpfiles, + install_dir : tmpfilesdir) +endforeach + +if enable_tmpfiles + meson.add_install_script( + 'sh', '-c', + mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d'))) +endif diff --git a/tools/make-man-rules.py b/tools/make-man-rules.py index 18aa513952..ecb9d2d9b5 100644 --- a/tools/make-man-rules.py +++ b/tools/make-man-rules.py @@ -3,7 +3,7 @@ # # This file is part of systemd. # -# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013, 2017 Zbigniew Jędrzejewski-Szmek # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by @@ -22,6 +22,7 @@ from __future__ import print_function import collections import sys import os.path +import pprint from xml_helper import * SECTION = '''\ @@ -66,11 +67,13 @@ EXTRA_DIST += \\ {dist_files} ''' +meson = False + def man(page, number): - return 'man/{}.{}'.format(page, number) + return ('man/' if not meson else '') + '{}.{}'.format(page, number) def xml(file): - return 'man/{}'.format(os.path.basename(file)) + return ('man/' if not meson else '') + os.path.basename(file) def add_rules(rules, name): xml = xml_parse(name) @@ -122,9 +125,40 @@ def make_makefile(rules, dist_files): for conditional,rulegroup in sorted(rules.items()) ) + FOOTER.format(dist_files=mjoin(sorted(dist_files))) +MESON_HEADER = '''\ +# Do not edit. Generated by make-man-rules.py. +manpages = [''' + +MESON_FOOTER = '''\ +] +# Really, do not edit.''' + +def make_mesonfile(rules, dist_files): + # reformat rules as + # grouped = [ [name, section, [alias...], condition], ...] + # + # but first create a dictionary like + # lists = { (name, condition) => [alias...] + grouped = collections.defaultdict(list) + for condition, items in rules.items(): + for alias, name in items.items(): + group = grouped[(name, condition)] + if name != alias: + group.append(alias) + + lines = [ [p[0][:-2], p[0][-1], sorted(a[:-2] for a in aliases), p[1]] + for p, aliases in sorted(grouped.items()) ] + return '\n'.join((MESON_HEADER, pprint.pformat(lines)[1:-1], MESON_FOOTER)) + if __name__ == '__main__': - rules = create_rules(sys.argv[1:]) - dist_files = (xml(file) for file in sys.argv[1:] + meson = sys.argv[1] == '--meson' + pages = sys.argv[1+meson:] + + rules = create_rules(pages) + dist_files = (xml(file) for file in pages if not file.endswith(".directives.xml") and not file.endswith(".index.xml")) - print(make_makefile(rules, dist_files), end='') + if meson: + print(make_mesonfile(rules, dist_files)) + else: + print(make_makefile(rules, dist_files), end='') diff --git a/tools/meson-check-compilation.sh b/tools/meson-check-compilation.sh new file mode 100755 index 0000000000..d3b2a312fd --- /dev/null +++ b/tools/meson-check-compilation.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eu + +"$@" '-' -o/dev/null 80' | grep -E --color=yes '.{80}' + exit 1 +fi + +# no --help output to stdout +if "$1" --help 2>&1 1>/dev/null | grep .; then + echo "$(basename "$1") --help prints to stderr" + exit 2 +fi + +# error output to stderr +if ! "$1" --no-such-parameter 2>&1 1>/dev/null | grep -q .; then + echo "$(basename "$1") with an unknown parameter does not print to stderr" + exit 3 +fi diff --git a/tools/meson-git-contrib.sh b/tools/meson-git-contrib.sh new file mode 100755 index 0000000000..1c614ef511 --- /dev/null +++ b/tools/meson-git-contrib.sh @@ -0,0 +1,7 @@ +#!/bin/sh -eu + +git shortlog -s `git describe --abbrev=0`.. | \ + cut -c8- | \ + sed 's/ / /g' | \ + awk '{ print $$0 "," }' | \ + sort -u diff --git a/tools/meson-hwdb-update.sh b/tools/meson-hwdb-update.sh new file mode 100755 index 0000000000..4c919073bb --- /dev/null +++ b/tools/meson-hwdb-update.sh @@ -0,0 +1,15 @@ +#!/bin/sh -eu + +cd "$1" + +curl -L -o usb.ids 'http://www.linux-usb.org/usb.ids' +curl -L -o pci.ids 'http://pci-ids.ucw.cz/v2.2/pci.ids' +curl -L -o ma-large.txt 'http://standards-oui.ieee.org/oui/oui.txt' +curl -L -o ma-medium.txt 'http://standards-oui.ieee.org/oui28/mam.txt' +curl -L -o ma-small.txt 'http://standards-oui.ieee.org/oui36/oui36.txt' +curl -L -o pnp_id_registry.html 'http://www.uefi.org/uefi-pnp-export' +curl -L -o acpi_id_registry.html 'http://www.uefi.org/uefi-acpi-export' +./ids-update.pl +./acpi-update.py > 20-acpi-vendor.hwdb.base +patch -p0 -o- 20-acpi-vendor.hwdb.base <20-acpi-vendor.hwdb.patch >20-acpi-vendor.hwdb +diff -u 20-acpi-vendor.hwdb.base 20-acpi-vendor.hwdb >20-acpi-vendor.hwdb.patch diff --git a/tools/meson-link-test.c b/tools/meson-link-test.c new file mode 100644 index 0000000000..825bbff05f --- /dev/null +++ b/tools/meson-link-test.c @@ -0,0 +1 @@ +int main(void) {return 0;} diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh new file mode 100755 index 0000000000..47a5e70ae5 --- /dev/null +++ b/tools/meson-make-symlink.sh @@ -0,0 +1,11 @@ +#!/bin/sh -eu + +# this is needed mostly because $DESTDIR is provided as a variable, +# and we need to create the target directory... + +mkdir -vp "$(dirname "${DESTDIR:-}$2")" +if [ "$(dirname $1)" = . ]; then + ln -vfs -T "$1" "${DESTDIR:-}$2" +else + ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" +fi diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh new file mode 100755 index 0000000000..dfd287e172 --- /dev/null +++ b/units/meson-add-wants.sh @@ -0,0 +1,27 @@ +#!/bin/sh -eu + +unitdir="$1" +target="$2" +unit="$3" + +case "$target" in + */?*) # a path, but not just a slash at the end + dir="${DESTDIR:-}${target}" + ;; + *) + dir="${DESTDIR:-}${unitdir}/${target}" + ;; +esac + +unitpath="${DESTDIR:-}${unitdir}/${unit}" + +case "$target" in + */) + mkdir -p -m 0755 "$dir" + ;; + *) + mkdir -p -m 0755 "$(basename "$dir")" + ;; +esac + +ln -vfs --relative "$unitpath" "$dir" diff --git a/units/meson.build b/units/meson.build new file mode 100644 index 0000000000..0cc5f8861a --- /dev/null +++ b/units/meson.build @@ -0,0 +1,329 @@ +units = [ + ['basic.target', ''], + ['bluetooth.target', ''], + ['cryptsetup-pre.target', 'HAVE_LIBCRYPTSETUP'], + ['cryptsetup.target', 'HAVE_LIBCRYPTSETUP', + 'sysinit.target.wants/'], + ['dev-hugepages.mount', '', + 'sysinit.target.wants/'], + ['dev-mqueue.mount', '', + 'sysinit.target.wants/'], + ['emergency.target', ''], + ['exit.target', ''], + ['final.target', ''], + ['getty.target', '', + 'multi-user.target.wants/'], + ['graphical.target', '', + 'runlevel5.target default.target'], + ['halt.target', ''], + ['hibernate.target', 'ENABLE_HIBERNATE'], + ['hybrid-sleep.target', 'ENABLE_HIBERNATE'], + ['initrd-fs.target', ''], + ['initrd-root-device.target', ''], + ['initrd-root-fs.target', ''], + ['initrd-switch-root.target', ''], + ['initrd.target', ''], + ['kexec.target', ''], + ['ldconfig.service', 'ENABLE_LDCONFIG', + 'sysinit.target.wants/'], + ['local-fs-pre.target', ''], + ['local-fs.target', ''], + ['machine.slice', 'ENABLE_MACHINED'], + ['machines.target', 'ENABLE_MACHINED', + join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['multi-user.target', '', + 'runlevel2.target runlevel3.target runlevel4.target'], + ['network-online.target', ''], + ['network-pre.target', ''], + ['network.target', ''], + ['nss-lookup.target', ''], + ['nss-user-lookup.target', ''], + ['paths.target', ''], + ['poweroff.target', '', + 'runlevel0.target'], + ['printer.target', ''], + ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', + 'sysinit.target.wants/'], + ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], + ['reboot.target', '', + 'runlevel6.target ctrl-alt-del.target'], + ['remote-fs-pre.target', ''], + ['remote-fs.target', '', + join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['rescue.target', '', + 'runlevel1.target'], + ['rpcbind.target', ''], + ['shutdown.target', ''], + ['sigpwr.target', ''], + ['sleep.target', ''], + ['slices.target', ''], + ['smartcard.target', ''], + ['sockets.target', ''], + ['sound.target', ''], + ['suspend.target', ''], + ['swap.target', ''], + ['sys-fs-fuse-connections.mount', '', + 'sysinit.target.wants/'], + ['sys-kernel-config.mount', '', + 'sysinit.target.wants/'], + ['sys-kernel-debug.mount', '', + 'sysinit.target.wants/'], + ['sysinit.target', ''], + ['syslog.socket', ''], + ['system-update.target', ''], + ['system.slice', ''], + ['systemd-ask-password-console.path', '', + 'sysinit.target.wants/'], + ['systemd-ask-password-wall.path', '', + 'multi-user.target.wants/'], + ['systemd-coredump.socket', 'ENABLE_COREDUMP', + 'sockets.target.wants/'], + ['systemd-initctl.socket', '', + 'sockets.target.wants/'], + ['systemd-journal-gatewayd.socket', ''], + ['systemd-journal-remote.socket', ''], + ['systemd-journald-audit.socket', '', + 'sockets.target.wants/'], + ['systemd-journald-dev-log.socket', '', + 'sockets.target.wants/'], + ['systemd-journald.socket', '', + 'sockets.target.wants/'], + ['systemd-networkd.socket', '', + join_paths(pkgsysconfdir, 'system/sockets.target.wants/')], + ['systemd-rfkill.socket', 'ENABLE_RFKILL'], + ['systemd-tmpfiles-clean.timer', '', + 'timers.target.wants/'], + ['systemd-udevd-control.socket', '', + 'sockets.target.wants/'], + ['systemd-udevd-kernel.socket', '', + 'sockets.target.wants/'], + ['time-sync.target', ''], + ['timers.target', ''], + ['umount.target', ''], + ['user.slice', ''], + ['var-lib-machines.mount', '', + 'local-fs.target.wants/'], +] + +in_units = [ + ['debug-shell.service', ''], + ['emergency.service', ''], + ['halt-local.service', 'HAVE_SYSV_COMPAT'], + ['initrd-cleanup.service', ''], + ['initrd-parse-etc.service', ''], + ['initrd-switch-root.service', ''], + ['initrd-udevadm-cleanup-db.service', ''], + ['kmod-static-nodes.service', 'HAVE_KMOD ENABLE_TMPFILES', + 'sysinit.target.wants/'], + ['quotaon.service', 'ENABLE_QUOTACHECK'], + ['rc-local.service', 'HAVE_SYSV_COMPAT'], + ['rescue.service', ''], + ['system-update-cleanup.service', ''], + ['systemd-ask-password-console.service', ''], + ['systemd-ask-password-wall.service', ''], + ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], + ['systemd-binfmt.service', 'ENABLE_BINFMT', + 'sysinit.target.wants/'], + ['systemd-coredump@.service', 'ENABLE_COREDUMP'], + ['systemd-exit.service', ''], + ['systemd-firstboot.service', 'ENABLE_FIRSTBOOT', + 'sysinit.target.wants/'], + ['systemd-fsck-root.service', ''], + ['systemd-fsck@.service', ''], + ['systemd-halt.service', ''], + ['systemd-hibernate-resume@.service', 'ENABLE_HIBERNATE'], + ['systemd-hibernate.service', 'ENABLE_HIBERNATE'], + ['systemd-hybrid-sleep.service', 'ENABLE_HIBERNATE'], + ['systemd-hostnamed.service', 'ENABLE_HOSTNAMED', + 'dbus-org.freedesktop.hostname1.service'], + ['systemd-hwdb-update.service', 'ENABLE_HWDB', + 'sysinit.target.wants/'], + ['systemd-importd.service', 'ENABLE_IMPORTD', + 'dbus-org.freedesktop.import1.service'], + ['systemd-initctl.service', ''], + ['systemd-journal-catalog-update.service', '', + 'sysinit.target.wants/'], + ['systemd-journal-flush.service', '', + 'sysinit.target.wants/'], + ['systemd-journal-gatewayd.service', 'ENABLE_REMOTE HAVE_MICROHTTPD'], + ['systemd-journal-remote.service', 'ENABLE_REMOTE HAVE_MICROHTTPD'], + ['systemd-journal-upload.service', 'ENABLE_REMOTE HAVE_LIBCURL'], + ['systemd-journald.service', '', + 'sysinit.target.wants/'], + ['systemd-kexec.service', ''], + ['systemd-localed.service', 'ENABLE_LOCALED', + 'dbus-org.freedesktop.locale1.service'], + ['systemd-logind.service', 'ENABLE_LOGIND', + 'multi-user.target.wants/ dbus-org.freedesktop.login1.service'], + ['systemd-machine-id-commit.service', '', + 'sysinit.target.wants/'], + ['systemd-machined.service', 'ENABLE_MACHINED', + 'dbus-org.freedesktop.machine1.service'], + ['systemd-modules-load.service', 'HAVE_KMOD', + 'sysinit.target.wants/'], + ['systemd-networkd-wait-online.service', 'ENABLE_NETWORKD', + join_paths(pkgsysconfdir, 'system/network-online.target.wants/')], + ['systemd-nspawn@.service', ''], + ['systemd-poweroff.service', ''], + ['systemd-quotacheck.service', 'ENABLE_QUOTACHECK'], + ['systemd-random-seed.service', 'ENABLE_RANDOMSEED', + 'sysinit.target.wants/'], + ['systemd-reboot.service', ''], + ['systemd-remount-fs.service', '', + 'local-fs.target.wants/'], + ['systemd-rfkill.service', 'ENABLE_RFKILL'], + ['systemd-suspend.service', ''], + ['systemd-sysctl.service', '', + 'sysinit.target.wants/'], + ['systemd-sysusers.service', 'ENABLE_SYSUSERS', + 'sysinit.target.wants/'], + ['systemd-timedated.service', 'ENABLE_TIMEDATED', + 'dbus-org.freedesktop.timedate1.service'], + ['systemd-timesyncd.service', 'ENABLE_TIMESYNCD', + join_paths(pkgsysconfdir, 'system/sysinit.target.wants/')], + ['systemd-tmpfiles-clean.service', 'ENABLE_TMPFILES'], + ['systemd-tmpfiles-setup-dev.service', 'ENABLE_TMPFILES', + 'sysinit.target.wants/'], + ['systemd-tmpfiles-setup.service', 'ENABLE_TMPFILES', + 'sysinit.target.wants/'], + ['systemd-udev-settle.service', ''], + ['systemd-udev-trigger.service', '', + 'sysinit.target.wants/'], + ['systemd-udevd.service', '', + 'sysinit.target.wants/'], + ['systemd-update-done.service', '', + 'sysinit.target.wants/'], + ['systemd-update-utmp-runlevel.service', 'HAVE_UTMP HAVE_SYSV_COMPAT', + 'multi-user.target.wants/ graphical.target.wants/ rescue.target.wants/'], + ['systemd-update-utmp.service', 'HAVE_UTMP', + 'sysinit.target.wants/'], + ['systemd-user-sessions.service', '', + 'multi-user.target.wants/'], + ['systemd-vconsole-setup.service', 'ENABLE_VCONSOLE'], + ['systemd-volatile-root.service', ''], +] + +m4_units = [ + ['getty@.service', '', + 'autovt@.service ' + + join_paths(pkgsysconfdir, 'system/getty.target.wants/getty@tty1.service')], + ['serial-getty@.service', ''], + ['tmp.mount', '', + 'local-fs.target.wants/'], +] + +m4_in_units = [ + ['console-getty.service', ''], + ['container-getty@.service', ''], + ['systemd-networkd.service', 'ENABLE_NETWORKD', + join_paths(pkgsysconfdir, 'system/dbus-org.freedesktop.network1.service') + ' ' + + join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['systemd-resolved.service', 'ENABLE_RESOLVED', + join_paths(pkgsysconfdir, 'system/dbus-org.freedesktop.resolve1.service') + ' ' + + join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['user@.service', ''], +] + +foreach tuple : m4_in_units + file = tuple[0] + + gen = configure_file( + input : file + '.m4.in', + output : file + '.m4', + configuration : substs) + + m4_units += [[file, tuple.get(1, ''), tuple.get(2, ''), gen]] +endforeach + +foreach tuple : in_units + file = tuple[0] + + # we do this here because install_data does not accept custom_target output + conds = tuple[1].split(' ') + install = ((conds.get(0, '') == '' or conf.get(conds[0], 0) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1], 0) == 1)) + + gen1 = configure_file( + input : file + '.in', + output : file + '.tmp', + configuration : substs) + gen2 = custom_target( + file, + input : gen1, + output : file, + command : [sed, '/^## /d', '@INPUT@'], + capture : true, + install : install, + install_dir : systemunitdir) + + if install and tuple.length() > 2 + foreach target : tuple[2].split() + meson.add_install_script('meson-add-wants.sh', systemunitdir, target, file) + endforeach + endif +endforeach + +foreach tuple : m4_units + file = tuple[0] + input = tuple.get(3, file + '.m4') + + # we do this here because install_data does not accept custom_target output + conds = tuple[1].split(' ') + install = ((conds.get(0, '') == '' or conf.get(conds[0], 0) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1], 0) == 1)) + + custom_target( + file, + input : input, + output: file, + command : [m4, '-P'] + m4_defines + ['@INPUT@'], + capture : true, + install : install, + install_dir : systemunitdir) + + if tuple.length() > 2 and install + foreach target : tuple[2].split() + meson.add_install_script('meson-add-wants.sh', systemunitdir, target, file) + endforeach + endif +endforeach + +foreach tuple : units + file = tuple[0] + input = tuple.get(3, file) + + conds = tuple[1].split(' ') + install = ((conds.get(0, '') == '' or conf.get(conds[0], 0) == 1) and + (conds.get(1, '') == '' or conf.get(conds[1], 0) == 1)) + + if install + install_data(input, + install_dir : systemunitdir) + + if tuple.length() > 2 + foreach target : tuple[2].split() + meson.add_install_script( + 'meson-add-wants.sh', systemunitdir, target, file) + endforeach + endif + endif +endforeach + +############################################################ + +meson.add_install_script(meson_make_symlink, + join_paths(pkgsysconfdir, 'user'), + join_paths(sysconfdir, 'xdg/systemd/user')) +meson.add_install_script(meson_make_symlink, + join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'), + join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service')) +if conf.get('HAVE_SYSV_COMPAT', 0) == 1 + foreach i : [1, 2, 3, 4, 5] + meson.add_install_script( + 'sh', '-c', + mkdir_p + .format(join_paths(systemunitdir, 'runlevel@0@.target.wants'.format(i)))) + endforeach +endif + +subdir('user') diff --git a/units/user/meson.build b/units/user/meson.build new file mode 100644 index 0000000000..b507144c05 --- /dev/null +++ b/units/user/meson.build @@ -0,0 +1,33 @@ +units = [ + 'basic.target', + 'bluetooth.target', + 'default.target', + 'exit.target', + 'graphical-session-pre.target', + 'graphical-session.target', + 'paths.target', + 'printer.target', + 'shutdown.target', + 'smartcard.target', + 'sockets.target', + 'sound.target', + 'timers.target', +] + +foreach file : units + install_data(file, + install_dir : userunitdir) +endforeach + +in_units = [ + 'systemd-exit.service', +] + +foreach file : in_units + gen = configure_file( + input : file + '.in', + output : file, + configuration : substs) + install_data(gen, + install_dir : userunitdir) +endforeach