Commit Graph

204 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek af4d7860c4 meson: avoid warning about comparison of bool and string
meson.build:2907: WARNING: Trying to compare values of different types (bool, str) using ==.
The result of this is undefined and will become a hard error in a future Meson release.
2018-03-09 14:21:08 +01:00
Zbigniew Jędrzejewski-Szmek ad6a085310 meson: bump so revision and systemd version in preparation for v238 2018-03-05 17:21:09 +01:00
Zbigniew Jędrzejewski-Szmek 3cca71c456
Merge pull request #8323 from xyproto/ok_color
Make the color of the status OK configurable at build-time
2018-03-02 13:00:07 +01:00
Zbigniew Jędrzejewski-Szmek f7c5427c28 meson: use dashes in colour names 2018-03-02 09:09:29 +01:00
Alexander F Rødseth 96164a3936 Add build-time option to change the color of the "OK" status text 2018-03-02 09:00:44 +01:00
Zbigniew Jędrzejewski-Szmek 671f0f8de0 Remove /sbin from paths if split-bin is false (#8324)
Follow-up for 157baa87e4.
2018-03-01 21:48:36 +01:00
Zbigniew Jędrzejewski-Szmek 157baa87e4 meson: support both separate and merged sbin-bin directories
Follow-up for ba7f4ae617.

By default, we detect if the real root has a separate /usr/sbin directory, but
this can be overrides with -Dsplit-bin=true|false. The check assumes that
/usr/sbin is split if it is not a symlink, so it'll return a false negative
with some more complicated setups. But that's OK, in those cases this should be
configured explicitly.

This will copy the structure of the directories in the root file system to
$DESTDIR. If a directory is a directory in $DESTDIR but a symlink in the root
file system, this script will fail. This means that it's not possible to reuse
a $DESTDIR from between ba7f4ae61 and this patch.
2018-03-01 12:27:33 +01:00
Zbigniew Jędrzejewski-Szmek 2675413e39 meson: autodetect split-usr
Also move the status from "features" to the paths section. This is more of an
anti-feature.
2018-03-01 12:23:00 +01:00
Zbigniew Jędrzejewski-Szmek ba7f4ae617 meson: install compat symlinks for systemctl and systemd (#8300)
v2:
- init is a symlink to systemd, not systemctl!
2018-02-28 10:20:48 +01:00
Lennart Poettering f09eb7688e doc: add a new doc/ directory, and move two markdown docs into them
I figure sooneror later we'll have more of these docs, hence let's give
them a clean place to be.

This leaves NEWS and README/README.md as well as the LICENSE texts in
the root directory of the project since that appears to be customary for
Free Software projects.
2018-02-27 19:59:09 +01:00
Zbigniew Jędrzejewski-Szmek aa484f3561 tree-wide: use reallocarray instead of our home-grown realloc_multiply (#8279)
There isn't much difference, but in general we prefer to use the standard
functions. glibc provides reallocarray since version 2.26.

I moved explicit_bzero is configure test to the bottom, so that the two stdlib
functions are at the bottom.
2018-02-26 21:20:00 +01:00
Lennart Poettering 4c2e1b399f xattr-util: use crtime/btime if statx() is available for implementation of fd_setcrtime() and friends
The Linux kernel exposes the birth time now for files through statx()
hence make use of it where available. We keep the xattr logic in place
for this however, since only a subset of file systems on Linux currently
expose the birth time. NFS and tmpfs for example do not support it. OTOH
there are other file systems that do support the birth time but might
not support xattrs (smb…), hence make the best of the two, in particular
in order to deal with journal files copied between file system types and
to maintain compatibility with older file systems that are updated to
newer version of the file system.
2018-02-20 15:41:49 +01:00
Caio Marcelo de Oliveira Filho 2f62cf3552 meson: apply defaults if /etc/login.defs doesn't exist
Apply defaults for system_{uid,gid}_max even if the /etc/login.defs file
doesn't exist (e.g. in Clear Linux with no changes).

awk returns an empty string in case the file doesn't exist, causing meson to
fail in to_int(). So set the default if output is empty. This makes the BEGIN{}
blocks unnecessary, so remove them.
2018-02-19 12:59:37 +01:00
Caio Marcelo de Oliveira Filho 9e70f2f818 meson: use multiline string syntax (#8214)
The single quote working with multiple lines is likely to be unintended. With
current versions of meson, it also causes error messages after it to report the
wrong line number. Use the documented syntax instead.
2018-02-19 18:37:19 +09:00
Zbigniew Jędrzejewski-Szmek 444d586333 meson: add -Dmemory-accounting-default=true|false
This makes it easy to set the default for distributions and users which want to
default to off because they primarily use older kernels.
2018-02-15 12:02:41 +01:00
tblume 75aaade16b meson.build: make docdir configurable (#8068)
SUSE is using a different docdir, so the path should be configurable
2018-02-02 06:46:15 +09:00
Lennart Poettering 7755083256
Merge pull request #7881 from keszybz/pcre
Add new --grep option to journalctl
2018-01-28 15:29:10 +01:00
Zbigniew Jędrzejewski-Szmek 6becf48ca3 journalctl: regexp matching 2018-01-27 13:40:57 +01:00
Evgeny Vereshchagin 4c0d481095
Merge pull request #7933 from keszybz/fuzz-regression
test: add fuzzer regression testing
2018-01-27 12:56:42 +03:00
Zbigniew Jędrzejewski-Szmek 25a8210234 meson: use env object instead of string in tags targets
I used 'tags' before because this way we avoided a unnecessary
line about 'env' detection. But we cannot use 'env' in test(), so
previous commit added 'env' detection. We might just as well use
it in custom_target().
2018-01-27 09:03:46 +01:00
Zbigniew Jędrzejewski-Szmek b68dfb9e83 Hook up oss-fuzz test cases as tests
This is a bit painful because a separate build of systemd is necessary. The
tests are guarded by tests!=false and slow-tests==true. Running them is not
slow, but compilation certainly is. If this proves unwieldy, we can add a
separate option controlling those builds later.

The build for each sanitizer has its own directory, and we build all fuzzer
tests there, and then pull them out one-by-one by linking into the target
position as necessary. It would be nicer to just build the desired fuzzer, but
we need to build the whole nested build as one unit.

[I also tried making systemd and nested meson subproject. This would work
nicely, but meson does not allow that because the nested target names are the
same as the outer project names. If that is ever fixed, that would be the way
to go.]

v2:
- make sure things still work if memory sanitizer is not available
v3:
- switch to syntax which works with meson 0.42.1 found in Ubuntu
2018-01-27 09:03:46 +01:00
Zbigniew Jędrzejewski-Szmek e12fa1fdb4
Merge pull request #7996 from poettering/v237-prepare
preparation for v237
2018-01-25 17:41:25 +03:00
Björn Esser 9f555bba67 firstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)
Not every target system may provide a crypt() function in its stdlibc
and may use an external or replacement library, like libxcrypt, for
providing such functions.

See https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt.
2018-01-25 17:30:15 +03:00
Lennart Poettering 69cd51de5d meson: bump so revision and systemd version in preparation for v237 2018-01-25 14:18:14 +01:00
Jonathan Rudenberg 31e57a35dc fuzz: allow building fuzzers outside of oss-fuzz
Add a new -Dllvm-fuzz=true option that can be used to build against
libFuzzer and update the oss-fuzz script to work outside of the
oss-fuzz build environment.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg b4081f3ea2 fuzz: disable all deps when building with oss-fuzz
The fuzz targets are intended to be fast and only target systemd
code, so they don't need to call out to any dependencies. They also
shouldn't depend on shared libraries outside of libc, so we disable
every dependency when compiling against oss-fuzz. This also
simplifies the upstream build environment significantly.
2018-01-17 13:57:06 -05:00
Jonathan Rudenberg 7db7d5b733 fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and
continuously fuzz systemd.

This commit includes the build tooling necessary to build fuzz
targets, and a fuzzer for the DNS packet parser.
2018-01-17 13:57:06 -05:00
Adam Duskett 08318a2c5a add false option for tests (#7778)
Currently there is no way to prevent tests from building using meson.
This introduces two problems:

1) It adds a extra 381 files to compile.
2) One of these tests explicitly requires libgcrypt to be built even if systemd
   is not using it.
3) It adds C++ to the requirements to build systemd.

When cross-compiling, this is uneccessary.
2018-01-15 15:25:46 +04:00
Zbigniew Jędrzejewski-Szmek c4c978a07f meson: detect pcre2 dep 2018-01-12 14:44:45 +01:00
Lennart Poettering 51b13863a2 meson: resurrect API documentation target
We had this functionality back in Automake times, let's resurrect it.
2018-01-05 13:58:33 +01:00
Mike Gilbert 2fa645f1cc meson: don't search PATH for telinit (#7770)
On a typical system running systemd, the telinit in PATH is very likely to be a symlink
to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called
and sd_booted() == 0. This may commonly occur in a chroot environment.

Bug: https://bugs.gentoo.org/642724

[zj:
The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without
changing the default in 4ad61fd180. Then the default was
changed to `/lib/sysvinit/telinit` in abaaabf40a. Then it
started being  autodetected when meson support was added in 
5c23128dab. This patch restores the behaviour that was 
implemented in configure.ac at the time of its removal.]
2018-01-04 13:14:20 +01:00
Lennart Poettering 7f9ac71c76
Merge pull request #7705 from keszybz/redo-linking
Redo linking
2018-01-03 18:37:00 +01:00
Zbigniew Jędrzejewski-Szmek 7f1ea2cc94 meson: add a single .h file to shared libs with no sources
Otherwise stuff doesn't build on old Ubuntu with meson-0.42.1-1~xenial.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 568a4ff8b1 meson: use a convenience lib for shared resolve files
This reduces the man=false meson target count from 1281 to 1253.

--

A fully scientific test:
  git grep _sources, :/*.build|cut -d: -f2|tr -d ' '|sort|uniq -c
reveals that libudev_sources is the only source list now reused twice.  There's
some ugly circular dependency between libudev and libshared, and anyway I'm not
sure if we don't want to use different compilation options (LOG_REALM_…) in
those two cases, so I'm leaving that alone for now.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 0c06b50662 meson: rename libudev_internal to libudev_static and link into libudev
This reduces the meson man=false target count to 1281.

v2:
- link test-engine with libshared instead of libsystemd_static
Previous version built fine on F27, but fails on F26 with the following error:
/usr/bin/ld: /tmp/ccr8HRGw.ltrans6.ltrans.o: undefined reference to symbol '__start_BUS_ERROR_MAP@@SD_SHARED'
/home/zbyszek/fedora/systemd/systemd-9d5aae75c64f5583a110f03b94816aacc03bbf4d/x86_64-redhat-linux-gnu/src/shared/libsystemd-shared-236.so: error adding symbols: DSO missing from command line

v3:
- add libudev_basic
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 5e3cec87be meson: use a convenience lib for journal user sources
Instead of compiling those files twice, once for libsystemd and once for
libshared, compile once as a static archive and then link into both.
This reduce the meson target for man=no compile to 1291.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 34e221a58b Move gcrypt-util to basic/
We were including gcrypt-util.[ch] by hand in the few places where it
was used. Create a convenience library to avoid compiling the same
files multiple times.

v2:
- use a separate static library instead of mergin into libbasic
2018-01-03 12:09:45 +01:00
Zbigniew Jędrzejewski-Szmek 2d4ceca8a5 meson: link libbasic and libshared_static into libshared
gcrypt_util_sources had to be moved because otherwise they appeared twice
in libshared.so halfproducts, causing an error.

-fvisibility=default is added to libbasic, libshared_static so that the symbols
appear properly in the exported symbol list in libshared.

The advantage is that files are not compiled twice. When configured with -Dman=false,
the ninja target list is reduced from 1588 to 1347 targets. The difference in compilation
time is small (<10%). I think this is because of -O0 and ccache and multiple cores, and
in different settings the compilation time could be reduced. The main advantage is that
errors and warnings are not reported twice.
2018-01-03 12:09:14 +01:00
Lennart Poettering 2acfd0ff43 meson: hopefully renameat2() will show up where renameat() is defined
Should glibc add this eventually, let's try to be smart where to look
for it.
2017-12-25 12:35:43 +01:00
Lennart Poettering 7b961e40ee meson: look for gettid() definition where getpid() is defined
Hopefully, should gettid() show up one day in glibc it'll show up where
getpid() is defined too.
2017-12-25 12:35:28 +01:00
Lennart Poettering 3c042add1d meson: when pivot_root() is added one day, look for it in <unistd.h>
We of course don't know in which header glibc will export pivot_root()
and if it ever will. But there's a good chance they'll place it where
chroot() is located, given the similarity in the operations, hence let's
try our luck and look for it at the same place.

If we are lucky this means we don't have to patch our code if glibc
decides to expose the call one day.
2017-12-25 12:10:22 +01:00
Lennart Poettering 85db59b794 meson: use "args" for setting _GNU_SOURCE when checking for functions
This reworks how we set _GNU_SOURCE when checking for the availability
of functions:

1. We set it for most of the functions we look for. After all we set it
for our entire built anyway, and it's usually how Linux-specific
definitions in glibc are protected these days. Given that we usually
have checks for such modern stuff only anyway, let's just blanket enable
it.

2. Use "args" instead of "prefix" to set the macro. This is what is
suggested in the meson docs, hence let's do it.
2017-12-25 12:10:14 +01:00
Yu Watanabe 0e50bfaefd meson: define _GNU_SOURCE to detect copy_file_range() (#7734)
Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git
repository for glibc.

Recently glibc added `copy_file_range()`, but to use it,
`_GNU_SOURCE` needs to be defined. This adds the flag in
meson.build to detect the function by meson correctly.
2017-12-25 11:42:42 +01:00
Susant Sahani d384826f69 networkd: Add support for ipvlan L3s and flags (#7726)
This works supports to configure L3S mode and flags
such as bridge, private and vepa
2017-12-23 18:55:03 +01:00
Zbigniew Jędrzejewski-Szmek 4f561ecda9 meson: reuse libsystemd_static for libsystemd
This gets rid of recompilation, making things faster and avoids duplicated warnings.
The result seems to be the same:
$ ls -l build/libsystemd.so.0.20.0 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071312 Dec 19 11:45 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071760 Dec 19 11:11 build/libsystemd.so.0.20.0
$ diff -U1 <(objdump -T build/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g') <(objdump -T build2/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g')
-build/libsystemd.so.0.20.0:     file format elf64-x86-64
+build2/libsystemd.so.0.20.0:     file format elf64-x86-64
2017-12-21 17:01:23 +01:00
Zbigniew Jędrzejewski-Szmek 37e4d7a855 meson: rename libsystemd_internal to libsystem_static
We already use the "_static" suffix for libshared_static ("shared" is the name
of the library, "static" is the format) and other libs, so let's rename for
consistency.

Also change libsystemd_static_sources to libsystemd_sources, since the same
list is used for both and shorter is better.
2017-12-21 17:01:02 +01:00
Felipe Sateler f9f54413db build-sys: install TRANSIENT-SETTINGS.md and UIDS-GIDS.md (#7690) 2017-12-18 14:58:13 +01:00
Franck Bui 6671e818e9 meson: libudev_core and udevadm should have LOG_REALM=LOG_REALM_UDEV (#7666)
Otherwise, setting udev_log=debug in /etc/udev/udev.conf has no effects since
systemd-udevd is built with LOG_REALM=LOG_REALM_UDEV.

However using LOG_REALM_UDEV (for libudev_core) reveals another similar bug for
udevadm which should also define LOG_REALM_UDEV.
2017-12-16 09:36:36 +01:00
Max Harmathy 5424824adf Fix logical error in meson.build (#7658)
sysvinit_path and sysvrcnd_path have to be set both to activate Sysv compatibility.
2017-12-15 16:05:25 +01:00
Lennart Poettering cbd73c69ba meson: increase version numbers 2017-12-14 17:29:30 +01:00