systemd ❤ meson

After hearing good things about meson for a long time, I decided to take the plunge and started working on porting the build system of systemd to meson. In our case "build system" is really a system — 11.5k lines in configure.ac and two Makefile.am s. This undertaking was bigger than I expected. Even though I had the initial patch compiling most of the code after a weekend of work, it took another two weeks and 70 patches [1] to bring it to mergeable state. There are still minor issues outstanding, but the pull request has been merged, so I want to take the opportunity to celebrate and summarize my impressions about meson.

It has been an immense privilege and pleasure to receive feedback and advice from contributors on both sides. On the systemd side, Michael Biebl, Evgeny Vereshchagin, Michael Olbrich, and Mike Gilbert reviewed the pull request multiple times, providing a long stream of issues to fix and patches. But also from the other side, meson contributors Igor Gnatenko, Jussi Pakkanen, Nirbheek Chauhan, TingPing reviewed the patchset and provided many useful suggestions. In addition, since systemd is a fairly complicated project, I filed quite a few bugs against meson [2], and received response to all of them immediately, and some are already fixed. This makes me very optimistic about meson's future — even though there are some shortcomings, the community is extremely responsive and meson seems to improve very quickly.

Finally I want to give a shout out to Michal Sojka who wrote meson-mode for emacs and also fixed all reported bugs incredibly quickly.

Why meson

In case you didn't know, meson is python-based configuration system that performs detection and configuration and generates ninja rules to do the actual compilation [3]. The project is young — it was started right before Christmas 2012, but it has recently been picked up by various high-profile projects including mesa, gstreamer, gnome-builder, etc.

Why would one want to replace a working build system with something new?

For systemd, there are basically 2½ reasons

  • the build is faster. This sounds like a minor issue, but quick builds make development easier. Detailed statistics are provided below [update: will be provided in a subsequent note, this one is long enough already], but the summary is that under meson a full configuration and build is an order of magnitude faster, and for partial rebuilds the gap is even bigger. To quote Lennart Poettering

    you can't overestimate the relevance of the speed of building systemd: it's one of the most defining factors of making hacking systemd fun, and keeping people focused.

  • the configuration language is simpler. For historical reasons, autoconf uses a mixture of m4 and shell, and automake has its own dsl that is similar-but-not-the-same as make. Under meson this is replaced by a single pythonesque language that is used to declare the configuration options, environment checks, dependencies, and compilation and installation rules. This lowers the bar for contributors, and removes many gotchas.

    To get a taste for the syntax, compare meson

    if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
             conf.set('USE_SYS_RANDOM_H', 1)
             conf.set10('HAVE_DECL_GETRANDOM', 1)
    else
             have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
             conf.set10('HAVE_DECL_GETRANDOM', have)
    endif
    

    with autoconf

    AC_CHECK_DECLS([getrandom],
                   [AC_DEFINE([USE_SYS_RANDOM_H], [], [sys/random.h is usable])],
                   [AC_CHECK_DECLS([getrandom], [], [], [[
    #include <sys/random.h>
    ]])], [[
    #include <linux/random.h>
    ]])
    

    As a trivial example, we had occasional bugs in the old build system where a line continuation was omitted (e.g. c22569eeea, fe582db94b) resulting in strange build failures. Under the new build system I get a useful error message:

    Meson encountered an error in file src/shared/meson.build, line 114, column 44:
    Expecting rbracket got comma.
            shared_sources += ['seccomp-util.c',,]
                              ^_________________^
    
    Meson encountered an error in file src/shared/meson.build, line 115, column 27:
    Expecting rbracket got string.
                               'seccomm-util.h']
                               ^
    For a block that started at 114,26
            shared_sources += ['seccomp-util.c'
                              ^
    
  • the half reason is that meson + ninja provide slightly better error reporting in case of build failures. By default the compilation log is very terse, with \r used to constantly overwrite the status, keeping an uneventful build to one line. But when something goes wrong, the command is printed along with the full output. The result is superior in the case of multi-threaded compilation. On my workstation if normally use make -j12, so finding the error requires scrolling back through pages of logs to find the failure point.

    The way that the commands themselves are reported is also nicer under ninja. Compare meson:

    FAILED: src/shared/systemd-shared-233@sha/seccomp-util.c.o
    ccache cc '-Isrc/shared/systemd-shared-233@sha' '-Isrc/shared'
    '-Isrc/basic' '-Isrc/journal' '-I../src/shared'
    '-Isrc/libsystemd-network' '-I../src/libsystemd-network'
    '-I../src/libsystemd/sd-network' '-I../src/libsystemd/sd-netlink'
    '-I../src/libsystemd/sd-id128' '-I../src/libsystemd/sd-hwdb'
    '-I../src/libsystemd/sd-device' '-I../src/libsystemd/sd-bus'
    '-Isrc/core' '-I../src/core' '-Isrc/libudev' '-I../src/libudev'
    '-Isrc/udev' '-I../src/udev' '-Isrc/login' '-I../src/login'
    '-Isrc/timesync' '-I../src/timesync' '-Isrc/resolve'
    '-I../src/resolve' '-I../src/journal' '-Isrc/systemd'
    '-I../src/systemd' '-I../src/basic' '-I/usr/include/blkid'
    '-I/usr/include/uuid' '-fdiagnostics-color=always' '-pipe'
    '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-std=gnu99'
    '-O0' '-g' '-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'
    '-Werror=shadow' '-include' 'config.h' '-fPIC' '-pthread'
    '-fvisibility=default' '-MMD' '-MQ'
    'src/shared/systemd-shared-233@sha/seccomp-util.c.o' '-MF'
    'src/shared/systemd-shared-233@sha/seccomp-util.c.o.d' -o
    'src/shared/systemd-shared-233@sha/seccomp-util.c.o' -c
    ../src/shared/seccomp-util.c
    
    ../src/shared/seccomp-util.c: In function ‘seccomp_restrict_archs’:
    ../src/shared/seccomp-util.c:1305:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘r’
             int r r;
                   ^
    ../src/shared/seccomp-util.c:1305:15: error: ‘r’ undeclared (first use in this function)
    ../src/shared/seccomp-util.c:1305:15: note: each undeclared identifier is reported only once for each function it appears in
    

    with automake + libtool (make V=1):

    /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H
    -I. -I..  -include ./config.h -DPKGSYSCONFDIR=\"/etc/systemd\"
    -DSYSTEM_CONFIG_UNIT_PATH=\"/etc/systemd/system\"
    -DSYSTEM_DATA_UNIT_PATH=\"/usr/lib/systemd/system\"
    -DSYSTEM_SYSVINIT_PATH=\"/etc/init.d\"
    -DSYSTEM_SYSVRCND_PATH=\"/etc/rc.d\"
    -DUSER_CONFIG_UNIT_PATH=\"/etc/systemd/user\"
    -DUSER_DATA_UNIT_PATH=\"/usr/lib/systemd/user\"
    -DCERTIFICATE_ROOT=\"/etc/ssl\"
    -DCATALOG_DATABASE=\"/var/lib/systemd/catalog/database\"
    -DSYSTEMD_CGROUP_AGENT_PATH=\"/usr/lib/systemd/systemd-cgroups-agent\"
    -DSYSTEMD_BINARY_PATH=\"/usr/lib/systemd/systemd\"
    -DSYSTEMD_FSCK_PATH=\"/usr/lib/systemd/systemd-fsck\"
    -DSYSTEMD_SHUTDOWN_BINARY_PATH=\"/usr/lib/systemd/systemd-shutdown\"
    -DSYSTEMD_SLEEP_BINARY_PATH=\"/usr/lib/systemd/systemd-sleep\"
    -DSYSTEMCTL_BINARY_PATH=\"/usr/bin/systemctl\"
    -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"/usr/bin/systemd-tty-ask-password-agent\"
    -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"/usr/bin/systemd-stdio-bridge\" -DROOTPREFIX=\"/usr\"
    -DRANDOM_SEED_DIR=\"/var/lib/systemd/\"
    -DRANDOM_SEED=\"/var/lib/systemd/random-seed\"
    -DSYSTEMD_CRYPTSETUP_PATH=\"/usr/lib/systemd/systemd-cryptsetup\"
    -DSYSTEM_GENERATOR_PATH=\"/usr/lib/systemd/system-generators\"
    -DUSER_GENERATOR_PATH=\"/usr/lib/systemd/user-generators\"
    -DSYSTEM_ENV_GENERATOR_PATH=\"/usr/lib/systemd/system-environment-generators\"
    -DUSER_ENV_GENERATOR_PATH=\"/usr/lib/systemd/user-environment-generators\"
    -DSYSTEM_SHUTDOWN_PATH=\"/usr/lib/systemd/system-shutdown\"
    -DSYSTEM_SLEEP_PATH=\"/usr/lib/systemd/system-sleep\"
    -DSYSTEMD_KBD_MODEL_MAP=\"/usr/share/systemd/kbd-model-map\"
    -DSYSTEMD_LANGUAGE_FALLBACK_MAP=\"/usr/share/systemd/language-fallback-map\" -DUDEVLIBEXECDIR=\"/usr/lib/udev\"
    -DPOLKIT_AGENT_BINARY_PATH=\"/usr/bin/pkttyagent\" -DQUOTACHECK=\"/usr/sbin/quotacheck\" -DKEXEC=\"/usr/sbin/kexec\"
    -DMOUNT_PATH=\"/usr/bin/mount\"
    -DUMOUNT_PATH=\"/usr/bin/umount\" -DLIBDIR=\"/usr/lib64\" -DROOTLIBDIR=\"/usr/lib64\" -DROOTLIBEXECDIR=\"/usr/lib/systemd\" -I
    ../src -I ./src/basic -I ../src/basic -I ../src/shared -I
    ./src/shared -I ../src/network -I ../src/locale -I ../src/login -I
    ../src/journal -I ./src/journal -I ../src/timedate -I
    ../src/timesync -I ../src/nspawn -I ../src/resolve -I
    ./src/resolve -I ../src/systemd -I ./src/core -I ../src/core -I
    ../src/libudev -I ../src/udev -I ../src/udev/net -I ./src/udev -I
    ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-event -I
    ../src/libsystemd/sd-login -I ../src/libsystemd/sd-netlink -I
    ../src/libsystemd/sd-network -I ../src/libsystemd/sd-hwdb -I
    ../src/libsystemd/sd-device -I ../src/libsystemd/sd-id128 -I
    ../src/libsystemd-network
    -DABS_SRC_DIR=\"/home/zbyszek/src/systemd/build-autotools/..\"
    -DABS_BUILD_DIR=\"/home/zbyszek/src/systemd/build-autotools\"
    -Wp,-D_FORTIFY_SOURCE=2
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 -Werror=shadow -flto -ffunction-sections -fdata-sections
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 -Werror=shadow -flto -ffunction-sections -fdata-sections -pthread
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 -Werror=shadow -flto -ffunction-sections -fdata-sections
    -I/usr/include/blkid -I/usr/include/uuid
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 -Werror=shadow -flto -ffunction-sections -fdata-sections -Wno-pointer-arith
    -I/usr/include/blkid
    -I/usr/include/uuid -fvisibility=default -g -O2 -MT
    src/shared/libsystemd_shared_la-seccomp-util.lo -MD -MP -MF
    src/shared/.deps/libsystemd_shared_la-seccomp-util.Tpo -c -o
    src/shared/libsystemd_shared_la-seccomp-util.lo `test -f
    'src/shared/seccomp-util.c' || echo
    '../'`src/shared/seccomp-util.c
    
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -include
    ./config.h -DPKGSYSCONFDIR=\"/etc/systemd\"
    -DSYSTEM_CONFIG_UNIT_PATH=\"/etc/systemd/system\"
    -DSYSTEM_DATA_UNIT_PATH=\"/usr/lib/systemd/system\"
    -DSYSTEM_SYSVINIT_PATH=\"/etc/init.d\"
    -DSYSTEM_SYSVRCND_PATH=\"/etc/rc.d\"
    -DUSER_CONFIG_UNIT_PATH=\"/etc/systemd/user\"
    -DUSER_DATA_UNIT_PATH=\"/usr/lib/systemd/user\"
    -DCERTIFICATE_ROOT=\"/etc/ssl\"
    -DCATALOG_DATABASE=\"/var/lib/systemd/catalog/database\"
    -DSYSTEMD_CGROUP_AGENT_PATH=\"/usr/lib/systemd/systemd-cgroups-agent\"
    -DSYSTEMD_BINARY_PATH=\"/usr/lib/systemd/systemd\"
    -DSYSTEMD_FSCK_PATH=\"/usr/lib/systemd/systemd-fsck\"
    -DSYSTEMD_SHUTDOWN_BINARY_PATH=\"/usr/lib/systemd/systemd-shutdown\"
    -DSYSTEMD_SLEEP_BINARY_PATH=\"/usr/lib/systemd/systemd-sleep\"
    -DSYSTEMCTL_BINARY_PATH=\"/usr/bin/systemctl\"
    -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"/usr/bin/systemd-tty-ask-password-agent\"
    -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"/usr/bin/systemd-stdio-bridge\" -DROOTPREFIX=\"/usr\"
    -DRANDOM_SEED_DIR=\"/var/lib/systemd/\"
    -DRANDOM_SEED=\"/var/lib/systemd/random-seed\"
    -DSYSTEMD_CRYPTSETUP_PATH=\"/usr/lib/systemd/systemd-cryptsetup\"
    -DSYSTEM_GENERATOR_PATH=\"/usr/lib/systemd/system-generators\"
    -DUSER_GENERATOR_PATH=\"/usr/lib/systemd/user-generators\"
    -DSYSTEM_ENV_GENERATOR_PATH=\"/usr/lib/systemd/system-environment-generators\"
    -DUSER_ENV_GENERATOR_PATH=\"/usr/lib/systemd/user-environment-generators\"
    -DSYSTEM_SHUTDOWN_PATH=\"/usr/lib/systemd/system-shutdown\"
    -DSYSTEM_SLEEP_PATH=\"/usr/lib/systemd/system-sleep\"
    -DSYSTEMD_KBD_MODEL_MAP=\"/usr/share/systemd/kbd-model-map\"
    -DSYSTEMD_LANGUAGE_FALLBACK_MAP=\"/usr/share/systemd/language-fallback-map\" -DUDEVLIBEXECDIR=\"/usr/lib/udev\"
    -DPOLKIT_AGENT_BINARY_PATH=\"/usr/bin/pkttyagent\" -DQUOTACHECK=\"/usr/sbin/quotacheck\" -DKEXEC=\"/usr/sbin/kexec\"
    -DMOUNT_PATH=\"/usr/bin/mount\"
    -DUMOUNT_PATH=\"/usr/bin/umount\" -DLIBDIR=\"/usr/lib64\" -DROOTLIBDIR=\"/usr/lib64\" -DROOTLIBEXECDIR=\"/usr/lib/systemd\" -I
    ../src -I ./src/basic -I ../src/basic -I ../src/shared -I
    ./src/shared -I ../src/network -I ../src/locale -I ../src/login -I
    ../src/journal -I ./src/journal -I ../src/timedate -I
    ../src/timesync -I ../src/nspawn -I ../src/resolve -I
    ./src/resolve -I ../src/systemd -I ./src/core -I ../src/core -I
    ../src/libudev -I ../src/udev -I ../src/udev/net -I ./src/udev -I
    ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-event -I
    ../src/libsystemd/sd-login -I ../src/libsystemd/sd-netlink -I
    ../src/libsystemd/sd-network -I ../src/libsystemd/sd-hwdb -I
    ../src/libsystemd/sd-device -I ../src/libsystemd/sd-id128 -I
    ../src/libsystemd-network
    -DABS_SRC_DIR=\"/home/zbyszek/src/systemd/build-autotools/..\"
    -DABS_BUILD_DIR=\"/home/zbyszek/src/systemd/build-autotools\"
    -Wp,-D_FORTIFY_SOURCE=2
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 --param=ssp-buffer-size=4 -Werror=shadow -flto -ffunction-sections -fdata-sections
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 --param=ssp-buffer-size=4 -Werror=shadow -flto -ffunction-sections -fdata-sections -pthread
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 --param=ssp-buffer-size=4 -Werror=shadow -flto -ffunction-sections -fdata-sections
    -I/usr/include/blkid -I/usr/include/uuid
    -D__SANE_USERSPACE_TYPES__ -pipe -Wall -Wextra -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 --param=ssp-buffer-size=4 -Werror=shadow -flto -ffunction-sections -fdata-sections -Wno-pointer-arith
    -I/usr/include/blkid
    -I/usr/include/uuid -fvisibility=default -g -O2 -MT
    src/shared/libsystemd_shared_la-seccomp-util.lo -MD -MP -MF
    src/shared/.deps/libsystemd_shared_la-seccomp-util.Tpo -c
    ../src/shared/seccomp-util.c -fPIC -DPIC -o
    src/shared/.libs/libsystemd_shared_la-seccomp-util.o
    
    ../src/shared/seccomp-util.c: In function ‘seccomp_restrict_archs’:
    ../src/shared/seccomp-util.c:1305:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘r’
             int r r;
                   ^
    ../src/shared/seccomp-util.c:1305:15: error: ‘r’ undeclared (first use in this function)
    ../src/shared/seccomp-util.c:1305:15: note: each undeclared identifier is reported only once for each function it appears in
    Makefile:18833: recipe for target 'src/shared/libsystemd_shared_la-seccomp-util.lo' failed
    make: *** [src/shared/libsystemd_shared_la-seccomp-util.lo] Error 1
    make: Leaving directory '/home/zbyszek/src/systemd/build-autotools'
    

    (yes, some of the compilation options are needlessly repeated in both cases. Under automake, they seem to be repeated quite bit. I think nobody really noticed before, this stuff is so painful to look at.)

    I graded this as half of a reason, because autotools does a pretty good job with its V=0/1/2 options, and custom prefixes for different commands. I think there's still room for improvement under meson. For example, the command line would be much easier to read if the unneeded quoting was dropped.

Results

In the end, the meson patchset is 76 files with 7.5k lines.

[1]I include a changelog on patches that have been updated in response to comments, and the longest one is currently at v12. Even though it technically is still one patch, it doesn't feel like that.
[2]https://github.com/mesonbuild/meson/issues?utf8=%E2%9C%93&q=is%3Aissue%20author%3Akeszybz%20
[3]meson supports other backends, but since systemd is Linux-only, those are not relevant

Comments !

social