Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use systemd_user_unit_dir from systemd.pc, if found #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michel-slm
Copy link
Contributor

If pkg-config can find systemd.pc (e.g.
/usr/share/pkgconfig/systemd.pc), use its systemd_user_unit_dir for the location of psi-notify.service.

We override prefix to be whatever the user sets, which should work both for the distribution use case (prefix overridden to /usr) and for local compilation (prefix defaults to /usr/local)

Fall back to the old definition in case systemd.pc is not found.

Signed-off-by: Michel Alexandre Salim [email protected]

If `pkg-config` can find `systemd.pc` (e.g.
`/usr/share/pkgconfig/systemd.pc`), use its `systemd_user_unit_dir` for
the location of `psi-notify.service`.

We override `prefix` to be whatever the user sets, which should work
both for the distribution use case (`prefix` overridden to `/usr`) and
for local compilation (`prefix` defaults to `/usr/local`)

Fall back to the old definition in case `systemd.pc` is not found.

Signed-off-by: Michel Alexandre Salim <[email protected]>
@michel-slm
Copy link
Contributor Author

Tested using mock on my Fedora machine

  • with this PR but no systemd.pc, a warning is generated
  • with this PR and adding BR on pkgconfig(systemd), no warning

Both builds succeed as before

@cdown
Copy link
Owner

cdown commented Sep 26, 2022

Sorry, this one somehow slipped off my radar :-)

systemd_user_unit_dir is from v246 onwards -- about two years old since we added it in addition to the non-underscore. So probably alright, but maybe use the one without underscores just to have wider compatibility? :-)

ifeq ($(HAS_SYSTEMD),1)
SYSTEMD_USER_UNIT_DIR:=$(shell pkg-config --define-variable=prefix=$(prefix) --variable systemd_user_unit_dir systemd)
else
$(warning systemd not found, using default for SYSTEMD_USER_UNIT_DIR)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably clearer if you say "pkg-config for systemd"

@cdown
Copy link
Owner

cdown commented Mar 11, 2024

Been a bit, but just checking if you saw the compat question above :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants