Commit graph

1027 commits

Author SHA1 Message Date
Yu Watanabe d625f717db meson: first try dependency(), then fallback to find_library()
This also drops the fallback for libacl, libcap, libcrypt, and libgcrypt,
as recent Ubuntu (at least, 20.04 LTS and newer) and Debian (at least, buster
and newer) have relevant .pc files.

Fixes #28161.
2023-06-29 15:38:53 +09:00
Lennart Poettering 5e4c66450c
Merge pull request #27830 from 1awesomeJ/initrd
PID1: Detect battery level in initrd and if low refuse continuing to …
2023-06-28 19:18:03 +02:00
Dmitry V. Levin 51c425dc93 pwquality: remove old built-in cracklib dictionary workaround
The first version of libpwquality with the required change was 1.4.1
released in 2019.
2023-06-28 15:56:38 +02:00
OMOJOLA JOSHUA e3d4148d50 PID1: detect battery level in initrd and if low refuse continuing to boot, print message and shut down. 2023-06-28 14:48:54 +01:00
Yu Watanabe 16e1e4b3e7 meson: drop doubled empty line 2023-06-27 22:34:25 -06:00
Lennart Poettering 031d21bc45
Merge pull request #27843 from yuwata/usleep_safe
time-util: introduce usleep_safe()
2023-06-23 23:03:15 +02:00
Yu Watanabe 84d953e87a meson: sort types 2023-06-22 15:24:57 +09:00
Yu Watanabe c20d291416 meson: fix test dependency
Follow-up for daf4e78e48.
2023-06-22 14:37:45 +09:00
Yu Watanabe 1782534bb1 meson: shorten code a bit 2023-06-22 14:37:24 +09:00
Yu Watanabe e04e42312d meson: drop wrong and redundant assignment
Follow-up for b62ee354dd.
2023-06-22 14:20:32 +09:00
Yu Watanabe d37dee7450 meson: also build symbol tests for static-libsystemd=no-pic 2023-06-22 14:20:32 +09:00
Yu Watanabe 67b1c943cb meson: add dependency for udev runner to test 2023-06-22 14:20:32 +09:00
Yu Watanabe 35c035a1a7 meson: bump required version to 0.60.0
To suppress warning about install_tag argument.
2023-06-16 10:43:06 +09:00
Yu Watanabe ff5becf585 meson: bump required version to 0.59.0
fs.stemp() and fs.name() can take File object since 0.59.0.
2023-06-16 10:43:06 +09:00
Yu Watanabe d1b0d8415c meson: drop redundant spaces 2023-06-16 10:43:06 +09:00
Luca Boccassi 4dad6101fd
Merge pull request #28038 from mrc0mmand/cleanups
A couple of cleanups
2023-06-14 23:18:04 +01:00
Frantisek Sumsal 7f4544c9bc activate: rename to socket-activate
To make the naming consistent with the rest of the utils, i.e. binary
name minus the systemd- prefix.
2023-06-14 20:39:10 +02:00
Jan Janssen 739a62bb40 meson: Use fs module in more places 2023-06-14 16:05:52 +02:00
Lennart Poettering 5bc4570fd4
Merge pull request #26728 from keszybz/meson-update
Meson version update
2023-06-13 23:38:41 +02:00
Lennart Poettering 18cad4ebda
Merge pull request #27846 from keszybz/link-mode-generation
Autogenerate list of link modes
2023-06-13 23:03:51 +02:00
Yu Watanabe 80dc9ad98c meson: bump required version to 0.56.0 2023-06-12 11:01:58 +02:00
Yu Watanabe 573c0dc134 meson: bump required version to 0.55.0 2023-06-12 11:01:58 +02:00
Yu Watanabe daf4e78e48 meson: bump required version to 0.54.0 2023-06-12 11:01:58 +02:00
Zbigniew Jędrzejewski-Szmek 78103450b4 meson: define _GNU_SOURCE as '1'
This changes the generated config.h file thusly:
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1

Canonically, _GNU_SOURCE is just defined, without any value, but g++ defines
_GNU_SOURCE implicitly [1]. This causes a warning about a redefinition during
complilation of C++ programs after '-include config.h'. Our config attempts to
inject this (and a bunch of other arguments) into all compliations. But before
meson 0.54, flags for dependencies were not propagated correctly (*), and the C++
compilation was done without various flags (**). Once that was fixed, we started
getting a warning.

[1] http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.predefined
(*) Actually, the changelog doesn't say anything. But it mentions various work
    related to dependency propagation, and apparently this changes as a side
    effect.
(**) -fno-strict-aliasing
    -fstrict-flex-arrays=1
    -fvisibility=hidden
    -fno-omit-frame-pointer
    -include config.h

This could be solved in various ways, but it'd require either making the
compilation command line longer, which we want to avoid for readability of the
build logs, or splitting the logic to define the args for C++ progs separately,
which would make our meson.build files more complicated. Changing the
definition to '1' also solves the issue (because apparently now we match the
implicit definition), and shouldn't have other effects. I checked compilation
with gcc and clang. Maybe on other systems this could cause problems. We can
revisit if people report issues.
2023-06-12 10:59:45 +02:00
Luca Boccassi d30d9bf0ac meson: add systemd.pc and udev.pc to 'devel' target/tag
Same as the other pkg-config files, it is useful to install these in a specific
target that doesn't require compiling anything
2023-06-12 14:45:42 +09:00
Yu Watanabe 42551ea7e9 kernel-install: rewrite in C
This is mostly a one-to-one translation of kernel-install.sh, except for
the followings:
- BOOT_ROOT is searched with find_{esp,xbootldr}_and_warn().
- entry token is searched with boot_entry_token_ensure().
- inspect command verboses more information, e.g. found plugins,
  environment variables explicitly passed to plugins, arguments passed
  to plugins.
- paths specified in $KERNEL_INSTALL_PLUGINS must be absolute.
- LC_COLLATE is set to C.UTF-8 (or any specified on build time).

By writing kernel-install C, we can share the code used by bootctl or
so, and can introduce --root and/or --image options later.
2023-06-05 14:23:54 +09:00
Daan De Meyer d7a5730848 meson: Add missing tss2-tcti-device dependency 2023-06-02 15:43:28 +02:00
Luca Boccassi 5aab673dd1
Merge pull request #27840 from mrc0mmand/gcc-13
ci: add gcc-13, drop gcc-12
2023-05-31 11:07:22 +01:00
Lennart Poettering 40fb9eebbc tmpfiles: use same credstore perms everywhere
In b6033b7060 support was added to create
{/etc|/run}/credstore{|.encrypted} via tmpfiles.d with perms 0000. These
perms are so restrictive that not even root can access them unless it
has CAP_DAC_OVERRIDE capability. This is creates the dirs at boot time

In 24039e1207 support was added to create
/etc/credstore with perm 0700 from meson.build at build time.

This patch makes unifies the two parts:

1. creates both /etc/credstore *and* /etc/credstore.encrypted in both
   places (the build system still won't create them in /run/, since
   that's pointless since not shipped, and the runtime won't create the
   dirs below /usr/lib/, since that's not generically writable anyway).

2. Both at runtime and at build time we'll create the dirs with mode
   0700. This is easier for packaging tools to handle since they
   generally react pretty negatively on dirs they can't enumerate.
2023-05-31 11:15:26 +08:00
Zbigniew Jędrzejewski-Szmek c18dde32e5 man: generate link mode list dynamically
The entries are sorted by speed. Some fields are left empty when there is no
clear value to use. The table is much longer now, but I think it's better to
document the allowed values, even if some are not terribly useful.

Fixes #26256.
2023-05-30 13:05:33 +02:00
Frantisek Sumsal 6405afdaf5 meson: use -Werror=strict-flex-arrays 2023-05-30 10:31:25 +02:00
James Hilliard e4086f7dc9 bpf: test with GCC BPF compiler on opensuse 2023-05-30 13:30:28 +09:00
James Hilliard 4a7a13b5a0 bpf: stabilize GCC BPF support
Now that we have a GCC release which should support our bpf programs
lets set the minimum version and stabilize it.
2023-05-30 09:27:56 +09:00
Daan De Meyer 24039e1207 meson: Create credstore directories
Let's make the creds directories a bit more discoverable and make it
easier for users to use them. This also allows us to fix the
mode to 0700 for /etc instead of the usual 0755 which is what probably
would happen if users had to create this directory themselves.
2023-05-25 19:07:50 +02:00
Zbigniew Jędrzejewski-Szmek 02e0f430a0 meson: rename "dist-check" suite to "dist"
*Now* one of those tests is the longest, let's make them a bit shorter.
2023-05-18 17:18:11 +02:00
Zbigniew Jędrzejewski-Szmek ec2c6ac051 meson: rename "fuzzers" suite to "fuzz"
Fuzz tests have all the longest names, so by making this name
shorter, we save three columns of screen real estate.
2023-05-18 17:17:13 +02:00
Robert Scheck c06d2e440c portable, meson: allow statically linked build
Build option "link-portabled-shared" to build a statically linked
systemd-portabled by using

  -Dlink-portabled-shared=false

on systems with full systemd stack except systemd-portabled, such
as CentOS/RHEL 9.
2023-05-15 13:30:04 +02:00
Sam James eb29296937 dirent: conditionalize dirent assert based on dirent64 existence
>=musl-1.2.4 doesn't define dirent64 and its LFS friends as its "native"
functions are already LFS-aware.

Check for dirent64 in meson.build and only assert if it exists.

Bug: https://bugs.gentoo.org/905900
Closes: https://github.com/systemd/systemd/pull/25809
2023-05-10 15:05:18 +09:00
Zbigniew Jędrzejewski-Szmek 0454cf05d3 test: rework how udev-test is invoked
As part of the build, we would populate build/test/sys/ using
sys-script.py, and then udev-test.p[ly] would create a tmpfs instance
on build/test/tmpfs and copy the sys tree to build/test/tmpfs/sys.

Also, we had udev-test.p[ly] which called test-udev. test-udev was
marked as a manual test and installed, but neither udev-test.p[ly] or
sys-script.py were.

test-udev is renamed to udev-rule-runner, which reduces confusion and
frees up the test-udev name. udev-test.py is renamed to test-udev.py.
All three files are now installed.

test-udev.py is modified to internally call sys-script.py to set up the
sys tree. Copying and creating it from scratch should take the same
amount of time. We avoid having a magic directory, everything is now
done underneath a temporary directory.

test-udev.py is now a normal installed test, and run-unit-tests.py will
pick it up. When test-udev.py is invoked from meson, the path to
udev-rule-runner is passed via envvar; when it is invoked via
run-unit-tests.py or directly, it looks for udev-rule-runner in a relative
path.

The goal of this whole change is to let Debian drop the 'udev' test.
It called sys-script.py and udev-test.pl from the source directory and
had to recreate a bunch of the logic. Now test-udev.py will now be called
via 'upstream'.
2023-05-09 08:11:10 +02:00
Zbigniew Jędrzejewski-Szmek 09ea351b6f test: drop udev-test.pl 2023-05-09 08:11:10 +02:00
Zbigniew Jędrzejewski-Szmek b0bd2ae8b3 meson: fix indentation 2023-05-09 08:11:10 +02:00
Zbigniew Jędrzejewski-Szmek 6089235829 meson: add check-includes test to the test suite
Let's just call it always. It is quite fast (meson says 0.12 s).
2023-05-09 08:11:10 +02:00
Zbigniew Jędrzejewski-Szmek ba9ca60a88 meson: include .cc files in tags too
We only have one, but it seems reasonable to not exclude it.
Result tested with emacs.
2023-05-09 08:11:10 +02:00
Zbigniew Jędrzejewski-Szmek 3f80c1393e test/60-ukify: override stub location in tests
Without this, build would fail if the stub is not available in /usr/lib/.
2023-05-05 18:42:37 +02:00
Zbigniew Jędrzejewski-Szmek f9a6cb0e13 test-kernel-install: test 60-ukify.install and 90-uki-copy.install
We install a kernel with layout=uki and uki_generator=ukify, and test
that a UKI gets installed in the expected place. The two plugins cooperate,
so it's easiest to test them together.
2023-05-05 18:42:37 +02:00
Zbigniew Jędrzejewski-Szmek b62ee354dd meson: allow building .standalone on demand
We can always build the standalone version whenever we build the normal version
(the dependencies are the same). In most builds standalone binaries would be
disabled. But it is occasionally useful to have them for testing, so move the
conditional to install:, so the binaries can be build by giving the explicit
target name.

The default of 'build_by_default' for executable() is sadly true (since meson
0.38.0), so need to specify build_by_default: too.

Also add systemd-shutdown.standalone to public_programs for additional testing.
2023-05-03 12:29:41 +02:00
Zbigniew Jędrzejewski-Szmek 9a01fe3906 meson: avoid building executables that won't be installed
When executable() or custom_target() has install: that is conditional as is
false (i.e. not install:true), it won't be built by default. (build_by_default:
defaults to install:). But if that program is added to public_programs, it will
be build by default because it is pulled in by the test, effectively defeating
the disablement.

While at it, make 'ukify' follow the same pattern as 'kernel-install'.
They will be used later together.
2023-05-03 12:29:41 +02:00
Daan De Meyer d9081eb0ae meson: Search for find program
find is required by a few of the unit tests so let's make sure its
available when configuring the build.
2023-05-01 14:58:08 +02:00
Daan De Meyer 4d56d084d8 meson: Search for diff program
diff is required by a few of the unit tests so let's make sure its
available when configuring the build.
2023-05-01 14:58:08 +02:00
Lennart Poettering 4d3ef2d1a2 meson: move bpf hookup into main meson build file
This way we can use it in systemd-userdbd later on, too.
2023-04-24 17:10:08 +02:00