From 2d8867f6fa028d9e653efce041a49c58f5df23cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Fri, 7 Aug 2026 11:09:16 +0200
Subject: [PATCH] Clean up the build around xF
And make sure it gets built at all, if possible.
It's actually pretty good now, reaching feature parity with xP and xC.
---
CMakeLists.txt | 33 ++++++++++++++++++++-------------
README.adoc | 10 ++++++++--
config.h.in | 1 +
xF.c | 44 ++++++++++++++++++++++----------------------
4 files changed, 51 insertions(+), 37 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f39c92a..015ccf9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,6 @@ string (STRIP "${project_version}" project_version)
project (xK VERSION "${project_version}"
DESCRIPTION "IRC daemon, bot, TUI client and its web frontend" LANGUAGES C)
-# Options
-option (WITH_XF "Build the xF frontend" OFF)
-
# Moar warnings
set (CMAKE_C_STANDARD 99)
set (CMAKE_C_STANDARD_REQUIRED ON)
@@ -138,8 +135,27 @@ else ()
message (SEND_ERROR "Curses not found")
endif ()
+# Dependencies for xF
+find_package (Unistring)
+
+set (xF_SATISFIED FALSE)
+if (ncursesw_FOUND AND Unistring_FOUND)
+ set (xF_SATISFIED TRUE)
+endif ()
+option (WITH_XF "Build the xF frontend" "${xF_SATISFIED}")
+if (WITH_XF AND NOT xF_SATISFIED)
+ message (FATAL_ERROR "Some xF dependencies were not found")
+endif ()
+
+pkg_check_modules (x11 x11 xrender xft fontconfig libpng)
+option (WITH_X11 "Build xF with X11 support" "${x11_FOUND}")
+if (WITH_X11 AND NOT x11_FOUND)
+ message (FATAL_ERROR "Some X11 libraries were not found")
+endif ()
+
# Generate a configuration file
set (HAVE_LUA "${WITH_LUA}")
+set (HAVE_X11 "${WITH_X11}")
include (GNUInstallDirs)
set (project_config ${PROJECT_BINARY_DIR}/config.h)
@@ -171,8 +187,8 @@ add_custom_command (OUTPUT xC-proto.c
add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.c)
# Build
-set (project_binaries xB xC xD)
foreach (name xB xC xD)
+ list (APPEND project_binaries ${name})
add_executable (${name} ${name}.c ${project_config})
target_link_libraries (${name} PRIVATE ${project_libraries})
add_threads (${name})
@@ -186,14 +202,6 @@ target_include_directories (xC PRIVATE ${Termo_INCLUDE_DIRS})
if (WITH_XF)
list (APPEND project_binaries xF)
- find_package (Unistring REQUIRED)
-
- pkg_check_modules (x11 x11 xrender xft fontconfig libpng)
- option (WITH_X11 "Build xF with X11 support" "${x11_FOUND}")
- if (WITH_X11 AND NOT x11_FOUND)
- message (FATAL_ERROR "Some X11 libraries were not found")
- endif ()
-
add_executable (xF xF.c ${project_config})
add_dependencies (xF xC-proto)
target_include_directories (xF PRIVATE
@@ -202,7 +210,6 @@ if (WITH_XF)
${Unistring_LIBRARIES} ${Termo_LIBRARIES}
${ncursesw_LIBRARIES} ${project_libraries})
if (WITH_X11)
- target_compile_definitions (xF PRIVATE WITH_X11)
target_include_directories (xF PRIVATE ${x11_INCLUDE_DIRS})
target_link_directories (xF PRIVATE ${x11_LIBRARY_DIRS})
target_link_libraries (xF PRIVATE ${x11_LIBRARIES})
diff --git a/README.adoc b/README.adoc
index 1b709ca..4cd64c9 100644
--- a/README.adoc
+++ b/README.adoc
@@ -37,7 +37,9 @@ image::xP.webp[align="center"]
xF
--
The hybrid terminal/X11 frontend for 'xC'. It has simplified word wrapping,
-limited colour support, and X11 doesn't support text selection.
+limited colour support, and X11 doesn't support text selection (but in 'xC'
+tradition, it will happily launch embedded gVim on both the input and the log).
+
This frontend is perfect for testing.
xA, xT, xW, xM
@@ -102,7 +104,7 @@ Additionally for 'xF': ncursesw, libunistring, termo (included),
$ mkdir xK/build
$ cd xK/build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DWITH_LUA=ON -DWITH_XF=OFF
+ -DWITH_LUA=ON -DWITH_XF=ON
$ make
To install the application, you can do either the usual:
@@ -154,6 +156,10 @@ For remote use, it's recommended to put 'xP' behind a reverse proxy, with TLS,
and some form of HTTP authentication. Pass the external URL of the WebSocket
endpoint as the third command line argument in this case.
+xF
+~~
+The terminal/X11 frontend needs the relay address on its command line.
+
xA
~~
The Fyne frontend supports all of Linux, FreeBSD, Windows, macOS, Android, and
diff --git a/config.h.in b/config.h.in
index 0307dc1..85d85ba 100644
--- a/config.h.in
+++ b/config.h.in
@@ -7,6 +7,7 @@
#define PROJECT_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}"
#cmakedefine HAVE_LUA
+#cmakedefine HAVE_X11
#cmakedefine01 ICONV_ACCEPTS_TRANSLIT
diff --git a/xF.c b/xF.c
index 9e9652b..4787922 100644
--- a/xF.c
+++ b/xF.c
@@ -27,9 +27,9 @@
#include