diff --git a/x11/polybar/Makefile b/x11/polybar/Makefile index 499f4b60d957..4f4397e78ffe 100644 --- a/x11/polybar/Makefile +++ b/x11/polybar/Makefile @@ -1,96 +1,95 @@ PORTNAME= polybar -DISTVERSION= 3.6.3 -PORTREVISION= 3 +DISTVERSION= 3.7.0 CATEGORIES= x11 MASTER_SITES= https://github.com/polybar/polybar/releases/download/${DISTVERSION}/ MAINTAINER= jbo@FreeBSD.org COMMENT= Fast and easy-to-use status bar WWW= https://github.com/polybar/polybar LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= xcb-proto>=1.9:x11/xcb-proto LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libinotify.so:devel/libinotify \ libuv.so:devel/libuv \ libxcb-ewmh.so:x11/xcb-util-wm \ libxcb-icccm.so:x11/xcb-util-wm \ libxcb-image.so:x11/xcb-util-image \ libxcb-util.so:x11/xcb-util \ libxcb-xrm.so:x11/xcb-util-xrm # compiler:c++11-lang is needed for powerpc64 USES= cmake compiler:c++11-lang gnome localbase:ldflags \ pkgconfig python:build xorg USE_GNOME= cairo USE_XORG= xcb # Needs libnl to work. Disabling it completely. CMAKE_OFF= ENABLE_NETWORK BUILD_DOC OPTIONS_DEFINE= ALSA CURSOR DEBUG GITHUB I3 IPC MPD \ PULSEAUDIO TESTS XKEYBOARD OPTIONS_DEFAULT= CURSOR GITHUB I3 IPC MPD PULSEAUDIO XKEYBOARD OPTIONS_SUB= yes ALSA_DESC= Shows volume and mute state for Alsa CURSOR_DESC= Required for click and scroll settings GITHUB_DESC= Shows the unread notification count I3_DESC= Uses the i3 IPC to display information IPC_DESC= Built-in IPC support MPD_DESC= Support for controlling MPD TESTS_DESC= Build testsuite XKEYBOARD_DESC= Shows the current layout and active indicators ALSA_CMAKE_BOOL= ENABLE_ALSA ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib CURSOR_CMAKE_BOOL= WITH_XCURSOR CURSOR_LIB_DEPENDS= libxcb-cursor.so:x11/xcb-util-cursor DEBUG_CMAKE_BOOL= DEBUG_LOGGER GITHUB_CMAKE_BOOL= ENABLE_CURL GITHUB_LIB_DEPENDS= libcurl.so:ftp/curl I3_BUILD_DEPENDS= ${LOCALBASE}/include/i3/ipc.h:x11-wm/i3 I3_CMAKE_BOOL= ENABLE_I3 I3_LIB_DEPENDS= libjsoncpp.so:devel/jsoncpp IPC_CMAKE_BOOL= BUILD_IPC_MSG MPD_CMAKE_BOOL= ENABLE_MPD MPD_LIB_DEPENDS= libmpdclient.so:audio/libmpdclient PULSEAUDIO_CMAKE_BOOL= ENABLE_PULSEAUDIO PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio # fail while building on poudriere because it needs network access # during the building process to download googletest on-the-fly. TESTS_BUILD_DEPENDS= git>=0:devel/git TESTS_CMAKE_BOOL= BUILD_TESTS XKEYBOARD_CMAKE_BOOL= ENABLE_XKEYBOARD XKEYBOARD_LIB_DEPENDS= libxcb-xkb.so:x11/libxcb ETCFIX = include/utils/command.hpp \ contrib/bash/polybar \ contrib/zsh/_polybar \ doc/man/polybar.1.rst \ doc/man/polybar.5.rst \ CHANGELOG.md post-patch: .for f in ${ETCFIX} @${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/${f} .endfor do-test-TESTS-on: cd ${TEST_WRKSRC} && ${SETENV} BUILD_TESTS=ON \ ${SH} ${WRKSRC}/common/travis/tests.sh .include diff --git a/x11/polybar/distinfo b/x11/polybar/distinfo index f1d6b1a6b110..899c89a1255d 100644 --- a/x11/polybar/distinfo +++ b/x11/polybar/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1651678522 -SHA256 (polybar-3.6.3.tar.gz) = f25758573567208fc7b6f4d4115a6117a87389cbcc094cf605d079775be95fa5 -SIZE (polybar-3.6.3.tar.gz) = 439838 +TIMESTAMP = 1699810833 +SHA256 (polybar-3.7.0.tar.gz) = b8e07aca94a013341b7d47ee548afe84f519113f202300565d4852885a11e91d +SIZE (polybar-3.7.0.tar.gz) = 494588 diff --git a/x11/polybar/files/patch-CMakeLists.txt b/x11/polybar/files/patch-CMakeLists.txt deleted file mode 100644 index 00a661bf7aad..000000000000 --- a/x11/polybar/files/patch-CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt.orig 2022-03-27 18:35:56 UTC -+++ CMakeLists.txt -@@ -63,7 +63,7 @@ endif() - - if(BUILD_CONFIG) - install(FILES ${CMAKE_SOURCE_DIR}/doc/config.ini -- DESTINATION /etc/${PROJECT_NAME} -+ DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/${PROJECT_NAME} - COMPONENT config) - endif() - diff --git a/x11/polybar/files/patch-include_cairo_context.hpp b/x11/polybar/files/patch-include_cairo_context.hpp new file mode 100644 index 000000000000..fdb744f74a2c --- /dev/null +++ b/x11/polybar/files/patch-include_cairo_context.hpp @@ -0,0 +1,10 @@ +--- include/cairo/context.hpp.orig 2023-11-12 19:12:43 UTC ++++ include/cairo/context.hpp +@@ -3,6 +3,7 @@ + #include + + #include ++#include + #include + #include + #include diff --git a/x11/polybar/files/patch-include_common.hpp b/x11/polybar/files/patch-include_common.hpp index fe04eb492818..82f3db90dd21 100644 --- a/x11/polybar/files/patch-include_common.hpp +++ b/x11/polybar/files/patch-include_common.hpp @@ -1,12 +1,12 @@ ---- include/common.hpp.orig 2020-12-02 17:15:49 UTC +--- include/common.hpp.orig 2023-11-05 22:37:13 UTC +++ include/common.hpp -@@ -5,6 +5,9 @@ +@@ -6,6 +6,9 @@ + #include #include - #include +#include +#include + #include "settings.hpp" - #define POLYBAR_NS \ + #define POLYBAR_NS namespace polybar { diff --git a/x11/polybar/files/patch-lib_i3ipcpp_src_ipc.cpp b/x11/polybar/files/patch-lib_i3ipcpp_src_ipc.cpp new file mode 100644 index 000000000000..8d75f7072573 --- /dev/null +++ b/x11/polybar/files/patch-lib_i3ipcpp_src_ipc.cpp @@ -0,0 +1,10 @@ +--- lib/i3ipcpp/src/ipc.cpp.orig 2023-11-12 19:08:48 UTC ++++ lib/i3ipcpp/src/ipc.cpp +@@ -1,6 +1,7 @@ + #include "i3ipc++/ipc.hpp" + + #include ++#include + + #include + #include diff --git a/x11/polybar/files/patch-src_modules_cpu.cpp b/x11/polybar/files/patch-src_modules_cpu.cpp index 7d31e2c08bff..7fdd0a291ce3 100644 --- a/x11/polybar/files/patch-src_modules_cpu.cpp +++ b/x11/polybar/files/patch-src_modules_cpu.cpp @@ -1,66 +1,64 @@ -diff --git src/modules/cpu.cpp src/modules/cpu.cpp -index 527f27fb..179d9221 100644 ---- src/modules/cpu.cpp +--- src/modules/cpu.cpp.orig 2023-11-05 22:37:13 UTC +++ src/modules/cpu.cpp @@ -2,6 +2,11 @@ - + #include #include +#ifdef __FreeBSD__ + #include + #include + #include +#endif - + #include "drawtypes/label.hpp" #include "drawtypes/progressbar.hpp" -@@ -128,6 +133,41 @@ namespace modules { +@@ -129,6 +134,41 @@ namespace modules { m_cputimes.clear(); - + try { +#ifdef __FreeBSD__ + // Get number of CPUs + // ToDo: No need to do this on every invocation. + int ncpu = -1; + std::size_t sz = sizeof(ncpu); + if (sysctlbyname("hw.ncpu", &ncpu, &sz, nullptr, 0) != 0) { + m_log.err("Failed to query sysctl 'hw.ncpu' (errno: %s)", strerror(errno)); + return false; + } + if (ncpu < 1) { + m_log.err("Failed to determine number of CPUs."); + return false; + } + + // Query 'kern.cp_time' + long cpu_stat[CPUSTATES]; + sz = sizeof(cpu_stat); + if (sysctlbyname("kern.cp_time", cpu_stat, &sz, nullptr, 0) != 0) { + m_log.err("Failed to query sysctl 'kern.cp_time' (errno: %s)", strerror(errno)); + return false; + } + + // Parse + static std::size_t field_offset = sizeof(*cpu_stat) + ncpu; + for (std::size_t i = 0; i < ncpu; i++) { + m_cputimes.emplace_back(new cpu_time); + m_cputimes.back()->user = cpu_stat[CP_USER]; + m_cputimes.back()->nice = cpu_stat[CP_NICE]; + m_cputimes.back()->system = cpu_stat[CP_SYS]; + m_cputimes.back()->steal = cpu_stat[CP_INTR]; // Note: This is technically the reported "interrupt" time + m_cputimes.back()->idle = cpu_stat[CP_IDLE]; + m_cputimes.back()->total = m_cputimes.back()->user + m_cputimes.back()->nice + m_cputimes.back()->system + + m_cputimes.back()->idle + m_cputimes.back()->steal; + } +#else std::ifstream in(PATH_CPU_INFO); string str; - -@@ -148,6 +188,7 @@ namespace modules { + +@@ -149,6 +189,7 @@ namespace modules { m_cputimes.back()->total = m_cputimes.back()->user + m_cputimes.back()->nice + m_cputimes.back()->system + m_cputimes.back()->idle + m_cputimes.back()->steal; } +#endif } catch (const std::ios_base::failure& e) { m_log.err("Failed to read CPU values (what: %s)", e.what()); } diff --git a/x11/polybar/files/patch-src_modules_memory.cpp b/x11/polybar/files/patch-src_modules_memory.cpp index b0d836e120db..908adb9a168d 100644 --- a/x11/polybar/files/patch-src_modules_memory.cpp +++ b/x11/polybar/files/patch-src_modules_memory.cpp @@ -1,49 +1,47 @@ -diff --git src/modules/memory.cpp src/modules/memory.cpp -index eb36e5dc..042d85cb 100644 ---- src/modules/memory.cpp +--- src/modules/memory.cpp.orig 2023-11-05 22:37:13 UTC +++ src/modules/memory.cpp @@ -1,6 +1,10 @@ #include #include #include +#ifdef __FreeBSD__ + #include + #include +#endif - + #include "drawtypes/label.hpp" #include "drawtypes/progressbar.hpp" -@@ -63,6 +67,25 @@ namespace modules { +@@ -64,6 +68,25 @@ namespace modules { unsigned long long kb_swap_free{0ULL}; - + try { +#ifdef __FreeBSD__ + std::size_t sz; + + // Total + sz = sizeof(kb_total); + if (sysctlbyname("hw.physmem", &kb_total, &sz, nullptr, 0) != 0) { + m_log.err("Failed to query sysctl 'hw.physmem' (errno: %s)", strerror(errno)); + return false; + } + kb_total /= 1024; + + // Available + sz = sizeof(kb_avail); + if (sysctlbyname("hw.usermem", &kb_avail, &sz, nullptr, 0) != 0) { + m_log.err("Failed to query sysctl 'hw.usermem' (errno: %s)", strerror(errno)); + return false; + } + kb_avail /= 1024; +#else std::ifstream meminfo(PATH_MEMORY_INFO); std::map parsed; - -@@ -91,6 +114,7 @@ namespace modules { + +@@ -92,6 +115,7 @@ namespace modules { // old kernel; give a best-effort approximation of available memory kb_avail = parsed["MemFree"] + parsed["Buffers"] + parsed["Cached"] + parsed["SReclaimable"] - parsed["Shmem"]; } +#endif } catch (const std::exception& err) { m_log.err("Failed to read memory values (what: %s)", err.what()); } diff --git a/x11/polybar/files/patch-src_utils_string.cpp b/x11/polybar/files/patch-src_utils_string.cpp new file mode 100644 index 000000000000..2d5897731e5b --- /dev/null +++ b/x11/polybar/files/patch-src_utils_string.cpp @@ -0,0 +1,10 @@ +--- src/utils/string.cpp.orig 2023-11-12 19:11:07 UTC ++++ src/utils/string.cpp +@@ -1,6 +1,7 @@ + #include "utils/string.hpp" + + #include ++#include + #include + #include + #include