Commit Graph

35 Commits

Author SHA1 Message Date
Jörg Thalheim d7aa78c32f meson: add option to skip installing to $sysconfdir
This is useful for development where overwriting files out side
the configured prefix will affect the host as well as stateless
systems such as NixOS that don't let packages install to /etc but handle
configuration on their own.

Alternative to https://github.com/systemd/systemd/pull/17501

tested with:

$ mkdir inst build && cd build
$ meson \
  -Dcreate-log-dirs=false \
  -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \
  -Dsysvinit-path=$(realpath ../inst)/etc/init.d \
  -Drootprefix=$(realpath ../inst) \
  -Dinstall-sysconfdir=false \
  --prefix=$(realpath ../inst) ..
$ ninja install
2020-11-12 11:21:46 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Lennart Poettering 4917e7c727 shared: make libidn/libdidn2 dependency a dlopen() one 2020-10-09 15:47:09 +02:00
Lennart Poettering 9581bb8424 resolved: add minimal varlink api for resolving hostnames/addresses
This allows us to later port nss-resolve to use Varlink rather than
D-Bus for resolution. This has the benefit that nss-resolve based
resoluton works even without D-Bus being up. And it's faster too.
2020-08-26 16:48:06 +02:00
Marc-André Lureau 2d95d81f7b shared: move in_addr_ifindex_name_from_string_auto() there 2020-05-07 22:36:52 +02:00
Guilhem Lettron 2e22a54f4e Implement SNI when using DNS-over-TLS
Some DNS providers need SNI to identify client.

This can be used by adding #name to a DNS.
Example:
[Resolve]
DNS=192.168.1.1#example.com
2019-12-04 23:24:06 +09:00
Yu Watanabe 5e5420d1a1
Merge pull request #9770 from keszybz/etc-resolved-no-address
Slightly more efficient handling of /etc/hosts blacklist entries
2018-08-02 12:54:50 +09:00
Zbigniew Jędrzejewski-Szmek 78fc21a11a test-resolved-etc-hosts: add tests for /etc/hosts parsing
Calling 'build/test-resolved-etc-hosts filename' parses just that file.
This is useful to test against https://hosts.ubuntu101.co.za/hosts.
2018-08-01 12:38:39 +02:00
Zbigniew Jędrzejewski-Szmek 5a8b164092 meson: drop parens when appending to list
Meson does not care either way, so let's use the simpler syntax. And files()
already gives a list, so nesting this in a list wouldn't be necessary even
if meson did not flatten everything.
2018-07-31 21:02:01 +09:00
Iwan Timmer 096cbdce13 resolved: basic OpenSSL support for DNS-over-TLS
This provides basic OpenSSL support without optimizations like TCP Fast Open and TLS Session Tickets.
Notice only a single SSL library can be enabled at a time and therefore journald functions provided by GnuTLS will be disabled when using OpenSSL.
Fixes #9531
2018-07-27 21:23:17 +01:00
Iwan Timmer 6016fcb0ea resolved: refactor GnuTLS specific code in separate source file
This is a first step towards supporting alternative TLS implementations for DNS-over-TLS.

Co-authored-by: Filipe Brandenburger <filbranden@google.com>
2018-07-27 21:23:17 +01:00
Yu Watanabe 56ddbf1009 meson: make DNS-over-TLS support optional
This adds dns-over-tls option to meson. If set to 'false',
systemd-resolved is not linked with libgnutls.
2018-06-20 22:28:01 +02:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Yu Watanabe c2e84cab3a resolvectl: rename systemd-resolve to resolvectl
For the compatibility, `systemd-resolve` will be created as a symbolic
link to `resolvectl`.
2018-04-19 03:24:23 +09:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Lennart Poettering 088c136384 resolve-tool: provide resolvconf(8) compatibility
This turns resolve-tool into a multi-call binary. When invoked as
"resolvconf" it provides minimal compatibility with the resolvconf(8)
tool of various distributions (and FreeBSD as it appears).

This new interface understands to varying degrees features of the two
major implementations of resolvconf(8): Debian's original one and
"openresolv". Specifically:

Fully supported:

        -a -d (supported by all implementations)
        -f    (introduced by openresolv)

Somewhat supported:

        -x    (introduced by openresolv, mapped to a '~.' domain entry)

Unsupported and ignored:

        -m -p (introduced by openresolv, not really necessary for us)

Unsupported and resulting in failure:
        -u    (supported by all other implementations)
        -I -i -l -R -r -v -V
              (all introduced by openresolv)
        --enable-updates --disable-updates --updates-are-enabled
              (specific to Debian's implementation)

Of course, resolvconf(8) is a tool with multiple backends, in our
implementation systemd-resolved is the only backend.

Fixes: #7202
2018-03-02 15:48:46 +01:00
Zbigniew Jędrzejewski-Szmek 9b3cff199d meson: drop unnecessary "transformation" of policy files
Those files don't contain any @variables@, so the configuration step was just
copying them to build/. Let's avoid that, and fix their suffixes while at it.
2018-02-16 13:01:12 +01:00
Gunnar Hjalmarsson 264d8dcc16 Gettextize policy files
* Don't merge translations into the files
* Add gettext-domain="systemd" to description and message

Closes #8162, replaces #8118.
2018-02-16 13:00:52 +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
Dmitry Rozhkov 84b0f133e4 resolved: consult Polkit for privileges when manipulating DNS-SD 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov c3036641f0 resolved: implement D-Bus API for DNS-SD 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 6501dd31a7 resolved: add enablers for DNS-SD
Introduce network services loaded from .dnssd files that
can be used for server-side DNS-SD implementation in systemd-resolved.
2017-12-08 14:29:27 +02:00
Zbigniew Jędrzejewski-Szmek 3a726fcd08 Add license headers and SPDX identifiers to meson.build files
So far I avoided adding license headers to meson files, but they are pretty
big and important and should carry license headers like everything else.
I added my own copyright, even though other people modified those files too.
But this is mostly symbolic, so I hope that's OK.
2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek 1ec57f3394 build-sys: s/ENABLE_RESOLVED/ENABLE_RESOLVE/
The configuration option was called -Dresolve, but the internal define
was …RESOLVED. This options governs more than just resolved itself, so
let's settle on the version without "d".
2017-10-04 12:09:51 +02:00
Zbigniew Jędrzejewski-Szmek 349cc4a507 build-sys: use #if Y instead of #ifdef Y everywhere
The advantage is that is the name is mispellt, cpp will warn us.

$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build

squash! build-sys: use #if Y instead of #ifdef Y everywhere

v2:
- fix incorrect setting of HAVE_LIBIDN2
2017-10-04 12:09:29 +02:00
Zbigniew Jędrzejewski-Szmek 751ca3f1de test-resolved-packet: add a simple test for our allocation functions 2017-06-27 13:19:31 -04:00
Zbigniew Jędrzejewski-Szmek 2c201c2140 meson: use booleans for conf.set and drop unecessary conditionals
Using conf.set() with a boolean argument does the right thing:
either #ifdef or #undef. This means that conf.set can be used unconditionally.

Previously I used '1' as the placeholder value, and that needs to be changed to
'true' for consistency (under meson 1 cannot be used in boolean context). All
checks need to be adjusted.
2017-05-02 16:29:11 -04:00
userwithuid d8431fc3f4 build-sys: only install libexecdir/resolv.conf if resolved is enabled (#5826)
as mentioned in https://github.com/systemd/systemd/pull/5811
2017-04-27 13:22:40 -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 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 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 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 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
Zbigniew Jędrzejewski-Szmek 5c23128dab meson: build systemd using meson
It's crucial that we can build systemd using VS2010!

... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.

This is not complete, I'm throwing it out here for your amusement and critique.

- rules for sd-boot are missing. Those might be quite complicated.

- rules for tests are missing too. Those are probably quite simple and
  repetitive, but there's lots of them.

- it's likely that I didn't get all the conditions right, I only tested "full"
  compilation where most deps are provided and nothing is disabled.

- busname.target and all .busname units are skipped on purpose.

  Otherwise, installation into $DESTDIR has the same list of files and the
  autoconf install, except for .la files.

It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.

meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.

The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.

v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments

v3:
- drop required:true and fix progs/prog typo

v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute

v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components

v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
  hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.

v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
  ("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
  split-usr==true.

v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it

v9:
- indentation

v10:
- fix check for qrencode and libaudit

v11:
- unify handling of executable paths, provide options for all progs

  This makes the meson build behave slightly differently than the
  autoconf-based one, because we always first try to find the executable in the
  filesystem, and fall back to the default. I think different handling of
  loadkeys, setfont, and telinit was just a historical accident.

  In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
  In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
  but in Debian, those directories are not included in the path.

  C.f. https://github.com/mesonbuild/meson/issues/1576.

- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-23 21:47:26 -04:00