Introduce utmps support (#1962)

utmps library can be used to provide utmp functionality on systems whose
libcs do not implement it, e.g. musl.

For more details, see https://skarnet.org/software/utmps/.

Signed-off-by: Peter Shkenev <petershh@disroot.org>
This commit is contained in:
Peter 2024-07-11 20:55:24 +03:00 committed by GitHub
parent 5c7af4e5c0
commit b704e2ee35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View File

@ -168,6 +168,9 @@ else()
set(RUNTIME_DIR_DEFAULT "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/sddm")
endif()
# utmps
find_package(utmps)
add_feature_info("utmps" UTMPS_FOUND "utmps support")
# Set constants
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/sddm" CACHE PATH "System application data install directory")

12
cmake/Findutmps.cmake Normal file
View File

@ -0,0 +1,12 @@
# - Try to find utmps and its dependencies
# Once done this will define
# UTMPS_FOUND - system has utmps and dependencies
# UTMPS_INCLUDE_DIR - the utmps include dir
# UTMPS_LIBRARIES - libutmps
find_path(UTMPS_INCLUDE_DIR NAMES utmps/utmpx.h)
find_library(UTMPS_LIBRARIES utmps)
if (UTMPS_INCLUDE_DIR AND UTMPS_LIBRARIES)
set(UTMPS_FOUND TRUE)
endif (UTMPS_INCLUDE_DIR AND UTMPS_LIBRARIES)

View File

@ -53,6 +53,11 @@ else()
target_link_libraries(sddm-helper crypt)
endif()
if (UTMPS_FOUND)
target_include_directories(sddm-helper SYSTEM PRIVATE ${UTMPS_INCLUDE_DIR})
target_link_libraries(sddm-helper ${UTMPS_LIBRARIES})
endif (UTMPS_FOUND)
install(TARGETS sddm-helper RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}")
add_executable(sddm-helper-start-wayland HelperStartWayland.cpp waylandsocketwatcher.cpp waylandhelper.cpp ${CMAKE_SOURCE_DIR}/src/common/SignalHandler.cpp)