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 <security/pam_misc.h>
      |          ^~~~~~~~~~~~~~~~~~~~~

* 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<char>::basic_string(<brace-enclosed initializer list>)'
   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);
      |         ^~~~~~~~~~~
This commit is contained in:
Jan Beich 2024-02-23 12:54:14 +00:00 committed by GitHub
parent 9ba88d0ace
commit f85287a523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -3,8 +3,11 @@
#include <unistd.h>
#include <security/pam_appl.h>
#if __has_include(<security/pam_misc.h>)
#include <security/pam_misc.h>
#endif
#include <cstring>
#include <thread>
struct pam_response* reply;

View File

@ -9,6 +9,7 @@
#include <sys/poll.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>

View File

@ -9,6 +9,7 @@
#include <GLES3/gl32.h>
#include <GLES3/gl3ext.h>
#include <GLES2/gl2ext.h>
#include <unistd.h>
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = nullptr;
static PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT = nullptr;

View File

@ -2,6 +2,7 @@
#include "../../helpers/Log.hpp"
#include "../../helpers/VarList.hpp"
#include <chrono>
#include <unistd.h>
Vector2D IWidget::posFromHVAlign(const Vector2D& viewport, const Vector2D& size, const Vector2D& offset, const std::string& halign, const std::string& valign) {
Vector2D pos = offset;