Commit Graph

22 Commits

Author SHA1 Message Date
Jan Tojnar 60bce7c6d9 pkg-config: make prefix overridable again
While we don't support prefix being != /usr, and this is hardcoded
all over the place, variables in pkg-config file are expected
to have overridable base directory.

This is important for at least the following two use cases:

- Installing projects to non-FHS package-specific prefixes for Nix-style
  package managers. Of course, it is then their responsibility
  to ensure systemd can find the service files.
- Installing to local path for development purposes.
  This is a compromise between running a program from a build directory,
  and running it fully installed to system prefix.

You will not want to write to system prefix in either case.

For more information, see also
https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/

Fixes https://github.com/systemd/systemd/issues/18082

Partially reverts 6e65df89c3
2021-01-07 15:28:21 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek fc1a5d1a70 Also parse the minimum uid/gid values
We don't (and shouldn't I think) look at them when determining the type of the
user, but they should be used during user/group allocation. (For example, an
admin may specify SYS_UID_MIN==200 to allow statically numbered users that are
shared with other systems in the range 1–199.)
2020-10-01 17:52:41 +02:00
Lennart Poettering 6e65df89c3 pkg-config: prefix is not really configurable, don't pretend it was
We generally don't support prefix being != /usr, and this is hardcoded
all over the place. In the systemd.pc file it wasn't so far. Let's
adjust this to match the rest of the codebase.
2020-09-11 13:09:06 +02:00
Lennart Poettering 4a56315a99 path: use ROOTPREFIX properly
ROOTPREFIX doesn't include the trailing /, hence add it in where needed.

Also, given that sysctl.d/, binfmt.d/, sysusers.d/ are generally
accessed before /var/ is up they should use ROOTPREFIX rather than
PREFIX. Fix that.
2020-05-28 23:52:34 +02:00
Zbigniew Jędrzejewski-Szmek 162392b75a tree-wide: spellcheck using codespell
Fixes #15436.
2020-04-16 18:00:40 +02:00
Zbigniew Jędrzejewski-Szmek 4908de44b0 {systemd,udev}.pc: add names with underscores, deprecate the old ones
The names with multiple lowercase words run together are hard to read.  We
started that way with very short names like rootprefix, but then same pattern
was applied to longer and longer names. Looking at the body of .pc files
available on my machine, many packages use underscores; let's do the same. Old
names are kept for compatiblity, so this is backwards compatible.
2020-03-27 20:12:44 +01:00
Sascha Dewald fc57f105d9 pkgconf: add full generator paths 2020-01-18 17:48:28 +01:00
Zbigniew Jędrzejewski-Szmek 23bdba61b1 pkgconfig: avoid double slash with split-usr configuration
By defining rootprefix= we avoid a double slash in $systemdsystemunitdir and
other variables. This fixes a regression introduced in
1c2c7c6cb3 where the variables using rootprefix=/
would start with a double slash. This should be interpreted the same, but is
certainly ugly.

The rootprefix variable was added to systemd.pc in
1c2c7c6cb3, so there is no question of backwards
compatiblity. If people try to "override" the prefix and specify
--define-variable=rootprefix=/, they will get a double slash, which should be
OK, and is the same as --define-variable=rootprefix=/something/, which also
results in a double slash somewhere in the strings.
2019-03-05 18:49:28 +01:00
Lennart Poettering 9a43fc6a2a
Merge pull request #11827 from keszybz/pkgconfig-variables
Allow overriding pkgconfig prefixes
2019-02-26 18:58:03 +01:00
Zbigniew Jędrzejewski-Szmek a67c318df8 meson: define PROJECT_VERSION as the "bare" project version
Let's not use atoi() if we can simply provide the project version as a number.

In C code, this is the numerical project version. In substitutions in other
files, this is just the bare substitution.

The "PACKAGE_" prefix is from autotools, and is strange. We call systemd a
"project", and "package" is something that distros build. Let's rename.

PACKAGE_URL is renamed to PROJECT_URL for the same reasons and for consistency.

(This leave PACKAGE_VERSION as the stringified define for C code.)
2018-12-20 21:35:29 +01:00
Zbigniew Jędrzejewski-Szmek 1c2c7c6cb3 pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
Fixes #4549.

People want to be able to redefine the prefixes relative to which the other
variables are defined. Something like
  pkgconf --define-variable=prefix=/home/user/installpath --variable=systemdsystemunitdir systemd

I'm not convinced that this entirely useful, because the installed systemd will
not look at those paths, but maybe it's OK as an alternative type of $DESTDIR.
This has been requested a few times over the years, so let's just provide this.

I thought this would be more complicated, since we allow all kinds of directories
to be overrides in the compilation configuration. But it turns out that all the
directories defined in systemd.pc are relative to three prefixes:
$prefix, $rootprefix, and $sysconfdir. So this patch adds $rootprefix and $sysconfdir
to the .pc file and then changes the subsequent definitions in the .pc file to use
them. In the end we define each path twice using the same rules: once in meson.build
and once in the .pc file.

Without overrides:
$ for i in $(pkgconf --with-path=build/src/core systemd --print-variables); do
     echo -n "$i = "; pkgconf --with-path=$PWD/build/src/core --variable=$i systemd
  done
containeruidbasemax = 1878982656
containeruidbasemin = 524288
dynamicuidmax = 65519
dynamicuidmin = 61184
systemgidmax = 999
systemuidmax = 999
catalogdir = /usr/lib/systemd/catalog
modulesloaddir = /usr/lib/modules-load.d
binfmtdir = /usr/lib/binfmt.d
sysctldir = /usr/lib/sysctl.d
sysusersdir = /usr/lib/sysusers.d
tmpfilesdir = /usr/lib/tmpfiles.d
systemdshutdowndir = /usr/lib/systemd/system-shutdown
systemdsleepdir = /usr/lib/systemd/system-sleep
systemdusergeneratordir = /usr/lib/systemd/user-generators
systemdsystemgeneratordir = /usr/lib/systemd/system-generators
systemduserunitpath = /etc/systemd/user:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:/usr/lib/systemd/user:/usr/lib/systemd/user:/usr/share/systemd/user
systemdsystemunitpath = /etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
systemduserconfdir = /etc/systemd/user
systemdsystemconfdir = /etc/systemd/system
systemduserpresetdir = /usr/lib/systemd/user-preset
systemduserunitdir = /usr/lib/systemd/user
systemdsystempresetdir = /usr/lib/systemd/system-preset
systemdsystemunitdir = /usr/lib/systemd/system
systemdutildir = /usr/lib/systemd
sysconfdir = /etc
rootprefix = /usr
prefix = /usr
pcfiledir = /usr/share/pkgconfig

With overrides:
$ for i in $(pkgconf --with-path=build/src/core systemd --print-variables); do
     echo -n "$i = "; pkgconf --with-path=$PWD/build/src/core \
     --define-variable=prefix=/PREFIX \
     --define-variable=rootprefix=/ROOTPREFIX \
     --define-variable=sysconfdir=/SYSCONF --variable=$i systemd
  done
containeruidbasemax = 1878982656
containeruidbasemin = 524288
dynamicuidmax = 65519
dynamicuidmin = 61184
systemgidmax = 999
systemuidmax = 999
catalogdir = /PREFIX/lib/systemd/catalog
modulesloaddir = /PREFIX/lib/modules-load.d
binfmtdir = /PREFIX/lib/binfmt.d
sysctldir = /PREFIX/lib/sysctl.d
sysusersdir = /PREFIX/lib/sysusers.d
tmpfilesdir = /PREFIX/lib/tmpfiles.d
systemdshutdowndir = /ROOTPREFIX/lib/systemd/system-shutdown
systemdsleepdir = /ROOTPREFIX/lib/systemd/system-sleep
systemdusergeneratordir = /PREFIX/lib/systemd/user-generators
systemdsystemgeneratordir = /ROOTPREFIX/lib/systemd/system-generators
systemduserunitpath = /SYSCONF/systemd/user:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:/PREFIX/lib/systemd/user:/usr/lib/systemd/user:/usr/share/systemd/user
systemdsystemunitpath = /SYSCONF/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/ROOTPREFIX/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
systemduserconfdir = /SYSCONF/systemd/user
systemdsystemconfdir = /SYSCONF/systemd/system
systemduserpresetdir = /PREFIX/lib/systemd/user-preset
systemduserunitdir = /PREFIX/lib/systemd/user
systemdsystempresetdir = /ROOTPREFIX/lib/systemd/system-preset
systemdsystemunitdir = /ROOTPREFIX/lib/systemd/system
systemdutildir = /usr/lib/systemd
sysconfdir = /SYSCONF
rootprefix = /ROOTPREFIX
prefix = /PREFIX
pcfiledir = /usr/share/pkgconfig

(pkgconf doesn't provide a way to print all variables together with their definitions,
according to the man page. Disappointing.)
2018-11-17 15:38:15 +01:00
Lennart Poettering 87d5e4f286 build-sys: make the dynamic UID range, and the container UID range configurable
Also, export these ranges in our pkg-config files.
2017-12-06 12:55:37 +01:00
Zbigniew Jędrzejewski-Szmek d9215cd838 Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
Lennart Poettering 3bd3150367 build-sys: move systemd.pc from pkgconfiglibdir back into pkgconfigdatadir
The original idea of systemd.pc was to contain arch-independent system
and systemd information. By exposing libdir as part of the fields (added
in eb39a6239c), it started to carry
arch-dependent data, thus breaking multilib systems. It was then moved
to pkgconfiglibdir to deal with this (in
aec432c613), but actually the right
approach is to simply not include libdir in the .pc file at all.

THis patch hence more or less reverts both commits again, and moves the
.pc file back into pkgconfigdatadir.

As alternative for querying the systems primary libdir there's now
"systemd-path system-library-arch", hence a more correct alternative
exists for querying this variable from the .pc file.
2015-04-21 20:35:17 +02:00
Lennart Poettering ded21b6de3 pc: no longer expose exec_prefix in .pc file
There's little reason to export this, so let's drop it to minimize the
file a bit.
2014-06-30 23:19:00 +02:00
Lennart Poettering d4e85aac0b pc: expose more drop-in dirs in the .pc file 2014-06-30 23:19:00 +02:00
Lennart Poettering eb39a6239c pc: export $libdir in the .pc file
This is useful for code that tries to figure out the primary arch's
$libdir on the local system, given that is different on the various
Linuxes.
2014-06-30 23:19:00 +02:00
Lennart Poettering f7dc3ab9f4 logind: don't apply RemoveIPC= to system users
We shouldn't destroy IPC objects of system users on logout.

http://lists.freedesktop.org/archives/systemd-devel/2014-April/018373.html

This introduces SYSTEM_UID_MAX defined to the maximum UID of system
users. This value is determined compile-time, either as configure switch
or from /etc/login.defs. (We don't read that file at runtime, since this
is really a choice for a system builder, not the end user.)

While we are at it we then also update journald to use SYSTEM_UID_MAX
when we decide whether to split out log data for a specific client.
2014-05-21 09:36:49 +09:00
Zbigniew Jędrzejewski-Szmek d267e69da4 pkg-config: export systemd{system,user}generatordir and catalogdir
We export the location of a bunch of directories this way,
so it makes sense to add those three. Especially catalogdir
is something that we want people to add things to.

Note on the naming: the first two are tied closely to systemd
itself, so I prefixed them with "systemd". The third one is
rather more generic, so no prefix.

https://bugs.freedesktop.org/show_bug.cgi?id=67635
2013-08-03 09:20:12 -04:00
Lennart Poettering a1d41e17a5 rpm: expose preset dir as rpm macro and in systemd.pc 2012-09-13 22:17:46 +02:00
Kay Sievers 90ccc3fca7 move more main systemd parts to core/ 2012-04-12 14:24:40 +02:00
Renamed from src/systemd.pc.in (Browse further)