Commit Graph

53 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5464ec8a8e meson: there is no smack library
Detection would always fail, so this was broken.
Treat this as a binary enable/disable option.
2017-04-24 19:28:04 -04:00
Zbigniew Jędrzejewski-Szmek 80c6fce81c meson: add forgotten tpm support 2017-04-24 19:28:04 -04:00
Zbigniew Jędrzejewski-Szmek 41afb5eb72 meson: use -f{function,data}-sections for optimized builds 2017-04-24 19:28:04 -04:00
Michael Biebl 0da6f39619 meson: allow static linking of systemd-hwdb
Various distros split udev and its helpers into a separate binary
package. In case of Debian this also includes systemd-hwdb.
In Debian, the udev package is not supposed to depend on systemd, so a
dependency on libsystemd-shared.so is not desired. Allow the
systemd-hwdb binary to be linked statically if link-udev-shared is set
to false.

Follow-up for 3a30f21ff8.
2017-04-24 19:25:33 -04:00
Michael Biebl 76c8741060 meson: fix gcrypt config option
Also detect libgpg-error. Require both to be present for HAVE_CRYPT,
even though libgpg-error is only used in src/resolve. If one is available,
the other should be too, so it doesn't seem worth the trouble to make two
separate conditions.
2017-04-24 19:25:33 -04:00
Zbigniew Jędrzejewski-Szmek 36f0387efc meson: add option to disable libacl support 2017-04-24 19:25:33 -04:00
Zbigniew Jędrzejewski-Szmek 6800fe7f06 meson: define gnu_efi_arch for the arch efi name, fix ldsdir detection
This fixes ldsdir detection under Debian.

v2:
- define gnu_efi_arch for the arch efi include directory name

  In the autotools naming convention, efi_arch and this directory always had
  the same name. But meson.cpu_family() uses a slightly different convention,
  so those two don't always match.
2017-04-24 19:24:36 -04:00
Zbigniew Jędrzejewski-Szmek 4984c8be73 meson: detect getrandom in sys/random.h, fall back to linux/random.h
This is analogous to commit e84397d95c3da2b9722ff265843ad4a8874643d8.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 38f1ae0f99 meson: check string.h not strings.h for explicit_bzero
I used strings.h because that's what explicit_bzero(3) says. But glibc defines
it in string.h. There are no other available implementations atm (musl does not
define it, bionic aliases it to memset in openbsd-compat.h, yikes). We also
include just string.h from the code. So just look for the function in string.h,
and if it ever appears in other places, we can change the detection and includes.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 1276a9f63a meson: add ln --relative check 2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek a923e085af meson: use run_target instead of custom_target where appropriate
This way a fake output does not need to be specified.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 1aec3ed90d meson: add libblkid as libudev-core dep to fix include dir
Follow-up for 6b5cf3ea62.

v2:
- also link udevadm and systemd-udev statically if requested

v3:
- fix install_rpath for udevadm (Michael Biebl)
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 37efbbd821 meson: reindent all files with 8 spaces
The indentation for emacs'es meson-mode is added .dir-locals.

All files are reindented automatically, using the lasest meson-mode from git.
Indentation should now be fairly consistent.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 3a30f21ff8 meson: allow optional static linking of shared code in udev helpers
This makes the helper binaries significantly bigger (in some cases, the final
size depends on link options and optimization level), and is only useful for
distributions which want to provide the option to install udev without systemd.
As the linking is improved, the difference between the columns might shrink,
but it's unlikely that linking libshared statically could ever be more
efficient.

E.g. with -O0, no -flto:
                   (static) (shared)
src/udev/ata_id     999176    85696
src/udev/cdrom_id  1024344   111656
src/udev/collect    990344    81280
src/udev/scsi_id   1023592   115656
src/udev/v4l_id     811736    17744

When linked dynamically, install_rpath must be specified, so add that.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek d83f4f506d test-efi-create-disk.sh: allow running from separate build dir, hook up to meson
This allow test-efi-disk.img to be created under meson.
The invocation of qemu is not converted yet, in particular because the
command-line used in Makefile.am is outdated.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek fdd147a88e meson: add dist-check-includes replacement
This is more-or-less the same as dist-check-includes. meson doesn't exactly
make it easy to call a compiler with a custom set of options. The tests
are included in the test listing.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek abba22c51c meson: add hwdb/update target 2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 177929c236 meson: add git-contrib target 2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 83b6af36d1 meson: add test-dlopen
test-dlopen is a very simple binary that is only linked with libc and
libdl. From it we do dlopen() on the nss and pam modules to check that they are
linked to all necessary libs.

(meson-compiled nss modules are linked to less libraries, for whatever reason.
I suspected that some deps are missing, but it turns out that my suspicions
weren't justified, and the modules load just fine. Let's keep the test though,
it is very quick, and might detect missing linkage in the future.)
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek aac2605820 meson: eliminate libsystemd_journal_internal and use libsystemd_internal less
This simplifies things and leads to a smaller installation footprint.
libsystemd_internal and libsystemd_journal_internal are linked into
libystemd-shared and available to all programs linked to libsystemd-shared.
libsystemd_journal_internal is not needed anymore, and libsystemd-shared
is used everwhere. The few exceptions are: libsystemd.so, test-engine,
test-bus-error, and various loadable modules.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek ab916f2e81 meson: add rootprefix option (for Gentoo) 2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 4ff3f251b9 meson: install test data
v2:
- do not install test-data if instal-tests=no
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 4390be305b meson: replace yes/no/auto with true/false/auto
This doesn't feel as natural, but is more consistent with the boolean options
which require true/false, and allows setting of options without knowing of
which type the option is.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek b184e8feb9 meson: skip index generation when lxml is not available 2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 2895c8ee9f meson: ima support 2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 1eeb43f5af meson: libxkbcommon support 2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 005a29f234 meson: recreate dist-check-help 2017-04-23 21:47:28 -04:00
Michael Biebl e17e5ba9bf meson: use join_paths consistently
With -Dsplit-usr=true, we set rootprefix to /. This leads to //lib/systemd or
//lib/udev for various dir variables. Using join_paths() avoids this.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 2a4c156d64 meson: fix a bunch of substitutions
This makes the diff -r output on autotools and meson installations
empty, except for binary files and ## comments.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 3ca0cb7363 meson: properly conditionalize polkit installation
... including pkla installation on Debian.

v2:
- fix polkit-gobject-1 pkgconfig name
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek b710072da4 meson: add support for building efi modules
This is a very straightforward conversion of the rules in Makefile.am.
Generated objects (on arm64) are identical.
The only difference in executed commands is that automake uses ld -m
elf_x86_64, without us specifying the -m option anywhere. I suspect that
using the default for the given linker should be OK, so it's fine to just
skip it.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 81efcc1c89 meson: specify a timeout of 90 s for tests which take a bit longer
Both test-hashmap and test-benchmark need 10-11 s here, but might time out
under load with the default meson timeout of 30 s.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 8191c5948b meson: disable bootctl without libblkid
bootctl uses blkid probe functions to find the ESP, hence it's useless without
it. Don't even try to build it if libblkid is unavailable.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek f0bd7cc701 meson: fix compilation with -Dnetworkd=false, -Dkmod=no, -Dlibgcrypt=no
The tests are included under the conditional too, instead of specifying
'ENABLE_NETWORKD' in the test definition array, because libnetworkd_core
dependency is undefined if networkd is disabled.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 421f001277 meson: replace $ORIGIN with rootlibdir everywhere
$ORIGIN does not work when /proc is not mounted. So the systemd binary cannot use
$ORIGIN. Use the full path everywhere for consistency.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 9cc0e6e99c meson: make cpp invocations cross-compilation friendly
This implementation assumes that the arguments in compiler.cmd_array()
don't contain any spaces. Since we are only interested in compilation
on Linux, I think this is a safe assumption.

Solution suggested by Nirbheek Chauhan.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 3131bfe302 meson: add a few forgotten substitutions
v2:
- a few more
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek b2fc5836b2 meson: specify rpath on all executables linking to libshared
(i.e. pretty much all of them). libtools does this automatically for us.  It
would be great if meson did too. Otherwise, it would be nice to simply attach
the information about necessary rpath to the library object, and have it used
automatically for all users. Dunno, maybe there's already a way to do this.

I used '$ORIGIN' for stuff installed into libexecdir, since that's where
libshared ends up, and a full path for everything else. The advantage of
using $ORIGIN is that those binaries can be started from $DESTDIR, which can
sometimes be useful.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek ef0221bc95 meson: link test-lib{systemd,udev}-sym in the usual way
I tried to link to the right library by hand, because without
mesonbuid/meson#1545, libbasic.a is added to the link arguments. We want to
link the test with nothing but the library being tested. Doing the linking by
hand did achieve that, but it caused a bigger issue: meson didn't know about
the dependency on the library. And the dependency cannot be added using
link_depends, because "link_depends arguments must be strings...", and this
does not work with a compilation target. So just link in the usual way and
accept the overlinking (for now).
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 826472ce36 meson: update linking for fixed meson linking
With mesonbuid/meson#1545, meson does not propagate deps of a library
when linking with that library. That's of course the right thing to do,
but it exposes a bunch of missing deps.

This compiles with both meson-0.39.1 and meson-git + pr/1545.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek e0bec52f27 meson: add test-libudev-sym
This is slightly complicated by the fact that files('libudev.h') cannot be used
as an argument in custom_target command (string is required). This restriction
should be lifted in future versions of mesons, so this could be simplified.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 37ab1a25ec meson: add test-libsystemd-sym, fix linking of libsystemd
This is quite messy. I think libtool might have been using something
like -Wl,--whole-archive, but I don't think meson has support for that.
For now, just recompile all the sources for linking into libsystemd
directly. This should not matter much for efficiency, since it's a
few small files.
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 4e4ab1c32a meson: install systemd-sulogin-shell too 2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek d714867686 meson: remove libnss_*.so symlinks after install 2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 7b76fce1a5 meson: create various symlinks
v2:
- remove bashisms
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 94e75a5409 meson: create dirs and touch /usr
This is the equivalent of $(INSTALL_DIRS) and install-touch-usr-hook.
I did not bother to create the directories into which we install files,
since they will be created anyway.

v2:
- remove bashism
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek f4ee10a282 meson: create a static version of libshared and link libcore and some tests to it
This is what autoconf-based build does, and it makes test-bus-error and
test-engine able to access the bus error mapping table. OTOH, this is a heavy
price to pay: it would be excellent to link libcore.a to libsystemd-shared-NNN.so.
Otherwise we duplicate the same code in 'systemd' and 'libsystemd-shared-NNN.so'.

-rwxrwxr-x. 1 4075544 Apr  6 20:30 systemd* <-- libcore linked against libsystemd-shared.so
-rwxrwxr-x. 1 5596504 Apr  9 14:07 systemd* <-- libcore linked against libsystemd-shared.a

v2:
- update for 6b5cf3ea62
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 6b30f2801b meson: include the library symbol version list in link_depends
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[https://github.com/mesonbuild/meson/issues/1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
2017-04-23 21:47:26 -04:00
Zbigniew Jędrzejewski-Szmek 572baca1d4 meson: add option to install tests
Instead of a separate target as with make, it is decided at configure time
whether to install tests as part of the install target. The effect should be
the same.
2017-04-23 21:47:26 -04:00
Zbigniew Jędrzejewski-Szmek 69e96427a2 meson: define tests
Tests can be run with 'ninja-build test' or using 'mesontest'.
'-Dtests=unsafe' can be used to include the "unsafe" tests in the
test suite, same as with autotools.

v2:
- use more conf.get guards are optional components
- declare deps on generated headers for test-{af,arphrd,cap}-list

v3:
- define environment for tests

  Most test don't need this, but to be consistent with autotools-based build, and
  to avoid questions which tests need it and which don't, set the same environment
  for all tests.

v4:
- rework test generation

  Use a list of lists to define each test. This way we can reduce the
  boilerplate somewhat, although the test listings are still pretty verbose. We
  can also move the definitions of the tests to the subdirs. Unfortunately some
  subdirs are included earlier than some of the libraries that test binaries
  are linked to.  So just dump all definitions of all tests that cannot be
  defined earlier into src/test. The `executable` definitions are still at the
  top level, so the binaries are compiled into the build root.

v5:
- tag test-dnssec-complex as manual

v6:
- fix HAVE_LIBZ typo
- add missing libgobject/libgio defs
- mark test-qcow2 as manual
2017-04-23 21:47:26 -04:00