diff --git a/dnf5.spec b/dnf5.spec index f7a217c84..a74ab4f02 100644 --- a/dnf5.spec +++ b/dnf5.spec @@ -167,6 +167,10 @@ BuildRequires: pkgconfig(zck) >= %{zchunk_version} %if %{with systemd} BuildRequires: pkgconfig(sdbus-c++) >= 0.8.1 BuildRequires: systemd-devel + + # We need to get the SYSTEMD_SYSTEM_UNIT_DIR from + # /usr/share/pkgconfig/systemd.pc +BuildRequires: systemd %endif %if %{with html} || %{with man} diff --git a/dnf5/CMakeLists.txt b/dnf5/CMakeLists.txt index 4b7ba6eed..47f911e4f 100644 --- a/dnf5/CMakeLists.txt +++ b/dnf5/CMakeLists.txt @@ -2,8 +2,6 @@ if(NOT WITH_DNF5) return() endif() -pkg_check_modules(SYSTEMD REQUIRED systemd) -pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir) find_package(Threads) @@ -59,6 +57,8 @@ install(DIRECTORY "config/usr/" DESTINATION "${CMAKE_INSTALL_PREFIX}" PATTERN ". install(DIRECTORY "config/etc/" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}" PATTERN ".gitkeep" EXCLUDE) if(WITH_SYSTEMD) + pkg_check_modules(SYSTEMD REQUIRED systemd) + pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir) install(DIRECTORY "config/systemd/system/" DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}" PATTERN ".gitkeep" EXCLUDE) endif()