From 2ea367839bf6eb6eef1e954601b1cab63e218b84 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 15 Apr 2024 13:42:17 +0000 Subject: [PATCH] build: Unbreak build on FreeBSD by adjusting dependencies (#5595) * deps: add epoll-shim for some BSDs after 863c7b6072d6 ld: error: undefined symbol: timerfd_create >>> referenced by EventLoopManager.cpp >>> src/Hyprland.p/managers_eventLoop_EventLoopManager.cpp.o:(CEventLoopManager::CEventLoopManager()) ld: error: undefined symbol: timerfd_settime >>> referenced by EventLoopManager.cpp >>> src/Hyprland.p/managers_eventLoop_EventLoopManager.cpp.o:(CEventLoopManager::nudgeTimers()) See also https://github.com/freebsd/freebsd-src/commit/af93fea71038 https://github.com/netbsd/src/commit/75f1bc6655cf * deps: drop unused xcb-image after 45945a3e7d44 $ pkg install $ pkg install meson jq `pkg rquery %dn wlroots` hwdata $ gmake all [...] -- Checking for modules 'xcb;xwayland;xcb-util;xcb-render;xcb-image;xcb-xfixes;xcb-icccm;xcb-composite;xcb-res;xcb-ewmh' -- Package 'xcb-image' not found CMake Error at /usr/local/share/cmake/Modules/FindPkgConfig.cmake:619 (message): The following required packages were not found: - xcb-image Call Stack (most recent call first): /usr/local/share/cmake/Modules/FindPkgConfig.cmake:841 (_pkg_check_modules_internal) CMakeLists.txt:177 (pkg_check_modules) See also https://github.com/swaywm/wlroots/commit/ae7c3f3d1c56 --- CMakeLists.txt | 8 +++++++- meson.build | 1 + nix/patches/meson-build.patch | 3 ++- src/meson.build | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1190876d..ef0ce88e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,12 @@ if(HAVE_LIBEXECINFO) target_link_libraries(Hyprland execinfo) endif() +check_include_file("sys/timerfd.h" HAS_TIMERFD) +pkg_check_modules(epoll IMPORTED_TARGET epoll-shim) +if(NOT HAS_TIMERFD AND epoll_FOUND) + target_link_libraries(Hyprland PkgConfig::epoll) +endif() + if(LEGACY_RENDERER) message(STATUS "Using the legacy GLES2 renderer!") add_compile_definitions(LEGACY_RENDERER) @@ -174,7 +180,7 @@ if(NO_XWAYLAND) add_compile_definitions(NO_XWAYLAND) else() message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...") - pkg_check_modules(xdeps REQUIRED IMPORTED_TARGET xcb xwayland xcb-util xcb-render xcb-image xcb-xfixes xcb-icccm xcb-composite xcb-res xcb-ewmh) + pkg_check_modules(xdeps REQUIRED IMPORTED_TARGET xcb xwayland xcb-util xcb-render xcb-xfixes xcb-icccm xcb-composite xcb-res xcb-ewmh) pkg_check_modules(xcb_errors IMPORTED_TARGET xcb-errors) target_link_libraries(Hyprland PkgConfig::xdeps) if(xcb_errors_FOUND) diff --git a/meson.build b/meson.build index 28e652d7..dd73cb92 100644 --- a/meson.build +++ b/meson.build @@ -51,6 +51,7 @@ if not have_xwayland endif backtrace_dep = cpp_compiler.find_library('execinfo', required: false) +epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs systemd_dep = dependency('libsystemd', required: get_option('systemd')) if get_option('systemd').enabled() diff --git a/nix/patches/meson-build.patch b/nix/patches/meson-build.patch index 21cec8ee..5827e5c3 100644 --- a/nix/patches/meson-build.patch +++ b/nix/patches/meson-build.patch @@ -46,13 +46,14 @@ index 45701f5f..3505cefe 100644 dependency('cairo'), dependency('hyprcursor'), dependency('hyprlang', version: '>= 0.3.2'), -@@ -16,12 +16,12 @@ executable('Hyprland', src, +@@ -17,11 +17,11 @@ executable('Hyprland', src, dependency('egl'), dependency('xkbcommon'), dependency('libinput'), - xcb_dep, + dependency('xcb', required: get_option('xwayland')), backtrace_dep, + epoll_dep, systemd_dep, - udis86, + dependency('udis86'), diff --git a/src/meson.build b/src/meson.build index 59771fcf..d490cddb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -19,6 +19,7 @@ executable('Hyprland', src, dependency('libinput'), xcb_dep, backtrace_dep, + epoll_dep, systemd_dep, udis86,