commit 10c11c4644e30f06b5d3029b72b2a945b654ca22
parent 477b43aa7ff7ef081f9552f59caf344f23102000
Author: User0 <104380885+user0-07161@users.noreply.github.com>
Date: Sun, 23 Nov 2025 18:45:00 +0100
build: haiku os support #36639
Initial support for compiling on haiku os. Some deps can be pulled from
haiku repos, some need to be compiled with nvim's dep build system:
cmake -DUSE_BUNDLED_LIBUV=OFF -DUSE_BUNDLED_UNIBILIUM=OFF -DUSE_BUNDLED_LUAJIT=OFF -B .deps ./cmake.deps
make -C .deps
Diffstat:
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/cmake.config/CMakeLists.txt b/cmake.config/CMakeLists.txt
@@ -91,7 +91,7 @@ int main(void)
}
" HAVE_BITSCANFORWARD64)
-if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "Haiku")
check_c_source_compiles("
#include <termios.h>
int
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
@@ -98,7 +98,7 @@ if(NOT MSVC)
endif()
# -fstack-protector breaks Mingw-w64 builds
-if(NOT MINGW)
+if(NOT MINGW AND NOT CMAKE_SYSTEM_NAME STREQUAL "Haiku")
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
target_compile_options(main_lib INTERFACE -fstack-protector-strong)
@@ -150,7 +150,10 @@ endif()
# Platform specific options
if(UNIX)
target_link_libraries(main_lib INTERFACE m)
- if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
+ if (CMAKE_SYSTEM_NAME STREQUAL "Haiku")
+ target_link_libraries(main_lib INTERFACE bsd)
+ target_link_libraries(nvim_bin PRIVATE -lnetwork)
+ elseif (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
target_link_libraries(main_lib INTERFACE util)
endif()
endif()
diff --git a/src/nvim/os/pty_proc_unix.c b/src/nvim/os/pty_proc_unix.c
@@ -47,12 +47,17 @@ int forkpty(int *, char *, const struct termios *, const struct winsize *);
#include "os/pty_proc_unix.c.generated.h"
-#if defined(__sun) && !defined(HAVE_FORKPTY)
+#if !defined(HAVE_FORKPTY) && !defined(__APPLE__)
// this header defines STR, just as nvim.h, but it is defined as ('S'<<8),
// to avoid #undef STR, #undef STR, #define STR ('S'<<8) just delay the
// inclusion of the header even though it gets include out of order.
-# include <sys/stropts.h>
+
+# if !defined(__HAIKU__)
+# include <sys/stropts.h>
+# else
+# define I_PUSH 0 // XXX: find the actual value
+# endif
static int vim_openpty(int *amaster, int *aslave, char *name, struct termios *termp,
struct winsize *winp)
@@ -344,9 +349,11 @@ static void init_termios(struct termios *termios) FUNC_ATTR_NONNULL_ALL
termios->c_cc[VSTART] = 0x1f & 'Q';
termios->c_cc[VSTOP] = 0x1f & 'S';
termios->c_cc[VSUSP] = 0x1f & 'Z';
+#if !defined(__HAIKU__)
termios->c_cc[VREPRINT] = 0x1f & 'R';
termios->c_cc[VWERASE] = 0x1f & 'W';
termios->c_cc[VLNEXT] = 0x1f & 'V';
+#endif
termios->c_cc[VMIN] = 1;
termios->c_cc[VTIME] = 0;
}