From f85287a5230250b102ee151995c0a60fa656e265 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 23 Feb 2024 12:54:14 +0000 Subject: [PATCH] core: Unbreak build on FreeBSD (#71) * Add OpenPAM support (used by BSDs except OpenBSD) -- Package 'pam', required by 'virtual:world', not found CMake Error at /usr/local/share/cmake/Modules/FindPkgConfig.cmake:619 (message): The following required packages were not found: - pam src/core/Password.cpp:6:10: fatal error: 'security/pam_misc.h' file not found 6 | #include | ^~~~~~~~~~~~~~~~~~~~~ * Add missing headers src/renderer/widgets/IWidget.cpp: In member function 'virtual IWidget::SFormatResult IWidget::formatString(std::string)': src/renderer/widgets/IWidget.cpp:51:41: error: 'getlogin' was not declared in this scope 51 | replaceAll(in, "$USER", std::string{getlogin()}); | ^~~~~~~~ src/renderer/widgets/IWidget.cpp:51:51: error: no matching function for call to 'std::__cxx11::basic_string::basic_string()' 51 | replaceAll(in, "$USER", std::string{getlogin()}); | ^ src/renderer/DMAFrame.cpp: In member function 'bool CDMAFrame::onBufferDone()': src/renderer/DMAFrame.cpp:181:17: error: 'close' was not declared in this scope; did you mean 'pclose'? 181 | close(fd[plane_tmp]); | ^~~~~ | pclose src/renderer/DMAFrame.cpp:196:13: error: 'close' was not declared in this scope; did you mean 'pclose'? 196 | close(fd[plane]); | ^~~~~ | pclose src/core/Password.cpp: In lambda function: src/core/Password.cpp:44:31: error: 'strdup' was not declared in this scope 44 | reply->resp = strdup(pass.c_str()); | ^~~~~~ src/core/hyprlock.cpp: In member function 'void CHyprlock::spawnAsync(const std::string&)': src/core/hyprlock.cpp:768:9: error: 'sigemptyset' was not declared in this scope 768 | sigemptyset(&set); | ^~~~~~~~~~~ src/core/hyprlock.cpp:769:21: error: 'SIG_SETMASK' was not declared in this scope 769 | sigprocmask(SIG_SETMASK, &set, NULL); | ^~~~~~~~~~~ src/core/hyprlock.cpp:769:9: error: 'sigprocmask' was not declared in this scope 769 | sigprocmask(SIG_SETMASK, &set, NULL); | ^~~~~~~~~~~ --- CMakeLists.txt | 4 ++-- src/core/Password.cpp | 3 +++ src/core/hyprlock.cpp | 1 + src/renderer/DMAFrame.cpp | 1 + src/renderer/widgets/IWidget.cpp | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ff8e19..3d7327b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,11 +33,11 @@ message(STATUS "Checking deps...") find_package(Threads REQUIRED) find_package(PkgConfig REQUIRED) find_package(OpenGL REQUIRED) -pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols wayland-egl hyprlang>=0.4.0 egl opengl xkbcommon cairo pangocairo pam libdrm gbm) +pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols wayland-egl hyprlang>=0.4.0 egl opengl xkbcommon cairo pangocairo libdrm gbm) file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp") add_executable(hyprlock ${SRCFILES}) -target_link_libraries(hyprlock PRIVATE rt Threads::Threads PkgConfig::deps OpenGL::EGL OpenGL::GL) +target_link_libraries(hyprlock PRIVATE pam rt Threads::Threads PkgConfig::deps OpenGL::EGL OpenGL::GL) # protocols find_program(WaylandScanner NAMES wayland-scanner) diff --git a/src/core/Password.cpp b/src/core/Password.cpp index a777fdf..cdc7b10 100644 --- a/src/core/Password.cpp +++ b/src/core/Password.cpp @@ -3,8 +3,11 @@ #include #include +#if __has_include() #include +#endif +#include #include struct pam_response* reply; diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 55bda04..8740f09 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/src/renderer/DMAFrame.cpp b/src/renderer/DMAFrame.cpp index e9b287d..9969870 100644 --- a/src/renderer/DMAFrame.cpp +++ b/src/renderer/DMAFrame.cpp @@ -9,6 +9,7 @@ #include #include #include +#include static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = nullptr; static PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT = nullptr; diff --git a/src/renderer/widgets/IWidget.cpp b/src/renderer/widgets/IWidget.cpp index bbfdd80..5aa21e1 100644 --- a/src/renderer/widgets/IWidget.cpp +++ b/src/renderer/widgets/IWidget.cpp @@ -2,6 +2,7 @@ #include "../../helpers/Log.hpp" #include "../../helpers/VarList.hpp" #include +#include Vector2D IWidget::posFromHVAlign(const Vector2D& viewport, const Vector2D& size, const Vector2D& offset, const std::string& halign, const std::string& valign) { Vector2D pos = offset;